TB2J 0.8.2.8__py3-none-any.whl → 0.9.0.1__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/__init__.py +1 -1
- TB2J/abacus/abacus_wrapper.py +1 -2
- TB2J/exchange.py +3 -3
- TB2J/io_merge.py +125 -376
- TB2J/myTB.py +0 -2
- TB2J/rotate_atoms.py +22 -20
- TB2J/rotate_siestaDM.py +36 -0
- TB2J/sisl_wrapper.py +0 -1
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_merge.py +9 -2
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_rotate.py +6 -1
- TB2J-0.9.0.1.data/scripts/TB2J_rotateDM.py +21 -0
- {TB2J-0.8.2.8.dist-info → TB2J-0.9.0.1.dist-info}/METADATA +6 -9
- {TB2J-0.8.2.8.dist-info → TB2J-0.9.0.1.dist-info}/RECORD +23 -26
- {TB2J-0.8.2.8.dist-info → TB2J-0.9.0.1.dist-info}/WHEEL +1 -1
- TB2J/cut_cell.py +0 -82
- TB2J/io_exchange/io_pickle.py +0 -0
- TB2J/spinham/h_matrix.py +0 -68
- TB2J/spinham/obtain_J.py +0 -79
- TB2J/supercell.py +0 -532
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_downfold.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_eigen.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_magnon.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/TB2J_magnon_dos.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/abacus2J.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/siesta2J.py +0 -0
- {TB2J-0.8.2.8.data → TB2J-0.9.0.1.data}/scripts/wann2J.py +0 -0
- {TB2J-0.8.2.8.dist-info → TB2J-0.9.0.1.dist-info}/LICENSE +0 -0
- {TB2J-0.8.2.8.dist-info → TB2J-0.9.0.1.dist-info}/top_level.txt +0 -0
TB2J/rotate_atoms.py
CHANGED
@@ -5,19 +5,24 @@ import numpy as np
|
|
5
5
|
from TB2J.tensor_rotate import Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz
|
6
6
|
|
7
7
|
|
8
|
-
def rotate_atom_xyz(atoms):
|
8
|
+
def rotate_atom_xyz(atoms, noncollinear=False):
|
9
9
|
"""
|
10
|
-
given a atoms, return:
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
given a atoms, return rotated atoms:
|
11
|
+
atoms_1, ..., atoms_n,
|
12
|
+
where we considered n diffeerent roation axes.
|
13
|
+
|
14
|
+
When noncollinear == True, more rotated structures
|
15
|
+
will be generated.
|
14
16
|
"""
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
|
18
|
+
rotation_axes = [(1, 0, 0), (0, 1, 0)]
|
19
|
+
if noncollinear:
|
20
|
+
rotation_axes += [(1, 1, 0), (1, 0, 1), (0, 1, 1)]
|
21
|
+
|
22
|
+
for axis in rotation_axes:
|
23
|
+
rotated_atoms = copy.deepcopy(atoms)
|
24
|
+
rotated_atoms.rotate(90, axis, rotate_cell=True)
|
25
|
+
yield rotated_atoms
|
21
26
|
|
22
27
|
|
23
28
|
def rotate_atom_spin_one_rotation(atoms, Rotation):
|
@@ -96,18 +101,15 @@ def check_ftype(ftype):
|
|
96
101
|
print("=" * 40)
|
97
102
|
|
98
103
|
|
99
|
-
def rotate_xyz(fname, ftype="xyz"):
|
104
|
+
def rotate_xyz(fname, ftype="xyz", noncollinear=False):
|
100
105
|
check_ftype(ftype)
|
101
106
|
atoms = read(fname)
|
102
107
|
atoms.set_pbc(True)
|
103
108
|
|
104
|
-
|
109
|
+
rotated = rotate_atom_xyz(atoms, noncollinear=noncollinear)
|
105
110
|
|
106
|
-
|
107
|
-
|
108
|
-
|
111
|
+
for i, rotated_atoms in enumerate(rotated):
|
112
|
+
write(f"atoms_{i+1}.{ftype}", rotated_atoms)
|
113
|
+
write(f"atoms_0.{ftype}", atoms)
|
109
114
|
|
110
|
-
|
111
|
-
write(fname_y, atoms_y)
|
112
|
-
write(fname_z, atoms_z)
|
113
|
-
print(f"The output has been written to {fname_x}, {fname_y}, {fname_z}")
|
115
|
+
print(f"The output has been written to the atoms_i.{ftype} files. atoms_0.{ftype} contains the reference structure.")
|
TB2J/rotate_siestaDM.py
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
import sisl
|
2
|
+
|
3
|
+
def rotate_siesta_DM(DM, noncollinear=False):
|
4
|
+
|
5
|
+
angles_list = [ [0.0, 90.0, 0.0], [0.0, 90.0, 90.0] ]
|
6
|
+
if noncollinear:
|
7
|
+
angles_list += [[0.0, 45.0, 0.0], [0.0, 90.0, 45.0], [0.0, 45.0, 90.0]]
|
8
|
+
|
9
|
+
for angles in angles_list:
|
10
|
+
yield DM.spin_rotate(angles)
|
11
|
+
|
12
|
+
def read_label(fdf_fname):
|
13
|
+
|
14
|
+
label = 'siesta'
|
15
|
+
with open(fdf_fname, 'r') as File:
|
16
|
+
for line in File:
|
17
|
+
corrected_line = line.lower().replace('.', '').replace('-', '')
|
18
|
+
if 'systemlabel' in corrected_line:
|
19
|
+
label = line.split()[1]
|
20
|
+
break
|
21
|
+
|
22
|
+
return label
|
23
|
+
|
24
|
+
def rotate_DM(fdf_fname, noncollinear=False):
|
25
|
+
|
26
|
+
fdf = sisl.get_sile(fdf_fname)
|
27
|
+
DM = fdf.read_density_matrix()
|
28
|
+
label = read_label(fdf_fname)
|
29
|
+
|
30
|
+
rotated = rotate_siesta_DM(DM, noncollinear=noncollinear)
|
31
|
+
|
32
|
+
for i, rotated_DM in enumerate(rotated):
|
33
|
+
rotated_DM.write(f"{label}_{i+1}.DM")
|
34
|
+
DM.write(f"{label}_0.DM")
|
35
|
+
|
36
|
+
print(f"The output has been written to the {label}_i.DM files. {label}_0.DM contains the reference density matrix.")
|
TB2J/sisl_wrapper.py
CHANGED
@@ -10,7 +10,6 @@ from TB2J.mathutils import Lowdin
|
|
10
10
|
|
11
11
|
class SislWrapper(AbstractTB):
|
12
12
|
def __init__(self, sisl_hamiltonian, geom=None, spin=None):
|
13
|
-
self.is_siesta = False
|
14
13
|
self.is_orthogonal = False
|
15
14
|
self.ham = sisl_hamiltonian
|
16
15
|
# k2Rfactor : H(k) = \int_R H(R) * e^(k2Rfactor * k.R)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import argparse
|
3
3
|
import os
|
4
4
|
import sys
|
5
|
-
from TB2J.io_merge import merge
|
5
|
+
from TB2J.io_merge import merge
|
6
6
|
|
7
7
|
|
8
8
|
def main():
|
@@ -28,11 +28,18 @@ def main():
|
|
28
28
|
type=str,
|
29
29
|
default="TB2J_results",
|
30
30
|
)
|
31
|
+
parser.add_argument(
|
32
|
+
"--main_path",
|
33
|
+
help="The path containning the reference structure.",
|
34
|
+
type=str,
|
35
|
+
default=None
|
36
|
+
)
|
31
37
|
|
32
38
|
args = parser.parse_args()
|
33
39
|
# merge(*(args.directories), args.type.strip().lower(), path=args.output_path)
|
34
40
|
# merge(*(args.directories), method=args.type.strip().lower(), path=args.output_path)
|
35
|
-
merge2(args.directories, args.type.strip().lower(), path=args.output_path)
|
41
|
+
#merge2(args.directories, args.type.strip().lower(), path=args.output_path)
|
42
|
+
merge(*args.directories, main_path=args.main_path, write_path=args.output_path)
|
36
43
|
|
37
44
|
|
38
45
|
main()
|
@@ -14,9 +14,14 @@ def main():
|
|
14
14
|
default="xyz",
|
15
15
|
type=str,
|
16
16
|
)
|
17
|
+
parser.add_argument(
|
18
|
+
"--noncollinear",
|
19
|
+
action="store_true",
|
20
|
+
help="If present, six different configurations will be generated. These are required for non-collinear systems."
|
21
|
+
)
|
17
22
|
|
18
23
|
args = parser.parse_args()
|
19
|
-
rotate_xyz(args.fname, ftype=args.ftype)
|
24
|
+
rotate_xyz(args.fname, ftype=args.ftype, noncollinear=args.noncollinear)
|
20
25
|
|
21
26
|
|
22
27
|
if __name__ == "__main__":
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!python
|
2
|
+
import argparse
|
3
|
+
from TB2J.rotate_siestaDM import rotate_DM
|
4
|
+
|
5
|
+
def main():
|
6
|
+
parser = argparse.ArgumentParser(description="")
|
7
|
+
parser.add_argument(
|
8
|
+
"--fdf_fname", help="Name of the *.fdf siesta file."
|
9
|
+
)
|
10
|
+
parser.add_argument(
|
11
|
+
"--noncollinear",
|
12
|
+
action="store_true",
|
13
|
+
help="If present, six different configurations will be generated. These are required for non-collinear systems."
|
14
|
+
)
|
15
|
+
|
16
|
+
args = parser.parse_args()
|
17
|
+
rotate_DM(args.fdf_fname, noncollinear=args.noncollinear)
|
18
|
+
|
19
|
+
|
20
|
+
if __name__ == "__main__":
|
21
|
+
main()
|
@@ -1,12 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: TB2J
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.0.1
|
4
4
|
Summary: TB2J: First principle to Heisenberg exchange J using tight-binding Green function method
|
5
|
-
Home-page: UNKNOWN
|
6
5
|
Author: Xu He
|
7
6
|
Author-email: mailhexu@gmail.com
|
8
7
|
License: BSD-2-clause
|
9
|
-
Platform: UNKNOWN
|
10
8
|
Classifier: Development Status :: 3 - Alpha
|
11
9
|
Classifier: Programming Language :: Python :: 3
|
12
10
|
Classifier: Operating System :: OS Independent
|
@@ -16,14 +14,13 @@ Classifier: Topic :: Scientific/Engineering :: Physics
|
|
16
14
|
Classifier: License :: OSI Approved :: BSD License
|
17
15
|
Requires-Python: >=3.6
|
18
16
|
License-File: LICENSE
|
19
|
-
Requires-Dist:
|
17
|
+
Requires-Dist: numpy >1.16.5
|
18
|
+
Requires-Dist: scipy
|
20
19
|
Requires-Dist: matplotlib
|
21
|
-
Requires-Dist:
|
22
|
-
Requires-Dist:
|
20
|
+
Requires-Dist: ase >=3.19
|
21
|
+
Requires-Dist: tqdm
|
23
22
|
Requires-Dist: pathos
|
23
|
+
Requires-Dist: packaging >=20.0
|
24
24
|
Requires-Dist: pre-commit
|
25
|
-
Requires-Dist: scipy
|
26
|
-
Requires-Dist: tqdm
|
27
25
|
|
28
26
|
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.
|
29
|
-
|
@@ -2,39 +2,38 @@ TB2J/Jdownfolder.py,sha256=Nw2ixvn2Uq-o1wficz6rdaYHjfRN3U_kQCvrNJGNb68,6980
|
|
2
2
|
TB2J/Jtensor.py,sha256=0fhfOcfVQGu75gytEnApKWTJZfg9ksKJ0anJgco5wRQ,3179
|
3
3
|
TB2J/Oiju.py,sha256=cNGv8N5uH_swGq7cnAt2OyiDfqtjLlLrwseGu0E4iaM,3383
|
4
4
|
TB2J/Oiju_epc.py,sha256=oytM3NYW7nWmklrGgNlqwIpI_JYv_hb7ZnR4o9nYNog,6809
|
5
|
-
TB2J/__init__.py,sha256=
|
5
|
+
TB2J/__init__.py,sha256=hcEWkag_UvLm1ZSbjsgcTWkGVlR3Bwmzg1QYAwsvf-g,24
|
6
6
|
TB2J/basis.py,sha256=DFo6_QUwjBwisP6zGxvoO0lpGTMDPAOkiL9giNCjOjA,1558
|
7
7
|
TB2J/citation.py,sha256=gcQeyJZaT1Qrtsl8Y3s4neOH3-vvgmIcCvXeV2o3vj0,2891
|
8
8
|
TB2J/contour.py,sha256=aw8LX6wVFCRPhcpkzuI0jGnHisvk4cezvUhkF_6Yx94,2633
|
9
|
-
TB2J/cut_cell.py,sha256=kr9WeQhBQLm8QXL2B3NcsSYmSw-OAtJk3f9wksAOZbs,2952
|
10
9
|
TB2J/density_matrix.py,sha256=D5k8Oe21OCiLVORNYbo4TZOFG0slrQSbj91kJ3TMFjs,1514
|
11
10
|
TB2J/epc.py,sha256=zLbtqZJhDr8DnnGN6YENcXwrMb3Qxu6KB08mLy9Pw20,3474
|
12
|
-
TB2J/exchange.py,sha256=
|
11
|
+
TB2J/exchange.py,sha256=dsXQhlxXaBurxa7z3YkBjqmEFFtfEy1xaHf0VT3eKZE,29581
|
13
12
|
TB2J/exchangeCL2.py,sha256=TIr-d2X56AiGe4qEhyXyZhRuwXvQG6clJMwDmjnTOaE,10985
|
14
13
|
TB2J/exchange_pert.py,sha256=jmFMtQbYa_uczM4VAeS6TijkIHRFIqEzZJswzE9Wfuo,8523
|
15
14
|
TB2J/exchange_qspace.py,sha256=ZL68qBGFUaQ9BsSPsJaaoWOr9RssPiqX34R_9I3nk_8,8436
|
16
15
|
TB2J/gpaw_wrapper.py,sha256=aJ--9Dtyq7jOP1Hkh-Sh1nWcfXm6zKcljOCO0DNCAr0,6890
|
17
16
|
TB2J/green.py,sha256=X-D8UZcIyz6zh_0W9VgUUv5yXPP3KWJ6C03m6CMWE3o,13377
|
18
17
|
TB2J/greentest.py,sha256=2ISSfhor9ecSEOi_E6b4Cv26wEIQlwlzca0ru8z44_E,1603
|
19
|
-
TB2J/io_merge.py,sha256=
|
18
|
+
TB2J/io_merge.py,sha256=t85k3L6IL9X5ys-PWK7CzResb3xJsyqM3LAlKPUe9vM,6825
|
20
19
|
TB2J/kpoints.py,sha256=6XK2KqTncidEq3o9GuO6VEZRPNTRtWeXg9QfcV-9smI,532
|
21
20
|
TB2J/manager.py,sha256=4-4x9jJRHpUEqJuhc5HqpXfh2-Ze5G9Wg8gOtn-AqR4,15372
|
22
21
|
TB2J/mathutils.py,sha256=tHA6q3KPDpXLIbZHdDZ2NU5s886VVM_oEG490zQ6Ris,300
|
23
|
-
TB2J/myTB.py,sha256=
|
22
|
+
TB2J/myTB.py,sha256=ok_B4my29bOIghMSZfx0Es6G8FaXaIiLP4gPxTdSj00,17659
|
24
23
|
TB2J/orbmap.py,sha256=RCMJkOPGbfPrcZzcc5ia1ZMKBQWxGcyj8W1ve8BJaEw,6669
|
25
24
|
TB2J/pauli.py,sha256=_FIF62jq2CkQdWC473a3S2F6NmzCdeCnglO9PjNVmMI,4120
|
26
25
|
TB2J/pert.py,sha256=RaCJfewl0doht4cjAnzzGKe-uj2le4aqe0iPKFrq9fo,1192
|
27
26
|
TB2J/plot.py,sha256=AnFIFWE2vlmj7Z6f_7-dX_O1stJN-qbuiurPj43dUCM,4104
|
28
|
-
TB2J/rotate_atoms.py,sha256
|
29
|
-
TB2J/
|
30
|
-
TB2J/
|
27
|
+
TB2J/rotate_atoms.py,sha256=Dwptn-wdDW4zYzjYb95yxTzuZOe9WPuLjh3d3-YcSs0,3277
|
28
|
+
TB2J/rotate_siestaDM.py,sha256=eR97rspdrRaK9YTwQwUKfobI0S9UnEcbEZ2f5IgR7Tk,1070
|
29
|
+
TB2J/sisl_wrapper.py,sha256=A5x1-tt8efUSPeGY5wM5m6-pJYQFXTCzQHVqD6RBa2g,14792
|
31
30
|
TB2J/tensor_rotate.py,sha256=4-DfT_Mg5e40fbd74M5W0D5DqmUq-kVOOLDkkkI834A,8083
|
32
31
|
TB2J/utest.py,sha256=z_ahi7tpHQF9WlHNQihcQ7qzfezRJQXQt28eB1X_z64,3897
|
33
32
|
TB2J/utils.py,sha256=_ARYKAeWfP1p5w0mEl-d7KwNfXoqC85TveYl0iCBD3c,9880
|
34
33
|
TB2J/versioninfo.py,sha256=wZwS9QDFRVDe7rf8JyPDDI8UGdTQiO6Pb_sWv8GAegA,337
|
35
34
|
TB2J/abacus/__init__.py,sha256=5sHiDnF2L-Y80QeET9zOiS83a5T_TQAXvnIhcYB6wNU,56
|
36
35
|
TB2J/abacus/abacus_api.py,sha256=D_NyXW-Pno92d3RVHByx0l1HDPHQAvXsmQVt8cfIGR8,7267
|
37
|
-
TB2J/abacus/abacus_wrapper.py,sha256=
|
36
|
+
TB2J/abacus/abacus_wrapper.py,sha256=QR3ZW6v-d7dgneKwBO5s9FfCjBp-fkWMEaTO4SlcROA,8461
|
38
37
|
TB2J/abacus/gen_exchange_abacus.py,sha256=lKZqkWMnLQtaSwgn8O5Fzr-pV6tzwoMqfZU_vbET6gU,2973
|
39
38
|
TB2J/abacus/orbital_api.py,sha256=l48Hn5z7TA0TH7Is4NDmz74b6B9L2ztYO4dRR37U4mQ,1562
|
40
39
|
TB2J/abacus/stru_api.py,sha256=aBKKlZ2hvAZChVCfNxRdxH51rfHKqZn6kOlazY-yW8k,67888
|
@@ -45,7 +44,6 @@ TB2J/external/p_tqdm.py,sha256=ug1jy3-43r8iW7bC37xzPSIe0EjYKH_GUluGzMiQiDw,5831
|
|
45
44
|
TB2J/io_exchange/__init__.py,sha256=KfGHum7B8E4G_KKfillqw0lErtoyKEuFUUttHLs-mg4,32
|
46
45
|
TB2J/io_exchange/io_exchange.py,sha256=RxCZ7OOxhiIzGrIidCOqxNbgLsrHUfCqDVinMvrPdmI,19354
|
47
46
|
TB2J/io_exchange/io_multibinit.py,sha256=8PDmWxzGuv-GwJosj2ZTmiyNY_duFVWJ4ekCuSqGdd8,6739
|
48
|
-
TB2J/io_exchange/io_pickle.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
47
|
TB2J/io_exchange/io_tomsasd.py,sha256=NqkAC1Fl-CUnFA21eBzSy_S5F_oeQFJysw4UukQbN8o,4173
|
50
48
|
TB2J/io_exchange/io_txt.py,sha256=BMr1eSILlKpgtjvDx7uw2VMAkEKSvGEPNxpaT_zev0I,10547
|
51
49
|
TB2J/io_exchange/io_uppasd.py,sha256=bI4iPEgnK4TvCZNvb6x2xYXgjW7pEehCqmcizy2pqFU,3301
|
@@ -53,10 +51,8 @@ TB2J/io_exchange/io_vampire.py,sha256=UllC4twf06_q2vBCnAYFzEDGvS8mSefwQXDquBuyc0
|
|
53
51
|
TB2J/spinham/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
52
|
TB2J/spinham/base_parser.py,sha256=oQRHvFE_BlUtTaTZykKgvicu40oXcbICB-D1aAt-qlA,2196
|
55
53
|
TB2J/spinham/constants.py,sha256=y4-hRyl5EAR42k24Oa5XhAsUQtKVn1MAgyqNf-p3PrM,762
|
56
|
-
TB2J/spinham/h_matrix.py,sha256=MfHIz6RViKkEB3Mu-WcwNx5uk7A5sjAlbqVG9wYA4xk,2784
|
57
54
|
TB2J/spinham/hamiltonian.py,sha256=OfsjlGIgFwpXaohopZcgPamSfjm3X46_zc245eyTr_A,16607
|
58
55
|
TB2J/spinham/hamiltonian_terms.py,sha256=7e84tfEjvAfZltUkrSWi1sUEiW_itLKy83lxi5iBpcQ,9714
|
59
|
-
TB2J/spinham/obtain_J.py,sha256=sg8tiCRRLEN57Olb3MHIuqkDhAkmu-w87AkM00ylXtA,2401
|
60
56
|
TB2J/spinham/plot.py,sha256=tLLNqFAATVrP1kmSVLPKzn686i-CUyqu4qgOcs-okHI,6599
|
61
57
|
TB2J/spinham/qsolver.py,sha256=Sr9I3aGfVNYn5wzwPx1QonHe6ZZUXBAujWRa7nTA5u4,4986
|
62
58
|
TB2J/spinham/spin_api.py,sha256=oN3AKg1WQl0YzR4f5ealcJOaVoAy8d7HodIwrbXvQeY,2219
|
@@ -65,17 +61,18 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
|
|
65
61
|
TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
|
66
62
|
TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
|
67
63
|
TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
|
68
|
-
TB2J-0.
|
69
|
-
TB2J-0.
|
70
|
-
TB2J-0.
|
71
|
-
TB2J-0.
|
72
|
-
TB2J-0.
|
73
|
-
TB2J-0.
|
74
|
-
TB2J-0.
|
75
|
-
TB2J-0.
|
76
|
-
TB2J-0.
|
77
|
-
TB2J-0.
|
78
|
-
TB2J-0.
|
79
|
-
TB2J-0.
|
80
|
-
TB2J-0.
|
81
|
-
TB2J-0.
|
64
|
+
TB2J-0.9.0.1.data/scripts/TB2J_downfold.py,sha256=F9oImXFysejCMP7eIBjbCX2jdHFOCvDW5beF1sG-UM8,1854
|
65
|
+
TB2J-0.9.0.1.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
|
66
|
+
TB2J-0.9.0.1.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
|
67
|
+
TB2J-0.9.0.1.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
|
68
|
+
TB2J-0.9.0.1.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
|
69
|
+
TB2J-0.9.0.1.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
|
70
|
+
TB2J-0.9.0.1.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
|
71
|
+
TB2J-0.9.0.1.data/scripts/abacus2J.py,sha256=M4B07lvTCDczTPTqvnDh_PERzCARAd09TLKv4aIdSQM,4408
|
72
|
+
TB2J-0.9.0.1.data/scripts/siesta2J.py,sha256=hBzS7ZgoHM3oXlTCQd-xVA07Ks2FiIwyRpQWUFITRPE,4303
|
73
|
+
TB2J-0.9.0.1.data/scripts/wann2J.py,sha256=2t2hWwyELskYCwkGDziCgiIAnfr6odLLJ6cQBJ2RQwQ,5714
|
74
|
+
TB2J-0.9.0.1.dist-info/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
|
75
|
+
TB2J-0.9.0.1.dist-info/METADATA,sha256=ky_ng24tVY8IC_GQn9420M7jzPnCpUiNcp-QtFkUbsk,1420
|
76
|
+
TB2J-0.9.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
77
|
+
TB2J-0.9.0.1.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
|
78
|
+
TB2J-0.9.0.1.dist-info/RECORD,,
|
TB2J/cut_cell.py
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
import numpy as np
|
2
|
-
from TB2J.supercell import find_primitive_cell, map_to_primitive
|
3
|
-
from TB2J.io_exchange.io_exchange import SpinIO, gen_distance_dict
|
4
|
-
|
5
|
-
|
6
|
-
def cut_cell(path, output_path, sc_matrix, origin_atom_id, thr=1e-5):
|
7
|
-
"""
|
8
|
-
Cut the exchange parameters
|
9
|
-
:param path: the original TB2J_results path
|
10
|
-
:param output_path: the output path.
|
11
|
-
:param sc_matrix: the matrix which maps the primitive cell to supercell.
|
12
|
-
:param origin: the origin of the primitive cell.
|
13
|
-
:param thr: the atoms which the reduced position is within -thr to 1.0+thr are considered as inside the primitive atoms
|
14
|
-
:returns:
|
15
|
-
"""
|
16
|
-
sc_matrix = np.asarray(sc_matrix, dtype=int)
|
17
|
-
sc_excparams = SpinIO.load_pickle(path=path, fname='TB2J.pickle')
|
18
|
-
sc_atoms = sc_excparams.atoms
|
19
|
-
uc_atoms, ids = find_primitive_cell(sc_atoms,
|
20
|
-
sc_matrix,
|
21
|
-
origin_atom_id=origin_atom_id,
|
22
|
-
thr=thr,
|
23
|
-
perfect=False)
|
24
|
-
uc_charges = sc_excparams.charges[ids]
|
25
|
-
uc_spinat = sc_excparams.spinat[ids]
|
26
|
-
indmap, Rmap = map_to_primitive(sc_atoms, uc_atoms)
|
27
|
-
|
28
|
-
# TODO index_spin: {iatom: ispin}
|
29
|
-
|
30
|
-
# list of iatom for each spin index.
|
31
|
-
uc_index_spin = [sc_excparams.index_spin[i] for i in ids]
|
32
|
-
|
33
|
-
uc_ind_atoms = {}
|
34
|
-
for iatom, ispin in enumerate(uc_index_spin):
|
35
|
-
if ispin >= 0:
|
36
|
-
uc_ind_atoms[ispin] = iatom
|
37
|
-
|
38
|
-
uc_Jdict = {}
|
39
|
-
uc_Rset = set()
|
40
|
-
for key, val in sc_excparams.exchange_Jdict.items():
|
41
|
-
R, ispin, jspin = key
|
42
|
-
iatom = sc_excparams.ind_atoms[ispin]
|
43
|
-
jatom = sc_excparams.ind_atoms[jspin]
|
44
|
-
uc_ispin = uc_index_spin[indmap[iatom]]
|
45
|
-
uc_jspin = uc_index_spin[indmap[jatom]]
|
46
|
-
uc_R = R @ sc_matrix + Rmap[jatom] - Rmap[iatom]
|
47
|
-
uc_R = tuple(uc_R)
|
48
|
-
if iatom in ids:
|
49
|
-
#print(f"{iatom=}, {indmap[iatom]=},{uc_ispin=}, {uc_jspin=}, {uc_R=} ")
|
50
|
-
uc_Jdict[(uc_R, uc_ispin, uc_jspin)] = val
|
51
|
-
uc_Rset.add(uc_R)
|
52
|
-
|
53
|
-
uc_distance_dict = gen_distance_dict(uc_ind_atoms, uc_atoms, list(uc_Rset))
|
54
|
-
|
55
|
-
assert sc_excparams.colinear, "Cut supercell for non-collinear spin is not yet implemented."
|
56
|
-
|
57
|
-
uc_exc = SpinIO(uc_atoms,
|
58
|
-
spinat=uc_spinat,
|
59
|
-
charges=uc_charges,
|
60
|
-
index_spin=uc_index_spin,
|
61
|
-
colinear=sc_excparams.colinear,
|
62
|
-
distance_dict=uc_distance_dict,
|
63
|
-
exchange_Jdict=uc_Jdict,
|
64
|
-
description="Cutted")
|
65
|
-
|
66
|
-
uc_exc.write_all(output_path)
|
67
|
-
|
68
|
-
|
69
|
-
def run_cut_cell(
|
70
|
-
path="TB2J_results",
|
71
|
-
output_path="./TB2J_cutted",
|
72
|
-
sc_matrix=np.array([[1, 1, 0], [-1, 1, 0], [0, 0, 2]]),
|
73
|
-
):
|
74
|
-
cut_cell(path,
|
75
|
-
output_path,
|
76
|
-
np.array(sc_matrix),
|
77
|
-
origin_atom_id=0,
|
78
|
-
thr=1e-19)
|
79
|
-
|
80
|
-
|
81
|
-
if __name__ == "__main__":
|
82
|
-
run_cut_cell()
|
TB2J/io_exchange/io_pickle.py
DELETED
File without changes
|
TB2J/spinham/h_matrix.py
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
import numpy as np
|
2
|
-
import matplotlib.pyplot as plt
|
3
|
-
import aiida
|
4
|
-
from aiida_tb2j.data import ExchangeData
|
5
|
-
|
6
|
-
def plot_dispersion(bands, kpoint_labels, color='blue', title=None):
|
7
|
-
|
8
|
-
fig, axs = plt.subplots(1, 1, constrained_layout=True)
|
9
|
-
fig.set_size_inches(6, 6/1.618)
|
10
|
-
|
11
|
-
'''
|
12
|
-
Plot the bands
|
13
|
-
'''
|
14
|
-
kpoints = np.arange(len(bands))
|
15
|
-
axs.plot(kpoints, bands, color=color, linewidth=1.5)
|
16
|
-
|
17
|
-
'''
|
18
|
-
Plot the symmetry points
|
19
|
-
'''
|
20
|
-
bmin = bands.min(); bmax = bands.max()
|
21
|
-
ymin = bmin - 0.05*np.abs(bmin-bmax); ymax = bmax + 0.05*np.abs(bmax-bmin);
|
22
|
-
axs.set_xticks(kpoint_labels[0], kpoint_labels[1], fontsize=10)
|
23
|
-
axs.vlines(x=kpoint_labels[0], ymin=ymin, ymax=ymax, color='black', linewidth=0.5)
|
24
|
-
axs.set_xlim([0, len(kpoints)])
|
25
|
-
axs.set_ylim([ymin, ymax])
|
26
|
-
|
27
|
-
if title is not None:
|
28
|
-
plt.title(title, fontsize=10)
|
29
|
-
|
30
|
-
plt.show()
|
31
|
-
|
32
|
-
|
33
|
-
if __name__ == "__main__":
|
34
|
-
|
35
|
-
from argparse import ArgumentParser
|
36
|
-
|
37
|
-
parser = ArgumentParser()
|
38
|
-
parser.add_argument('-f', '--pickle_filename', type=str, help="Path of the 'TB2J.pickle' file.", required=True)
|
39
|
-
args = parser.parse_args()
|
40
|
-
|
41
|
-
'''
|
42
|
-
Right now the implementation depends on AiiDA and so we must create and load an AiiDA profile,
|
43
|
-
even if we do not store any information on a data base.
|
44
|
-
'''
|
45
|
-
aiida.load_profile()
|
46
|
-
'''
|
47
|
-
Create an ExchangeData object with the informations from the TB2J.pickle file
|
48
|
-
'''
|
49
|
-
exchange = ExchangeData.load_tb2j(pickle_file=args.pickle_filename, isotropic=False, pbc=(True, True, True))
|
50
|
-
'''
|
51
|
-
Compute the magnon band structure along a high symmetry path generated with
|
52
|
-
the ASE package. The informations is stored in an AiiDA BandsData object.
|
53
|
-
Here tol is the symmetry tolerance to determine the space group of the system.
|
54
|
-
They are in units of eV
|
55
|
-
'''
|
56
|
-
magnon_data = exchange.get_magnon_bands(npoints=300, tol=1e-1, with_DMI=True, with_Jani=True)
|
57
|
-
magnon_bands = 1000*magnon_data.get_bands() # Convert to meV
|
58
|
-
raw_labels = [(k, '$\Gamma$') if s == 'GAMMA' else (k, s) for k, s in magnon_data.labels]
|
59
|
-
kpoint_labels = list( zip( *raw_labels ) )
|
60
|
-
plot_dispersion(magnon_bands, kpoint_labels, color='blue', title='Magnon Bands')
|
61
|
-
'''
|
62
|
-
We can also obtain the dynamical matrix h instead of the actual magnon bands. The result
|
63
|
-
is stored in a numpy array with shape (number of kpoints, 2*natoms, 2*natoms)
|
64
|
-
'''
|
65
|
-
kpoints = magnon_data.get_kpoints() # The shape of the kpoints must be (nkpoints, 3)
|
66
|
-
h_matrix = 1000*exchange._H_matrix(kpoints, with_DMI=True, with_Jani=True) # Convert to meV
|
67
|
-
h_dispersion = np.linalg.eigvalsh(h_matrix) # We can also get the eigenvectors with np.linalg.eigh
|
68
|
-
plot_dispersion(h_dispersion, kpoint_labels, color='red', title='h matrix dispersion')
|
TB2J/spinham/obtain_J.py
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
import numpy as np
|
2
|
-
from aiida_tb2j.data import ExchangeData
|
3
|
-
from aiida_tb2j.data.exchange import get_rotation_arrays
|
4
|
-
from itertools import combinations_with_replacement
|
5
|
-
|
6
|
-
ux, uy, uz = np.eye(3).reshape((3, 1, 3))
|
7
|
-
|
8
|
-
def combine_arrays(u, v):
|
9
|
-
|
10
|
-
return np.concatenate([u*v, np.roll(u, -1, axis=-1)*v, np.roll(v, -1, axis=-1)*u], axis=-1)
|
11
|
-
|
12
|
-
def get_coefficients(magmoms, indices):
|
13
|
-
|
14
|
-
i, j = indices
|
15
|
-
|
16
|
-
U, V = zip(*[get_rotation_arrays(magmoms, u=u) for u in [ux, uy, uz]])
|
17
|
-
U = np.stack(U).swapaxes(0, 1)
|
18
|
-
V = np.stack(V).swapaxes(0, 1)
|
19
|
-
|
20
|
-
uc = combine_arrays(U[i], U[j].conj())
|
21
|
-
ur = combine_arrays(U[i], U[j])
|
22
|
-
uc2 = combine_arrays(U[i].conj(), U[j])
|
23
|
-
u = np.concatenate([uc, ur, uc2], axis=1)
|
24
|
-
|
25
|
-
return u, V
|
26
|
-
|
27
|
-
def get_C(H0, u, V):
|
28
|
-
|
29
|
-
n = int(H0.shape[-1]/2)
|
30
|
-
upi = np.triu_indices(n)
|
31
|
-
dig = np.diag_indices(n)
|
32
|
-
|
33
|
-
i, j = upi
|
34
|
-
AB0 = H0[:, [i, i, i+n], [j, j+n, j+n]]
|
35
|
-
AB0 = np.swapaxes(AB0, 0, 2).reshape(len(i), 9)
|
36
|
-
J0_flat = np.linalg.solve(u, AB0)
|
37
|
-
|
38
|
-
J0 = np.empty((n, n, 3, 3), dtype=complex)
|
39
|
-
J0[*upi] = J0_flat[:, [0, 6, 5, 3, 1, 7, 8, 4, 2]].reshape(-1, 3, 3)
|
40
|
-
J0 += J0.swapaxes(0, 1)
|
41
|
-
J0[*dig] = 0.0
|
42
|
-
|
43
|
-
C = np.array([np.diag(a) for a in np.einsum('imx,ijxy,jmy->mi', V, 2*J0, V)])
|
44
|
-
|
45
|
-
return C
|
46
|
-
|
47
|
-
def get_J(H, kpoints, exchange):
|
48
|
-
|
49
|
-
n = int(H.shape[-1]/2)
|
50
|
-
upi = np.triu_indices(n)
|
51
|
-
dig = np.diag_indices(n)
|
52
|
-
i, j = upi
|
53
|
-
|
54
|
-
magmoms = exchange.magmoms()[np.unique(exchange.pairs)]
|
55
|
-
magmoms /= np.linalg.norm(magmoms, axis=-1).reshape(-1, 1)
|
56
|
-
u, V = get_coefficients(magmoms, indices=upi)
|
57
|
-
|
58
|
-
H0 = np.stack([1000*exchange._H_matrix(kpoints=np.zeros((1, 3)), with_DMI=True, with_Jani=True, u=u) for u in [ux, uy, uz]])[:, 0, :, :]
|
59
|
-
C = get_C(H0, u, V)
|
60
|
-
H[:, :, :n, :n] += C.reshape(3, 1, n, n)
|
61
|
-
H[:, :, n:, n:] += C.reshape(3, 1, n, n)
|
62
|
-
|
63
|
-
AB = H[:, :, [i, i, i+n], [j, j+n, j+n]]
|
64
|
-
AB[:, :, 2, :] = AB[:, ::-1, 2, :]
|
65
|
-
AB = np.moveaxis(AB, [2, 3], [1, 0]).reshape(len(i), 9, -1)
|
66
|
-
|
67
|
-
vectors = exchange.get_vectors()
|
68
|
-
exp_summand = np.exp( -2j*np.pi*vectors @ kpoints.T )
|
69
|
-
nAB = np.einsum('nik,ndk->nid', AB, exp_summand) / len(kpoints)
|
70
|
-
|
71
|
-
ii = np.where(i == j)
|
72
|
-
i0 = np.where(np.linalg.norm(vectors, axis=-1) == 0.0)
|
73
|
-
J = np.linalg.solve(u, nAB).swapaxes(1, 2)
|
74
|
-
J = J[:, :, [0, 6, 5, 3, 1, 7, 8, 4, 2]].reshape(len(i), -1, 3, 3)
|
75
|
-
J *= -1
|
76
|
-
J[ii] *= 2
|
77
|
-
J[i0] *= 0
|
78
|
-
|
79
|
-
return J
|