Skip to content

Conversation

maki49
Copy link
Collaborator

@maki49 maki49 commented Nov 24, 2023

Fix #2975

  • read lcao wavefunction only in the initial ion step
  • change error-exit to warning and return to atomic initialization in reading lcao wavefunction and charge density
  • overwrite rather than append when writing lcao wavefunction

@maki49 maki49 changed the title Fix: allocate lcao wfc only in the initial ion step Fix: allocate lcao wfc only in the initial ion step; change error-exit to warning Nov 24, 2023
@maki49 maki49 changed the title Fix: allocate lcao wfc only in the initial ion step; change error-exit to warning Fix init_wfc == "file " Nov 24, 2023
Copy link
Collaborator

@QuantumMisaka QuantumMisaka left a comment

Choose a reason for hiding this comment

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

Thanks! It will fix #2975 and helps a lot

@QuantumMisaka
Copy link
Collaborator

QuantumMisaka commented Nov 25, 2023

@maki49 Could the init_chg option be similar to init_wfc option that : if SPIN*.cube files do not exist and init_chg file option specified, raise a warning in stdout/running*log and switch to atomic option?

@maki49 maki49 changed the title Fix init_wfc == "file " Fix: optimize the IO of lcao-wfc and charge Nov 25, 2023
@maki49
Copy link
Collaborator Author

maki49 commented Nov 25, 2023

@maki49 Could the init_chg option be similar to init_wfc option that : if SPIN*.cube files do not exist and init_chg file option specified, raise a warning in stdout/running*log and switch to atomic option?

Done.
Also, the append-output is changed to overwriting.

@QuantumMisaka
Copy link
Collaborator

I've directly tested this branch, the lcao-wfc part have no running problem, but when setting init_chg file but no SPIN*.cube file, this error will arise:

Initial plane wave basis and FFT box
 ---------------------------------------------------------
 DONE(0.206486   SEC) : INIT PLANEWAVE
 -------------------------------------------
 SELF-CONSISTENT : 
 -------------------------------------------
 START CHARGE      : file
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         NOTICE                           
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 Can't find even an electron!
 CHECK IN FILE : OUT.ABACUS/warning.log
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         NOTICE                           
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

may need more refinements.

@maki49
Copy link
Collaborator Author

maki49 commented Nov 26, 2023

I've directly tested this branch, the lcao-wfc part have no running problem, but when setting init_chg file but no SPIN*.cube file, this error will arise:

I've fixed it, does this problem still exist now?

@QuantumMisaka
Copy link
Collaborator

I've directly tested this branch, the lcao-wfc part have no running problem, but when setting init_chg file but no SPIN*.cube file, this error will arise:

I've fixed it, does this problem still exist now?

Fixed

Copy link
Collaborator

@QuantumMisaka QuantumMisaka left a comment

Choose a reason for hiding this comment

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

Worked well.
If wavefunction/charge extrapolation by analysis the new input STRU and old wfc/chg file can be done, the efficiency for outer interface using ABACUS will be improved more. I'll pay some attention on it.

@QuantumMisaka
Copy link
Collaborator

@kirk0830 Could you review and merge it ?

@QuantumMisaka
Copy link
Collaborator

The ABACUS directly from this branch have much low efficiency in SCF of ferromagnetic system than ABACUS commit 573b6ea, but this IO should not have any efficiency change. I'll have more test after merged.

@QuantumMisaka
Copy link
Collaborator

The ABACUS directly from this branch have much low efficiency in SCF of ferromagnetic system than ABACUS commit 573b6ea, but this IO should not have any efficiency change. I'll have more test after merged.

The latest abacus branch have no problem. The performance tests should be done after merged

@QuantumMisaka
Copy link
Collaborator

The ABACUS directly from this branch have much low efficiency in SCF of ferromagnetic system than ABACUS commit 573b6ea, but this IO should not have any efficiency change. I'll have more test after merged.

The latest abacus branch have no problem. The performance tests should be done after merged

No problem now

@hongriTianqi
Copy link

Can nscf be done by reading wfc now? Have spin 1, 2, 4 all been considered? @maki49 @QuantumMisaka

@QuantumMisaka
Copy link
Collaborator

QuantumMisaka commented Nov 29, 2023

Can nscf be done by reading wfc now? Have spin 1, 2, 4 all been considered? @maki49 @QuantumMisaka

CANNOT

I tried nscf calculation with SPIN1.cube and wavefunction file from scf calculation, and nscf input setting:

init_chg        atomic
init_wfc        file

