Skip to content

Commit

Permalink
Merge branch 'develop' into fix_psi
Browse files Browse the repository at this point in the history
  • Loading branch information
Qianruipku authored Nov 2, 2023
2 parents 03cbdd0 + 9c7398a commit 30b21e8
Show file tree
Hide file tree
Showing 126 changed files with 24,184 additions and 916 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
cmake --install build
- name: Testing
run: |
cmake --build build --target test ARGS="-V --timeout 21600"
cd tests/integrate
bash Autotest.sh -n 2 -s true
- name: Publish Report to Dashboard
uses: crazy-max/ghaction-github-pages@v4
if: ${{ ! cancelled() }}
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ if(ENABLE_LCAO)
gint
dftu
hcontainer
deltaspin
numerical_atomic_orbitals
)
if (USE_ELPA)
Expand Down
2 changes: 1 addition & 1 deletion deps/libpaw_interface
93 changes: 93 additions & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@
- [tau](#tau)
- [sigma\_k](#sigma_k)
- [nc\_k](#nc_k)
- [Deltaspin](#deltaspin)
- [sc\_mag\_switch](#sc_mag_switch)
- [decay\_grad\_switch](#decay_grad_switch)
- [sc\_thr](#sc_thr)
- [nsc](#nsc)
- [nsc\_min](#nsc_min)
- [alpha\_trial](#alpha_trial)
- [sccut](#sccut)
- [sc\_file](#sc_file)

[back to top](#full-list-of-input-keywords)

Expand Down Expand Up @@ -3210,4 +3219,88 @@ These variables are used to control the usage of implicit solvation model. This
- **Default**: 0.00037
- **Unit**: $Bohr^{-3}$

## Deltaspin

These variables are used to control the usage of deltaspin functionality.

### sc_mag_switch

- **Type**: boolean
- **Description**: the switch of deltaspin functionality
- 0: no deltaspin
- 1: use the deltaspin method to constrain atomic magnetic moments
- **Default**: 0

### decay_grad_switch

- **Type**: boolean
- **Description**: the switch of decay gradient method
- 0: no decay gradient method
- 1: use the decay gradient method and set ScDecayGrad in the file specified by `sc_file`. ScDecayGrad is an element dependent parameter, which is used to control the decay rate of the gradient of the magnetic moment.
- **Default**: 0

### sc_thr

- **Type**: Real
- **Description**: the threshold of the spin constraint atomic magnetic moment
- **Default**: 1e-6
- **Unit**: Bohr Mag (\muB)

### nsc

- **Type**: Integer
- **Description**: the maximum number of steps in the inner lambda loop
- **Default**: 100

### nsc_min

- **Type**: Integer
- **Description**: the minimum number of steps in the inner lambda loop
- **Default**: 2

### alpha_trial

- **Type**: Real
- **Description**: initial trial step size for lambda in eV/uB^2
- **Default**: 0.01
- **Unit**: eV/uB^2

### sccut

- **Type**: Real
- **Description**: restriction of step size in eV/uB
- **Default**: 3
- **Unit**: eV/uB

### sc_file

- **Type**: String
- **Description**: the file in json format to specify atomic constraining parameters. An example of the sc_file json file is shown below:
```json
[
{
"element": "Fe",
"itype": 0,
"ScDecayGrad": 0.9,
"ScAtomData": [
{
"index": 0,
"lambda": [0, 0, 0],
"target_mag": [2.0, 0.0, 0.0],
"constrain": [1,1,1]
},
{
"index": 1,
"lambda": [0, 0, 0],
"target_mag_val": 2.0,
"target_mag_angle1": 80.0,
"target_mag_angle2": 0.0,
"constrain": [1,1,1]
}
]
}
]
```
- **Default**: none

[back to top](#full-list-of-input-keywords)
48 changes: 48 additions & 0 deletions docs/advanced/scf/spin.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,54 @@ The SOC effect is considered but the magnetic moment is limited to the Z directi
- noncolin=1 lspinorb=1 :
The SOC effect and non-collinear magnetic moment are both calculated.

### Constraint Spin functionality for noncollinear spin polarized calculations

The `DeltaSpin` function as proposed by Zefeng Cai and Ben Xu, et al. [arXiv:2208.04551v6](https://arxiv.org/abs/2208.04551) has been implemented in ABACUS in the LCAO basis. In order to use this function, the following parameters are needed to be set in the input file:
```
#deltaspin
sc_mag_switch 1
decay_grad_switch 1
sc_thr 1e-7
nsc 150
nsc_min 2
sc_file sc.json
alpha_trial 0.01
sccut 3
```


`sc_mag_switch` is the switch of deltaspin functionality; `decay_grad_switch` is the switch of decay gradient method; `sc_thr` is the threshold of the spin constraint atomic magnetic moment in unit of Bohr Mag (\muB); `nsc` is the number of self-consistent iterations; `nsc_min` is the minimum number of self-consistent iterations; `sc_file` is the file name of the spin constraint parameters; `alpha_trial` is the initial trial step size for lambda in eV/uB^2; `sccut` restriction of step size in eV/uB.

An example of the sc_file json file is shown below:
```json
[
{
"element": "Fe",
"itype": 0,
"ScDecayGrad": 0.9,
"ScAtomData": [
{
"index": 0,
"lambda": [0, 0, 0],
"target_mag": [2.0, 0.0, 0.0],
"constrain": [1,1,1]
},
{
"index": 1,
"lambda": [0, 0, 0],
"target_mag_val": 2.0,
"target_mag_angle1": 80.0,
"target_mag_angle2": 0.0,
"constrain": [1,1,1]
}
]
}
]
```

The sc_file json file is a list of elemental data in total. For each element, the user should specify its name, the `itype` parameter should be in accord with `STRU` file and start from 0. `ScDecayGrad` is a parameter for each element in unit of (uB^2/eV), this parameter needs to be determined for different element, for example, 0.9 uB^2/eV is an appropriate value for BCC-Fe according to Zefeng Cai's tests. `ScAtomData` specifies spin constraining parameters for each atom, the `index` starts from 0 and corresponds atomic order in the `STRU` file. `lambda` is a 3d vector for each atom, and it is recommended to set to [0.0, 0.0, 0.0] for all atoms. Users have two optional choices to set the target magnetic moments for each atom, i.e., by a 3d vector or by angles. If the `target_mag` is set, the `target_mag_val` and `target_mag_angle1` and `target_mag_angle2` will be ignored. The `target_mag` is a 3d vector in unit of Bohr Mag (\muB), and the `target_mag_val` is a scalar value in unit of Bohr Mag (\muB), `target_mag_angle1` and `target_mag_angle2` are two angles in unit of degree. The `constrain` is a 3d vector, if the corresponding element is set to 1, the corresponding component of the magnetic moment will be constrained, otherwise, it will be free. Note that the initial atomic magnetic moments are still set in the `STRU` file. Simple examples are provided in the `abacus-develop/examples/noncollinear` directory. One should set `noncolliear` to 1 to run the DeltaSpin function, `lspinorb=1` is not mandatory, but it is recommended to set to 1 to get more accurate results.


## For the continuation job
- Continuation job for "nspin 1" need file "SPIN1_CHG.cube" which is generated by setting "out_chg=1" in task before. By setting "init_chg file" in new job's INPUT file, charge density will start from file but not atomic.
- Continuation job for "nspin 2" need files "SPIN1_CHG.cube" and "SPIN2_CHG.cube" which are generated by "out_chg 1" with "nspin 2", and refer to spin-up and spin-down charge densities respectively. It should be note that reading "SPIN1_CHG.cube" only for the continuation target magnetic moment job is not supported now.
Expand Down
30 changes: 30 additions & 0 deletions examples/noncollinear/BCC_Fe_NC_deltaspin/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
INPUT_PARAMETERS
pseudo_dir ../../../tests/PP_ORB
orbital_dir ../../../tests/PP_ORB
suffix ABACUS
calculation scf
ecutwfc 100
scf_thr 1.0e-5
scf_nmax 200
out_chg 0
smearing_method gaussian
smearing_sigma 0.07
mixing_type pulay
mixing_ndim 10
mixing_beta 0.1
ks_solver genelpa
basis_type lcao
symmetry 0
noncolin true
nspin 4
lspinorb true
out_mul true
#deltaspin
sc_mag_switch 1
decay_grad_switch 1
sc_thr 1e-7
nsc 150
nsc_min 2
sc_file sc.json
alpha_trial 0.01
sccut 3
4 changes: 4 additions & 0 deletions examples/noncollinear/BCC_Fe_NC_deltaspin/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
2 2 2 0 0 0
21 changes: 21 additions & 0 deletions examples/noncollinear/BCC_Fe_NC_deltaspin/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ATOMIC_SPECIES
Fe 55.845 Fe.upf

NUMERICAL_ORBITAL
Fe_gga_10au_100Ry_4s2p2d1f.orb

LATTICE_CONSTANT
1.889725989

LATTICE_VECTORS
2.8328152400000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 2.8328152400000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 2.8328152400000000
ATOMIC_POSITIONS
Direct

Fe
1.0
2
0.0 0.0 0.0 mag 5 angle1 0 angle2 0
0.5 0.5 0.5 mag 5 angle1 0 angle2 0
Loading

0 comments on commit 30b21e8

Please sign in to comment.