Skip to content

Conversation

@JGHan7
Copy link

@JGHan7 JGHan7 commented Oct 22, 2024

RDMFT is an ab-initio method.

I have implemented some code for rdmft in ABACUS. As long as the default value "ks" (instead, "rdmft") of the parameter ab_initio_type is used in INPUT, it will not affect the normal function of ABACUS.

image

…e I do three for() to realize gemm and it doesn't support many processors...
…ll has two parameters don't pass), and pass in rdmft_cal() successfully
…Hartree, EXC_RDMFT = E_exx, but my Etotal doesn't include ion energy terms, etc.
@JGHan7
Copy link
Author

JGHan7 commented Nov 25, 2024

I'm so sorry. Since I don't know how to use GitHub, all my replies in the past month are in "pending" status, and only I can see them (I wonder why no one has ever replied to me...).
I'm really sorry, everyone. I will learn quickly and at least successfully push the replies from the past few days.

Copy link
Collaborator

@kirk0830 kirk0830 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, a small change request is made, please check if my suggestion is correct, Thanks

@mohanchen mohanchen merged commit 7198ec1 into deepmodeling:develop Nov 27, 2024
14 checks passed
@mohanchen mohanchen added the Useful Information Useful information for others to learn/study label Nov 27, 2024
@mohanchen mohanchen changed the title add RDMFT(Reduced Density Matrix Functional Theory) code add RDMFT(Reduced Density Matrix Functional Theory) code (Useful Information: for those who what to contribute codes to ABACUS, this is a good example) Nov 27, 2024
Fisherd99 pushed a commit to Fisherd99/abacus-BSE that referenced this pull request Mar 31, 2025
…g#5325)

* in last commit, 2 processor has 'malloc(): memory corruption:' because I do three for() to realize gemm and it doesn't support many processors...

* first push with rdmft writed in abacus-v3.4.4

* update README.md

* update README.md again