from the stdout, the wavefunction file can not be read, nscf calculation will still use charge file. The reason is that the KPOINTS is different from scf and nscf

 SPIN    KPOINTS         PROCESSORS  NBASE       
 1       128             4           104         
 ---------------------------------------------------------
 Use Systematically Improvable Atomic bases
 ---------------------------------------------------------
 ELEMENT ORBITALS        NBASE       NATOM       XC          
 Si      2s2p1d-7au      13          8           
 ---------------------------------------------------------
 Initial plane wave basis and FFT box
 ---------------------------------------------------------
 DONE(0.0661723  SEC) : INIT PLANEWAVE
 -------------------------------------------
 NONSELF-CONSISTENT : 
 -------------------------------------------
 Read in wave functions files: 128
 Successfully read in wave functions 1
In k-dependent wave function file, k point is not correct
WARNING: Failed to read in wavefunction, use default initialization instead.
 START CHARGE      : file
 NON-SELF CONSISTENT CALCULATIONS

For reading wavefunction and charge file do scf calculation, spin 1 and 2 is running normally, spin 4 is not tested, but due to this change only concern IO part, I consider that spin 4 have no problem.

@hongriTianqi
Copy link

OK, do we need to read wfc and charge together to do scf now in spin 1 and 2? Can we read wfc only?

@QuantumMisaka
Copy link
Collaborator

OK, do we need to read wfc and charge together to do scf now in spin 1 and 2? Can we read wfc only?

From my test in nspin=2 calculation, set

init_chg        atomic
init_wfc        file

and

init_chg        file
init_wfc        file

have the SAME effect. the charge file SPIN*.cube will be read in the latter setting, but the scf calculation process is the same as the former, I guess the charge density will be initialized by wavefunction whatever charge file is read is not if wavefunction file is read.

@QuantumMisaka
Copy link
Collaborator

OK, do we need to read wfc and charge together to do scf now in spin 1 and 2? Can we read wfc only?

As #2975 . read wfc (or charge file) to do scf calculation can make ABACUS more efficient if using interface like ASE to do optimization or NEB calculation. This file can be iteratively read when ASE do each ionic step.

Of course it is better if wavefunction extrapolation can be done when the STRU of read wfc/charge file in last ionic step and the STRU in this ionic step have some difference. I'll focus on it later

@hongriTianqi
Copy link

OK, I have no other questions. Thanks for your reply.

@hongriTianqi
Copy link

Sorry, by the way, can we do the nscf calculation with the same kpt file? If so, maybe we can close #1235.

@QuantumMisaka
Copy link
Collaborator

Sorry, by the way, can we do the nscf calculation with the same kpt file? If so, maybe we can close #1235.

in same KPT calculation of nscf, the nscf will still trying to read and use charge file. and if charge file not exist. the nscf process can still be done, but I don't know whether the result is based on read wfc file . working on it

@QuantumMisaka
Copy link
Collaborator

One warning generated in compile process:

/lustre/home/2201110432/apps/abacus/abacus-develop-relax-read/source/module_hamilt_lcao/hamilt_lcaodft/DM_gamma.cpp:81:20: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]
    if (istep == 0 & INPUT.init_wfc == "file")
        ~~~~~~~~~~~^
/lustre/home/2201110432/apps/abacus/abacus-develop-relax-read/source/module_hamilt_lcao/hamilt_lcaodft/DM_gamma.cpp:81:20: note: place parentheses around the '==' expression to silence this warning
    if (istep == 0 & INPUT.init_wfc == "file")
                   ^
        (         )
/lustre/home/2201110432/apps/abacus/abacus-develop-relax-read/source/module_hamilt_lcao/hamilt_lcaodft/DM_gamma.cpp:81:20: note: place parentheses around the & expression to evaluate it first
    if (istep == 0 & INPUT.init_wfc == "file")
                   ^
                 (                           )

But it seems not a huge problem

@QuantumMisaka
Copy link
Collaborator

Sorry, by the way, can we do the nscf calculation with the same kpt file? If so, maybe we can close #1235.

@hongriTianqi I tested the nscf calculation using wfc file with same kpt file and without charge file, the TDOS and PDOS by nscf calculation from wfc file and charge file are not exactly the same, but they are much similar.

example: Si bulk with 8 atoms, KPT is 9 9 9

TDOS below, left from nscf with wfc , right from scf and nscf with charge

image

PDOS below, left from nscf with wfc , right from scf and nscf with charge

image

@hongriTianqi
Copy link

hongriTianqi commented Nov 29, 2023

@QuantumMisaka Thanks. Then ISSUE #1235 is still not solved. We may keep it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Flexibly detect and read wavefunction file as init guess
4 participants