Skip to content

Commit 4baa8af

Browse files
xuan112358Kai Luo
authored andcommitted
Feature: Add deepks_out_base to support simultaneous output of numpy files of base and target functionals (deepmodeling#6483)
* add parameter deepks_out_base, when it is not "none", use a new esolver type "Esolver_DoubleXC" * Modify Esolver_DoubleXC to calculate ebase,hbase,obase of output charge density (not charge density after charge mixing). Force to use deepks_out_freq_elec along with deepks_out_base * some output info which helps when debuging * output files of deepks base; add some annotation for output * fix bug of force output related to gevdm when deepks_scf = false but deepks_out_labels = 1 * fix the bug of gamma only related to smatrix_k, add some annotations * update annotation * add conditions for p_hamit->refresh * output force and stress base also in DeePKS_Labels_Elec * revert changes to INPUT in test * modify test for deepks_out_base * Revert "some output info which helps when debuging" to delete output information This reverts commit 73c3d6d. * remove some output info for debugging in esolver_double_xc * add some anotation for out_mat_hs used along with deepks_out_base * add esolver_double_xc in Makefile.Objects * Add deepks_out_base to input-main.md Added documentation for deepks_out_base parameter. * add ifdef for __MLALGO in esolver_double_xc, in case of not compiling with MLALGO * Update doc for deepks_out_base
1 parent 0680c75 commit 4baa8af

File tree

20 files changed

+953
-359
lines changed

20 files changed

+953
-359
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
- [DeePKS](#deepks)
192192
- [deepks\_out\_labels](#deepks_out_labels)
193193
- [deepks\_out\_freq\_elec](#deepks_out_freq_elec)
194+
- [deepks\_out\_base](#deepks_out_base)
194195
- [deepks\_scf](#deepks_scf)
195196
- [deepks\_equiv](#deepks_equiv)
196197
- [deepks\_model](#deepks_model)
@@ -2173,6 +2174,13 @@ Warning: this function is not robust enough for the current version. Please try
21732174
- **Description**: When `deepks_out_freq_elec` is greater than 0, print labels and descriptors for DeePKS in OUT.${suffix}/DeePKS_Labels_Elec per `deepks_out_freq_elec` electronic iterations, with suffix `_e*` to distinguish different steps. Often used with `deepks_out_labels` equals 1.
21742175
- **Default**: 0
21752176

2177+
### deepks_out_base
2178+
2179+
- **Type**: String
2180+
- **Availability**: Numerical atomic orbital basis and `deepks_out_freq_elec` is greater than 0
2181+
- **Description**: Print labels and descriptors calculated by base functional ( determined by `deepks_out_base` ) and target functional ( determined by `dft_functional` ) for DeePKS in per `deepks_out_freq_elec` electronic iterations. The SCF process, labels and descriptors output of the target functional are all consistent with those when the target functional is used alone. The only additional output under this configuration is the labels of the base functional. Often used with `deepks_out_labels` equals 1.
2182+
- **Default**: None
2183+
21762184
### deepks_scf
21772185

21782186
- **Type**: Boolean

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
277277
esolver_gets.o\
278278
lcao_others.o\
279279
esolver_dm2rho.o\
280+
esolver_double_xc.o\
280281

281282
OBJS_GINT=gint_old.o\
282283
gint_gamma_env.o\

source/source_esolver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if(ENABLE_LCAO)
2424
esolver_gets.cpp
2525
lcao_others.cpp
2626
esolver_dm2rho.cpp
27+
esolver_double_xc.cpp
2728
)
2829
endif()
2930

source/source_esolver/esolver.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "source_io/module_parameter/parameter.h"
77
#ifdef __LCAO
88
#include "esolver_dm2rho.h"
9+
#include "esolver_double_xc.h"
910
#include "esolver_gets.h"
1011
#include "esolver_ks_lcao.h"
1112
#include "esolver_ks_lcao_tddft.h"
@@ -222,14 +223,25 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
222223
}
223224
if (PARAM.globalv.gamma_only_local)
224225
{
225-
return new ESolver_KS_LCAO<double, double>();
226+
if (PARAM.inp.deepks_out_base != "none")
227+
{
228+
return new ESolver_DoubleXC<double, double>();
229+
}
230+
else
231+
{
232+
return new ESolver_KS_LCAO<double, double>();
233+
}
226234
}
227235
else if (PARAM.inp.nspin < 4)
228236
{
229237
if (PARAM.inp.dm_to_rho)
230238
{
231239
return new ESolver_DM2rho<std::complex<double>, double>();
232240
}
241+
else if (PARAM.inp.deepks_out_base != "none")
242+
{
243+
return new ESolver_DoubleXC<std::complex<double>, double>();
244+
}
233245
else
234246
{
235247
return new ESolver_KS_LCAO<std::complex<double>, double>();
@@ -241,6 +253,10 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
241253
{
242254
return new ESolver_DM2rho<std::complex<double>, std::complex<double>>();
243255
}
256+
else if (PARAM.inp.deepks_out_base != "none")
257+
{
258+
return new ESolver_DoubleXC<std::complex<double>, std::complex<double>>();
259+
}
244260
else
245261
{
246262
return new ESolver_KS_LCAO<std::complex<double>, std::complex<double>>();

0 commit comments

Comments
 (0)