Skip to content

Commit 83e1ebf

Browse files
author
root
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into diag
2 parents 9825563 + e25db6e commit 83e1ebf

File tree

440 files changed

+13567
-12546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

440 files changed

+13567
-12546
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- [ndx, ndy, ndz](#ndx-ndy-ndz)
3939
- [pw\_seed](#pw_seed)
4040
- [pw\_diag\_thr](#pw_diag_thr)
41+
- [diago\_smooth\_ethr](#diago_smooth_ethr)
4142
- [pw\_diag\_nmax](#pw_diag_nmax)
4243
- [pw\_diag\_ndim](#pw_diag_ndim)
4344
- [diag\_subspace](#diag_subspace)
@@ -791,6 +792,12 @@ These variables are used to control the plane wave related parameters.
791792
- **Description**: Only used when you use `ks_solver = cg/dav/dav_subspace/bpcg`. It indicates the threshold for the first electronic iteration, from the second iteration the pw_diag_thr will be updated automatically. **For nscf calculations with planewave basis set, pw_diag_thr should be <= 1e-3.**
792793
- **Default**: 0.01
793794

795+
### diago_smooth_ethr
796+
797+
- **Type**: bool
798+
- **Description**: If `TRUE`, the smooth threshold strategy, which applies a larger threshold (10e-5) for the empty states, will be implemented in the diagonalization methods. (This strategy should not affect total energy, forces, and other ground-state properties, but computational efficiency will be improved.) If `FALSE`, the smooth threshold strategy will not be applied.
799+
- **Default**: false
800+
794801
### pw_diag_nmax
795802

796803
- **Type**: Integer
@@ -1391,6 +1398,7 @@ These variables are used to control the geometry relaxation.
13911398
- **Description**: The methods to do geometry optimization.
13921399
- cg: using the conjugate gradient (CG) algorithm. Note that there are two implementations of the conjugate gradient (CG) method, see [relax_new](#relax_new).
13931400
- bfgs: using the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm.
1401+
- bfgs_trad: using the traditional Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm.
13941402
- cg_bfgs: using the CG method for the initial steps, and switching to BFGS method when the force convergence is smaller than [relax_cg_thr](#relax_cg_thr).
13951403
- sd: using the steepest descent (SD) algorithm.
13961404
- fire: the Fast Inertial Relaxation Engine method (FIRE), a kind of molecular-dynamics-based relaxation algorithm, is implemented in the molecular dynamics (MD) module. The algorithm can be used by setting [calculation](#calculation) to `md` and [md_type](#md_type) to `fire`. Also ionic velocities should be set in this case. See [fire](../md.md#fire) for more details.
@@ -1569,10 +1577,8 @@ These variables are used to control the output of properties.
15691577
### out_freq_elec
15701578

15711579
- **Type**: Integer
1572-
- **Description**: The output frequency of the charge density (controlled by [out_chg](#out_chg)), wavefunction (controlled by [out_wfc_pw](#out_wfc_pw) or [out_wfc_r](#out_wfc_r)), and density matrix of localized orbitals (controlled by [out_dm](#out_dm)).
1573-
- \>0: Output them every `out_freq_elec` iteration numbers in electronic iterations.
1574-
- 0: Output them when the electronic iteration is converged or reaches the maximal iteration number.
1575-
- **Default**: 0
1580+
- **Description**: Output the charge density (only binary format, controlled by [out_chg](#out_chg)), wavefunction (controlled by [out_wfc_pw](#out_wfc_pw) or [out_wfc_r](#out_wfc_r)) per `out_freq_elec` electronic iterations. Note that they are always output when converged or reach the maximum iterations [scf_nmax](#scf_nmax).
1581+
- **Default**: [scf_nmax](#scf_nmax)
15761582

15771583
### out_chg
15781584

@@ -2068,7 +2074,7 @@ Warning: this function is not robust enough for the current version. Please try
20682074
- **Type**: int
20692075
- **Availability**: numerical atomic orbital basis
20702076
- **Description**: Include V_delta label for DeePKS training. When `deepks_out_labels` is true and `deepks_v_delta` > 0, ABACUS will output h_base.npy, v_delta.npy and h_tot.npy(h_tot=h_base+v_delta).
2071-
Meanwhile, when `deepks_v_delta` equals 1, ABACUS will also output v_delta_precalc.npy, which is used to calculate V_delta during DeePKS training. However, when the number of atoms grows, the size of v_delta_precalc.npy will be very large. In this case, it's recommended to set `deepks_v_delta` as 2, and ABACUS will output psialpha.npy and grad_evdm.npy but not v_delta_precalc.npy. These two files are small and can be used to calculate v_delta_precalc in the procedure of training DeePKS.
2077+
Meanwhile, when `deepks_v_delta` equals 1, ABACUS will also output v_delta_precalc.npy, which is used to calculate V_delta during DeePKS training. However, when the number of atoms grows, the size of v_delta_precalc.npy will be very large. In this case, it's recommended to set `deepks_v_delta` as 2, and ABACUS will output phialpha.npy and grad_evdm.npy but not v_delta_precalc.npy. These two files are small and can be used to calculate v_delta_precalc in the procedure of training DeePKS.
20722078
- **Default**: 0
20732079

20742080
### deepks_out_unittest
@@ -2454,10 +2460,11 @@ These variables are relevant when using hybrid functionals.
24542460
### exx_ccp_rmesh_times
24552461

24562462
- **Type**: Real
2457-
- **Description**: This parameter determines how many times larger the radial mesh required for calculating Columb potential is to that of atomic orbitals. For HSE, setting it to 1 is enough. But for PBE0, a much larger number must be used.
2463+
- **Description**: This parameter determines how many times larger the radial mesh required for calculating Columb potential is to that of atomic orbitals. The value should be at least 1. Reducing this value can effectively increase the speed of self-consistent calculations using hybrid functionals.
24582464
- **Default**:
2459-
- 1.5: if *[dft_functional](#dft_functional)==hse*
2460-
- 5: else
2465+
- 5: if *[dft_functional](#dft_functional)==hf/pbe0/scan0/muller/power/wp22*
2466+
- 1.5: if *[dft_functional](#dft_functional)==hse/cwp22*
2467+
- 1: else
24612468

24622469
### exx_distribute_type
24632470

@@ -2496,6 +2503,7 @@ These variables are relevant when using hybrid functionals.
24962503
- **Description**:
24972504
- True: Enforce LibRI to use `double` data type.
24982505
- False: Enforce LibRI to use `complex` data type.
2506+
Setting it to True can effectively improve the speed of self-consistent calculations with hybrid functionals.
24992507
- **Default**: depends on the [gamma_only](#gamma_only) option
25002508
- True: if gamma_only
25012509
- False: else

docs/advanced/opt.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ In the nested procedure mentioned above, we used CG method to perform cell relax
2222

2323
The [BFGS method](https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm) is a quasi-Newton method for solving nonlinear optimization problem. It belongs to the class of quasi-Newton method where the Hessian matrix is approximated during the optimization process. If the initial point is not far from the extrema, BFGS tends to work better than gradient-based methods.
2424

25-
In ABACUS, we implemented the BFGS method for doing fixed-cell structural relaxation.
25+
There is an alternative traditional BFGS method, which can be called by using the keyword 'bfgs_trad'. The bfgs_trad method is a quasi-Newton method that substitute an approximate matrix B for the Hessian matrix. The main difference between 'bfgs' and 'bfgs_trad' is that 'bfgs' updates the inverse of matrix B while 'bfgs_trad' updates matrix B and obtains the inverse of B by solving the matrix eigenvalues and taking the reciprocal of the eigenvalues. Both methods are mathematically equivalent, but in some cases, 'bfgs_trad' performs better.
26+
27+
In ABACUS, we implemented the BFGS method for doing fixed-cell structural relaxation. Users can choose which implementation of BFGS to call by adding the 'bfgs_trad' or 'bfgs' parameter.
2628

2729
### SD method
2830

docs/quick_start/input.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ The `INPUT` file contains parameters that control the type of calculation as wel
88

99
Below is an example `INPUT` file with some of the most important parameters that need to be set:
1010

11-
```
11+
```plaintext
1212
INPUT_PARAMETERS
1313
suffix MgO
1414
ntype 2
1515
pseudo_dir ./
16-
orbital_dir ./
17-
ecutwfc 100 # Rydberg
18-
scf_thr 1e-4 # Rydberg
19-
basis_type lcao
20-
calculation scf # this is the key parameter telling abacus to do a scf calculation
21-
out_chg True
16+
orbital_dir ./
17+
ecutwfc 100 # in Rydberg
18+
scf_thr 1e-4 # Rydberg
19+
basis_type lcao
20+
calculation scf # this is the key parameter telling abacus to do a scf calculation
21+
out_chg True
2222
```
2323

2424
The parameter list always starts with key word `INPUT_PARAMETERS`. Any content before `INPUT_PARAMETERS` will be ignored.
@@ -40,22 +40,23 @@ In the above example, the meanings of the parameters are:
4040
- `ntype` : how many types of elements in the unit cell
4141
- `pseudo_dir` : the directory where pseudopotential files are provided
4242
- `orbital_dir` : the directory where orbital files are provided
43-
- `ecutwfc` : the plane-wave energy cutoff for the wave function expansion (UNIT: Rydberg)
44-
- `scf_thr` : the threshold for the convergence of charge density (UNIT: Rydberg)
43+
- `ecutwfc` : the plane-wave energy cutoff for the wave function expansion (UNIT: Rydberg)
44+
- `scf_thr` : the threshold for the convergence of charge density (UNIT: Rydberg)
4545
- `basis_type` : the type of basis set for expanding the electronic wave functions
4646
- `calculation` : the type of calculation to be performed by ABACUS
47-
- `out_chg` : if true, output thee charge density oon real space grid
47+
- `out_chg` : if true, output the charge density on real space grid
4848

4949
For a complete list of input parameters, please consult this [instruction](../advanced/input_files/input-main.md).
5050

51-
> **Note:** Users cannot change the filename “INPUT” to other names. Boolean paramerters such as `out_chg` can be set by using `True` and `False`, `1` and `0`, or `T` and `F`. It is case insensitive so that other preferences such as `true` and `false`, `TRUE` and `FALSE`, and `t` and `f` for setting boolean values are also supported.
51+
> **Note:** Users cannot change the filename “INPUT” to other names. Boolean paramerters such as `out_chg` can be set by using `True` and `False`, `1` and `0`, or `T` and `F`. It is case insensitive so that other preferences such as `true` and `false`, `TRUE` and `FALSE`, and `t` and `f` for setting boolean values are also supported. Specifically for the `out_chg`, `-1` option is also available, which means turn off the checkpoint of charge density in binary (always dumped in `OUT.{suffix}`, whose name ends with `CHARGE-DENSITY.restart`). Some parameters controlling the output also support a second option to control the output precision, e.g., `out_chg True 8` will output the charge density on realspace grid with 8 digits after the decimal point.
5252
5353
## *STRU*
5454

55-
The structure file contains structural information about the system, e.g., lattice constant, lattice vectors, and positions of the atoms within a unit cell. The positions can be given either in direct or Cartesian coordinates.
55+
The structure file contains structural information about the system, e.g., lattice constant, lattice vectors, and positions of the atoms within a unit cell. The positions can be given either in direct or Cartesian coordinates.
5656

5757
An example of the `STRU` file is given as follows :
58-
```
58+
59+
```plaintext
5960
#This is the atom file containing all the information
6061
#about the lattice structure.
6162
@@ -68,7 +69,7 @@ Mg_gga_8au_100Ry_4s2p1d.orb
6869
O_gga_8au_100Ry_2s2p1d.orb
6970
7071
LATTICE_CONSTANT
71-
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
72+
1.8897259886 # 1.8897259886 Bohr = 1.0 Angstrom
7273
7374
LATTICE_VECTORS
7475
4.25648 0.00000 0.00000
@@ -100,9 +101,10 @@ For a more detailed description of STRU file, please consult [here](../advanced/
100101
## *KPT*
101102

102103
This file contains information of the kpoint grid setting for the Brillouin zone sampling.
103-
104+
104105
An example of the `KPT` file is given below:
105-
```
106+
107+
```plaintext
106108
K_POINTS
107109
0
108110
Gamma
@@ -111,7 +113,6 @@ Gamma
111113

112114
> **Note:** users may choose a different name for their k-point file using keyword `kpoint_file`
113115
114-
115116
For a more detailed description, please consult [here](../advanced/input_files/kpt.md).
116117

117118
- The pseudopotential files

examples/lr-tddft/lcao_H2O/INPUT

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ orbital_dir ../../../tests/PP_ORB
66
calculation scf
77
nbands 23
88
symmetry -1
9+
nspin 2
910

1011
#Parameters (2.Iteration)
1112
ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1]
@@ -30,6 +31,7 @@ xc_kernel lda
3031
lr_solver dav
3132
lr_thr 1e-2
3233
pw_diag_ndim 2
34+
# lr_unrestricted 1 ### use this to do TDUKS calculation for closeshell systems (openshell system will force TDUKS)
3335

3436
esolver_type ks-lr
3537
out_alllog 1
@@ -39,6 +41,7 @@ out_alllog 1
3941
nvirt 19
4042
abs_wavelen_range 40 180
4143
abs_broadening 0.01
44+
abs_gauge length
4245

4346
### [1] Energy cutoff determines the quality of numerical quadratures in your calculations.
4447
### So it is strongly recommended to test whether your result (such as converged SCF energies) is

examples/lr-tddft/lcao_Si2/INPUT

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ pseudo_dir ../../../tests/PP_ORB
55
orbital_dir ../../../tests/PP_ORB
66
calculation scf
77
nbands 23
8-
symmetry 0
8+
symmetry -1
9+
nspin 2
910

1011
#Parameters (2.Iteration)
1112
ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1]
@@ -37,6 +38,8 @@ out_alllog 1
3738

3839
nvirt 19
3940
abs_wavelen_range 100 175
41+
abs_broadening 0.01 # in Ry
42+
abs_gauge velocity ### velocity gauge is recommended for periodic systems
4043

4144

4245
### [1] Energy cutoff determines the quality of numerical quadratures in your calculations.

source/Makefile.Objects

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,25 +187,26 @@ OBJS_CELL=atom_pseudo.o\
187187
klist.o\
188188
cell_index.o\
189189
check_atomic_stru.o\
190+
update_cell.o\
191+
bcast_cell.o\
190192

191193
OBJS_DEEPKS=LCAO_deepks.o\
192-
deepks_fgamma.o\
193-
deepks_fk.o\
194-
LCAO_deepks_odelta.o\
194+
deepks_force.o\
195+
deepks_descriptor.o\
196+
deepks_orbital.o\
197+
deepks_orbpre.o\
198+
deepks_vdpre.o\
199+
deepks_hmat.o\
195200
LCAO_deepks_io.o\
196-
LCAO_deepks_mpi.o\
197201
LCAO_deepks_pdm.o\
198-
LCAO_deepks_psialpha.o\
202+
LCAO_deepks_phialpha.o\
199203
LCAO_deepks_torch.o\
200204
LCAO_deepks_vdelta.o\
201-
deepks_hmat.o\
202205
LCAO_deepks_interface.o\
203-
orbital_precalc.o\
204206
cal_gdmx.o\
207+
cal_gdmepsl.o\
205208
cal_gedm.o\
206209
cal_gvx.o\
207-
cal_descriptor.o\
208-
v_delta_precalc.o\
209210

210211

211212
OBJS_ELECSTAT=elecstate.o\
@@ -370,7 +371,6 @@ OBJS_MD=fire.o\
370371

371372
OBJS_NEIGHBOR=sltk_atom.o\
372373
sltk_atom_arrange.o\
373-
sltk_atom_input.o\
374374
sltk_grid.o\
375375
sltk_grid_driver.o\
376376

@@ -734,6 +734,7 @@ OBJS_TENSOR=tensor.o\
734734
xc_kernel.o\
735735
pot_hxc_lrtd.o\
736736
lr_spectrum.o\
737+
lr_spectrum_velocity.o\
737738
hamilt_casida.o\
738739
esolver_lrtd_lcao.o\
739740

source/driver.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ void Driver::init()
4343
// (4) close all of the running logs
4444
ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK, PARAM.inp.out_alllog,PARAM.inp.calculation);
4545

46-
// (5) output the json file
47-
// Json::create_Json(&GlobalC::ucell.symm,GlobalC::ucell.atoms,&INPUT);
48-
Json::create_Json(&GlobalC::ucell, PARAM);
4946
}
5047

5148
void Driver::print_start_info()
@@ -180,7 +177,7 @@ void Driver::atomic_world()
180177
//--------------------------------------------------
181178

182179
// where the actual stuff is done
183-
this->driver_run(GlobalC::ucell);
180+
this->driver_run();
184181

185182
ModuleBase::timer::finish(GlobalV::ofs_running);
186183
ModuleBase::Memory::print_all(GlobalV::ofs_running);

source/driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Driver
3636
void atomic_world();
3737

3838
// the actual calculations
39-
void driver_run(UnitCell& ucell);
39+
void driver_run();
4040
};
4141

4242
#endif

source/driver_run.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
* the configuration-changing subroutine takes force and stress and updates the
2525
* configuration
2626
*/
27-
void Driver::driver_run(UnitCell& ucell)
27+
void Driver::driver_run()
2828
{
2929
ModuleBase::TITLE("Driver", "driver_line");
3030
ModuleBase::timer::tick("Driver", "driver_line");
3131

3232
//! 1: setup cell and atom information
33-
3433
// this warning should not be here, mohan 2024-05-22
3534
#ifndef __LCAO
3635
if (PARAM.inp.basis_type == "lcao_in_pw" || PARAM.inp.basis_type == "lcao") {
@@ -40,6 +39,13 @@ void Driver::driver_run(UnitCell& ucell)
4039
#endif
4140

4241
// the life of ucell should begin here, mohan 2024-05-12
42+
UnitCell ucell;
43+
ucell.setup(PARAM.inp.latname,
44+
PARAM.inp.ntype,
45+
PARAM.inp.lmaxmax,
46+
PARAM.inp.init_vel,
47+
PARAM.inp.fixed_axes);
48+
4349
ucell.setup_cell(PARAM.globalv.global_in_stru, GlobalV::ofs_running);
4450
Check_Atomic_Stru::check_atomic_stru(ucell, PARAM.inp.min_dist_coef);
4551

@@ -86,6 +92,8 @@ void Driver::driver_run(UnitCell& ucell)
8692

8793
ModuleESolver::clean_esolver(p_esolver);
8894

95+
//! 6: output the json file
96+
Json::create_Json(&ucell, PARAM);
8997
ModuleBase::timer::tick("Driver", "driver_line");
9098
return;
9199
}

0 commit comments

Comments
 (0)