Skip to content

Commit a5e8214

Browse files
committed
Add integrate test for deepks_v_delta<0.
1 parent bb76e8c commit a5e8214

File tree

33 files changed

+400
-5
lines changed

33 files changed

+400
-5
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,7 @@ Warning: this function is not robust enough for the current version. Please try
20602060
- **Description**: Print labels and descriptors for DeePKS in OUT.${suffix}. The names of these files start with "deepks".
20612061
- 0 : No output.
20622062
- 1 : Output intermediate files needed during DeePKS training.
2063-
- 2 : Output target labels for label preperation. The label files are named as `deepks_<property>.npy`, where the units and formats are the same as label files `<property>.npy` required for training, except that the first dimension (`nframes`) is excluded. System structrue files are also given in `deepks_atom.npy` and `deepks_box.npy` in the unit of *Bohr*, which means `lattice_constant` should be set to 1 when training.
2063+
- 2 : Output target labels for label preperation. The label files are named as `deepks_<property>.npy` or `deepks_<property>.csr`, where the units and formats are the same as label files `<property>.npy` or `<property>.csr` required for training, except that the first dimension (`nframes`) is excluded. System structrue files are also given in `deepks_atom.npy` and `deepks_box.npy` in the unit of *Bohr*, which means `lattice_constant` should be set to 1 when training.
20642064
- **Note**: When `deepks_out_labels` equals **1**, the path of a numerical descriptor (an `orb` file) is needed to be specified under the `NUMERICAL_DESCRIPTOR` tag in the `STRU` file. For example:
20652065