* find all parameters used in Veff_rdmft (for hartree and local, XC still has two parameters don't pass), and pass in rdmft_cal() successfully

* use class Veff_rdmft get correct Ehartree and Eexx, but Etotal is wrong

* all energy terms correct, ETV_RDMFT = E_one_elec, Ehartree_RDMFT = E_Hartree, EXC_RDMFT = E_exx, but my Etotal doesn't include ion energy terms, etc.

* z/dgemm_() is used correctly, next step to use pz/dgemm_()

* just one processor is correct, 2 processors have some problem and maybe the error is occurred in processor 2

* 2 processors is wrong but 6 processors is correct...

* check 2 processors error

* update, realize print Dmn in different processors

* get successful result in different numbers of processors, and the printout has not been deleted yet

* get the sum of different processors, that is, get the true total energy of each term

* delete some printout and next step is replace the pz/dgemm_() used in psiDotPsi()

* add some comments

* do some little modifications to make the code more concise

* just save

* just save

* last save before realizing gamma_only calculation

* gamma_only calculation with errors

* save with errors in gamma_only

* gamma_only realization with errors in E_T+nonlocal

* gamma_only successful with one processors, but multi-processor errors

* support g(wg)*H_wfc and g(wg)*wfcHwfc with different g(wg) which is provided by HF_XCfunc or power_XCfunc

* get the special DM used in constructing V_XC, and can be used for split_m2D_ktoR()

* get the special DM used in constructing V_XC and run successfully (not in numerica meaning)

* modify the namespace of rdmft_test files from hamilt to rdmft

* error with using spilt_m2D_ktoR()

* successfully get Ds_XC, next step is update abacus to have the new interface

* successfully run rdmft with power functional in multi-k calculation, have tested alpha=1.0, 0.95, 0.5

* do some little modifications to make the code more concise

* fix interface provided by class OperatorEXX but having errors when do V_XC.contributeHk(ik)

* print data of tensor from Ds_XC

* just save

* check the length and data of LM->Hexxc and Vxc_fromRI_c.Hexxs

* have modified op_exx_lcao.h/.cpp, RI_2D_Comm.h/.cpp files, delete the modifying in the future

* save

* successfullu add power XC_functional and run correctly with Si soilds in 6 nodes and 6 processors

* successfully realize power functional with testing Si solids, and some printout need to be deleted

* Print: last push before delete many printout

* delete modifying in source code

* Refactor: first add class RDMFT

* save

* get DM used for updating charge/rho

* try to initial DMR of class DensityMatrix

* save before modifying gint.cpp

* update charge using wg&wfc which provided by me successfully

* delete some comment

* last save before transfer wg -> natural occupation numbers (occupation_num)

* successfully transfer wg -> occ_number and get correct result in Muller_XC

* modifying some variable names, function names and comments (for wg -> occNum)

* add module_rdmft and copy code here working successfully

* delete rdmft_test.h/.cpp files in module_hamilt_lcao/... and modify corresponding CMakeLists.txt

* add rdmft.h, rdmft.cpp, rdmft_tools.cpp files to create class RDMFT

* just save. In the process of factor function rdmft_cal() -> class RDMFT

* modify rdmft_solver in esolver_ks_lcao.h/.cpp

* push with compile error in cal_dm.h( psiMulPsiMpi() function with the same name is wrong )

* add class rdmft and do rdmft_solver.init() successfully, next step is init V_TV, V_XC...

* successfully move functions of class RDMFT to rdmft.cpp

* just save

* just save

* factor function rdmft_cal() -> class RDMFT and with running error

* just save

* Factor: transfer function rdmft_cal() -> class RDMFT and run in afterscf() successfully

* just save

* now get V_local in eiter, next step move it to istep, i.e. together with T_nonlocal

* move the obtaining of V_local from elec-step to ion-step

* successfully find where to do update_ion()

* class RDMFT get correct E_TV and E_hartree, but E_XC=0.0

* Factor: complete func rdmft_cal() -> class RDMFT and find where to use the RDMFT class object rdmft_solver appropriately

* save

* save for debug

* Fix: fix bug in HkPsi(), transfer 'T'->'C'

* save

* Fix: fix nk_total in class RDMFT depend on the Symmetry::symm_flag

* save

* test different branch

* add Dell_abaInstall.sh for Dell_server

* modify module_rdmft to latest version

* just save for updating branch rdmft

* update module_xc for rdmft(WP22,CWP22 and so on)

* Fix memory bug in XC_Functional_Libxc::cal_gdr()

* Refactor XC_Functional_Libxc::convert_vtxc_v()

* merge to abacus-v3.8.0 but don't debug(many, because many functions and interfaces have changed). The scaling_factor_xc issue is not handled

* merge to abacus-v3.8.0 and add scaling_factor in libxc_cpp files

* merge to abacus-v3.8.0 and debug is not finished

* just save

* just save

* after merging into abacus-v3.8.0, the first compilation passed, but the program has not been run yet

* after merging to abacus-v3.8.0, the program ran successfully for the first time, but the call of V_exx was not correct.

* just save

* just save

* just save

* the Vexx may have error when symmetry==1, skip it and continue do my own code

* add parameters used in rdmft in input_parameters.h and so on

* merge all rdmft-code to abacus-v3.8.0, next step is debug and test

* debug now ,some energy is little different from abacus

* merge to the latest aABACUS

* Fix the bug caused by merging the latest ABAUCS, need to test other bugs such as wp22, cwp22 and the difference of energy

* just save

* add XC-functional BLYP_LIBXC and BLYP_LR to test

* stop tracking abaInstall_HZWpara.sh

* just save

* just save

* save

* just save

* modify cmake/FindELPA.cmake

* save

* add RDMFT(Reduced Density Matrix Functional Theory) code

* [pre-commit.ci lite] apply automatic fixes

* delete lib64/ and include/

* delete some production code and modify some variable/function names

* save

* merge to the latest abacus

* just save

* add tests for rdmft

* recover accidentally deleted files

* move rdmft related functions and their calls from esolver_ks to esolver_ks_lcao, and so on

* save

* save

* [pre-commit.ci lite] apply automatic fixes

* add '#ifdef __MPI', delete run_rdmft() and so on

* just save

* save

* debug

* add if(ENABLE_LCAO) in rdmft/CMakeLists.txt

* save

* save

* fix compile problem

* save

* modify the error in module_io/test/read_input_ptest.cpp

* prepare for PR

* save

* add symmetry calculation of exx in rdmft

* add test in esolver_ks_lcao.cpp, function after_scf(): update exx to test the exx_energy get by rdmft is exactly equal to exx_energy by abacus

* delete rdmft_test.h/.cpp

* delete the test for exx in esolver_ks_lcao.cpp, after_scf(

* update test with symmetry, tests/integrate/1001_NO_Si2_dzp_rdmft

* save

* [pre-commit.ci lite] apply automatic fixes

* save

* delete the new ord_file in tests/

* last save befor move cal_V_ TV/hartree/XC from rdmft.cpp to cal_V_rdmft.cpp

* last save before move the functions about update_state from rdmft.cpp to update_state_rdmft.cpp

* save

* save

* [pre-commit.ci lite] apply automatic fixes

* save

* modify ab_initio_type to bool rdmft

* save

* Fix: let nk_total *= nspin, in rdmft

* modified according to Mr. Chen's suggestion

* save

* save

* merge the latest abacus

* [pre-commit.ci lite] apply automatic fixes

* save

* add some tests for rdmft

* save

* save

* [pre-commit.ci lite] apply automatic fixes

* reduce calculation time of tests: rdmft

* modify some comments

* modify tests

* save

* modify class RDMFT

* save

* modify Comments

* save

* save

* save

* save

* save

* modify

* save

* [pre-commit.ci lite] apply automatic fixes

* add a comment in rdmft_cal_hamilt/V.cpp

* rename rdmft_cal_hamilt.cpp to rdmft_pot_mat.cpp

* Refactore psiDotPsi()

* save

* save

* save

* save

---------

Co-authored-by: linpz <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Mohan Chen <[email protected]>
Co-authored-by: maki49 <[email protected]>
Co-authored-by: wqzhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Features Needed The features are indeed needed, and developers should have sophisticated knowledge Useful Information Useful information for others to learn/study

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants