Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions source/source_hamilt/module_gint/gint_common.cpp
Comment thread
mohanchen marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,18 @@ void merge_hr_part_to_hR(const std::vector<hamilt::HContainer<double>>& hr_gint_
+ std::complex<double>(clx_i[is], clx_j[is]) * mat_nspin2->get_value(irow, icol);
}
}
//fill the lower triangle matrix at -R by conjugate transpose of upper at R
// This ensures H(-R) = H(R)^dagger, required for Hermiticity of H(k).
// For real matrices (is=0,3), conj has no effect.
// For complex matrices (is=1,2), conj is essential.
// Transpose only the spatial indices within this fixed spin block.
// The real Pauli-channel matrices obey V_mu(-R) = V_mu(R)^T.
// Full spinor Hermiticity also exchanges the spin indices; the
// conjugate coefficients are already in the opposite spin block.
if (iat1 < iat2)
{
auto lower_mat = lower_ap->find_matrix(-R_index);
for (int irow = 0; irow < upper_mat->get_row_size(); ++irow)
{
for (int icol = 0; icol < upper_mat->get_col_size(); ++icol)
{
lower_mat->get_value(icol, irow) = std::conj(upper_mat->get_value(irow, icol));
lower_mat->get_value(icol, irow) = upper_mat->get_value(irow, icol);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/03_NAO_multik/CASES_CPU.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ get_pchg_k
get_s
scf_deltaspin2
scf_deltaspin4
scf_nspin4_nsoc_hr
scf_nspin4_soc_hr
22 changes: 22 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
INPUT_PARAMETERS
suffix autotest
calculation scf
symmetry 0
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
gamma_only 0
ecutwfc 15
scf_thr 1e-7
scf_nmax 50
noncolin 1
nspin 4
lspinorb 0
basis_type lcao
ks_solver scalapack_gvx
dft_functional pbe
smearing_method gauss
smearing_sigma 0.02
mixing_type pulay
mixing_beta 0.4
mixing_gg0 3.0
out_hsr 1 12
4 changes: 4 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
1 1 1 0 0 0
7 changes: 7 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Self-consistent nspin=4 O2 H(R)/S(R) regression, without SOC.
O-O distance 2.3 bohr in an 18-bohr cubic cell; existing O FR PP and minimal 6-bohr 1s1p orbitals.
PBE/LCAO, 15 Ry, Gamma 1x1x1; initial moments (1/sqrt(2),1/sqrt(2),0) muB per atom.
Full SCF uses scf_thr=1e-7, scf_nmax=50, Pulay 0.4 and mixing_gg0=3; no DeltaSpin.
References are complete raw 16x16 complex matrices with only R=0 and finite y magnetization.
Repeated local GNU/Intel runs pass the unchanged matrix comparator; the unfixed parent fails H.
These compact parameters test the assembly regression rather than material-property convergence.
22 changes: 22 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ATOMIC_SPECIES
O 15.999 O_ONCV_PBE_FR-1.0.upf

NUMERICAL_ORBITAL
O_gga_6au_60Ry_1s1p.orb

LATTICE_CONSTANT
18

LATTICE_VECTORS
1 0 0
0 1 0
0 0 1

ATOMIC_POSITIONS
Direct

O
0.0
2
0.5 0.5 0.43611111111111112 0 0 0 mag 0.7071067811865475 0.7071067811865475 0
0.5 0.5 0.56388888888888888 0 0 0 mag 0.7071067811865475 0.7071067811865475 0
56 changes: 56 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/hrs1_nao.csr.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
--- Ionic Step 1 ---
# print H matrix in real space H(R)
1 # number of spin directions
1 # spin index, E_Fermi = -6.68506 eV
16 # number of localized basis
1 # number of Bravais lattice vector R

user_defined_lattice
9.52519
1 0 0
0 1 0
0 0 1
O
2
Direct
0.5 0.5 0.436111111110222
0.5 0.5 0.563888888889778

#----------------------------------------------------------------------#
# CSR Format #
# The outer loop corresponds to the number of Bravais lattice vectors. #
# The first line contains the index of the Bravais lattice vector #
# (Rx, Ry, Rz), followed by the number of non-zero elements. #
# The subsequent lines consist of three blocks of data, which are #
# values, column indices, row pointers. #
#----------------------------------------------------------------------#

0 0 0 96
# CSR values
(-2.004383330761e+00,0.000000000000e+00) (-4.378766338937e-02,4.378766338938e-02) (-4.154791598051e-01,0.000000000000e+00) (9.594409771163e-04,-9.594409771162e-04) (-1.004647828998e+00,0.000000000000e+00) (-8.828573496782e-03,8.828573496782e-03)
(1.093397372134e+00,0.000000000000e+00) (9.833707841451e-03,-9.833707841451e-03) (-4.378766338937e-02,-4.378766338938e-02) (-2.004383330761e+00,0.000000000000e+00) (9.594409771163e-04,9.594409771162e-04) (-4.154791598051e-01,0.000000000000e+00)
(-8.828573496782e-03,-8.828573496782e-03) (-1.004647828998e+00,0.000000000000e+00) (9.833707841451e-03,9.833707841451e-03) (1.093397372134e+00,0.000000000000e+00) (-4.154791598051e-01,0.000000000000e+00) (9.594409771163e-04,-9.594409771162e-04)
(-1.157395052414e+00,0.000000000000e+00) (-1.903117650352e-02,1.903117650352e-02) (-1.093397372134e+00,0.000000000000e+00) (-9.833707841514e-03,9.833707841515e-03) (8.102031397564e-01,0.000000000000e+00) (1.899269201656e-03,-1.899269201656e-03)
(9.594409771163e-04,9.594409771162e-04) (-4.154791598051e-01,0.000000000000e+00) (-1.903117650352e-02,-1.903117650352e-02) (-1.157395052414e+00,0.000000000000e+00) (-9.833707841514e-03,-9.833707841515e-03) (-1.093397372134e+00,0.000000000000e+00)
(1.899269201656e-03,1.899269201656e-03) (8.102031397564e-01,0.000000000000e+00) (-7.974273329164e-01,0.000000000000e+00) (-5.630637244357e-02,5.630637244358e-02) (-4.148020119102e-01,0.000000000000e+00) (-6.023892705908e-03,6.023892705908e-03)
(-5.630637244357e-02,-5.630637244358e-02) (-7.974273329164e-01,0.000000000000e+00) (-6.023892705908e-03,-6.023892705908e-03) (-4.148020119102e-01,0.000000000000e+00) (-7.974273329164e-01,0.000000000000e+00) (-5.630637244357e-02,5.630637244358e-02)
(-4.148020119102e-01,0.000000000000e+00) (-6.023892705908e-03,6.023892705908e-03) (-5.630637244357e-02,-5.630637244358e-02) (-7.974273329164e-01,0.000000000000e+00) (-6.023892705908e-03,-6.023892705908e-03) (-4.148020119102e-01,0.000000000000e+00)
(-1.004647828998e+00,0.000000000000e+00) (-8.828573496782e-03,8.828573496782e-03) (-1.093397372134e+00,0.000000000000e+00) (-9.833707841514e-03,9.833707841515e-03) (-2.004383330761e+00,0.000000000000e+00) (-4.378766338969e-02,4.378766338969e-02)
(4.154791598051e-01,0.000000000000e+00) (-9.594409771072e-04,9.594409771072e-04) (-8.828573496782e-03,-8.828573496782e-03) (-1.004647828998e+00,0.000000000000e+00) (-9.833707841514e-03,-9.833707841515e-03) (-1.093397372134e+00,0.000000000000e+00)
(-4.378766338969e-02,-4.378766338969e-02) (-2.004383330761e+00,0.000000000000e+00) (-9.594409771072e-04,-9.594409771072e-04) (4.154791598051e-01,0.000000000000e+00) (1.093397372134e+00,0.000000000000e+00) (9.833707841451e-03,-9.833707841451e-03)
(8.102031397564e-01,0.000000000000e+00) (1.899269201656e-03,-1.899269201656e-03) (4.154791598051e-01,0.000000000000e+00) (-9.594409771072e-04,9.594409771072e-04) (-1.157395052414e+00,0.000000000000e+00) (-1.903117650366e-02,1.903117650366e-02)
(9.833707841451e-03,9.833707841451e-03) (1.093397372134e+00,0.000000000000e+00) (1.899269201656e-03,1.899269201656e-03) (8.102031397564e-01,0.000000000000e+00) (-9.594409771072e-04,-9.594409771072e-04) (4.154791598051e-01,0.000000000000e+00)
(-1.903117650366e-02,-1.903117650366e-02) (-1.157395052414e+00,0.000000000000e+00) (-4.148020119102e-01,0.000000000000e+00) (-6.023892705908e-03,6.023892705908e-03) (-7.974273329162e-01,0.000000000000e+00) (-5.630637244396e-02,5.630637244396e-02)
(-6.023892705908e-03,-6.023892705908e-03) (-4.148020119102e-01,0.000000000000e+00) (-5.630637244396e-02,-5.630637244396e-02) (-7.974273329162e-01,0.000000000000e+00) (-4.148020119102e-01,0.000000000000e+00) (-6.023892705908e-03,6.023892705908e-03)
(-7.974273329162e-01,0.000000000000e+00) (-5.630637244396e-02,5.630637244396e-02) (-6.023892705908e-03,-6.023892705908e-03) (-4.148020119102e-01,0.000000000000e+00) (-5.630637244396e-02,-5.630637244396e-02) (-7.974273329162e-01,0.000000000000e+00)
# CSR column indices
0 1 2 3 8 9 10 11 0 1 2 3 8 9 10 11
0 1 2 3 8 9 10 11 0 1 2 3 8 9 10 11
4 5 12 13 4 5 12 13 6 7 14 15 6 7 14 15
0 1 2 3 8 9 10 11 0 1 2 3 8 9 10 11
0 1 2 3 8 9 10 11 0 1 2 3 8 9 10 11
4 5 12 13 4 5 12 13 6 7 14 15 6 7 14 15
# CSR row pointers
0 8 16 24 32 36 40 44 48 56 64 72 80 84 88 92
96

5 changes: 5 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/result.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
etotref -861.8592868019903
etotperatomref -430.9296434010
CompareHR_pass 0
CompareSR_pass 0
totaltimeref 1.52
44 changes: 44 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_nsoc_hr/sr_nao.csr.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--- Ionic Step 1 ---
# print S matrix in real space S(R)
1 # number of spin directions
1 # spin index
16 # number of localized basis
1 # number of Bravais lattice vector R

user_defined_lattice
9.52519
1 0 0
0 1 0
0 0 1
O
2
Direct
0.5 0.5 0.436111111110222
0.5 0.5 0.563888888889778

#----------------------------------------------------------------------#
# CSR Format #
# The outer loop corresponds to the number of Bravais lattice vectors. #
# The first line contains the index of the Bravais lattice vector #
# (Rx, Ry, Rz), followed by the number of non-zero elements. #
# The subsequent lines consist of three blocks of data, which are #
# values, column indices, row pointers. #
#----------------------------------------------------------------------#

0 0 0 40
# CSR values
(1.000000000000e+00,0.000000000000e+00) (3.122772551440e-01,0.000000000000e+00) (-3.769119232454e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (3.122772551440e-01,0.000000000000e+00) (-3.769119232454e-01,0.000000000000e+00)
(1.000000000000e+00,0.000000000000e+00) (3.769119232454e-01,0.000000000000e+00) (-2.556149750289e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (3.769119232454e-01,0.000000000000e+00) (-2.556149750289e-01,0.000000000000e+00)
(1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00)
(1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (3.122772551440e-01,0.000000000000e+00) (3.769119232454e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (3.122772551440e-01,0.000000000000e+00)
(3.769119232454e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (-3.769119232454e-01,0.000000000000e+00) (-2.556149750289e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (-3.769119232454e-01,0.000000000000e+00)
(-2.556149750289e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00)
(2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00) (2.212660810968e-01,0.000000000000e+00) (1.000000000000e+00,0.000000000000e+00)
# CSR column indices
0 8 10 1 9 11 2 8 10 3 9 11 4 12 5 13
6 14 7 15 0 2 8 1 3 9 0 2 10 1 3 11
4 12 5 13 6 14 7 15
# CSR row pointers
0 3 6 9 12 14 16 18 20 23 26 29 32 34 36 38
40

22 changes: 22 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_soc_hr/INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
INPUT_PARAMETERS
suffix autotest
calculation scf
symmetry 0
pseudo_dir ../../PP_ORB
orbital_dir ../../PP_ORB
gamma_only 0
ecutwfc 15
scf_thr 1e-7
scf_nmax 50
noncolin 1
nspin 4
lspinorb 1
basis_type lcao
ks_solver scalapack_gvx
dft_functional pbe
smearing_method gauss
smearing_sigma 0.02
mixing_type pulay
mixing_beta 0.4
mixing_gg0 3.0
out_hsr 1 12
4 changes: 4 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_soc_hr/KPT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
K_POINTS
0
Gamma
1 1 1 0 0 0
7 changes: 7 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_soc_hr/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Self-consistent nspin=4 O2 H(R)/S(R) regression, with SOC.
O-O distance 2.3 bohr in an 18-bohr cubic cell; existing O FR PP and minimal 6-bohr 1s1p orbitals.
PBE/LCAO, 15 Ry, Gamma 1x1x1; initial moments (1/sqrt(2),1/sqrt(2),0) muB per atom.
Full SCF uses scf_thr=1e-7, scf_nmax=50, Pulay 0.4 and mixing_gg0=3; no DeltaSpin.
References are complete raw 16x16 complex matrices with only R=0 and finite y magnetization.
Repeated local GNU/Intel runs pass the unchanged matrix comparator; the unfixed parent fails H.
These compact parameters test the assembly regression rather than material-property convergence.
22 changes: 22 additions & 0 deletions tests/03_NAO_multik/scf_nspin4_soc_hr/STRU
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ATOMIC_SPECIES
O 15.999 O_ONCV_PBE_FR-1.0.upf

NUMERICAL_ORBITAL
O_gga_6au_60Ry_1s1p.orb

LATTICE_CONSTANT
18

LATTICE_VECTORS
1 0 0
0 1 0
0 0 1

ATOMIC_POSITIONS
Direct

O
0.0
2
0.5 0.5 0.43611111111111112 0 0 0 mag 0.7071067811865475 0.7071067811865475 0
0.5 0.5 0.56388888888888888 0 0 0 mag 0.7071067811865475 0.7071067811865475 0
Loading
Loading