20662066
```text

source/module_hamilt_lcao/module_deepks/LCAO_deepks_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void LCAO_Deepks_Interface<TK, TR>::out_deepks_labels(const double& etot,
359359
// set the output
360360
const double sparse_threshold = 1e-10;
361361
const int precision = 8;
362-
const std::string file_hrtot = PARAM.globalv.global_out_dir + (PARAM.inp.deepks_out_labels == 1 ? "deepks_hrtot.csr" : "hamiltonian_r.csr");
362+
const std::string file_hrtot = PARAM.globalv.global_out_dir + (PARAM.inp.deepks_out_labels == 1 ? "deepks_hrtot.csr" : "deepks_hamiltonian_r.csr");
363363
hamilt::HContainer<TR>* hR_tot = (p_ham->getHR());
364364

365365
if (rank == 0)

source/module_io/read_input_item_deepks.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ void ReadInput::item_deepks()
4848
Input_Item item("deepks_bandgap");
4949
item.annotation = ">0 for bandgap label";
5050
read_sync_int(input.deepks_bandgap);
51+
item.check_value = [](const Input_Item& item, const Parameter& para) {
52+
if (para.input.deepks_bandgap < 0 || para.input.deepks_bandgap > 3)
53+
{
54+
ModuleBase::WARNING_QUIT("ReadInput", "deepks_bandgap must be integer in [0, 3]");
55+
}
56+
};
5157
this->add_item(item);
5258
}
5359
{
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
suffix autotest
4+
calculation scf
5+
6+
nbands 6
7+
symmetry 0
8+
pseudo_dir ../../PP_ORB
9+
orbital_dir ../../PP_ORB
10+
11+
#Parameters (2.Iteration)
12+
ecutwfc 50
13+
scf_thr 1e-6
14+
scf_nmax 50
15+
16+
#Parameters (3.Basis)
17+
basis_type lcao
18+
gamma_only 0
19+
20+
#Parameters (4.Smearing)
21+
smearing_method gaussian
22+
smearing_sigma 0.02
23+
24+
#Parameters (5.Mixing)
25+
mixing_type broyden
26+
mixing_beta 0.8
27+
28+
#Parameters (6.File)
29+
deepks_out_labels 1
30+
deepks_scf 1
31+
deepks_model ../Model_ProjOrb/model_lda_pbe_18.ptg
32+
deepks_v_delta -1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
1 1 1 0 0 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test hamiltonian label (deepks_v_delta = -1) output for deepks_out_labels = 1, for gamma_only H2O molecule
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ATOMIC_SPECIES
2+
H 1.008 H_ONCV_PBE2PZ-1.0.upf
3+
O 15.9994 O_ONCV_PBE2PZ-1.0.upf
4+
5+
NUMERICAL_ORBITAL
6+
H_gga_6au_60Ry_2s1p.orb
7+
O_gga_6au_60Ry_2s2p1d.orb
8+
9+
NUMERICAL_DESCRIPTOR
10+
../Model_ProjOrb/2au_20Ry_jle.orb
11+
12+
LATTICE_CONSTANT
13+
1
14+
15+
LATTICE_VECTORS
16+
15 0 0
17+
0 15 0
18+
0 0 15
19+
20+
ATOMIC_POSITIONS
21+
Cartesian
22+
23+
H
24+
0
25+
2
26+
-12.081531451316582 1.463368531712373 10.304287878967891 1 1 1
27+
-12.056180479123837 4.25408045699522 10.010554611214044 1 1 1
28+
O
29+
0
30+
1
31+
-13.1930046246741 2.91132430713516 10.440289103003526 1 1 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Matrix Dimension of H_delta(R): 23
2+
Matrix number of H_delta(R): 1
3+
0 0 0 144
4+
-1.17226740e-02 -7.57658616e-05 1.61519520e-03 2.14838886e-03 -1.34740806e-03 -8.30754807e-03 7.47161074e-04 -3.31336838e-03 -1.94293588e-03 2.75341536e-03 4.07871413e-04 4.10885575e-03 -7.57658616e-05 -2.29579487e-03 7.50289951e-04 1.02377862e-04 -5.48909920e-05 -2.94642184e-04 -8.25177686e-04 1.94818297e-04 -1.19266527e-04 -7.46808290e-05 -8.73270929e-04 3.20285418e-04 1.61519520e-03 7.50289951e-04 -5.96371822e-04 -5.81645379e-05 1.37541461e-03 3.71901393e-03 -1.08600805e-04 -5.51784265e-04 -1.08973508e-04 -2.26761593e-04 2.01147715e-04 -2.82691276e-04 2.14838886e-03 1.02377862e-04 -5.81645379e-05 -3.34036572e-03 3.80487988e-04 6.01680816e-04 5.43170647e-04 2.59440381e-03 -2.85153605e-04 3.33506511e-04 -1.05075443e-03 -3.77203641e-03 -1.34740806e-03 -5.48909920e-05 1.37541461e-03 3.80487988e-04 4.66309048e-04 -2.79020310e-03 2.98197496e-04 -7.00712687e-04 -7.72562067e-05 -1.48728519e-04 -2.30021977e-04 -3.50951237e-04 -8.30754807e-03 -2.94642184e-04 3.71901393e-03 6.01680816e-04 -2.79020310e-03 -1.26915681e-02 6.40881586e-04 -6.12780257e-05 -1.56385352e-03 1.75141762e-03 -4.37464862e-04 1.26280909e-05 7.47161074e-04 -8.25177686e-04 -1.08600805e-04 5.43170647e-04 2.98197496e-04 6.40881586e-04 -1.80813878e-03 -6.96488950e-05 2.45238335e-04 9.54997836e-05 1.72195202e-04 2.89724169e-04 -3.31336838e-03 1.94818297e-04 -5.51784265e-04 2.59440381e-03 -7.00712687e-04 -6.12780257e-05 -6.96488950e-05 -2.13180521e-03 -4.05397975e-05 1.71581618e-04 8.85356707e-04 3.60025084e-03 -1.94293588e-03 -1.19266527e-04 -1.08973508e-04 -2.85153605e-04 -7.72562067e-05 -1.56385352e-03 2.45238335e-04 -4.05397975e-05 -6.06345144e-04 7.81662817e-04 -1.54549695e-04 2.40887746e-05 2.75341536e-03 -7.46808290e-05 -2.26761593e-04 3.33506511e-04 -1.48728519e-04 1.75141762e-03 9.54997836e-05 1.71581618e-04 7.81662817e-04 -5.88627411e-04 -2.89432341e-04 -2.73772524e-04 4.07871413e-04 -8.73270929e-04 2.01147715e-04 -1.05075443e-03 -2.30021977e-04 -4.37464862e-04 1.72195202e-04 8.85356707e-04 -1.54549695e-04 -2.89432341e-04 -2.37112515e-03 -1.20550576e-03 4.10885575e-03 3.20285418e-04 -2.82691276e-04 -3.77203641e-03 -3.50951237e-04 1.26280909e-05 2.89724169e-04 3.60025084e-03 2.40887746e-05 -2.73772524e-04 -1.20550576e-03 -7.09398430e-03
5+
0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11
6+
0 12 24 36 48 60 72 84 96 108 120 132 144 144 144 144 144 144 144 144 144 144 144 144
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Matrix Dimension of H(R): 23
2+
Matrix number of H(R): 1
3+
0 0 0 144
4+
-8.42107904e-01 -3.36018443e-02 4.57125255e-01 2.48575301e-01 -1.13625395e-01 -1.07975761e+00 6.92996341e-02 -4.87107239e-01 -7.19175506e-03 1.10813024e-01 9.06402772e-04 9.15211632e-02 -3.36018443e-02 2.49598467e+00 3.30086601e-02 2.78231936e-02 9.74834800e-03 -4.25617904e-02 -2.15042800e-01 -2.49406909e-02 1.47258242e-02 -8.47667718e-02 3.92807294e-01 -7.69616324e-02 4.57125255e-01 3.30086601e-02 2.06576968e+00 -3.14993633e-02 9.87617873e-02 5.39706282e-01 -4.07170235e-02 6.21072104e-02 -1.28863490e-01 2.24558957e-01 6.67403369e-02 5.21985815e-01 2.48575301e-01 2.78231936e-02 -3.14993633e-02 9.32647363e-01 -2.91947949e-02 1.96293189e-01 8.84269909e-02 3.75282153e-01 4.31349825e-02 -1.22832429e-01 4.49127331e-02 6.44049862e-02 -1.13625395e-01 9.74834800e-03 9.87617873e-02 -2.91947949e-02 2.23408330e+00 -4.00917139e-01 6.85175949e-02 2.02359643e-01 -3.39239660e-02 -1.39561982e-01 2.40210913e-01 2.44261809e-01 -1.07975761e+00 -4.25617904e-02 5.39706282e-01 1.96293189e-01 -4.00917139e-01 -1.70549181e+00 6.48395657e-02 -7.05142835e-03 -2.62232291e-02 1.66491876e-01 -3.83218137e-02 1.50531270e-03 6.92996341e-02 -2.15042800e-01 -4.07170235e-02 8.84269909e-02 6.85175949e-02 6.48395657e-02 -4.74768823e-01 -2.57988231e-02 1.11451453e-02 1.52852492e-02 7.90528504e-03 2.42311440e-02 -4.87107239e-01 -2.49406909e-02 6.21072104e-02 3.75282153e-01 2.02359643e-01 -7.05142835e-03 -2.57988231e-02 -7.15138160e-01 -1.64611138e-03 1.55738906e-02 9.09657799e-02 3.66026282e-01 -7.19175506e-03 1.47258242e-02 -1.28863490e-01 4.31349825e-02 -3.39239660e-02 -2.62232291e-02 1.11451453e-02 -1.64611138e-03 7.76366120e-01 5.68900637e-02 -1.06890265e-02 1.61948811e-03 1.10813024e-01 -8.47667718e-02 2.24558957e-01 -1.22832429e-01 -1.39561982e-01 1.66491876e-01 1.52852492e-02 1.55738906e-02 5.68900637e-02 3.19891456e+00 7.27737784e-03 -1.42881909e-02 9.06402772e-04 3.92807294e-01 6.67403369e-02 4.49127331e-02 2.40210913e-01 -3.83218137e-02 7.90528504e-03 9.09657799e-02 -1.06890265e-02 7.27737784e-03 3.19660717e+00 -9.14134117e-02 9.15211632e-02 -7.69616324e-02 5.21985815e-01 6.44049862e-02 2.44261809e-01 1.50531270e-03 2.42311440e-02 3.66026282e-01 1.61948811e-03 -1.42881909e-02 -9.14134117e-02 2.85906938e+00
5+
0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11
6+
0 12 24 36 48 60 72 84 96 108 120 132 144 144 144 144 144 144 144 144 144 144 144 144
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
etotref -466.043171161868
2+
etotperatomref -155.3477237206
3+
deepks_desc 2.319019
4+
deepks_dm_eig 10.787022245391764
5+
deepks_e_label 17.12676450564565
6+
deepks_edelta 0.09815855485768665
7+
deepks_hr_label_pass 0
8+
deepks_vdelta_r_pass 0
9+
deepks_vdrp 176.1482475142101
10+
totaltimeref 2.69

0 commit comments

Comments
 (0)