Skip to content

Commit d71661d

Browse files
authored
Feature: Add deepks_out_base to support simultaneous output of numpy files of base and target functionals (#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 a6ced75 commit d71661d

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
@@ -275,6 +275,7 @@ OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
275275
esolver_gets.o\
276276
lcao_others.o\
277277
esolver_dm2rho.o\
278+
esolver_double_xc.o\
278279

279280
OBJS_GINT=gint_old.o\
280281
gint_gamma_env.o\

source/source_esolver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ if(ENABLE_LCAO)
2222
esolver_gets.cpp
2323
lcao_others.cpp
2424
esolver_dm2rho.cpp
25+
esolver_double_xc.cpp
2526
)
2627
endif()
2728

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"
@@ -197,14 +198,25 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
197198
}
198199
if (PARAM.globalv.gamma_only_local)
199200
{
200-
return new ESolver_KS_LCAO<double, double>();
201+
if (PARAM.inp.deepks_out_base != "none")
202+
{
203+
return new ESolver_DoubleXC<double, double>();
204+
}
205+
else
206+
{
207+
return new ESolver_KS_LCAO<double, double>();
208+
}
201209
}
202210
else if (PARAM.inp.nspin < 4)
203211
{
204212
if (PARAM.inp.dm_to_rho)
205213
{
206214
return new ESolver_DM2rho<std::complex<double>, double>();
207215
}
216+
else if (PARAM.inp.deepks_out_base != "none")
217+
{
218+
return new ESolver_DoubleXC<std::complex<double>, double>();
219+
}
208220
else
209221
{
210222
return new ESolver_KS_LCAO<std::complex<double>, double>();
@@ -216,6 +228,10 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
216228
{
217229
return new ESolver_DM2rho<std::complex<double>, std::complex<double>>();
218230
}
231+
else if (PARAM.inp.deepks_out_base != "none")
232+
{
233+
return new ESolver_DoubleXC<std::complex<double>, std::complex<double>>();
234+
}
219235
else
220236
{
221237
return new ESolver_KS_LCAO<std::complex<double>, std::complex<double>>();

0 commit comments

Comments
 (0)