Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RDMFT(Reduced Density Matrix Functional Theory) code #5325

Open
wants to merge 196 commits into
base: develop
Choose a base branch
from

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.

… but 2 processor has 'malloc(): memory corruption:'
…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.
@mohanchen mohanchen added the Features Needed The features are indeed needed, and developers should have sophisticated knowledge label Oct 31, 2024
@maki49
Copy link
Collaborator

maki49 commented Oct 31, 2024

@mohanchen Now the new .orb file is removed, and rdmft.cpp is separated into shorter files.

Since this PR does not implement a complete ESolver with optimization (but only an initial guess generated by KSDFT), I think we can merge this PR at first without the new option of esolver_type. The new ESolver for RDMFT will be added in the future (maybe by Professor Kai Luo), then the newly added parameter can be deleted.

@mohanchen
Copy link
Collaborator

@mohanchen Now the new .orb file is removed, and rdmft.cpp is separated into shorter files.

Since this PR does not implement a complete ESolver with optimization (but only an initial guess generated by KSDFT), I think we can merge this PR at first without the new option of esolver_type. The new ESolver for RDMFT will be added in the future (maybe by Professor Kai Luo), then the newly added parameter can be deleted.

I see what you mean, but I need to review again the codes.


ab-initio methods and the xc-functional parameters used in RDMFT.

### ab_initio_type
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest changing " ab_initio_type" to "rdmft" and set its type to bool, and make this variable controlled by yourself. Do not invent any ambiguous variable for other developers to think they can do something new with this variable.

source/module_esolver/esolver_ks_lcao.cpp Outdated Show resolved Hide resolved
source/module_esolver/esolver_ks_lcao.cpp Outdated Show resolved Hide resolved
source/module_esolver/esolver_ks_lcao.cpp Outdated Show resolved Hide resolved
source/module_rdmft/rdmft.h Show resolved Hide resolved
source/module_rdmft/rdmft_tools.cpp Outdated Show resolved Hide resolved
source/module_rdmft/rdmft_tools.cpp Show resolved Hide resolved
source/module_rdmft/rdmft_tools.cpp Outdated Show resolved Hide resolved
source/module_rdmft/update_state_rdmft.cpp Outdated Show resolved Hide resolved
orb->cutoffs(),
&GlobalC::GridD,
nspin,

Copy link
Collaborator

Choose a reason for hiding this comment

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

one extra line can be deleted

orb->cutoffs(),
&GlobalC::GridD,
nspin,

Copy link
Collaborator

Choose a reason for hiding this comment

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

one extra line found

orb->cutoffs(),
&GlobalC::GridD,
nspin,

Copy link
Collaborator

Choose a reason for hiding this comment

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

several similar places found (one blank line), please check

template <typename TK, typename TR>
class RDMFT
{
public:
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need so many public variables and public functions, can we made some of them as private?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest moving module_rdmft into module_hamilt_lcao, in future, maybe we will rename the module_hamilt_lcao to module_lcao_algorithms

#ifdef _OPENMP
#pragma omp parallel for schedule(static, 1024)
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

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

one extra line found here



template <>
void conj_psi<double>(psi::Psi<double>& wfc);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not a good idea to 'invent' several new operations on Psi, these are common tools, not the tools by RDMFT itself.

source/module_rdmft/rdmft_tools.h Show resolved Hide resolved
@JGHan7
Copy link
Author

JGHan7 commented Nov 5, 2024

Most of the spaces here are because I modified the veff class according to my needs. I use a line of spaces to distinguish what I added myself, to remind me that a more suitable interface may be provided to me in the future, making the veff_rdmft class more concise or even deleting it.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants