Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2d07141
modify unit of output deepks *.npy from Ry to Hartree, which is consi…
xuan112358 Mar 31, 2025
ee6625f
Merge branch 'develop' into out_labels
xuan112358 Mar 31, 2025
45e7346
change ref in test because of unit change of deepks *.npy files
xuan112358 Mar 31, 2025
6b49862
change deepks_out_labels from bool to int, which enables deepks_out_l…
xuan112358 Apr 1, 2025
f32c3ea
support output of atom.npy and box.npy
xuan112358 Apr 1, 2025
4119a19
change the file names of deepks_*.npy and delete no-use files when de…
xuan112358 Apr 2, 2025
85e82d7
change the units of npy by adding parameter unit_scale
xuan112358 Apr 2, 2025
4cf3aac
fix : overlap martrix should not be scaled by 0.5
xuan112358 Apr 2, 2025
79c39aa
fix : don't need jle.orb when deepks_out_labels=2
xuan112358 Apr 2, 2025
6cf8615
add integrate test for deepks_out_labels = 2
xuan112358 Apr 2, 2025
4b19196
Merge branch 'develop' into out_labels
xuan112358 Apr 3, 2025
0d126b6
add doc for deepks_out_labels=2
xuan112358 Apr 3, 2025
0ca3c5f
Merge branch 'develop' into out_labels
xuan112358 Apr 3, 2025
42e5f1a
clang-format
xuan112358 Apr 3, 2025
65973b6
Merge branch 'develop' into out_labels
xuan112358 Apr 3, 2025
e0c71c9
seperate catch_deepks_properties.sh from catch_properties.sh
xuan112358 Apr 4, 2025
f6ba68d
fix a bug of catch_deepks_properties.sh
xuan112358 Apr 4, 2025
73fb65a
Revert "change ref in test because of unit change of deepks *.npy files"
xuan112358 Apr 4, 2025
cf8df38
fix the bug of no has_force and has_stress in catch_deepks_properties.sh
xuan112358 Apr 4, 2025
6d98a3d
change ref in test because of unit change of deepks *.npy files, just…
xuan112358 Apr 4, 2025
604b781
Merge branch 'develop' into out_labels
xuan112358 Apr 4, 2025
734fe08
Merge branch 'out_labels' of https://github.com/xuan112358/abacus-dev…
xuan112358 Apr 4, 2025
ba09518
Merge branch 'develop' into out_labels
xuan112358 Apr 5, 2025
0893ecf
Merge branch 'develop' into out_labels
xuan112358 Apr 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -2027,10 +2027,13 @@ Warning: this function is not robust enough for the current version. Please try

### deepks_out_labels

- **Type**: Boolean
- **Type**: Integer
- **Availability**: numerical atomic orbital basis
- **Description**: Print labels and descriptors for DeePKS training in OUT.${suffix}. The names of these files start with "deepks".
- **Note**: In `LCAO` calculation, 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:
- **Description**: Print labels and descriptors for DeePKS in OUT.${suffix}. The names of these files start with "deepks".
- 0 : No output.
- 1 : Output intermediate files needed during DeePKS training.
- 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.
- **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:

```text
NUMERICAL_ORBITAL
Expand All @@ -2040,8 +2043,8 @@ Warning: this function is not robust enough for the current version. Please try
NUMERICAL_DESCRIPTOR
jle.orb
```

- **Default**: False
This is not needed when `deepks_out_labels` equals 2.
- **Default**: 0

### deepks_scf

