TB2J 0.9.9rc11__py3-none-any.whl → 0.9.9rc14__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/exchange.py +65 -83
- TB2J/exchange_params.py +0 -19
- TB2J/io_exchange/io_exchange.py +2 -5
- TB2J/rotate_siestaDM.py +9 -11
- tb2j-0.9.9rc14.data/scripts/abacus2J.py +146 -0
- tb2j-0.9.9rc14.data/scripts/siesta2J.py +163 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/wann2J.py +0 -1
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/METADATA +2 -3
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/RECORD +20 -20
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/WHEEL +1 -1
- tb2j-0.9.9rc11.data/scripts/abacus2J.py +0 -58
- tb2j-0.9.9rc11.data/scripts/siesta2J.py +0 -74
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_downfold.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_eigen.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_magnon.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_magnon_dos.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_merge.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_rotate.py +0 -0
- {tb2j-0.9.9rc11.data → tb2j-0.9.9rc14.data}/scripts/TB2J_rotateDM.py +0 -0
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/entry_points.txt +0 -0
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/licenses/LICENSE +0 -0
- {tb2j-0.9.9rc11.dist-info → tb2j-0.9.9rc14.dist-info}/top_level.txt +0 -0
TB2J/exchange.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
import pickle
|
3
|
-
from collections import defaultdict
|
3
|
+
from collections import OrderedDict, defaultdict
|
4
4
|
|
5
5
|
import numpy as np
|
6
6
|
from tqdm import tqdm
|
@@ -96,96 +96,78 @@ class Exchange(ExchangeParams):
|
|
96
96
|
|
97
97
|
def _prepare_orb_dict(self):
|
98
98
|
"""
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
self.
|
109
|
-
|
110
|
-
self.
|
111
|
-
|
112
|
-
self.
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
99
|
+
generate self.ind_mag_atoms and self.orb_dict
|
100
|
+
"""
|
101
|
+
# adict: dictionary of {'Fe': ['dxy', 'dyz', ...], ...}
|
102
|
+
adict = OrderedDict()
|
103
|
+
# orb_dict: {ind_atom:[ind_orb,1,2], ...}
|
104
|
+
self.orb_dict = {}
|
105
|
+
# labels: {0:{dxy, ...}}
|
106
|
+
self.labels = {}
|
107
|
+
# magnetic atoms index
|
108
|
+
self.ind_mag_atoms = []
|
109
|
+
|
110
|
+
sdict = symbol_number(self.atoms)
|
111
|
+
|
112
|
+
for i, base in enumerate(self.basis):
|
113
|
+
if i not in self.exclude_orbs:
|
114
|
+
# e.g. Fe2, dxy, _, _
|
115
|
+
if isinstance(base, str):
|
116
|
+
atom_sym, orb_sym = base.split("|")[:2]
|
117
|
+
iatom = sdict[atom_sym]
|
118
|
+
else:
|
119
|
+
try:
|
120
|
+
atom_sym, orb_sym = base[:2]
|
121
|
+
iatom = sdict[atom_sym]
|
122
|
+
except Exception:
|
123
|
+
iatom = base.iatom
|
124
|
+
atom_sym = base.iatom
|
125
|
+
orb_sym = base.sym
|
126
|
+
|
127
|
+
if atom_sym in adict:
|
128
|
+
adict[atom_sym].append(orb_sym)
|
129
|
+
else:
|
130
|
+
adict[atom_sym] = [orb_sym]
|
131
|
+
if iatom not in self.orb_dict:
|
132
|
+
self.orb_dict[iatom] = [i]
|
133
|
+
self.labels[iatom] = [orb_sym]
|
134
|
+
else:
|
135
|
+
self.orb_dict[iatom] += [i]
|
136
|
+
self.labels[iatom] += [orb_sym]
|
123
137
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
atom_sym, orb_sym = base[:2]
|
131
|
-
atom_idx = atom_symbols[atom_sym]
|
132
|
-
except Exception:
|
133
|
-
atom_idx = base.iatom
|
134
|
-
atom_sym = base.iatom
|
135
|
-
orb_sym = base.sym
|
136
|
-
|
137
|
-
# Update orbital mappings
|
138
|
-
if atom_idx not in self.orb_dict:
|
139
|
-
self.orb_dict[atom_idx] = [orb_idx]
|
140
|
-
self.labels[atom_idx] = [orb_sym]
|
141
|
-
else:
|
142
|
-
self.orb_dict[atom_idx].append(orb_idx)
|
143
|
-
self.labels[atom_idx].append(orb_sym)
|
138
|
+
# index of magnetic atoms
|
139
|
+
symbols = self.atoms.get_chemical_symbols()
|
140
|
+
tags = self.atoms.get_tags()
|
141
|
+
for i, (sym, tag) in enumerate(zip(symbols, tags)):
|
142
|
+
if sym in self.magnetic_elements or f"{sym}{tag}" in self.magnetic_elements:
|
143
|
+
self.ind_mag_atoms.append(i)
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
self.ind_mag_atoms = self.index_magnetic_atoms
|
149
|
-
else:
|
150
|
-
self.ind_mag_atoms = []
|
151
|
-
symbols = self.atoms.get_chemical_symbols()
|
152
|
-
tags = self.atoms.get_tags()
|
153
|
-
|
154
|
-
for atom_idx, (sym, tag) in enumerate(zip(symbols, tags)):
|
155
|
-
if (
|
156
|
-
sym in self.magnetic_elements
|
157
|
-
or f"{sym}{tag}" in self.magnetic_elements
|
158
|
-
):
|
159
|
-
self.ind_mag_atoms.append(atom_idx)
|
160
|
-
print(f"Magnetic atoms: {self.ind_mag_atoms}")
|
161
|
-
|
162
|
-
def _validate_orbital_assignments(self):
|
163
|
-
"""Validate that magnetic atoms have proper orbital assignments."""
|
164
|
-
# Check all magnetic atoms have orbitals
|
165
|
-
for atom_idx in self.ind_mag_atoms:
|
166
|
-
if atom_idx not in self.orb_dict:
|
145
|
+
# sanity check to see if some magnetic atom has no orbital.
|
146
|
+
for iatom in self.ind_mag_atoms:
|
147
|
+
if iatom not in self.orb_dict:
|
167
148
|
raise ValueError(
|
168
|
-
f"
|
169
|
-
"Check Wannier function definitions."
|
149
|
+
f"""Cannot find any orbital for atom {iatom}, which is supposed to be magnetic. Please check the Wannier functions."""
|
170
150
|
)
|
171
|
-
|
172
|
-
# For non-collinear case, check spin-orbital pairing
|
173
151
|
if not self._is_collinear:
|
174
|
-
for
|
175
|
-
|
152
|
+
for iatom, orb in self.orb_dict.items():
|
153
|
+
# print(f"iatom: {iatom}, orb: {orb}")
|
154
|
+
nsorb = len(self.orb_dict[iatom])
|
155
|
+
if nsorb % 2 != 0 and False:
|
176
156
|
raise ValueError(
|
177
|
-
f"
|
178
|
-
|
157
|
+
f"""The number of spin-orbitals for atom {iatom} is not even,
|
158
|
+
{nsorb} spin-orbitals are found near this atom.
|
159
|
+
which means the spin up/down does not have same number of orbitals.
|
160
|
+
This is often because the Wannier functions are wrongly defined,
|
161
|
+
or badly localized. Please check the Wannier centers in the Wannier90 output file.
|
162
|
+
"""
|
179
163
|
)
|
164
|
+
self._spin_dict = {}
|
165
|
+
self._atom_dict = {}
|
166
|
+
for ispin, iatom in enumerate(self.ind_mag_atoms):
|
167
|
+
self._spin_dict[iatom] = ispin
|
168
|
+
self._atom_dict[ispin] = iatom
|
180
169
|
|
181
|
-
|
182
|
-
"""Create mappings between atom indices and spin indices."""
|
183
|
-
self._spin_dict = {} # {atom_index: spin_index}
|
184
|
-
self._atom_dict = {} # {spin_index: atom_index}
|
185
|
-
|
186
|
-
for spin_idx, atom_idx in enumerate(self.ind_mag_atoms):
|
187
|
-
self._spin_dict[atom_idx] = spin_idx
|
188
|
-
self._atom_dict[spin_idx] = atom_idx
|
170
|
+
self._prepare_orb_mmat()
|
189
171
|
|
190
172
|
def _prepare_orb_mmat(self):
|
191
173
|
self.mmats = {}
|
TB2J/exchange_params.py
CHANGED
@@ -15,7 +15,6 @@ class ExchangeParams:
|
|
15
15
|
efermi: float
|
16
16
|
basis = []
|
17
17
|
magnetic_elements = []
|
18
|
-
index_magnetic_atoms = None
|
19
18
|
include_orbs = {}
|
20
19
|
_kmesh = [4, 4, 4]
|
21
20
|
emin: float = -15
|
@@ -56,7 +55,6 @@ class ExchangeParams:
|
|
56
55
|
mae_angles=None,
|
57
56
|
orth=False,
|
58
57
|
ibz=False,
|
59
|
-
index_magnetic_atoms=None,
|
60
58
|
):
|
61
59
|
self.efermi = efermi
|
62
60
|
self.basis = basis
|
@@ -81,7 +79,6 @@ class ExchangeParams:
|
|
81
79
|
self.mae_angles = mae_angles
|
82
80
|
self.orth = orth
|
83
81
|
self.ibz = ibz
|
84
|
-
self.index_magnetic_atoms = index_magnetic_atoms
|
85
82
|
|
86
83
|
def set_params(self, **kwargs):
|
87
84
|
for key, val in kwargs.items():
|
@@ -232,21 +229,6 @@ def add_exchange_args_to_parser(parser: argparse.ArgumentParser):
|
|
232
229
|
default=False,
|
233
230
|
)
|
234
231
|
|
235
|
-
parser.add_argument(
|
236
|
-
"--mae_angles",
|
237
|
-
help="angles for computing MAE, default is 0 0 0",
|
238
|
-
type=float,
|
239
|
-
nargs="*",
|
240
|
-
default=[0.0, 0.0, 0.0],
|
241
|
-
)
|
242
|
-
parser.add_argument(
|
243
|
-
"--index_magnetic_atoms",
|
244
|
-
help="index of magnetic atoms in the unit cell, default is None. If specified, this will be used to determine the atoms to be considered as magnetic atoms, instead of determined from magnetic elements. Note that the index starts from 1 ",
|
245
|
-
type=int,
|
246
|
-
nargs="*",
|
247
|
-
default=None,
|
248
|
-
)
|
249
|
-
|
250
232
|
return parser
|
251
233
|
|
252
234
|
|
@@ -268,5 +250,4 @@ def parser_argument_to_dict(args) -> dict:
|
|
268
250
|
"orb_decomposition": args.orb_decomposition,
|
269
251
|
"output_path": args.output_path,
|
270
252
|
"orth": args.orth,
|
271
|
-
"index_magnetic_atoms": args.index_magnetic_atoms,
|
272
253
|
}
|
TB2J/io_exchange/io_exchange.py
CHANGED
@@ -8,16 +8,13 @@ write not only xml output.
|
|
8
8
|
- tom's asd inputs.
|
9
9
|
"""
|
10
10
|
|
11
|
+
# matplotlib.use("Agg")
|
12
|
+
import gc
|
11
13
|
import os
|
12
14
|
import pickle
|
13
15
|
from collections.abc import Iterable
|
14
16
|
from datetime import datetime
|
15
17
|
|
16
|
-
import matplotlib
|
17
|
-
|
18
|
-
matplotlib.use("Agg")
|
19
|
-
import gc
|
20
|
-
|
21
18
|
import matplotlib.pyplot as plt
|
22
19
|
import numpy as np
|
23
20
|
|
TB2J/rotate_siestaDM.py
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
import sisl
|
2
2
|
|
3
|
-
|
4
3
|
def rotate_siesta_DM(DM, noncollinear=False):
|
5
|
-
|
4
|
+
|
5
|
+
angles_list = [ [0.0, 90.0, 0.0], [0.0, 90.0, 90.0] ]
|
6
6
|
if noncollinear:
|
7
7
|
angles_list += [[0.0, 45.0, 0.0], [0.0, 90.0, 45.0], [0.0, 45.0, 90.0]]
|
8
8
|
|
9
9
|
for angles in angles_list:
|
10
10
|
yield DM.spin_rotate(angles)
|
11
11
|
|
12
|
-
|
13
12
|
def read_label(fdf_fname):
|
14
|
-
|
15
|
-
|
13
|
+
|
14
|
+
label = 'siesta'
|
15
|
+
with open(fdf_fname, 'r') as File:
|
16
16
|
for line in File:
|
17
|
-
corrected_line = line.lower().replace(
|
18
|
-
if
|
17
|
+
corrected_line = line.lower().replace('.', '').replace('-', '')
|
18
|
+
if 'systemlabel' in corrected_line:
|
19
19
|
label = line.split()[1]
|
20
20
|
break
|
21
21
|
|
22
22
|
return label
|
23
23
|
|
24
|
-
|
25
24
|
def rotate_DM(fdf_fname, noncollinear=False):
|
25
|
+
|
26
26
|
fdf = sisl.get_sile(fdf_fname)
|
27
27
|
DM = fdf.read_density_matrix()
|
28
28
|
label = read_label(fdf_fname)
|
@@ -33,6 +33,4 @@ def rotate_DM(fdf_fname, noncollinear=False):
|
|
33
33
|
rotated_DM.write(f"{label}_{i+1}.DM")
|
34
34
|
DM.write(f"{label}_0.DM")
|
35
35
|
|
36
|
-
print(
|
37
|
-
f"The output has been written to the {label}_i.DM files. {label}_0.DM contains the reference density matrix."
|
38
|
-
)
|
36
|
+
print(f"The output has been written to the {label}_i.DM files. {label}_0.DM contains the reference density matrix.")
|
@@ -0,0 +1,146 @@
|
|
1
|
+
#!python
|
2
|
+
import argparse
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from TB2J.interfaces import gen_exchange_abacus
|
6
|
+
from TB2J.versioninfo import print_license
|
7
|
+
|
8
|
+
|
9
|
+
def run_abacus2J():
|
10
|
+
print_license()
|
11
|
+
parser = argparse.ArgumentParser(
|
12
|
+
description="abacus2J: Using magnetic force theorem to calculate exchange parameter J from abacus Hamiltonian in the LCAO mode"
|
13
|
+
)
|
14
|
+
|
15
|
+
parser.add_argument(
|
16
|
+
"--path", help="the path of the abacus calculation", default="./", type=str
|
17
|
+
)
|
18
|
+
|
19
|
+
parser.add_argument(
|
20
|
+
"--suffix",
|
21
|
+
help="the label of the abacus calculation. There should be an output directory called OUT.suffix",
|
22
|
+
default="abacus",
|
23
|
+
type=str,
|
24
|
+
)
|
25
|
+
|
26
|
+
parser.add_argument(
|
27
|
+
"--elements",
|
28
|
+
help="list of elements to be considered in Heisenberg model.",
|
29
|
+
# , For each element, a postfixes can be used to specify the orbitals(Only with Siesta backend), eg. Fe_3d, or Fe_3d_4s ",
|
30
|
+
default=None,
|
31
|
+
type=str,
|
32
|
+
nargs="*",
|
33
|
+
)
|
34
|
+
parser.add_argument(
|
35
|
+
"--rcut",
|
36
|
+
help="range of R. The default is all the commesurate R to the kmesh",
|
37
|
+
default=None,
|
38
|
+
type=float,
|
39
|
+
)
|
40
|
+
parser.add_argument(
|
41
|
+
"--efermi", help="Fermi energy in eV. For test only. ", default=None, type=float
|
42
|
+
)
|
43
|
+
parser.add_argument(
|
44
|
+
"--kmesh",
|
45
|
+
help="kmesh in the format of kx ky kz. Monkhorst pack. If all the numbers are odd, it is Gamma cenetered. (strongly recommended), Default: 5 5 5",
|
46
|
+
type=int,
|
47
|
+
nargs="*",
|
48
|
+
default=[5, 5, 5],
|
49
|
+
)
|
50
|
+
parser.add_argument(
|
51
|
+
"--emin",
|
52
|
+
help="energy minimum below efermi, default -14 eV",
|
53
|
+
type=float,
|
54
|
+
default=-14.0,
|
55
|
+
)
|
56
|
+
|
57
|
+
parser.add_argument(
|
58
|
+
"--use_cache",
|
59
|
+
help="whether to use disk file for temporary storing wavefunctions and hamiltonian to reduce memory usage. Default: False",
|
60
|
+
action="store_true",
|
61
|
+
default=False,
|
62
|
+
)
|
63
|
+
|
64
|
+
parser.add_argument(
|
65
|
+
"--nz", help="number of integration steps. Default: 50", default=50, type=int
|
66
|
+
)
|
67
|
+
|
68
|
+
parser.add_argument(
|
69
|
+
"--cutoff",
|
70
|
+
help="The minimum of J amplitude to write, (in eV). Default: 1e-7 eV",
|
71
|
+
default=1e-7,
|
72
|
+
type=float,
|
73
|
+
)
|
74
|
+
|
75
|
+
parser.add_argument(
|
76
|
+
"--exclude_orbs",
|
77
|
+
help="the indices of wannier functions to be excluded from magnetic site. counting start from 0. Default is none.",
|
78
|
+
default=[],
|
79
|
+
type=int,
|
80
|
+
nargs="+",
|
81
|
+
)
|
82
|
+
|
83
|
+
parser.add_argument(
|
84
|
+
"--nproc",
|
85
|
+
"--np",
|
86
|
+
help="number of cpu cores to use in parallel, default: 1",
|
87
|
+
default=1,
|
88
|
+
type=int,
|
89
|
+
)
|
90
|
+
|
91
|
+
parser.add_argument(
|
92
|
+
"--description",
|
93
|
+
help="add description of the calculatiion to the xml file. Essential information, like the xc functional, U values, magnetic state should be given.",
|
94
|
+
type=str,
|
95
|
+
default="Calculated with TB2J.",
|
96
|
+
)
|
97
|
+
|
98
|
+
parser.add_argument(
|
99
|
+
"--orb_decomposition",
|
100
|
+
default=False,
|
101
|
+
action="store_true",
|
102
|
+
help="whether to do orbital decomposition in the non-collinear mode. Default: False.",
|
103
|
+
)
|
104
|
+
|
105
|
+
parser.add_argument(
|
106
|
+
"--fname",
|
107
|
+
default="exchange.xml",
|
108
|
+
type=str,
|
109
|
+
help="exchange xml file name. default: exchange.xml",
|
110
|
+
)
|
111
|
+
|
112
|
+
parser.add_argument(
|
113
|
+
"--output_path",
|
114
|
+
help="The path of the output directory, default is TB2J_results",
|
115
|
+
type=str,
|
116
|
+
default="TB2J_results",
|
117
|
+
)
|
118
|
+
|
119
|
+
args = parser.parse_args()
|
120
|
+
|
121
|
+
if args.elements is None:
|
122
|
+
print("Please input the magnetic elements, e.g. --elements Fe Ni")
|
123
|
+
sys.exit()
|
124
|
+
|
125
|
+
# include_orbs = {}
|
126
|
+
|
127
|
+
gen_exchange_abacus(
|
128
|
+
path=args.path,
|
129
|
+
suffix=args.suffix,
|
130
|
+
kmesh=args.kmesh,
|
131
|
+
magnetic_elements=args.elements,
|
132
|
+
include_orbs={},
|
133
|
+
Rcut=args.rcut,
|
134
|
+
emin=args.emin,
|
135
|
+
nz=args.nz,
|
136
|
+
description=args.description,
|
137
|
+
output_path=args.output_path,
|
138
|
+
use_cache=args.use_cache,
|
139
|
+
nproc=args.nproc,
|
140
|
+
exclude_orbs=args.exclude_orbs,
|
141
|
+
orb_decomposition=args.orb_decomposition,
|
142
|
+
)
|
143
|
+
|
144
|
+
|
145
|
+
if __name__ == "__main__":
|
146
|
+
run_abacus2J()
|
@@ -0,0 +1,163 @@
|
|
1
|
+
#!python
|
2
|
+
import argparse
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from TB2J.interfaces import gen_exchange_siesta
|
6
|
+
from TB2J.versioninfo import print_license
|
7
|
+
|
8
|
+
|
9
|
+
def run_siesta2J():
|
10
|
+
print_license()
|
11
|
+
parser = argparse.ArgumentParser(
|
12
|
+
description="siesta2J: Using magnetic force theorem to calculate exchange parameter J from siesta Hamiltonian"
|
13
|
+
)
|
14
|
+
parser.add_argument(
|
15
|
+
"--fdf_fname", help="path of the input fdf file", default="./", type=str
|
16
|
+
)
|
17
|
+
parser.add_argument(
|
18
|
+
"--elements",
|
19
|
+
help="list of elements to be considered in Heisenberg model. For each element, a postfixes can be used to specify the orbitals(Only with Siesta backend), eg. Fe_3d, or Fe_3d_4s ",
|
20
|
+
default=None,
|
21
|
+
type=str,
|
22
|
+
nargs="*",
|
23
|
+
)
|
24
|
+
parser.add_argument(
|
25
|
+
"--rcut",
|
26
|
+
help="range of R. The default is all the commesurate R to the kmesh",
|
27
|
+
default=None,
|
28
|
+
type=float,
|
29
|
+
)
|
30
|
+
parser.add_argument(
|
31
|
+
"--efermi", help="Fermi energy in eV. For test only. ", default=None, type=float
|
32
|
+
)
|
33
|
+
parser.add_argument(
|
34
|
+
"--kmesh",
|
35
|
+
help="kmesh in the format of kx ky kz. Monkhorst pack. If all the numbers are odd, it is Gamma cenetered. (strongly recommended), Default: 5 5 5",
|
36
|
+
type=int,
|
37
|
+
nargs="*",
|
38
|
+
default=[5, 5, 5],
|
39
|
+
)
|
40
|
+
parser.add_argument(
|
41
|
+
"--emin",
|
42
|
+
help="energy minimum below efermi, default -14 eV",
|
43
|
+
type=float,
|
44
|
+
default=-14.0,
|
45
|
+
)
|
46
|
+
parser.add_argument(
|
47
|
+
"--emax",
|
48
|
+
help="energy maximum above efermi. Default 0.0 eV",
|
49
|
+
type=float,
|
50
|
+
default=0.05,
|
51
|
+
)
|
52
|
+
parser.add_argument(
|
53
|
+
"--use_cache",
|
54
|
+
help="whether to use disk file for temporary storing wavefunctions and hamiltonian to reduce memory usage. Default: False",
|
55
|
+
action="store_true",
|
56
|
+
default=False,
|
57
|
+
)
|
58
|
+
parser.add_argument(
|
59
|
+
"--nz", help="number of integration steps. Default: 50", default=50, type=int
|
60
|
+
)
|
61
|
+
parser.add_argument(
|
62
|
+
"--cutoff",
|
63
|
+
help="The minimum of J amplitude to write, (in eV). Default: 1e-5 eV",
|
64
|
+
default=1e-5,
|
65
|
+
type=float,
|
66
|
+
)
|
67
|
+
|
68
|
+
parser.add_argument(
|
69
|
+
"--exclude_orbs",
|
70
|
+
help="the indices of wannier functions to be excluded from magnetic site. counting start from 0. Default is none.",
|
71
|
+
default=[],
|
72
|
+
type=int,
|
73
|
+
nargs="+",
|
74
|
+
)
|
75
|
+
|
76
|
+
parser.add_argument(
|
77
|
+
"--np",
|
78
|
+
help="number of cpu cores to use in parallel, default: 1",
|
79
|
+
default=1,
|
80
|
+
type=int,
|
81
|
+
)
|
82
|
+
|
83
|
+
parser.add_argument(
|
84
|
+
"--description",
|
85
|
+
help="add description of the calculatiion to the xml file. Essential information, like the xc functional, U values, magnetic state should be given.",
|
86
|
+
type=str,
|
87
|
+
default="Calculated with TB2J.",
|
88
|
+
)
|
89
|
+
|
90
|
+
parser.add_argument(
|
91
|
+
"--orb_decomposition",
|
92
|
+
default=False,
|
93
|
+
action="store_true",
|
94
|
+
help="whether to do orbital decomposition in the non-collinear mode. Default: False.",
|
95
|
+
)
|
96
|
+
|
97
|
+
parser.add_argument(
|
98
|
+
"--fname",
|
99
|
+
default="exchange.xml",
|
100
|
+
type=str,
|
101
|
+
help="exchange xml file name. default: exchange.xml",
|
102
|
+
)
|
103
|
+
|
104
|
+
parser.add_argument(
|
105
|
+
"--output_path",
|
106
|
+
help="The path of the output directory, default is TB2J_results",
|
107
|
+
type=str,
|
108
|
+
default="TB2J_results",
|
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
|
+
|
125
|
+
args = parser.parse_args()
|
126
|
+
|
127
|
+
if args.elements is None:
|
128
|
+
print("Please input the magnetic elements, e.g. --elements Fe Ni")
|
129
|
+
sys.exit()
|
130
|
+
|
131
|
+
# include_orbs = {}
|
132
|
+
# for element in args.elements:
|
133
|
+
# if "_" in element:
|
134
|
+
# elem = element.split("_")[0]
|
135
|
+
# orb = element.split("_")[1:]
|
136
|
+
# include_orbs[elem] = orb
|
137
|
+
# else:
|
138
|
+
# include_orbs[element] = None
|
139
|
+
|
140
|
+
gen_exchange_siesta(
|
141
|
+
fdf_fname=args.fdf_fname,
|
142
|
+
kmesh=args.kmesh,
|
143
|
+
# magnetic_elements=list(include_orbs.keys()),
|
144
|
+
# include_orbs=include_orbs,
|
145
|
+
magnetic_elements=args.elements,
|
146
|
+
include_orbs={},
|
147
|
+
Rcut=args.rcut,
|
148
|
+
emin=args.emin,
|
149
|
+
emax=args.emax,
|
150
|
+
nz=args.nz,
|
151
|
+
description=args.description,
|
152
|
+
output_path=args.output_path,
|
153
|
+
use_cache=args.use_cache,
|
154
|
+
nproc=args.np,
|
155
|
+
exclude_orbs=args.exclude_orbs,
|
156
|
+
orb_decomposition=args.orb_decomposition,
|
157
|
+
read_H_soc=args.split_soc,
|
158
|
+
orth=args.orth,
|
159
|
+
)
|
160
|
+
|
161
|
+
|
162
|
+
if __name__ == "__main__":
|
163
|
+
run_siesta2J()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: TB2J
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.9rc14
|
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
|
@@ -21,10 +21,9 @@ 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
|
24
|
+
Requires-Dist: HamiltonIO>=0.2.1
|
25
25
|
Requires-Dist: pre-commit
|
26
26
|
Requires-Dist: sympair>0.1.0
|
27
|
-
Requires-Dist: sisl>=0.9.0
|
28
27
|
Dynamic: author
|
29
28
|
Dynamic: author-email
|
30
29
|
Dynamic: classifier
|
@@ -11,9 +11,9 @@ TB2J/citation.py,sha256=gcQeyJZaT1Qrtsl8Y3s4neOH3-vvgmIcCvXeV2o3vj0,2891
|
|
11
11
|
TB2J/contour.py,sha256=zLHQZZ3hhgLkLFPATCraLOJyLJKLC0fba_L_5sRz23o,3246
|
12
12
|
TB2J/density_matrix.py,sha256=D5k8Oe21OCiLVORNYbo4TZOFG0slrQSbj91kJ3TMFjs,1514
|
13
13
|
TB2J/epc.py,sha256=zLbtqZJhDr8DnnGN6YENcXwrMb3Qxu6KB08mLy9Pw20,3474
|
14
|
-
TB2J/exchange.py,sha256=
|
14
|
+
TB2J/exchange.py,sha256=1kkrrQvmoOaPgT_rKG7wgLy31rWpbFGNYXai1ysd58M,26221
|
15
15
|
TB2J/exchangeCL2.py,sha256=P7bklMXVYX_tn9DbjEPqeTir1SeZyfPBIP1fhWUzLmY,11419
|
16
|
-
TB2J/exchange_params.py,sha256=
|
16
|
+
TB2J/exchange_params.py,sha256=AcGYYky27DXSF3yDZWVjksr_3rt6im6qeIzpOwvqssk,7141
|
17
17
|
TB2J/exchange_pert.py,sha256=jmFMtQbYa_uczM4VAeS6TijkIHRFIqEzZJswzE9Wfuo,8523
|
18
18
|
TB2J/exchange_qspace.py,sha256=ZL68qBGFUaQ9BsSPsJaaoWOr9RssPiqX34R_9I3nk_8,8436
|
19
19
|
TB2J/gpaw_wrapper.py,sha256=aJ--9Dtyq7jOP1Hkh-Sh1nWcfXm6zKcljOCO0DNCAr0,6890
|
@@ -29,7 +29,7 @@ TB2J/pauli.py,sha256=ESpAhk6LG5ugzuW1YFUTqiDxcg-pQ7wNnzR2FtUnvKM,5295
|
|
29
29
|
TB2J/pert.py,sha256=RaCJfewl0doht4cjAnzzGKe-uj2le4aqe0iPKFrq9fo,1192
|
30
30
|
TB2J/plot.py,sha256=AnFIFWE2vlmj7Z6f_7-dX_O1stJN-qbuiurPj43dUCM,4104
|
31
31
|
TB2J/rotate_atoms.py,sha256=Dwptn-wdDW4zYzjYb95yxTzuZOe9WPuLjh3d3-YcSs0,3277
|
32
|
-
TB2J/rotate_siestaDM.py,sha256=
|
32
|
+
TB2J/rotate_siestaDM.py,sha256=eR97rspdrRaK9YTwQwUKfobI0S9UnEcbEZ2f5IgR7Tk,1070
|
33
33
|
TB2J/sisl_wrapper.py,sha256=A5x1-tt8efUSPeGY5wM5m6-pJYQFXTCzQHVqD6RBa2g,14792
|
34
34
|
TB2J/symmetrize_J.py,sha256=IypvLL0JxExq-cmqc4o0nLL8psE7OC9ijj9YMcsqJeA,4487
|
35
35
|
TB2J/tensor_rotate.py,sha256=4-DfT_Mg5e40fbd74M5W0D5DqmUq-kVOOLDkkkI834A,8083
|
@@ -55,7 +55,7 @@ TB2J/interfaces/abacus/test_density_matrix.py,sha256=bMWWJYtDS57SpPZ-eZXZ9Hr_UK4
|
|
55
55
|
TB2J/interfaces/abacus/test_read_HRSR.py,sha256=W1oO_yigT50Yb5_u-KB_IfTpM7kArGkBuMSMs0H4CTs,1235
|
56
56
|
TB2J/interfaces/abacus/test_read_stru.py,sha256=hoKPHVco8vwzC7Gao4bOPCdAPhh29x-9DTJJqRr7AYM,788
|
57
57
|
TB2J/io_exchange/__init__.py,sha256=KfGHum7B8E4G_KKfillqw0lErtoyKEuFUUttHLs-mg4,32
|
58
|
-
TB2J/io_exchange/io_exchange.py,sha256=
|
58
|
+
TB2J/io_exchange/io_exchange.py,sha256=6fefcfYAyRojkCJA5bFwAa2Hjwx6epysfyX8Snj9DWc,20102
|
59
59
|
TB2J/io_exchange/io_multibinit.py,sha256=8PDmWxzGuv-GwJosj2ZTmiyNY_duFVWJ4ekCuSqGdd8,6739
|
60
60
|
TB2J/io_exchange/io_tomsasd.py,sha256=NqkAC1Fl-CUnFA21eBzSy_S5F_oeQFJysw4UukQbN8o,4173
|
61
61
|
TB2J/io_exchange/io_txt.py,sha256=BMr1eSILlKpgtjvDx7uw2VMAkEKSvGEPNxpaT_zev0I,10547
|
@@ -80,19 +80,19 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
|
|
80
80
|
TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
|
81
81
|
TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
|
82
82
|
TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
|
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.
|
94
|
-
tb2j-0.9.
|
95
|
-
tb2j-0.9.
|
96
|
-
tb2j-0.9.
|
97
|
-
tb2j-0.9.
|
98
|
-
tb2j-0.9.
|
83
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_downfold.py,sha256=i4BVqnpDdgrX_amookVWeLGefGBn-qeAutWiwuY9SfQ,2099
|
84
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
|
85
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
|
86
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
|
87
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
|
88
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
|
89
|
+
tb2j-0.9.9rc14.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
|
90
|
+
tb2j-0.9.9rc14.data/scripts/abacus2J.py,sha256=0HLXoJhAkiZ-ZM1cs26lncccxE8-TzC8JiDTba1h1uM,4163
|
91
|
+
tb2j-0.9.9rc14.data/scripts/siesta2J.py,sha256=gp31LioqpPkDmMY0y_5gXIjOBPNnf080P37pRo0yjw8,4886
|
92
|
+
tb2j-0.9.9rc14.data/scripts/wann2J.py,sha256=pTFDf6h72I_LN_NX5UivyCoJPgwvyAyHW175nSAJvLo,2987
|
93
|
+
tb2j-0.9.9rc14.dist-info/licenses/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
|
94
|
+
tb2j-0.9.9rc14.dist-info/METADATA,sha256=EIyzpsZFIW8RLeCDLgJDZGnwwqmlFobdrx1kqvs9S_Y,1661
|
95
|
+
tb2j-0.9.9rc14.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
96
|
+
tb2j-0.9.9rc14.dist-info/entry_points.txt,sha256=Hdz1WC9waUzyFVmowKnbbZ6j-J4adHh_Ko6JpxGYAtE,131
|
97
|
+
tb2j-0.9.9rc14.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
|
98
|
+
tb2j-0.9.9rc14.dist-info/RECORD,,
|
@@ -1,58 +0,0 @@
|
|
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_abacus
|
7
|
-
from TB2J.versioninfo import print_license
|
8
|
-
|
9
|
-
|
10
|
-
def run_abacus2J():
|
11
|
-
print_license()
|
12
|
-
parser = argparse.ArgumentParser(
|
13
|
-
description="abacus2J: Using magnetic force theorem to calculate exchange parameter J from abacus Hamiltonian in the LCAO mode"
|
14
|
-
)
|
15
|
-
# Add ABACUS specific arguments
|
16
|
-
parser.add_argument(
|
17
|
-
"--path", help="the path of the abacus calculation", default="./", type=str
|
18
|
-
)
|
19
|
-
parser.add_argument(
|
20
|
-
"--suffix",
|
21
|
-
help="the label of the abacus calculation. There should be an output directory called OUT.suffix",
|
22
|
-
default="abacus",
|
23
|
-
type=str,
|
24
|
-
)
|
25
|
-
|
26
|
-
# Add common exchange arguments
|
27
|
-
parser = add_exchange_args_to_parser(parser)
|
28
|
-
|
29
|
-
args = parser.parse_args()
|
30
|
-
|
31
|
-
if args.elements is None:
|
32
|
-
print("Please input the magnetic elements, e.g. --elements Fe Ni")
|
33
|
-
sys.exit()
|
34
|
-
|
35
|
-
# include_orbs = {}
|
36
|
-
|
37
|
-
gen_exchange_abacus(
|
38
|
-
path=args.path,
|
39
|
-
suffix=args.suffix,
|
40
|
-
kmesh=args.kmesh,
|
41
|
-
magnetic_elements=args.elements,
|
42
|
-
include_orbs={},
|
43
|
-
Rcut=args.rcut,
|
44
|
-
emin=args.emin,
|
45
|
-
nz=args.nz,
|
46
|
-
description=args.description,
|
47
|
-
output_path=args.output_path,
|
48
|
-
use_cache=args.use_cache,
|
49
|
-
nproc=args.nproc,
|
50
|
-
exclude_orbs=args.exclude_orbs,
|
51
|
-
orb_decomposition=args.orb_decomposition,
|
52
|
-
index_magnetic_atoms=args.index_magnetic_atoms,
|
53
|
-
cutoff=args.cutoff,
|
54
|
-
)
|
55
|
-
|
56
|
-
|
57
|
-
if __name__ == "__main__":
|
58
|
-
run_abacus2J()
|
@@ -1,74 +0,0 @@
|
|
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_siesta
|
7
|
-
from TB2J.versioninfo import print_license
|
8
|
-
|
9
|
-
|
10
|
-
def run_siesta2J():
|
11
|
-
print_license()
|
12
|
-
parser = argparse.ArgumentParser(
|
13
|
-
description="siesta2J: Using magnetic force theorem to calculate exchange parameter J from siesta Hamiltonian"
|
14
|
-
)
|
15
|
-
# Add siesta specific arguments
|
16
|
-
parser.add_argument(
|
17
|
-
"--fdf_fname", help="path of the input fdf file", default="./", type=str
|
18
|
-
)
|
19
|
-
parser.add_argument(
|
20
|
-
"--fname",
|
21
|
-
default="exchange.xml",
|
22
|
-
type=str,
|
23
|
-
help="exchange xml file name. default: exchange.xml",
|
24
|
-
)
|
25
|
-
parser.add_argument(
|
26
|
-
"--split_soc",
|
27
|
-
help="whether the SOC part of the Hamiltonian can be read from the output of siesta. Default: False",
|
28
|
-
action="store_true",
|
29
|
-
default=False,
|
30
|
-
)
|
31
|
-
|
32
|
-
# Add common exchange arguments
|
33
|
-
parser = add_exchange_args_to_parser(parser)
|
34
|
-
|
35
|
-
args = parser.parse_args()
|
36
|
-
|
37
|
-
if args.elements is None:
|
38
|
-
print("Please input the magnetic elements, e.g. --elements Fe Ni")
|
39
|
-
sys.exit()
|
40
|
-
|
41
|
-
# include_orbs = {}
|
42
|
-
# for element in args.elements:
|
43
|
-
# if "_" in element:
|
44
|
-
# elem = element.split("_")[0]
|
45
|
-
# orb = element.split("_")[1:]
|
46
|
-
# include_orbs[elem] = orb
|
47
|
-
# else:
|
48
|
-
# include_orbs[element] = None
|
49
|
-
|
50
|
-
gen_exchange_siesta(
|
51
|
-
fdf_fname=args.fdf_fname,
|
52
|
-
kmesh=args.kmesh,
|
53
|
-
# magnetic_elements=list(include_orbs.keys()),
|
54
|
-
# include_orbs=include_orbs,
|
55
|
-
magnetic_elements=args.elements,
|
56
|
-
include_orbs={},
|
57
|
-
Rcut=args.rcut,
|
58
|
-
emin=args.emin,
|
59
|
-
emax=args.emax,
|
60
|
-
nz=args.nz,
|
61
|
-
description=args.description,
|
62
|
-
output_path=args.output_path,
|
63
|
-
use_cache=args.use_cache,
|
64
|
-
nproc=args.np,
|
65
|
-
exclude_orbs=args.exclude_orbs,
|
66
|
-
orb_decomposition=args.orb_decomposition,
|
67
|
-
read_H_soc=args.split_soc,
|
68
|
-
orth=args.orth,
|
69
|
-
index_magnetic_atoms=args.index_magnetic_atoms,
|
70
|
-
)
|
71
|
-
|
72
|
-
|
73
|
-
if __name__ == "__main__":
|
74
|
-
run_siesta2J()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|