TB2J 0.9.9.3__tar.gz → 0.9.9.6__tar.gz
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-0.9.9.3 → tb2j-0.9.9.6}/PKG-INFO +1 -2
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/Jdownfolder.py +3 -2
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/MAEGreen.py +22 -17
- tb2j-0.9.9.6/TB2J/__init__.py +1 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/exchange_params.py +1 -2
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/gen_exchange_abacus.py +3 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/siesta_interface.py +15 -7
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/__init__.py +2 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_exchange.py +40 -12
- tb2j-0.9.9.6/TB2J/magnon/__init__.py +3 -0
- tb2j-0.9.9.6/TB2J/magnon/io_exchange2.py +695 -0
- tb2j-0.9.9.6/TB2J/magnon/magnon3.py +334 -0
- tb2j-0.9.9.6/TB2J/magnon/magnon_io.py +48 -0
- tb2j-0.9.9.6/TB2J/magnon/magnon_math.py +53 -0
- tb2j-0.9.9.6/TB2J/magnon/plot.py +58 -0
- tb2j-0.9.9.6/TB2J/magnon/structure.py +348 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/__init__.py +2 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/fibonacci_sphere.py +1 -1
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/rotate_spin.py +0 -3
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/symmetrize_J.py +1 -1
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/PKG-INFO +1 -2
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/SOURCES.txt +8 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/requires.txt +0 -1
- tb2j-0.9.9.6/scripts/TB2J_magnon2.py +78 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/abacus2J.py +1 -1
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/setup.py +2 -2
- tb2j-0.9.9.3/TB2J/__init__.py +0 -1
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/LICENSE +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/README.md +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/Jtensor.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/MAE.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/Oiju.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/Oiju_epc.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/anisotropy.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/basis.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/citation.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/contour.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/density_matrix.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/epc.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/exchange.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/exchangeCL2.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/exchange_pert.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/exchange_qspace.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/external/__init__.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/external/p_tqdm.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/gpaw_wrapper.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/green.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/greentest.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/__init__.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/__init__.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/abacus_api.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/abacus_wrapper.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/orbital_api.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/stru_api.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/test_density_matrix.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/test_read_HRSR.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/abacus/test_read_stru.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/gpaw_interface.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/lawaf_interface.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/manager.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/interfaces/wannier90_interface.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_multibinit.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_tomsasd.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_txt.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_uppasd.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_exchange/io_vampire.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/io_merge.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/kpoints.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/fermi.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/kR_convert.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mathutils/lowdin.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/myTB.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/mycfr.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/orbital_magmom.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/orbmap.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/pauli.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/pert.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/plot.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/rotate_atoms.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/rotate_siestaDM.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/sisl_wrapper.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/__init__.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/base_parser.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/constants.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/hamiltonian.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/hamiltonian_terms.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/plot.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/qsolver.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/spin_api.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/spin_xml.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/spinham/supercell.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/tensor_rotate.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/thetaphi.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/utest.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/utils.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/versioninfo.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/wannier/__init__.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/wannier/w90_parser.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J/wannier/w90_tb_parser.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/dependency_links.txt +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/entry_points.txt +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/TB2J.egg-info/top_level.txt +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_downfold.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_eigen.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_magnon.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_magnon_dos.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_merge.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_rotate.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/TB2J_rotateDM.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/siesta2J.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/scripts/wann2J.py +0 -0
- {tb2j-0.9.9.3 → tb2j-0.9.9.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: TB2J
|
3
|
-
Version: 0.9.9.
|
3
|
+
Version: 0.9.9.6
|
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
|
@@ -25,7 +25,6 @@ Requires-Dist: HamiltonIO>=0.2.1
|
|
25
25
|
Requires-Dist: pre-commit
|
26
26
|
Requires-Dist: sympair>0.1.0
|
27
27
|
Requires-Dist: sisl>=0.9.0
|
28
|
-
Requires-Dist: netcdf4
|
29
28
|
Dynamic: author
|
30
29
|
Dynamic: author-email
|
31
30
|
Dynamic: classifier
|
@@ -136,7 +136,7 @@ class JDownfolder_pickle:
|
|
136
136
|
outpath,
|
137
137
|
qmesh=[7, 7, 7],
|
138
138
|
iso_only=False,
|
139
|
-
method="
|
139
|
+
method="lowdin",
|
140
140
|
**kwargs,
|
141
141
|
):
|
142
142
|
self.exc = SpinIO.load_pickle(path=inpath, fname="TB2J.pickle")
|
@@ -146,6 +146,7 @@ class JDownfolder_pickle:
|
|
146
146
|
self.ligands = ligands
|
147
147
|
self.outpath = outpath
|
148
148
|
self.method = method
|
149
|
+
print("Using method:", self.method)
|
149
150
|
|
150
151
|
# read atomic structure
|
151
152
|
self.atoms = self.exc.atoms
|
@@ -176,7 +177,7 @@ class JDownfolder_pickle:
|
|
176
177
|
|
177
178
|
def _downfold(self, **kwargs):
|
178
179
|
JR2 = self.exc.get_full_Jtensor_for_Rlist(asr=True)
|
179
|
-
if self.method == "lowdin":
|
180
|
+
if self.method.lower() == "lowdin":
|
180
181
|
d = JDownfolder(
|
181
182
|
JR2,
|
182
183
|
self.exc.Rlist,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import gc
|
2
2
|
from pathlib import Path
|
3
3
|
|
4
|
-
import matplotlib.pyplot as plt
|
5
4
|
import numpy as np
|
6
5
|
import tqdm
|
7
6
|
from HamiltonIO.abacus.abacus_wrapper import AbacusSplitSOCParser
|
@@ -32,7 +31,9 @@ class MAEGreen(ExchangeNCL):
|
|
32
31
|
"""
|
33
32
|
super().__init__(**kwargs)
|
34
33
|
self.natoms = len(self.atoms)
|
35
|
-
if angles is None or angles == "
|
34
|
+
if angles is None or angles == "xyz":
|
35
|
+
self.set_angles_xyz()
|
36
|
+
elif angles == "axis":
|
36
37
|
self.set_angles_axis()
|
37
38
|
elif angles == "scan":
|
38
39
|
self.set_angles_scan()
|
@@ -51,6 +52,11 @@ class MAEGreen(ExchangeNCL):
|
|
51
52
|
self.es_atom = np.zeros((nangles, self.natoms), dtype=complex)
|
52
53
|
self.es_atom_orb = DefaultDict(lambda: 0)
|
53
54
|
|
55
|
+
def set_angles_xyz(self):
|
56
|
+
"""theta and phi are defined as the x, y, z, xy, yz, xz, xyz, x-yz, -xyz, -x-yz axis."""
|
57
|
+
self.thetas = [np.pi / 2, np.pi / 2, 0.0]
|
58
|
+
self.phis = [np.pi / 2, 0, 0.0]
|
59
|
+
|
54
60
|
def set_angles_axis(self):
|
55
61
|
"""theta and phi are defined as the x, y, z, xy, yz, xz, xyz, x-yz, -xyz, -x-yz axis."""
|
56
62
|
self.thetas = [0, np.pi / 2, np.pi / 2, np.pi / 2, np.pi, 0, np.pi / 2, 0, 0, 0]
|
@@ -75,7 +81,6 @@ class MAEGreen(ExchangeNCL):
|
|
75
81
|
self.thetas = thetas
|
76
82
|
self.phis = phis
|
77
83
|
self.angle_pairs = list(zip(thetas, phis))
|
78
|
-
# remove duplicates of angles using sets.
|
79
84
|
self.angle_pairs = list(set(self.angle_pairs))
|
80
85
|
self.thetas, self.phis = zip(*self.angle_pairs)
|
81
86
|
|
@@ -248,11 +253,11 @@ class MAEGreen(ExchangeNCL):
|
|
248
253
|
Path(output_path).mkdir(exist_ok=True)
|
249
254
|
fname = f"{output_path}/MAE.dat"
|
250
255
|
fname_orb = f"{output_path}/MAE_orb.dat"
|
251
|
-
fname_tensor = f"{output_path}/MAE_tensor.dat"
|
252
|
-
if figure3d is not None:
|
253
|
-
|
254
|
-
if figure_contourf is not None:
|
255
|
-
|
256
|
+
# fname_tensor = f"{output_path}/MAE_tensor.dat"
|
257
|
+
# if figure3d is not None:
|
258
|
+
# fname_fig3d = f"{output_path}/{figure3d}"
|
259
|
+
# if figure_contourf is not None:
|
260
|
+
# fname_figcontourf = f"{output_path}/{figure_contourf}"
|
256
261
|
|
257
262
|
# ouput with eigenvalues.
|
258
263
|
if with_eigen:
|
@@ -277,18 +282,18 @@ class MAEGreen(ExchangeNCL):
|
|
277
282
|
f.write(f"{ea*1e3:.8f} ")
|
278
283
|
f.write("\n")
|
279
284
|
|
280
|
-
self.ani = self.fit_anisotropy_tensor()
|
281
|
-
with open(fname_tensor, "w") as f:
|
282
|
-
|
283
|
-
|
285
|
+
# self.ani = self.fit_anisotropy_tensor()
|
286
|
+
# with open(fname_tensor, "w") as f:
|
287
|
+
# f.write("# Anisotropy tensor in meV\n")
|
288
|
+
# f.write(f"{self.ani.tensor_strings(include_isotropic=False)}\n")
|
284
289
|
|
285
|
-
if figure3d is not None:
|
286
|
-
|
290
|
+
# if figure3d is not None:
|
291
|
+
# self.ani.plot_3d(figname=fname_fig3d, show=False)
|
287
292
|
|
288
|
-
if figure_contourf is not None:
|
289
|
-
|
293
|
+
# if figure_contourf is not None:
|
294
|
+
# self.ani.plot_contourf(figname=fname_figcontourf, show=False)
|
290
295
|
|
291
|
-
plt.close()
|
296
|
+
# plt.close()
|
292
297
|
gc.collect()
|
293
298
|
|
294
299
|
with open(fname_orb, "w") as f:
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.9.0.1"
|
@@ -30,6 +30,7 @@ def gen_exchange_abacus(
|
|
30
30
|
nproc=1,
|
31
31
|
output_path="TB2J_results",
|
32
32
|
orb_decomposition=False,
|
33
|
+
index_magnetic_atoms=None,
|
33
34
|
description=None,
|
34
35
|
):
|
35
36
|
outpath = Path(path) / f"OUT.{suffix}"
|
@@ -64,6 +65,7 @@ data directory: {outpath}
|
|
64
65
|
use_cache=use_cache,
|
65
66
|
output_path=output_path,
|
66
67
|
orb_decomposition=orb_decomposition,
|
68
|
+
index_magnetic_atoms=index_magnetic_atoms,
|
67
69
|
description=description,
|
68
70
|
)
|
69
71
|
exchange.run(path=output_path)
|
@@ -90,6 +92,7 @@ data directory: {outpath}
|
|
90
92
|
nproc=nproc,
|
91
93
|
use_cache=use_cache,
|
92
94
|
orb_decomposition=orb_decomposition,
|
95
|
+
index_magnetic_atoms=index_magnetic_atoms,
|
93
96
|
description=description,
|
94
97
|
)
|
95
98
|
exchange.run()
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
4
4
|
|
5
5
|
from TB2J.exchange import ExchangeNCL
|
6
6
|
from TB2J.exchangeCL2 import ExchangeCL2
|
7
|
+
from TB2J.io_merge import merge
|
7
8
|
from TB2J.MAEGreen import MAEGreen
|
8
9
|
|
9
10
|
try:
|
@@ -156,7 +157,7 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
156
157
|
atoms=model.atoms,
|
157
158
|
basis=basis,
|
158
159
|
efermi=None,
|
159
|
-
angles="
|
160
|
+
angles="axis",
|
160
161
|
# magnetic_elements=magnetic_elements,
|
161
162
|
# include_orbs=include_orbs,
|
162
163
|
**exargs,
|
@@ -165,13 +166,12 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
165
166
|
# phis = [0, 0, 0, 0]
|
166
167
|
# MAE.set_angles(thetas=thetas, phis=phis)
|
167
168
|
MAE.run(output_path=f"{output_path}_anisotropy", with_eigen=False)
|
168
|
-
print(
|
169
|
-
|
170
|
-
)
|
169
|
+
# print(
|
170
|
+
# f"MAE calculation finished. The results are in {output_path} directory."
|
171
|
+
# )
|
171
172
|
|
172
173
|
angle = {"x": (np.pi / 2, 0), "y": (np.pi / 2, np.pi / 2), "z": (0, 0)}
|
173
174
|
for key, val in angle.items():
|
174
|
-
# model = parser.get_model()
|
175
175
|
theta, phi = val
|
176
176
|
model.set_so_strength(1.0)
|
177
177
|
model.set_Hsoc_rotation_angle([theta, phi])
|
@@ -182,8 +182,6 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
182
182
|
atoms=model.atoms,
|
183
183
|
basis=basis,
|
184
184
|
efermi=None, # set to None, compute from efermi.
|
185
|
-
# magnetic_elements=magnetic_elements,
|
186
|
-
# include_orbs=include_orbs,
|
187
185
|
**exargs,
|
188
186
|
)
|
189
187
|
exchange.run(path=output_path_full)
|
@@ -191,3 +189,13 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
191
189
|
print(
|
192
190
|
f"All calculation finished. The results are in {output_path_full} directory."
|
193
191
|
)
|
192
|
+
|
193
|
+
merge(
|
194
|
+
"TB2J_results_x",
|
195
|
+
"TB2J_results_y",
|
196
|
+
"TB2J_results_z",
|
197
|
+
main_path=None,
|
198
|
+
save=True,
|
199
|
+
write_path="TB2J_results",
|
200
|
+
)
|
201
|
+
print("Final TB2J_results written to TB2J_results directory.")
|
@@ -335,7 +335,7 @@ Generation time: {now.strftime("%y/%m/%d %H:%M:%S")}
|
|
335
335
|
)
|
336
336
|
return Jtensor
|
337
337
|
|
338
|
-
def
|
338
|
+
def get_full_Jtensor_for_one_R_i3j3(self, R, iso_only=False):
|
339
339
|
"""
|
340
340
|
Return the full exchange tensor of all i and j for cell R.
|
341
341
|
param R (tuple of integers): cell index R
|
@@ -351,18 +351,46 @@ Generation time: {now.strftime("%y/%m/%d %H:%M:%S")}
|
|
351
351
|
)
|
352
352
|
return Jmat
|
353
353
|
|
354
|
-
def
|
355
|
-
|
354
|
+
def get_full_Jtensor_for_one_R_ij33(self, R, iso_only=False):
|
355
|
+
"""
|
356
|
+
Return the full exchange tensor of all i and j for cell R.
|
357
|
+
param R (tuple of integers): cell index R
|
358
|
+
returns:
|
359
|
+
Jmat: (nspin,nspin,3,3) matrix.
|
360
|
+
"""
|
361
|
+
n = self.nspin
|
362
|
+
Jmat = np.zeros((n, n, 3, 3), dtype=float)
|
363
|
+
for i in range(self.nspin):
|
364
|
+
for j in range(self.nspin):
|
365
|
+
Jmat[i, j, :, :] = self.get_J_tensor(i, j, R, iso_only=iso_only)
|
366
|
+
return Jmat
|
367
|
+
|
368
|
+
def get_full_Jtensor_for_Rlist(self, asr=False, iso_only=True, order="i3j3"):
|
369
|
+
n = self.nspin
|
370
|
+
n3 = n * 3
|
356
371
|
nR = len(self.Rlist)
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
372
|
+
if order == "i3j3":
|
373
|
+
Jmat = np.zeros((nR, n3, n3), dtype=float)
|
374
|
+
for iR, R in enumerate(self.Rlist):
|
375
|
+
Jmat[iR] = self.get_full_Jtensor_for_one_R_i3j3(R, iso_only=iso_only)
|
376
|
+
if asr:
|
377
|
+
iR0 = np.argmin(np.linalg.norm(self.Rlist, axis=1))
|
378
|
+
assert np.linalg.norm(self.Rlist[iR0]) == 0
|
379
|
+
for i in range(n3):
|
380
|
+
sum_JRi = np.sum(np.sum(Jmat, axis=0)[i])
|
381
|
+
Jmat[iR0][i, i] -= sum_JRi
|
382
|
+
|
383
|
+
elif order == "ij33":
|
384
|
+
Jmat = np.zeros((nR, n, n, 3, 3), dtype=float)
|
385
|
+
Jmat[iR] = self.get_full_Jtensor_for_one_R_ij33(R, iso_only=iso_only)
|
386
|
+
if asr:
|
387
|
+
iR0 = np.argmin(np.linalg.norm(self.Rlist, axis=1))
|
388
|
+
assert np.linalg.norm(self.Rlist[iR0]) == 0
|
389
|
+
for i in range(n):
|
390
|
+
sum_JRi = np.sum(np.sum(Jmat, axis=0)[i])
|
391
|
+
Jmat[iR0][i, i] -= sum_JRi
|
392
|
+
else:
|
393
|
+
raise ValueError("order must be either 'i3j3' or 'ij33'.")
|
366
394
|
return Jmat
|
367
395
|
|
368
396
|
def write_pickle(self, path="TB2J_results", fname="TB2J.pickle"):
|