Expand Down
65 changes: 42 additions & 23 deletions source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +504,23 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
// DeePKS force
if (PARAM.inp.deepks_out_labels) // not parallelized yet
{
const std::string file_ftot = PARAM.globalv.global_out_dir + "deepks_ftot.npy";
LCAO_deepks_io::save_matrix2npy(file_ftot, fcs, GlobalV::MY_RANK); // Ry/Bohr, F_tot
const std::string file_ftot = PARAM.globalv.global_out_dir
+ (PARAM.inp.deepks_out_labels == 1 ? "deepks_ftot.npy" : "deepks_force.npy");
LCAO_deepks_io::save_matrix2npy(file_ftot, fcs, GlobalV::MY_RANK); // Hartree/Bohr, F_tot

const std::string file_fbase = PARAM.globalv.global_out_dir + "deepks_fbase.npy";
if (PARAM.inp.deepks_scf)
if (PARAM.inp.deepks_out_labels == 1)
{
LCAO_deepks_io::save_matrix2npy(file_fbase, fcs - fvnl_dalpha, GlobalV::MY_RANK); // Ry/Bohr, F_base
}
else
{
LCAO_deepks_io::save_matrix2npy(file_fbase, fcs, GlobalV::MY_RANK); // no scf, F_base=F_tot
const std::string file_fbase = PARAM.globalv.global_out_dir + "deepks_fbase.npy";
if (PARAM.inp.deepks_scf)
{
LCAO_deepks_io::save_matrix2npy(file_fbase,
fcs - fvnl_dalpha,
GlobalV::MY_RANK); // Hartree/Bohr, F_base
}
else
{
LCAO_deepks_io::save_matrix2npy(file_fbase, fcs, GlobalV::MY_RANK); // no scf, F_base=F_tot
}
}
}
#endif
Expand Down Expand Up @@ -686,25 +692,38 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
#ifdef __DEEPKS
if (PARAM.inp.deepks_out_labels) // not parallelized yet
{
const std::string file_stot = PARAM.globalv.global_out_dir + "deepks_stot.npy";
LCAO_deepks_io::save_matrix2npy(file_stot,
scs,
GlobalV::MY_RANK,
ucell.omega,
'U'); // change to energy unit Ry when printing, S_tot;

const std::string file_sbase = PARAM.globalv.global_out_dir + "deepks_sbase.npy";
if (PARAM.inp.deepks_scf)
if (PARAM.inp.deepks_out_labels == 1)
{
LCAO_deepks_io::save_matrix2npy(file_sbase,
scs - svnl_dalpha,
const std::string file_stot = PARAM.globalv.global_out_dir + "deepks_stot.npy";
LCAO_deepks_io::save_matrix2npy(file_stot,
scs,
GlobalV::MY_RANK,
ucell.omega,
'U'); // change to energy unit Ry when printing, S_base;
'U'); // change to energy unit Ry when printing, S_tot;

const std::string file_sbase = PARAM.globalv.global_out_dir + "deepks_sbase.npy";
if (PARAM.inp.deepks_scf)
{
LCAO_deepks_io::save_matrix2npy(file_sbase,
scs - svnl_dalpha,
GlobalV::MY_RANK,
ucell.omega,
'U'); // change to energy unit Ry when printing, S_base;
}
else
{
LCAO_deepks_io::save_matrix2npy(file_sbase,
scs,
GlobalV::MY_RANK,
ucell.omega,
'U'); // sbase = stot
}
}
else
else if (PARAM.inp.deepks_out_labels == 2)
{
LCAO_deepks_io::save_matrix2npy(file_sbase, scs, GlobalV::MY_RANK, ucell.omega, 'U'); // sbase = stot
const std::string file_stot = PARAM.globalv.global_out_dir + "deepks_stress.npy";
LCAO_deepks_io::save_matrix2npy(file_stot, scs, GlobalV::MY_RANK, ucell.omega,
'F'); // flat mode
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/hamilt_lcaodft/LCAO_allocate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void DeePKS_init(const UnitCell& ucell,
{
ModuleBase::TITLE("LCAO_domain", "DeePKS_init");
// preparation for DeePKS
if (PARAM.inp.deepks_out_labels || PARAM.inp.deepks_scf)
if (PARAM.inp.deepks_out_labels == 1 || PARAM.inp.deepks_scf)
{
// allocate relevant data structures for calculating descriptors
std::vector<int> na;
Expand Down
Loading
Loading