TB2J 0.9.4rc0__py3-none-any.whl → 0.9.6rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- TB2J/MAE.py +108 -24
- TB2J/anisotropy.py +672 -0
- TB2J/contour.py +8 -0
- TB2J/exchange.py +43 -103
- TB2J/exchangeCL2.py +11 -13
- TB2J/exchange_params.py +213 -0
- TB2J/green.py +62 -27
- TB2J/interfaces/__init__.py +12 -0
- TB2J/interfaces/abacus/__init__.py +4 -0
- TB2J/{abacus → interfaces/abacus}/abacus_api.py +3 -3
- TB2J/{abacus → interfaces/abacus}/abacus_wrapper.py +11 -7
- TB2J/{abacus → interfaces/abacus}/gen_exchange_abacus.py +6 -3
- TB2J/{abacus → interfaces/abacus}/orbital_api.py +4 -4
- TB2J/{abacus → interfaces/abacus}/stru_api.py +11 -11
- TB2J/{abacus → interfaces/abacus}/test_read_HRSR.py +0 -1
- TB2J/{abacus → interfaces/abacus}/test_read_stru.py +5 -3
- TB2J/interfaces/gpaw_interface.py +54 -0
- TB2J/interfaces/lawaf_interface.py +129 -0
- TB2J/interfaces/manager.py +23 -0
- TB2J/interfaces/siesta_interface.py +174 -0
- TB2J/interfaces/wannier90_interface.py +115 -0
- TB2J/io_exchange/io_exchange.py +21 -7
- TB2J/io_merge.py +2 -1
- TB2J/mathutils/fermi.py +11 -6
- TB2J/mathutils/lowdin.py +12 -2
- TB2J/mathutils/rotate_spin.py +222 -4
- TB2J/pauli.py +38 -2
- TB2J/symmetrize_J.py +120 -0
- TB2J/utils.py +82 -1
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/abacus2J.py +5 -4
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/siesta2J.py +21 -4
- TB2J-0.9.6rc0.data/scripts/wann2J.py +96 -0
- {TB2J-0.9.4rc0.dist-info → TB2J-0.9.6rc0.dist-info}/METADATA +4 -3
- {TB2J-0.9.4rc0.dist-info → TB2J-0.9.6rc0.dist-info}/RECORD +46 -46
- {TB2J-0.9.4rc0.dist-info → TB2J-0.9.6rc0.dist-info}/WHEEL +1 -1
- TB2J-0.9.6rc0.dist-info/entry_points.txt +3 -0
- TB2J/abacus/MAE.py +0 -320
- TB2J/abacus/__init__.py +0 -1
- TB2J/abacus/occupations.py +0 -278
- TB2J/cut_cell.py +0 -82
- TB2J/io_exchange/io_pickle.py +0 -0
- TB2J/manager.py +0 -441
- TB2J/mathutils.py +0 -12
- TB2J/patch.py +0 -50
- TB2J/spinham/h_matrix.py +0 -68
- TB2J/spinham/obtain_J.py +0 -79
- TB2J/supercell.py +0 -532
- TB2J-0.9.4rc0.data/scripts/wann2J.py +0 -194
- TB2J/{abacus → interfaces/abacus}/test_density_matrix.py +1 -1
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_downfold.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_eigen.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_magnon.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_magnon_dos.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_merge.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_rotate.py +0 -0
- {TB2J-0.9.4rc0.data → TB2J-0.9.6rc0.data}/scripts/TB2J_rotateDM.py +0 -0
- {TB2J-0.9.4rc0.dist-info → TB2J-0.9.6rc0.dist-info}/LICENSE +0 -0
- {TB2J-0.9.4rc0.dist-info → TB2J-0.9.6rc0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,9 @@
|
|
1
1
|
#!python
|
2
|
-
from TB2J.manager import gen_exchange_siesta
|
3
|
-
from TB2J.versioninfo import print_license
|
4
|
-
import sys
|
5
2
|
import argparse
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from TB2J.interfaces import gen_exchange_siesta
|
6
|
+
from TB2J.versioninfo import print_license
|
6
7
|
|
7
8
|
|
8
9
|
def run_siesta2J():
|
@@ -107,6 +108,20 @@ def run_siesta2J():
|
|
107
108
|
default="TB2J_results",
|
108
109
|
)
|
109
110
|
|
111
|
+
parser.add_argument(
|
112
|
+
"--split_soc",
|
113
|
+
help="whether the SOC part of the Hamiltonian can be read from the output of siesta. Default: False",
|
114
|
+
action="store_true",
|
115
|
+
default=False,
|
116
|
+
)
|
117
|
+
|
118
|
+
parser.add_argument(
|
119
|
+
"--orth",
|
120
|
+
help="whether to use orthogonalization before the diagonization of the electron Hamiltonian. Default: False",
|
121
|
+
action="store_true",
|
122
|
+
default=False,
|
123
|
+
)
|
124
|
+
|
110
125
|
args = parser.parse_args()
|
111
126
|
|
112
127
|
if args.elements is None:
|
@@ -134,9 +149,11 @@ def run_siesta2J():
|
|
134
149
|
description=args.description,
|
135
150
|
output_path=args.output_path,
|
136
151
|
use_cache=args.use_cache,
|
137
|
-
|
152
|
+
nproc=args.np,
|
138
153
|
exclude_orbs=args.exclude_orbs,
|
139
154
|
orb_decomposition=args.orb_decomposition,
|
155
|
+
read_H_soc=args.split_soc,
|
156
|
+
orth=args.orth,
|
140
157
|
)
|
141
158
|
|
142
159
|
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#!python
|
2
|
+
import argparse
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from TB2J.exchange_params import add_exchange_args_to_parser
|
6
|
+
from TB2J.interfaces import gen_exchange
|
7
|
+
from TB2J.versioninfo import print_license
|
8
|
+
|
9
|
+
|
10
|
+
def run_wann2J():
|
11
|
+
print_license()
|
12
|
+
parser = argparse.ArgumentParser(
|
13
|
+
description="wann2J: Using magnetic force theorem to calculate exchange parameter J from wannier functions"
|
14
|
+
)
|
15
|
+
parser.add_argument(
|
16
|
+
"--path", help="path to the wannier files", default="./", type=str
|
17
|
+
)
|
18
|
+
parser.add_argument(
|
19
|
+
"--posfile", help="name of the position file", default="POSCAR", type=str
|
20
|
+
)
|
21
|
+
parser.add_argument(
|
22
|
+
"--prefix_spinor",
|
23
|
+
help="prefix to the spinor wannier files",
|
24
|
+
default="wannier90",
|
25
|
+
type=str,
|
26
|
+
)
|
27
|
+
parser.add_argument(
|
28
|
+
"--prefix_up",
|
29
|
+
help="prefix to the spin up wannier files",
|
30
|
+
default="wannier90.up",
|
31
|
+
type=str,
|
32
|
+
)
|
33
|
+
parser.add_argument(
|
34
|
+
"--prefix_down",
|
35
|
+
help="prefix to the spin down wannier files",
|
36
|
+
default="wannier90.dn",
|
37
|
+
type=str,
|
38
|
+
)
|
39
|
+
parser.add_argument(
|
40
|
+
"--groupby",
|
41
|
+
help="In the spinor case, the order of the orbitals have two conventions: 1: group by spin (orb1_up, orb2_up,... orb1_down, ...), 2,group by orbital (orb1_up, orb1_down, orb2_up, ...,). Use 'spin' in the former case and 'orbital' in the latter case. The default is spin.",
|
42
|
+
default="spin",
|
43
|
+
type=str,
|
44
|
+
)
|
45
|
+
parser.add_argument(
|
46
|
+
"--wannier_type",
|
47
|
+
help="The type of Wannier function, either Wannier90 or banddownfolder",
|
48
|
+
type=str,
|
49
|
+
default="Wannier90",
|
50
|
+
)
|
51
|
+
|
52
|
+
# parser.add_argument("--qspace",
|
53
|
+
# action="store_true",
|
54
|
+
# help="Whether to calculate J in qspace first and transform to real space.",
|
55
|
+
# default=False)
|
56
|
+
|
57
|
+
add_exchange_args_to_parser(parser)
|
58
|
+
|
59
|
+
args = parser.parse_args()
|
60
|
+
|
61
|
+
if args.efermi is None:
|
62
|
+
print("Please input fermi energy using --efermi ")
|
63
|
+
sys.exit()
|
64
|
+
if args.elements is None:
|
65
|
+
print("Please input the magnetic elements, e.g. --elements Fe Ni")
|
66
|
+
sys.exit()
|
67
|
+
|
68
|
+
gen_exchange(
|
69
|
+
path=args.path,
|
70
|
+
colinear=(not args.spinor),
|
71
|
+
groupby=args.groupby,
|
72
|
+
posfile=args.posfile,
|
73
|
+
efermi=args.efermi,
|
74
|
+
kmesh=args.kmesh,
|
75
|
+
magnetic_elements=args.elements,
|
76
|
+
Rcut=args.rcut,
|
77
|
+
prefix_SOC=args.prefix_spinor,
|
78
|
+
prefix_up=args.prefix_up,
|
79
|
+
prefix_dn=args.prefix_down,
|
80
|
+
emin=args.emin,
|
81
|
+
emax=args.emax,
|
82
|
+
nz=args.nz,
|
83
|
+
use_cache=args.use_cache,
|
84
|
+
nproc=args.np,
|
85
|
+
description=args.description,
|
86
|
+
output_path=args.output_path,
|
87
|
+
exclude_orbs=args.exclude_orbs,
|
88
|
+
wannier_type=args.wannier_type,
|
89
|
+
# qspace=args.qspace,
|
90
|
+
write_density_matrix=args.write_dm,
|
91
|
+
orb_decomposition=args.orb_decomposition,
|
92
|
+
)
|
93
|
+
|
94
|
+
|
95
|
+
if __name__ == "__main__":
|
96
|
+
run_wann2J()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: TB2J
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.6rc0
|
4
4
|
Summary: TB2J: First principle to Heisenberg exchange J using tight-binding Green function method
|
5
5
|
Author: Xu He
|
6
6
|
Author-email: mailhexu@gmail.com
|
@@ -14,14 +14,15 @@ Classifier: Topic :: Scientific/Engineering :: Physics
|
|
14
14
|
Classifier: License :: OSI Approved :: BSD License
|
15
15
|
Requires-Python: >=3.6
|
16
16
|
License-File: LICENSE
|
17
|
-
Requires-Dist: numpy
|
17
|
+
Requires-Dist: numpy <2.0
|
18
18
|
Requires-Dist: scipy
|
19
19
|
Requires-Dist: matplotlib
|
20
20
|
Requires-Dist: ase >=3.19
|
21
21
|
Requires-Dist: tqdm
|
22
22
|
Requires-Dist: pathos
|
23
23
|
Requires-Dist: packaging >=20.0
|
24
|
+
Requires-Dist: HamiltonIO >=0.1.7
|
24
25
|
Requires-Dist: pre-commit
|
25
|
-
Requires-Dist:
|
26
|
+
Requires-Dist: sympair >0.1.0
|
26
27
|
|
27
28
|
TB2J is a Python package aimed to compute automatically the magnetic interactions (superexchange and Dzyaloshinskii-Moriya) between atoms of magnetic crystals from DFT Hamiltonian based on Wannier functions or Linear combination of atomic orbitals. It uses the Green's function method and take the local rigid spin rotation as a perturbation. The package can take the output from Wannier90, which is interfaced with many density functional theory codes or from codes based on localised orbitals. A minimal user input is needed, which allows for an easily integration into a high-throughput workflows.
|
@@ -1,73 +1,72 @@
|
|
1
1
|
TB2J/Jdownfolder.py,sha256=Rmg6KfQ-Lkhei5daTJ2POzr0XL-R1WM-rzUnDcfoDhc,9595
|
2
2
|
TB2J/Jtensor.py,sha256=t6OsqrSlYW6Im4H7ykVAW8Al_pFXN4C5yj2UEsV6r7g,3181
|
3
|
-
TB2J/MAE.py,sha256=
|
3
|
+
TB2J/MAE.py,sha256=ugyQ2fwp1c8I8LYjCkoMjHZ9KEscSxmA52VkU-ESj2c,10279
|
4
4
|
TB2J/Oiju.py,sha256=cNGv8N5uH_swGq7cnAt2OyiDfqtjLlLrwseGu0E4iaM,3383
|
5
5
|
TB2J/Oiju_epc.py,sha256=oytM3NYW7nWmklrGgNlqwIpI_JYv_hb7ZnR4o9nYNog,6809
|
6
6
|
TB2J/__init__.py,sha256=hcEWkag_UvLm1ZSbjsgcTWkGVlR3Bwmzg1QYAwsvf-g,24
|
7
|
+
TB2J/anisotropy.py,sha256=zz4ID6_Yjf5gxPJt1psc6liNKhTG8X5AtHdpq0dCEzM,22616
|
7
8
|
TB2J/basis.py,sha256=DFo6_QUwjBwisP6zGxvoO0lpGTMDPAOkiL9giNCjOjA,1558
|
8
9
|
TB2J/citation.py,sha256=gcQeyJZaT1Qrtsl8Y3s4neOH3-vvgmIcCvXeV2o3vj0,2891
|
9
|
-
TB2J/contour.py,sha256=
|
10
|
-
TB2J/cut_cell.py,sha256=kr9WeQhBQLm8QXL2B3NcsSYmSw-OAtJk3f9wksAOZbs,2952
|
10
|
+
TB2J/contour.py,sha256=4wFZSPV81WwuUrvn1MENMnP-cW5ICDy8azOdTO8HJdw,2877
|
11
11
|
TB2J/density_matrix.py,sha256=D5k8Oe21OCiLVORNYbo4TZOFG0slrQSbj91kJ3TMFjs,1514
|
12
12
|
TB2J/epc.py,sha256=zLbtqZJhDr8DnnGN6YENcXwrMb3Qxu6KB08mLy9Pw20,3474
|
13
|
-
TB2J/exchange.py,sha256=
|
14
|
-
TB2J/exchangeCL2.py,sha256=
|
13
|
+
TB2J/exchange.py,sha256=DRu01Ki6ykQPQ0QXXHACDXSMyVnN4-Ldk99ZjEXeef4,28393
|
14
|
+
TB2J/exchangeCL2.py,sha256=vJgVBpvtTE2K7Xf7hGQNc3C87VvVXTa689Qd5827ItE,11165
|
15
|
+
TB2J/exchange_params.py,sha256=zhOPyvgngPXlYbZ8TUEFXIpYak3MPh3Lh24m8WWWgnU,5846
|
15
16
|
TB2J/exchange_pert.py,sha256=jmFMtQbYa_uczM4VAeS6TijkIHRFIqEzZJswzE9Wfuo,8523
|
16
17
|
TB2J/exchange_qspace.py,sha256=ZL68qBGFUaQ9BsSPsJaaoWOr9RssPiqX34R_9I3nk_8,8436
|
17
18
|
TB2J/gpaw_wrapper.py,sha256=aJ--9Dtyq7jOP1Hkh-Sh1nWcfXm6zKcljOCO0DNCAr0,6890
|
18
|
-
TB2J/green.py,sha256=
|
19
|
+
TB2J/green.py,sha256=J83mAO-wEMlNckS-s4kj4TFWVm_4PQ622dRhk-UEQQ8,14722
|
19
20
|
TB2J/greentest.py,sha256=2ISSfhor9ecSEOi_E6b4Cv26wEIQlwlzca0ru8z44_E,1603
|
20
|
-
TB2J/io_merge.py,sha256=
|
21
|
+
TB2J/io_merge.py,sha256=E1_GfAB2HGpW-ipaO2lqU9SvaslwkiLxssn4DqJpMT8,6899
|
21
22
|
TB2J/kpoints.py,sha256=6XK2KqTncidEq3o9GuO6VEZRPNTRtWeXg9QfcV-9smI,532
|
22
|
-
TB2J/manager.py,sha256=UhFmfbeqo1dwHDbQVtHgQCbH6ax1oCIEabhlrLjD1GA,15701
|
23
|
-
TB2J/mathutils.py,sha256=tHA6q3KPDpXLIbZHdDZ2NU5s886VVM_oEG490zQ6Ris,300
|
24
23
|
TB2J/myTB.py,sha256=ok_B4my29bOIghMSZfx0Es6G8FaXaIiLP4gPxTdSj00,17659
|
25
24
|
TB2J/orbmap.py,sha256=RCMJkOPGbfPrcZzcc5ia1ZMKBQWxGcyj8W1ve8BJaEw,6669
|
26
|
-
TB2J/
|
27
|
-
TB2J/pauli.py,sha256=zOELm7Vgxw6SMaO5l7qVWx1pBKZt25RLnEpnVM3dz_0,4545
|
25
|
+
TB2J/pauli.py,sha256=ESpAhk6LG5ugzuW1YFUTqiDxcg-pQ7wNnzR2FtUnvKM,5295
|
28
26
|
TB2J/pert.py,sha256=RaCJfewl0doht4cjAnzzGKe-uj2le4aqe0iPKFrq9fo,1192
|
29
27
|
TB2J/plot.py,sha256=AnFIFWE2vlmj7Z6f_7-dX_O1stJN-qbuiurPj43dUCM,4104
|
30
28
|
TB2J/rotate_atoms.py,sha256=Dwptn-wdDW4zYzjYb95yxTzuZOe9WPuLjh3d3-YcSs0,3277
|
31
29
|
TB2J/rotate_siestaDM.py,sha256=eR97rspdrRaK9YTwQwUKfobI0S9UnEcbEZ2f5IgR7Tk,1070
|
32
30
|
TB2J/sisl_wrapper.py,sha256=A5x1-tt8efUSPeGY5wM5m6-pJYQFXTCzQHVqD6RBa2g,14792
|
33
|
-
TB2J/
|
31
|
+
TB2J/symmetrize_J.py,sha256=2wME5qaPvAfKzaPSefLeXlGvt6AfWzhaCk3N3FDdg2w,3810
|
34
32
|
TB2J/tensor_rotate.py,sha256=4-DfT_Mg5e40fbd74M5W0D5DqmUq-kVOOLDkkkI834A,8083
|
35
33
|
TB2J/utest.py,sha256=z_ahi7tpHQF9WlHNQihcQ7qzfezRJQXQt28eB1X_z64,3897
|
36
|
-
TB2J/utils.py,sha256=
|
34
|
+
TB2J/utils.py,sha256=DHkc7BK0KUGesfoAv1OxMgIw_iZzcFXh--3ybsFSd_c,12535
|
37
35
|
TB2J/versioninfo.py,sha256=wZwS9QDFRVDe7rf8JyPDDI8UGdTQiO6Pb_sWv8GAegA,337
|
38
|
-
TB2J/abacus/MAE.py,sha256=q9aSVDRZFAnZL3gHdNmde7sxj80oe-BRjwDO-ipyfew,12237
|
39
|
-
TB2J/abacus/__init__.py,sha256=5sHiDnF2L-Y80QeET9zOiS83a5T_TQAXvnIhcYB6wNU,56
|
40
|
-
TB2J/abacus/abacus_api.py,sha256=D_NyXW-Pno92d3RVHByx0l1HDPHQAvXsmQVt8cfIGR8,7267
|
41
|
-
TB2J/abacus/abacus_wrapper.py,sha256=aKMpcoMMhBnMW6feTOsleEOCN2cPLBkjzVjNG0yPTDk,12054
|
42
|
-
TB2J/abacus/gen_exchange_abacus.py,sha256=lKZqkWMnLQtaSwgn8O5Fzr-pV6tzwoMqfZU_vbET6gU,2973
|
43
|
-
TB2J/abacus/occupations.py,sha256=vaMVeZwldgzGDxjA7i3-2-V6akXjpgJwJFWKozJ-l2k,8947
|
44
|
-
TB2J/abacus/orbital_api.py,sha256=l48Hn5z7TA0TH7Is4NDmz74b6B9L2ztYO4dRR37U4mQ,1562
|
45
|
-
TB2J/abacus/stru_api.py,sha256=aBKKlZ2hvAZChVCfNxRdxH51rfHKqZn6kOlazY-yW8k,67888
|
46
|
-
TB2J/abacus/test_density_matrix.py,sha256=f0xHOTzIssT-XTvBJrQHU0JVbvBYOE1Mduh-j7qiLO8,774
|
47
|
-
TB2J/abacus/test_read_HRSR.py,sha256=cAT-e79jGjCBXLTJ9UYX0WvalG_yD4Awl79tTOUcwaQ,1254
|
48
|
-
TB2J/abacus/test_read_stru.py,sha256=CpK4zWhlCVAMCmYQmp9Hy-A40OblZQLFpo5JokpNcWQ,785
|
49
36
|
TB2J/external/__init__.py,sha256=yD_ZIMi76H49rj6GAQpiB7UlKa3TgSaMkkLHT6M-8w8,137
|
50
37
|
TB2J/external/p_tqdm.py,sha256=ug1jy3-43r8iW7bC37xzPSIe0EjYKH_GUluGzMiQiDw,5831
|
38
|
+
TB2J/interfaces/__init__.py,sha256=4tiLoXQ73Nlyi9L4j8jJXOYzXluVNPxQZkwfkQZEGHg,307
|
39
|
+
TB2J/interfaces/gpaw_interface.py,sha256=GCDlJ-hRWfChvWwsgBDYSmVqO4sH9HAuGZTV9GqgN6c,1504
|
40
|
+
TB2J/interfaces/lawaf_interface.py,sha256=PieLnmppdafOYsgeHznqOou1g9L1sam5jOm3KaObdqo,4408
|
41
|
+
TB2J/interfaces/manager.py,sha256=PQMLEfMCT5GnDWSl2nI4JOgRPm_fysyR-6Y6l97xWcw,860
|
42
|
+
TB2J/interfaces/siesta_interface.py,sha256=fGuRZOZsFZgytxxZrlhZ-gPDQ6-LjNplbGUCH1x7T2o,6171
|
43
|
+
TB2J/interfaces/wannier90_interface.py,sha256=qzRgXUBb7t1Aiegrl_RV51BB8csdtVM0EP0Z4pjmTcs,4467
|
44
|
+
TB2J/interfaces/abacus/__init__.py,sha256=leas71oCvM_HxrF4gnO5A_VKcJmDAgsI1BUctLU3OBw,177
|
45
|
+
TB2J/interfaces/abacus/abacus_api.py,sha256=lNV4LNkLcKw7Zux4MQYM9wnh3eFTlcSqbf4Pb7pqhrk,7243
|
46
|
+
TB2J/interfaces/abacus/abacus_wrapper.py,sha256=LyfbiuzsE4NiPIw3GOuZDezxi7CSmLvaYWyn3doV8jQ,12015
|
47
|
+
TB2J/interfaces/abacus/gen_exchange_abacus.py,sha256=U4s1wC_M2h0MJxlCbs92Ue8AHdMXfc6AK9BB5FjdIwU,3008
|
48
|
+
TB2J/interfaces/abacus/orbital_api.py,sha256=9_t89bWptSw0mI9IvmYXODerj0s5e9eiKMAp74YE0Sk,1495
|
49
|
+
TB2J/interfaces/abacus/stru_api.py,sha256=Ac03ikHRsZRXqTul4IUge7D2iG_xLh4_oyYfeP9tzGE,67881
|
50
|
+
TB2J/interfaces/abacus/test_density_matrix.py,sha256=bMWWJYtDS57SpPZ-eZXZ9Hr_UK4mv8ZHM7SzItG3IVA,774
|
51
|
+
TB2J/interfaces/abacus/test_read_HRSR.py,sha256=W1oO_yigT50Yb5_u-KB_IfTpM7kArGkBuMSMs0H4CTs,1235
|
52
|
+
TB2J/interfaces/abacus/test_read_stru.py,sha256=hoKPHVco8vwzC7Gao4bOPCdAPhh29x-9DTJJqRr7AYM,788
|
51
53
|
TB2J/io_exchange/__init__.py,sha256=KfGHum7B8E4G_KKfillqw0lErtoyKEuFUUttHLs-mg4,32
|
52
|
-
TB2J/io_exchange/io_exchange.py,sha256=
|
54
|
+
TB2J/io_exchange/io_exchange.py,sha256=ZeA8lpYUAQO1CqZnQL70IgS9TbAFyfPuadLGfKVf-Ms,19769
|
53
55
|
TB2J/io_exchange/io_multibinit.py,sha256=8PDmWxzGuv-GwJosj2ZTmiyNY_duFVWJ4ekCuSqGdd8,6739
|
54
|
-
TB2J/io_exchange/io_pickle.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
56
|
TB2J/io_exchange/io_tomsasd.py,sha256=NqkAC1Fl-CUnFA21eBzSy_S5F_oeQFJysw4UukQbN8o,4173
|
56
57
|
TB2J/io_exchange/io_txt.py,sha256=BMr1eSILlKpgtjvDx7uw2VMAkEKSvGEPNxpaT_zev0I,10547
|
57
58
|
TB2J/io_exchange/io_uppasd.py,sha256=bI4iPEgnK4TvCZNvb6x2xYXgjW7pEehCqmcizy2pqFU,3301
|
58
59
|
TB2J/io_exchange/io_vampire.py,sha256=UllC4twf06_q2vBCnAYFzEDGvS8mSefwQXDquBuyc0M,5583
|
59
60
|
TB2J/mathutils/__init__.py,sha256=tQLBfHkZqdVfVxPOahy42qMUkFYnFFFhM-uc4QsYFxI,27
|
60
|
-
TB2J/mathutils/fermi.py,sha256=
|
61
|
+
TB2J/mathutils/fermi.py,sha256=72tZ5CptGmYaBUD0xLWltuH7LBXcrMUwODyW6-WqlzI,638
|
61
62
|
TB2J/mathutils/kR_convert.py,sha256=p_9XWJVNanTzTK2rI6KRjTkbSq42la6N448-zJOsMwY,2671
|
62
|
-
TB2J/mathutils/lowdin.py,sha256=
|
63
|
-
TB2J/mathutils/rotate_spin.py,sha256=
|
63
|
+
TB2J/mathutils/lowdin.py,sha256=RYbm9OcnFnjcZFdC5YcNUsI9cOJmoDLsWSSCaP0GqKQ,499
|
64
|
+
TB2J/mathutils/rotate_spin.py,sha256=SfqadtkmoqkrD6lJ7tSCxfnv6QcEQ9_rE6Ee0gHONyk,8333
|
64
65
|
TB2J/spinham/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
65
66
|
TB2J/spinham/base_parser.py,sha256=oQRHvFE_BlUtTaTZykKgvicu40oXcbICB-D1aAt-qlA,2196
|
66
67
|
TB2J/spinham/constants.py,sha256=y4-hRyl5EAR42k24Oa5XhAsUQtKVn1MAgyqNf-p3PrM,762
|
67
|
-
TB2J/spinham/h_matrix.py,sha256=MfHIz6RViKkEB3Mu-WcwNx5uk7A5sjAlbqVG9wYA4xk,2784
|
68
68
|
TB2J/spinham/hamiltonian.py,sha256=OfsjlGIgFwpXaohopZcgPamSfjm3X46_zc245eyTr_A,16607
|
69
69
|
TB2J/spinham/hamiltonian_terms.py,sha256=7e84tfEjvAfZltUkrSWi1sUEiW_itLKy83lxi5iBpcQ,9714
|
70
|
-
TB2J/spinham/obtain_J.py,sha256=sg8tiCRRLEN57Olb3MHIuqkDhAkmu-w87AkM00ylXtA,2401
|
71
70
|
TB2J/spinham/plot.py,sha256=tLLNqFAATVrP1kmSVLPKzn686i-CUyqu4qgOcs-okHI,6599
|
72
71
|
TB2J/spinham/qsolver.py,sha256=Sr9I3aGfVNYn5wzwPx1QonHe6ZZUXBAujWRa7nTA5u4,4986
|
73
72
|
TB2J/spinham/spin_api.py,sha256=oN3AKg1WQl0YzR4f5ealcJOaVoAy8d7HodIwrbXvQeY,2219
|
@@ -76,18 +75,19 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
|
|
76
75
|
TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
|
77
76
|
TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
|
78
77
|
TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
|
79
|
-
TB2J-0.9.
|
80
|
-
TB2J-0.9.
|
81
|
-
TB2J-0.9.
|
82
|
-
TB2J-0.9.
|
83
|
-
TB2J-0.9.
|
84
|
-
TB2J-0.9.
|
85
|
-
TB2J-0.9.
|
86
|
-
TB2J-0.9.
|
87
|
-
TB2J-0.9.
|
88
|
-
TB2J-0.9.
|
89
|
-
TB2J-0.9.
|
90
|
-
TB2J-0.9.
|
91
|
-
TB2J-0.9.
|
92
|
-
TB2J-0.9.
|
93
|
-
TB2J-0.9.
|
78
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_downfold.py,sha256=i4BVqnpDdgrX_amookVWeLGefGBn-qeAutWiwuY9SfQ,2099
|
79
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
|
80
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
|
81
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
|
82
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
|
83
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
|
84
|
+
TB2J-0.9.6rc0.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
|
85
|
+
TB2J-0.9.6rc0.data/scripts/abacus2J.py,sha256=_Wiu0NekWKNZ1XVAEBNQOWTi8hE_KXg6iGxfHgcdKqI,4396
|
86
|
+
TB2J-0.9.6rc0.data/scripts/siesta2J.py,sha256=wQ9fbyiVyau7WwfusNvHxqBGfD_9_7GZmYZ6pqe6RaM,4806
|
87
|
+
TB2J-0.9.6rc0.data/scripts/wann2J.py,sha256=pTFDf6h72I_LN_NX5UivyCoJPgwvyAyHW175nSAJvLo,2987
|
88
|
+
TB2J-0.9.6rc0.dist-info/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
|
89
|
+
TB2J-0.9.6rc0.dist-info/METADATA,sha256=vf8jPKD-mmM9q2YWia9naugRicRN6UoqH81lD6DXkEw,1482
|
90
|
+
TB2J-0.9.6rc0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
91
|
+
TB2J-0.9.6rc0.dist-info/entry_points.txt,sha256=Hdz1WC9waUzyFVmowKnbbZ6j-J4adHh_Ko6JpxGYAtE,131
|
92
|
+
TB2J-0.9.6rc0.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
|
93
|
+
TB2J-0.9.6rc0.dist-info/RECORD,,
|
TB2J/abacus/MAE.py
DELETED
@@ -1,320 +0,0 @@
|
|
1
|
-
import numpy as np
|
2
|
-
from TB2J.abacus.abacus_wrapper import AbacusWrapper, AbacusParser
|
3
|
-
from TB2J.mathutils.rotate_spin import rotate_Matrix_from_z_to_axis
|
4
|
-
from TB2J.kpoints import monkhorst_pack
|
5
|
-
from TB2J.mathutils.fermi import fermi
|
6
|
-
from TB2J.mathutils.kR_convert import R_to_k
|
7
|
-
from scipy.linalg import eigh
|
8
|
-
from copy import deepcopy
|
9
|
-
from scipy.spatial.transform import Rotation
|
10
|
-
import matplotlib.pyplot as plt
|
11
|
-
from pathlib import Path
|
12
|
-
from TB2J.abacus.occupations import Occupations
|
13
|
-
|
14
|
-
# TODO List:
|
15
|
-
# - [x] Add the class AbacusSplitSOCWrapper
|
16
|
-
# - [x] Add the function to rotate the XC part
|
17
|
-
# - [x] Compute the band energy at arbitrary angle
|
18
|
-
|
19
|
-
|
20
|
-
def get_occupation(evals, kweights, nel, width=0.1):
|
21
|
-
occ = Occupations(nel=nel, width=width, wk=kweights, nspin=2)
|
22
|
-
return occ.occupy(evals)
|
23
|
-
|
24
|
-
|
25
|
-
def get_density_matrix(evals=None, evecs=None, kweights=None, nel=None, width=0.1):
|
26
|
-
occ = get_occupation(evals, kweights, nel, width=width)
|
27
|
-
rho = np.einsum("kib, kb, kjb -> kij", evecs, occ, evecs.conj())
|
28
|
-
return rho
|
29
|
-
|
30
|
-
|
31
|
-
def spherical_to_cartesian(theta, phi, normalize=True):
|
32
|
-
"""
|
33
|
-
Convert spherical coordinates to cartesian
|
34
|
-
"""
|
35
|
-
x = np.sin(theta) * np.cos(phi)
|
36
|
-
y = np.sin(theta) * np.sin(phi)
|
37
|
-
z = np.cos(theta)
|
38
|
-
vec = np.array([x, y, z])
|
39
|
-
if normalize:
|
40
|
-
vec = vec / np.linalg.norm(vec)
|
41
|
-
return vec
|
42
|
-
|
43
|
-
|
44
|
-
class AbacusSplitSOCWrapper(AbacusWrapper):
|
45
|
-
"""
|
46
|
-
Abacus wrapper with Hamiltonian split to SOC and non-SOC parts
|
47
|
-
"""
|
48
|
-
|
49
|
-
def __init__(self, *args, **kwargs):
|
50
|
-
HR_soc = kwargs.pop("HR_soc", None)
|
51
|
-
# nbasis = HR_soc.shape[1]
|
52
|
-
# kwargs["nbasis"] = nbasis
|
53
|
-
super().__init__(*args, **kwargs)
|
54
|
-
self._HR_copy = deepcopy(self._HR)
|
55
|
-
self.HR_soc = HR_soc
|
56
|
-
self.soc_lambda = 1.0
|
57
|
-
self.nel = 16
|
58
|
-
self.width = 0.1
|
59
|
-
|
60
|
-
@property
|
61
|
-
def HR(self):
|
62
|
-
return self._HR + self.HR_soc * self.soc_lambda
|
63
|
-
|
64
|
-
def rotate_HR_xc(self, axis):
|
65
|
-
"""
|
66
|
-
Rotate SOC part of Hamiltonian
|
67
|
-
"""
|
68
|
-
for iR, R in enumerate(self.Rlist):
|
69
|
-
self._HR[iR] = rotate_Matrix_from_z_to_axis(self._HR_copy[iR], axis)
|
70
|
-
|
71
|
-
def rotate_Hk_xc(self, axis):
|
72
|
-
"""
|
73
|
-
Rotate SOC part of Hamiltonian
|
74
|
-
"""
|
75
|
-
for ik in range(len(self._Hk)):
|
76
|
-
self._Hk[ik] = rotate_Matrix_from_z_to_axis(self._Hk_copy[ik], axis)
|
77
|
-
|
78
|
-
def get_density_matrix(self, kpts, kweights=None):
|
79
|
-
rho = np.zeros((len(kpts), self.nbasis, self.nbasis), dtype=complex)
|
80
|
-
evals, evecs = self.solve_all(kpts)
|
81
|
-
occ = get_occupation(evals, kweights, self.nel, width=self.width)
|
82
|
-
rho = np.einsum(
|
83
|
-
"kib, kb, kjb -> kij", evecs, occ, evecs.conj()
|
84
|
-
) # should multiply S to the the real DM.
|
85
|
-
return rho
|
86
|
-
|
87
|
-
def rotate_DM(self, rho, axis):
|
88
|
-
"""
|
89
|
-
Rotate the density matrix
|
90
|
-
"""
|
91
|
-
for ik in range(len(rho)):
|
92
|
-
rho[ik] = rotate_Matrix_from_z_to_axis(rho[ik], axis)
|
93
|
-
return rho
|
94
|
-
|
95
|
-
|
96
|
-
class RotateHam:
|
97
|
-
def __init__(self, model, kmesh, gamma=True):
|
98
|
-
self.model = model
|
99
|
-
self.kpts = monkhorst_pack(kmesh, gamma_center=gamma)
|
100
|
-
self.kweights = np.ones(len(self.kpts), dtype=float) / len(self.kpts)
|
101
|
-
|
102
|
-
def get_band_energy2(self):
|
103
|
-
for ik, kpt in enumerate(self.kpts):
|
104
|
-
Hk, Sk = self.model.gen_ham(kpt)
|
105
|
-
evals, evecs = eigh(Hk, Sk)
|
106
|
-
rho = np.einsum(
|
107
|
-
"ib, b, jb -> ij",
|
108
|
-
evecs,
|
109
|
-
fermi(evals, self.model.efermi, width=0.05),
|
110
|
-
evecs.conj(),
|
111
|
-
)
|
112
|
-
eband1 = np.sum(evals * fermi(evals, self.model.efermi, width=0.05))
|
113
|
-
eband2 = np.trace(Hk @ rho)
|
114
|
-
print(eband1, eband2)
|
115
|
-
|
116
|
-
def get_band_energy(self, dm=False):
|
117
|
-
evals, evecs = self.model.solve_all(self.kpts)
|
118
|
-
occ = get_occupation(
|
119
|
-
evals, self.kweights, self.model.nel, width=self.model.width
|
120
|
-
)
|
121
|
-
eband = np.sum(evals * occ * self.kweights[:, np.newaxis])
|
122
|
-
# * fermi(evals, self.model.efermi, width=0.05)
|
123
|
-
if dm:
|
124
|
-
density_matrix = self.model.get_density_matrix(evecs)
|
125
|
-
return eband, density_matrix
|
126
|
-
else:
|
127
|
-
return eband
|
128
|
-
|
129
|
-
def calc_ref(self):
|
130
|
-
# calculate the Hk_ref, Sk_ref, Hk_soc_ref, and rho_ref
|
131
|
-
self.Sk_ref = R_to_k(self.kpts, self.model.Rlist, self.model.SR)
|
132
|
-
self.Hk_xc_ref = R_to_k(self.kpts, self.model.Rlist, self.model._HR_copy)
|
133
|
-
self.Hk_soc_ref = R_to_k(self.kpts, self.model.Rlist, self.model.HR_soc)
|
134
|
-
self.rho_ref = np.zeros(
|
135
|
-
(len(self.kpts), self.model.nbasis, self.model.nbasis), dtype=complex
|
136
|
-
)
|
137
|
-
|
138
|
-
evals = np.zeros((len(self.kpts), self.model.nbasis), dtype=float)
|
139
|
-
evecs = np.zeros(
|
140
|
-
(len(self.kpts), self.model.nbasis, self.model.nbasis), dtype=complex
|
141
|
-
)
|
142
|
-
|
143
|
-
for ik, kpt in enumerate(self.kpts):
|
144
|
-
# evals, evecs = eigh(self.Hk_xc_ref[ik]+self.Hk_soc_ref[ik], self.Sk_ref[ik])
|
145
|
-
evals[ik], evecs[ik] = eigh(self.Hk_xc_ref[ik], self.Sk_ref[ik])
|
146
|
-
occ = get_occupation(
|
147
|
-
evals, self.kweights, self.model.nel, width=self.model.width
|
148
|
-
)
|
149
|
-
# occ = fermi(evals, self.model.efermi, width=self.model.width)
|
150
|
-
self.rho_ref = np.einsum("kib, kb, kjb -> kij", evecs, occ, evecs.conj())
|
151
|
-
|
152
|
-
def get_band_energy_from_rho(self, axis):
|
153
|
-
"""
|
154
|
-
This is wrong!! Should use second order perturbation theory to get the band energy instead.
|
155
|
-
"""
|
156
|
-
eband = 0.0
|
157
|
-
for ik, k in enumerate(self.kpts):
|
158
|
-
rho = rotate_Matrix_from_z_to_axis(self.rho_ref[ik], axis)
|
159
|
-
Hk_xc = rotate_Matrix_from_z_to_axis(self.Hk_xc_ref[ik], axis)
|
160
|
-
Hk_soc = self.Hk_soc_ref[ik]
|
161
|
-
Htot = Hk_xc + Hk_soc * self.model.soc_lambda
|
162
|
-
# Sk = self.Sk_ref[ik]
|
163
|
-
# evals, evecs = eigh(Htot, Sk)
|
164
|
-
# rho2= np.einsum("ib, b, jb -> ij", evecs, fermi(evals, self.model.efermi, width=0.05), evecs.conj())
|
165
|
-
if ik == 0 and False:
|
166
|
-
pass
|
167
|
-
# print(f"{evecs[:4,0:4].real=}")
|
168
|
-
# print(f"{evals[:4]=}")
|
169
|
-
# print(f"{Hk_xc[:4,0:4].real=}")
|
170
|
-
# print(f"{Htot[:4,0:4].real=}")
|
171
|
-
# print(f"{Sk[:4,0:4].real=}")
|
172
|
-
# print(f"{rho[:4,0:4].real=}")
|
173
|
-
# print(f"{rho2[:4,0:4].real=}")
|
174
|
-
# eband1 = np.sum(evals * fermi(evals, self.model.efermi, width=0.05))
|
175
|
-
# eband2 = np.trace(Htot @ rho2).real
|
176
|
-
# eband3 = np.trace(Htot @ rho).real
|
177
|
-
# print(eband1, eband2, eband3)
|
178
|
-
e_soc = np.trace(Hk_soc @ rho) * self.kweights[ik] * self.model.soc_lambda
|
179
|
-
eband += e_soc
|
180
|
-
return eband
|
181
|
-
|
182
|
-
def get_band_energy_vs_angles(
|
183
|
-
self,
|
184
|
-
thetas,
|
185
|
-
psis,
|
186
|
-
):
|
187
|
-
es = []
|
188
|
-
# es2 = []
|
189
|
-
# e,rho = self.model.get_band_energy(dm=True)
|
190
|
-
# self.calc_ref()
|
191
|
-
# thetas = np.linspace(*angle_range, npoints)
|
192
|
-
for i, theta, phi in enumerate(zip(thetas, psis)):
|
193
|
-
axis = spherical_to_cartesian(theta, phi)
|
194
|
-
self.model.rotate_HR_xc(axis)
|
195
|
-
# self.get_band_energy2()
|
196
|
-
e = self.get_band_energy()
|
197
|
-
es.append(e)
|
198
|
-
# es2.append(e2)
|
199
|
-
return es
|
200
|
-
|
201
|
-
|
202
|
-
def get_model_energy(model, kmesh, gamma=True):
|
203
|
-
ham = RotateHam(model, kmesh, gamma=gamma)
|
204
|
-
return ham.get_band_energy()
|
205
|
-
|
206
|
-
|
207
|
-
class AbacusSplitSOCParser:
|
208
|
-
"""
|
209
|
-
Abacus parser with Hamiltonian split to SOC and non-SOC parts
|
210
|
-
"""
|
211
|
-
|
212
|
-
def __init__(self, outpath_nosoc=None, outpath_soc=None, binary=False):
|
213
|
-
self.outpath_nosoc = outpath_nosoc
|
214
|
-
self.outpath_soc = outpath_soc
|
215
|
-
self.binary = binary
|
216
|
-
self.parser_nosoc = AbacusParser(outpath=outpath_nosoc, binary=binary)
|
217
|
-
self.parser_soc = AbacusParser(outpath=outpath_soc, binary=binary)
|
218
|
-
spin1 = self.parser_nosoc.read_spin()
|
219
|
-
spin2 = self.parser_soc.read_spin()
|
220
|
-
if spin1 != "noncollinear" or spin2 != "noncollinear":
|
221
|
-
raise ValueError("Spin should be noncollinear")
|
222
|
-
|
223
|
-
def parse(self):
|
224
|
-
nbasis, Rlist, HR, SR = self.parser_nosoc.Read_HSR_noncollinear()
|
225
|
-
nbasis2, Rlist2, HR2, SR2 = self.parser_soc.Read_HSR_noncollinear()
|
226
|
-
# print(HR[0])
|
227
|
-
HR_soc = HR2 - HR
|
228
|
-
model = AbacusSplitSOCWrapper(HR, SR, Rlist, nbasis, nspin=2, HR_soc=HR_soc)
|
229
|
-
model.efermi = self.parser_soc.efermi
|
230
|
-
model.basis = self.parser_nosoc.basis
|
231
|
-
model.atoms = self.parser_nosoc.atoms
|
232
|
-
return model
|
233
|
-
|
234
|
-
|
235
|
-
def abacus_get_MAE(
|
236
|
-
path_nosoc, path_soc, kmesh, thetas, psis, gamma=True, outfile="MAE.txt"
|
237
|
-
):
|
238
|
-
"""Get MAE from Abacus with magnetic force theorem. Two calculations are needed. First we do an calculation with SOC but the soc_lambda is set to 0. Save the density. The next calculatin we start with the density from the first calculation and set the SOC prefactor to 1. With the information from the two calcualtions, we can get the band energy with magnetic moments in the direction, specified in two list, thetas, and phis."""
|
239
|
-
parser = AbacusSplitSOCParser(
|
240
|
-
outpath_nosoc=path_nosoc, outpath_soc=path_soc, binary=False
|
241
|
-
)
|
242
|
-
model = parser.parse()
|
243
|
-
ham = RotateHam(model, kmesh, gamma=gamma)
|
244
|
-
es = []
|
245
|
-
for theta, psi in zip(thetas, psis):
|
246
|
-
axis = spherical_to_cartesian(theta, psi)
|
247
|
-
model.rotate_HR_xc(axis)
|
248
|
-
e = ham.get_band_energy()
|
249
|
-
es.append(ham.get_band_energy())
|
250
|
-
if outfile:
|
251
|
-
with open(outfile, "w") as f:
|
252
|
-
f.write("theta, psi, energy\n")
|
253
|
-
for theta, psi, e in zip(thetas, psis, es):
|
254
|
-
f.write(f"{theta}, {psi}, {e}\n")
|
255
|
-
return es
|
256
|
-
|
257
|
-
|
258
|
-
def test_AbacusSplitSOCWrapper():
|
259
|
-
# path = Path("~/projects/2D_Fe").expanduser()
|
260
|
-
path = Path("~/projects/TB2Jflows/examples/2D_Fe/Fe_z").expanduser()
|
261
|
-
outpath_nosoc = f"{path}/soc0/OUT.ABACUS"
|
262
|
-
outpath_soc = f"{path}/soc1/OUT.ABACUS"
|
263
|
-
parser = AbacusSplitSOCParser(
|
264
|
-
outpath_nosoc=outpath_nosoc, outpath_soc=outpath_soc, binary=False
|
265
|
-
)
|
266
|
-
model = parser.parse()
|
267
|
-
kmesh = [6, 6, 1]
|
268
|
-
|
269
|
-
r = RotateHam(model, kmesh)
|
270
|
-
# thetas, es = r.get_band_energy_vs_theta(angle_range=(0, np.pi*2), rotation_axis="z", initial_direction=(1,0,0), npoints=21)
|
271
|
-
thetas, es, es2 = r.get_band_energy_vs_theta(
|
272
|
-
angle_range=(0, np.pi * 2),
|
273
|
-
rotation_axis="y",
|
274
|
-
initial_direction=(0, 0, 1),
|
275
|
-
npoints=11,
|
276
|
-
)
|
277
|
-
# print the table of thetas and es, es2
|
278
|
-
print("theta, e, e2")
|
279
|
-
for theta, e, e2 in zip(thetas, es, es2):
|
280
|
-
print(f"{theta=}, {e=}, {e2=}")
|
281
|
-
|
282
|
-
plt.plot(thetas / np.pi, es - es[0], marker="o")
|
283
|
-
plt.plot(thetas / np.pi, es2 - es2[0], marker=".")
|
284
|
-
plt.savefig("E_along_z_x_z.png")
|
285
|
-
plt.show()
|
286
|
-
|
287
|
-
|
288
|
-
def abacus_get_MAE_cli():
|
289
|
-
import argparse
|
290
|
-
|
291
|
-
parser = argparse.ArgumentParser(
|
292
|
-
description="Get MAE from Abacus with magnetic force theorem. Two calculations are needed. First we do an calculation with SOC but the soc_lambda is set to 0. Save the density. The next calculatin we start with the density from the first calculation and set the SOC prefactor to 1. With the information from the two calcualtions, we can get the band energy with magnetic moments in the direction, specified in two list, thetas, and phis. "
|
293
|
-
)
|
294
|
-
parser.add_argument("path_nosoc", type=str, help="Path to the calculation with ")
|
295
|
-
parser.add_argument("path_soc", type=str, help="Path to the SOC calculation")
|
296
|
-
parser.add_argument("thetas", type=float, nargs="+", help="Thetas")
|
297
|
-
parser.add_argument("psis", type=float, nargs="+", help="Phis")
|
298
|
-
parser.add_argument("kmesh", type=int, nargs=3, help="K-mesh")
|
299
|
-
parser.add_argument(
|
300
|
-
"--gamma", action="store_true", help="Use Gamma centered kpoints"
|
301
|
-
)
|
302
|
-
parser.add_argument(
|
303
|
-
"--outfile",
|
304
|
-
type=str,
|
305
|
-
help="The angles and the energey will be saved in this file.",
|
306
|
-
)
|
307
|
-
args = parser.parse_args()
|
308
|
-
abacus_get_MAE(
|
309
|
-
args.path_nosoc,
|
310
|
-
args.path_soc,
|
311
|
-
args.kmesh,
|
312
|
-
args.thetas,
|
313
|
-
args.psis,
|
314
|
-
gamma=args.gamma,
|
315
|
-
outfile=args.outfile,
|
316
|
-
)
|
317
|
-
|
318
|
-
|
319
|
-
if __name__ == "__main__":
|
320
|
-
abacus_get_MAE_cli()
|
TB2J/abacus/__init__.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
from .abacus_wrapper import AbacusWrapper, AbacusParser
|