TB2J 0.9.6rc0__py3-none-any.whl → 0.9.7rc0__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 +41 -7
- TB2J/MAEGreen.py +84 -0
- TB2J/exchange.py +8 -82
- TB2J/green.py +1 -1
- TB2J/interfaces/siesta_interface.py +90 -62
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/METADATA +1 -1
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/RECORD +21 -20
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_downfold.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_eigen.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_magnon.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_magnon_dos.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_merge.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_rotate.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/TB2J_rotateDM.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/abacus2J.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/siesta2J.py +0 -0
- {TB2J-0.9.6rc0.data → TB2J-0.9.7rc0.data}/scripts/wann2J.py +0 -0
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/LICENSE +0 -0
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/WHEEL +0 -0
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/entry_points.txt +0 -0
- {TB2J-0.9.6rc0.dist-info → TB2J-0.9.7rc0.dist-info}/top_level.txt +0 -0
TB2J/MAE.py
CHANGED
@@ -35,12 +35,25 @@ def get_density_matrix(evals=None, evecs=None, kweights=None, nel=None, width=0.
|
|
35
35
|
|
36
36
|
|
37
37
|
class MAE:
|
38
|
-
def __init__(
|
38
|
+
def __init__(
|
39
|
+
self,
|
40
|
+
model,
|
41
|
+
kmesh=None,
|
42
|
+
gamma=True,
|
43
|
+
kpts=None,
|
44
|
+
kweights=None,
|
45
|
+
width=0.1,
|
46
|
+
nel=None,
|
47
|
+
):
|
39
48
|
self.model = model
|
40
49
|
if nel is not None:
|
41
50
|
self.model.nel = nel
|
42
|
-
|
43
|
-
|
51
|
+
if kpts is None:
|
52
|
+
self.kpts = monkhorst_pack(kmesh, gamma_center=gamma)
|
53
|
+
self.kweights = np.ones(len(self.kpts), dtype=float) / len(self.kpts)
|
54
|
+
else:
|
55
|
+
self.kpts = kpts
|
56
|
+
self.kweights = kweights
|
44
57
|
self.width = width
|
45
58
|
|
46
59
|
def get_band_energy(self):
|
@@ -94,8 +107,27 @@ class MAE:
|
|
94
107
|
|
95
108
|
|
96
109
|
class MAEGreen(MAE):
|
97
|
-
def __init__(
|
98
|
-
|
110
|
+
def __init__(
|
111
|
+
self,
|
112
|
+
model,
|
113
|
+
kmesh=None,
|
114
|
+
gamma=True,
|
115
|
+
kpts=None,
|
116
|
+
kweights=None,
|
117
|
+
nel=None,
|
118
|
+
width=0.1,
|
119
|
+
**kwargs,
|
120
|
+
):
|
121
|
+
self.model = model
|
122
|
+
if nel is not None:
|
123
|
+
self.model.nel = nel
|
124
|
+
if kpts is None:
|
125
|
+
self.kpts = monkhorst_pack(kmesh, gamma_center=gamma)
|
126
|
+
self.kweights = np.ones(len(self.kpts), dtype=float) / len(self.kpts)
|
127
|
+
else:
|
128
|
+
self.kpts = kpts
|
129
|
+
self.kweights = kweights
|
130
|
+
self.width = width
|
99
131
|
model.set_so_strength(0.0)
|
100
132
|
evals, evecs = model.solve_all(self.kpts)
|
101
133
|
occ = Occupations(
|
@@ -103,8 +135,9 @@ class MAEGreen(MAE):
|
|
103
135
|
)
|
104
136
|
# occ.occupy(evals)
|
105
137
|
efermi = occ.efermi(evals)
|
138
|
+
print(f"{efermi=}")
|
106
139
|
self.G = TBGreen(model, kmesh, efermi=efermi, gamma=gamma, **kwargs)
|
107
|
-
self.emin = -
|
140
|
+
self.emin = -12
|
108
141
|
self.emax = 0
|
109
142
|
self.nz = 50
|
110
143
|
self._prepare_elist()
|
@@ -143,7 +176,8 @@ class MAEGreen(MAE):
|
|
143
176
|
for i, dHk in enumerate(Hsoc_k):
|
144
177
|
dHi = rotate_spinor_matrix(dHk, theta, phi)
|
145
178
|
GdH = G0K[i] @ dHi
|
146
|
-
dE += np.trace(GdH @ G0K[i].T.conj() @ dHi) * self.kweights[i]
|
179
|
+
# dE += np.trace(GdH @ G0K[i].T.conj() @ dHi) * self.kweights[i]
|
180
|
+
dE += np.trace(GdH @ GdH) * self.kweights[i]
|
147
181
|
dE_ang.append(dE)
|
148
182
|
return np.array(dE_ang)
|
149
183
|
|
TB2J/MAEGreen.py
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
import numpy as np
|
4
|
+
import tqdm
|
5
|
+
|
6
|
+
# from TB2J.abacus.abacus_wrapper import AbacusSplitSOCParser
|
7
|
+
from TB2J.exchange import ExchangeNCL
|
8
|
+
|
9
|
+
# from HamiltonIO.model.rotate_spin import rotate_Matrix_from_z_to_axis, rotate_Matrix_from_z_to_sperical
|
10
|
+
# from TB2J.abacus.abacus_wrapper import AbacusWrapper, AbacusParser
|
11
|
+
from TB2J.mathutils.rotate_spin import (
|
12
|
+
rotate_spinor_matrix,
|
13
|
+
)
|
14
|
+
|
15
|
+
|
16
|
+
class MAEGreen(ExchangeNCL):
|
17
|
+
def __init__(self, angles=None, **kwargs):
|
18
|
+
super().__init__(**kwargs)
|
19
|
+
self.es = None
|
20
|
+
self.natoms = len(self.atoms)
|
21
|
+
if angles is None or angles == "axis":
|
22
|
+
self.set_angles_axis()
|
23
|
+
elif angles == "scan":
|
24
|
+
self.set_angles_scan()
|
25
|
+
|
26
|
+
def set_angles_axis(self):
|
27
|
+
"""theta and phi are defined as the x, y, z, axis."""
|
28
|
+
self.thetas = [0, np.pi / 2, np.pi / 2, np.pi / 2]
|
29
|
+
self.phis = [0, 0, np.pi / 2, np.pi / 4]
|
30
|
+
|
31
|
+
def set_angles_scan(self, step=15):
|
32
|
+
self.thetas = []
|
33
|
+
self.phis = []
|
34
|
+
for i in range(0, 181, step):
|
35
|
+
for j in range(0, 181, step):
|
36
|
+
self.thetas.append(i * np.pi / 180)
|
37
|
+
self.phis.append(j * np.pi / 180)
|
38
|
+
|
39
|
+
def get_perturbed(self, e, thetas, phis):
|
40
|
+
self.tbmodel.set_so_strength(0.0)
|
41
|
+
G0K = self.G.get_Gk_all(e)
|
42
|
+
Hsoc_k = self.tbmodel.get_Hk_soc(self.G.kpts)
|
43
|
+
na = len(thetas)
|
44
|
+
dE_angle = np.zeros(na, dtype=complex)
|
45
|
+
dE_angle_atoms = np.zeros((na, self.natoms), dtype=complex)
|
46
|
+
for iangle, (theta, phi) in enumerate(zip(thetas, phis)):
|
47
|
+
for ik, dHk in enumerate(Hsoc_k):
|
48
|
+
dHi = rotate_spinor_matrix(dHk, theta, phi)
|
49
|
+
GdH = G0K[ik] @ dHi
|
50
|
+
# dE += np.trace(GdH @ G0K[i].T.conj() @ dHi) * self.kweights[i]
|
51
|
+
# diagonal of second order perturbation.
|
52
|
+
dG2diag = np.diag(GdH @ GdH)
|
53
|
+
# dG2diag = np.diag(GdH @G0K[i].T.conj() @ dHi)
|
54
|
+
dE_angle[iangle] += np.sum(dG2diag) * self.G.kweights[ik]
|
55
|
+
for iatom in range(self.natoms):
|
56
|
+
dE_atom = np.sum(dG2diag[self.iorb(iatom)]) * self.G.kweights[ik]
|
57
|
+
dE_angle_atoms[iangle, iatom] += dE_atom
|
58
|
+
return dE_angle, dE_angle_atoms
|
59
|
+
|
60
|
+
def get_band_energy_vs_angles(self, thetas, phis):
|
61
|
+
nangles = len(thetas)
|
62
|
+
self.es = np.zeros(nangles, dtype=float)
|
63
|
+
self.es_atoms = np.zeros((nangles, self.natoms), dtype=float)
|
64
|
+
for ie, e in enumerate(tqdm.tqdm(self.contour.path)):
|
65
|
+
dE_angle, dE_angle_atoms = self.get_perturbed(e, thetas, phis)
|
66
|
+
self.es -= np.imag(dE_angle * self.contour.weights[ie]) / np.pi
|
67
|
+
self.es_atoms -= np.imag(dE_angle_atoms * self.contour.weights[ie]) / np.pi
|
68
|
+
|
69
|
+
def output(self, output_path="TB2J_anisotropy"):
|
70
|
+
Path(output_path).mkdir(exist_ok=True)
|
71
|
+
fname = f"{output_path}/MAE.dat"
|
72
|
+
with open(fname, "w") as f:
|
73
|
+
f.write("# theta phi MAE, MAEatom1, atom2, ...\n")
|
74
|
+
for i, (theta, phi, e, es) in enumerate(
|
75
|
+
zip(self.thetas, self.phis, self.es, self.es_atoms)
|
76
|
+
):
|
77
|
+
f.write(f"{theta:.5f} {phi:.5f} {e:.8f} ")
|
78
|
+
for ea in es:
|
79
|
+
f.write(f"{ea:.8f} ")
|
80
|
+
f.write("\n")
|
81
|
+
|
82
|
+
def run(self, output_path="TB2J_anisotropy"):
|
83
|
+
self.get_band_energy_vs_angles(self.thetas, self.phis)
|
84
|
+
self.output()
|
TB2J/exchange.py
CHANGED
@@ -11,7 +11,7 @@ from TB2J.external import p_map
|
|
11
11
|
from TB2J.green import TBGreen
|
12
12
|
from TB2J.io_exchange import SpinIO
|
13
13
|
from TB2J.orbmap import map_orbs_matrix
|
14
|
-
from TB2J.pauli import pauli_block_all, pauli_block_sigma_norm
|
14
|
+
from TB2J.pauli import pauli_block_all, pauli_block_sigma_norm
|
15
15
|
from TB2J.utils import (
|
16
16
|
kmesh_to_R,
|
17
17
|
simpson_nonuniform,
|
@@ -39,10 +39,7 @@ class Exchange(ExchangeParams):
|
|
39
39
|
self._prepare_distance()
|
40
40
|
|
41
41
|
# whether to calculate J and DMI with NJt method.
|
42
|
-
self.calc_NJt = True
|
43
42
|
# self._prepare_NijR()
|
44
|
-
self.Ddict_NJT = None
|
45
|
-
self.Jdict_NJT = None
|
46
43
|
self._is_collinear = True
|
47
44
|
self.has_elistc = False
|
48
45
|
self._clean_tbmodels()
|
@@ -60,8 +57,9 @@ class Exchange(ExchangeParams):
|
|
60
57
|
pass
|
61
58
|
|
62
59
|
def _clean_tbmodels(self):
|
63
|
-
del self.tbmodel
|
64
|
-
del self.G.tbmodel
|
60
|
+
# del self.tbmodel
|
61
|
+
# del self.G.tbmodel
|
62
|
+
pass
|
65
63
|
|
66
64
|
def _prepare_kmesh(self, kmesh):
|
67
65
|
for k in kmesh:
|
@@ -262,9 +260,11 @@ class ExchangeNCL(Exchange):
|
|
262
260
|
"""
|
263
261
|
self.tbmodel = tbmodels
|
264
262
|
self.backend_name = self.tbmodel.name
|
263
|
+
print(self.kmesh)
|
265
264
|
self.G = TBGreen(
|
266
265
|
tbmodel=self.tbmodel,
|
267
266
|
kmesh=self.kmesh,
|
267
|
+
gamma=True,
|
268
268
|
efermi=self.efermi,
|
269
269
|
use_cache=self._use_cache,
|
270
270
|
nproc=self.nproc,
|
@@ -551,53 +551,6 @@ class ExchangeNCL(Exchange):
|
|
551
551
|
self.rho_dict = rho
|
552
552
|
return self.rho_dict
|
553
553
|
|
554
|
-
def calculate_DMI_NJT(self):
|
555
|
-
"""
|
556
|
-
calculate exchange and DMI with the
|
557
|
-
This did not work and should be removed.
|
558
|
-
"""
|
559
|
-
Ddict_NJT = {}
|
560
|
-
Jdict_NJT = {}
|
561
|
-
for R in self.short_Rlist:
|
562
|
-
N = self.N[tuple(-np.array(R))] # density matrix
|
563
|
-
t = self.tbmodel.get_hamR(R) # hopping parameter
|
564
|
-
for iatom in self.ind_mag_atoms:
|
565
|
-
orbi = self.iorb(iatom)
|
566
|
-
ni = len(orbi)
|
567
|
-
for jatom in self.ind_mag_atoms:
|
568
|
-
orbj = self.iorb(jatom)
|
569
|
-
nj = len(orbj)
|
570
|
-
Nji = N[np.ix_(orbj, orbi)]
|
571
|
-
tij = t[np.ix_(orbi, orbj)]
|
572
|
-
D = np.zeros(3, dtype=float)
|
573
|
-
J = np.zeros(3, dtype=float)
|
574
|
-
for dim in range(3):
|
575
|
-
# S_i = pauli_mat(ni, dim +
|
576
|
-
# 1) #*self.rho[np.ix_(orbi, orbi)]
|
577
|
-
# S_j = pauli_mat(nj, dim +
|
578
|
-
# 1) #*self.rho[np.ix_(orbj, orbj)]
|
579
|
-
# TODO: Note that rho is complex, not the imaginary part
|
580
|
-
S_i = pauli_mat(ni, dim + 1) * self.rho[np.ix_(orbi, orbi)]
|
581
|
-
S_j = pauli_mat(nj, dim + 1) * self.rho[np.ix_(orbj, orbj)]
|
582
|
-
|
583
|
-
# [S, t]+ = Si tij + tij Sj, where
|
584
|
-
# Si and Sj are the spin operator
|
585
|
-
# Here we do not have L operator, so J-> S
|
586
|
-
Jt = np.matmul(S_i, tij) + np.matmul(tij, S_j)
|
587
|
-
|
588
|
-
Jtminus = np.matmul(S_i, tij) - np.matmul(tij, S_j)
|
589
|
-
# D = -1/2 Tr Nji [J, tij]
|
590
|
-
# Trace over spin and orb
|
591
|
-
D[dim] = -0.5 * np.imag(np.trace(np.matmul(Nji, Jt)))
|
592
|
-
J[dim] = -0.5 * np.imag(np.trace(np.matmul(Nji, Jtminus)))
|
593
|
-
ispin = self.ispin(iatom)
|
594
|
-
jspin = self.ispin(jatom)
|
595
|
-
Ddict_NJT[(R, ispin, jspin)] = D
|
596
|
-
Jdict_NJT[(R, ispin, jspin)] = J
|
597
|
-
self.Jdict_NJT = Jdict_NJT
|
598
|
-
self.Ddict_NJT = Ddict_NJT
|
599
|
-
return Ddict_NJT
|
600
|
-
|
601
554
|
def integrate(self, AijRs, AijRs_orb=None, method="simpson"):
|
602
555
|
"""
|
603
556
|
AijRs: a list of AijR,
|
@@ -620,37 +573,14 @@ class ExchangeNCL(Exchange):
|
|
620
573
|
|
621
574
|
def get_quantities_per_e(self, e):
|
622
575
|
Gk_all = self.G.get_Gk_all(e)
|
623
|
-
mae = self.get_mae_kspace(Gk_all)
|
576
|
+
# mae = self.get_mae_kspace(Gk_all)
|
577
|
+
mae = None
|
624
578
|
# TODO: get the MAE from Gk_all
|
625
579
|
GR = self.G.get_GR(self.short_Rlist, energy=e, get_rho=False, Gk_all=Gk_all)
|
626
580
|
# TODO: define the quantities for one energy.
|
627
581
|
AijR, AijR_orb = self.get_all_A(GR)
|
628
582
|
return dict(AijR=AijR, AijR_orb=AijR_orb, mae=mae)
|
629
583
|
|
630
|
-
def get_mae_kspace(self, Gk_all):
|
631
|
-
"""
|
632
|
-
get the MAE from Gk_all
|
633
|
-
TODO: This is only a place holder.
|
634
|
-
"""
|
635
|
-
return None
|
636
|
-
|
637
|
-
# mae_e = np.zeros(len(self.mae_angles), dtype=complex)
|
638
|
-
# # rotate the Hso_k to angles
|
639
|
-
# for ik, k in enumerate(self.G.kpoints):
|
640
|
-
# Hso_k = self.model.get_Hso_k(k)
|
641
|
-
# Gk = Gk_all[ik]
|
642
|
-
# for i_angle, angle in enumerate(self.mae_angles):
|
643
|
-
# # TODO: implementa rotate_H
|
644
|
-
# Hso_k_rot = rotate_H(Hso_k, angle)
|
645
|
-
# mae_e[i_angle] = Gk @ Hso_k @ Gk @ Hso_k
|
646
|
-
# return mae_e
|
647
|
-
|
648
|
-
def get_mae_rspace(self, GR):
|
649
|
-
"""
|
650
|
-
get the MAE from GR
|
651
|
-
"""
|
652
|
-
raise NotImplementedError("Not yet implemented.")
|
653
|
-
|
654
584
|
def save_AijR(self, AijRs, fname):
|
655
585
|
result = dict(path=self.contour.path, AijRs=AijRs)
|
656
586
|
with open(fname, "wb") as myfile:
|
@@ -739,8 +669,6 @@ class ExchangeNCL(Exchange):
|
|
739
669
|
Jani_dict=self.Jani,
|
740
670
|
DMI_orb=self.DMI_orb,
|
741
671
|
Jani_orb=self.Jani_orb,
|
742
|
-
NJT_Jdict=self.Jdict_NJT,
|
743
|
-
NJT_ddict=self.Ddict_NJT,
|
744
672
|
biquadratic_Jdict=self.B,
|
745
673
|
debug_dict=self.debug_dict,
|
746
674
|
description=self.description,
|
@@ -779,8 +707,6 @@ class ExchangeCL(ExchangeNCL):
|
|
779
707
|
distance_dict=self.distance_dict,
|
780
708
|
exchange_Jdict=self.exchange_Jdict,
|
781
709
|
dmi_ddict=None,
|
782
|
-
NJT_Jdict=None,
|
783
|
-
NJT_ddict=None,
|
784
710
|
biquadratic_Jdict=self.B,
|
785
711
|
description=self.description,
|
786
712
|
)
|
TB2J/green.py
CHANGED
@@ -166,7 +166,7 @@ class TBGreen:
|
|
166
166
|
print("Calculating Fermi energy from eigenvalues")
|
167
167
|
print(f"Number of electrons: {self.tbmodel.nel} ")
|
168
168
|
occ = Occupations(
|
169
|
-
nel=self.tbmodel.nel, width=0.
|
169
|
+
nel=self.tbmodel.nel, width=0.1, wk=self.kweights, nspin=2
|
170
170
|
)
|
171
171
|
self.efermi = occ.efermi(copy.deepcopy(self.evals))
|
172
172
|
print(f"Fermi energy found: {self.efermi}")
|
@@ -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.MAEGreen import MAEGreen
|
7
8
|
|
8
9
|
try:
|
9
10
|
from HamiltonIO.siesta import SislParser
|
@@ -12,28 +13,70 @@ except ImportError:
|
|
12
13
|
"Cannot import SislWrapper from HamiltonIO.siesta. Please install HamiltonIO first."
|
13
14
|
)
|
14
15
|
|
15
|
-
np.seterr(all="raise", under="ignore")
|
16
16
|
|
17
|
+
def siesta_anisotropy(**kwargs):
|
18
|
+
pass
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
20
|
+
|
21
|
+
def gen_exchange_siesta(fdf_fname, read_H_soc=False, **kwargs):
|
22
|
+
"""
|
23
|
+
parameters:
|
24
|
+
fdf_fname: str
|
25
|
+
The fdf file for the calculation.
|
26
|
+
read_H_soc: bool
|
27
|
+
Whether to read the SOC Hamiltonian. Default is False.
|
28
|
+
|
29
|
+
parameters in **kwargs:
|
30
|
+
magnetic_elements: list of str
|
31
|
+
The magnetic elements to calculate the exchange. e.g. ["Fe", "Co", "Ni"]
|
32
|
+
include_orbs: dict
|
33
|
+
The included orbitals for each magnetic element. e.g. {"Fe": ["d"]}. Default is None.
|
34
|
+
kmesh: list of int
|
35
|
+
The k-point mesh for the calculation. e.g. [5, 5, 5]. Default is [5, 5, 5].
|
36
|
+
emin: float
|
37
|
+
The minimum energy for the calculation. Default is -12.0.
|
38
|
+
emax: float
|
39
|
+
The maximum energy for the calculation. Default is 0.0.
|
40
|
+
nz: int
|
41
|
+
The number of points for the energy mesh. Default is 100.
|
42
|
+
exclude_orbs: list of str
|
43
|
+
The excluded orbitals for the calculation. Default is [].
|
44
|
+
Rcut: float
|
45
|
+
The cutoff radius for the exchange calculation in angstrom. Default is None.
|
46
|
+
ne: int
|
47
|
+
The number of electrons for the calculation. Default is None.
|
48
|
+
nproc: int
|
49
|
+
The number of processors for the calculation. Default is 1.
|
50
|
+
use_cache: bool
|
51
|
+
Whether to use the cache for the calculation. Default is False.
|
52
|
+
output_path: str
|
53
|
+
The output path for the calculation. Default is "TB2J_results".
|
54
|
+
orb_decomposition: bool
|
55
|
+
Whether to calculate the orbital decomposition. Default is False.
|
56
|
+
orth: bool
|
57
|
+
Whether to orthogonalize the orbitals. Default is False.
|
58
|
+
description: str
|
59
|
+
The description for the calculation. Default is "".
|
60
|
+
"""
|
61
|
+
|
62
|
+
exargs = dict(
|
63
|
+
magnetic_elements=[],
|
64
|
+
include_orbs=None,
|
65
|
+
kmesh=[5, 5, 5],
|
66
|
+
emin=-12.0,
|
67
|
+
emax=0.0,
|
68
|
+
nz=100,
|
69
|
+
exclude_orbs=[],
|
70
|
+
Rcut=None,
|
71
|
+
ne=None,
|
72
|
+
nproc=1,
|
73
|
+
use_cache=False,
|
74
|
+
output_path="TB2J_results",
|
75
|
+
orb_decomposition=False,
|
76
|
+
orth=False,
|
77
|
+
description="",
|
78
|
+
)
|
79
|
+
exargs.update(kwargs)
|
37
80
|
try:
|
38
81
|
import sisl
|
39
82
|
except ImportError:
|
@@ -46,7 +89,8 @@ def gen_exchange_siesta(
|
|
46
89
|
f"sisl version is {sisl.__version__}, but should be larger than 0.10.0."
|
47
90
|
)
|
48
91
|
|
49
|
-
|
92
|
+
magnetic_elements = exargs.pop("magnetic_elements")
|
93
|
+
include_orbs = exargs.pop("include_orbs")
|
50
94
|
if isinstance(magnetic_elements, str):
|
51
95
|
magnetic_elements = [magnetic_elements]
|
52
96
|
for element in magnetic_elements:
|
@@ -57,13 +101,10 @@ def gen_exchange_siesta(
|
|
57
101
|
else:
|
58
102
|
include_orbs[element] = None
|
59
103
|
magnetic_elements = list(include_orbs.keys())
|
104
|
+
output_path = exargs.pop("output_path")
|
60
105
|
|
61
|
-
# fdf = sisl.get_sile(fdf_fname)
|
62
|
-
# geom = fdf.read_geometry()
|
63
|
-
# H = fdf.read_hamiltonian()
|
64
|
-
# geom = H.geometry
|
65
106
|
parser = SislParser(
|
66
|
-
fdf_fname=fdf_fname, ispin=None, read_H_soc=read_H_soc, orth=orth
|
107
|
+
fdf_fname=fdf_fname, ispin=None, read_H_soc=read_H_soc, orth=exargs["orth"]
|
67
108
|
)
|
68
109
|
if parser.spin.is_colinear:
|
69
110
|
print("Reading Siesta hamiltonian: colinear spin.")
|
@@ -83,17 +124,7 @@ def gen_exchange_siesta(
|
|
83
124
|
efermi=0.0,
|
84
125
|
magnetic_elements=magnetic_elements,
|
85
126
|
include_orbs=include_orbs,
|
86
|
-
|
87
|
-
emin=emin,
|
88
|
-
emax=emax,
|
89
|
-
nz=nz,
|
90
|
-
exclude_orbs=exclude_orbs,
|
91
|
-
Rcut=Rcut,
|
92
|
-
ne=ne,
|
93
|
-
nproc=nproc,
|
94
|
-
use_cache=use_cache,
|
95
|
-
output_path=output_path,
|
96
|
-
description=description,
|
127
|
+
**exargs,
|
97
128
|
)
|
98
129
|
exchange.run(path=output_path)
|
99
130
|
print("\n")
|
@@ -111,28 +142,17 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
111
142
|
e.g. if the spins are along z, the xz, yz, zz, zx, zy components and the z component of DMI.
|
112
143
|
If you need these component, try to do three calculations with spin along x, y, z, or use structure with z rotated to x, y and z. And then use TB2J_merge.py to get the full set of parameters.
|
113
144
|
\n"""
|
145
|
+
exargs["description"] = description
|
114
146
|
if not model.split_soc:
|
115
147
|
exchange = ExchangeNCL(
|
116
148
|
tbmodels=model,
|
117
149
|
atoms=model.atoms,
|
118
150
|
basis=basis,
|
119
151
|
efermi=0.0,
|
120
|
-
# FIXME:
|
121
|
-
# efermi=None,
|
122
152
|
magnetic_elements=magnetic_elements,
|
123
153
|
include_orbs=include_orbs,
|
124
|
-
kmesh=kmesh,
|
125
|
-
emin=emin,
|
126
|
-
emax=emax,
|
127
|
-
nz=nz,
|
128
|
-
exclude_orbs=exclude_orbs,
|
129
|
-
Rcut=Rcut,
|
130
|
-
ne=ne,
|
131
|
-
nproc=nproc,
|
132
|
-
use_cache=use_cache,
|
133
|
-
description=description,
|
134
154
|
output_path=output_path,
|
135
|
-
|
155
|
+
**exargs,
|
136
156
|
)
|
137
157
|
exchange.run(path=output_path)
|
138
158
|
print("\n")
|
@@ -140,6 +160,25 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
140
160
|
f"All calculation finished. The results are in {output_path} directory."
|
141
161
|
)
|
142
162
|
else:
|
163
|
+
print("Starting to calculate MAE.")
|
164
|
+
model.set_so_strength(0.0)
|
165
|
+
MAE = MAEGreen(
|
166
|
+
tbmodels=model,
|
167
|
+
atoms=model.atoms,
|
168
|
+
basis=basis,
|
169
|
+
efermi=None,
|
170
|
+
magnetic_elements=magnetic_elements,
|
171
|
+
include_orbs=include_orbs,
|
172
|
+
**exargs,
|
173
|
+
)
|
174
|
+
# thetas = [0, np.pi / 2, np.pi, 3 * np.pi / 2]
|
175
|
+
# phis = [0, 0, 0, 0]
|
176
|
+
# MAE.set_angles(thetas=thetas, phis=phis)
|
177
|
+
MAE.run(output_path=output_path)
|
178
|
+
print(
|
179
|
+
f"MAE calculation finished. The results are in {output_path} directory."
|
180
|
+
)
|
181
|
+
|
143
182
|
angle = {"x": (np.pi / 2, 0), "y": (np.pi / 2, np.pi / 2), "z": (0, 0)}
|
144
183
|
for key, val in angle.items():
|
145
184
|
# model = parser.get_model()
|
@@ -154,18 +193,7 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
|
|
154
193
|
efermi=None, # set to None, compute from efermi.
|
155
194
|
magnetic_elements=magnetic_elements,
|
156
195
|
include_orbs=include_orbs,
|
157
|
-
|
158
|
-
emin=emin,
|
159
|
-
emax=emax,
|
160
|
-
nz=nz,
|
161
|
-
exclude_orbs=exclude_orbs,
|
162
|
-
Rcut=Rcut,
|
163
|
-
ne=ne,
|
164
|
-
nproc=nproc,
|
165
|
-
use_cache=use_cache,
|
166
|
-
description=description,
|
167
|
-
output_path=output_path_full,
|
168
|
-
orb_decomposition=orb_decomposition,
|
196
|
+
**exargs,
|
169
197
|
)
|
170
198
|
exchange.run(path=output_path_full)
|
171
199
|
print("\n")
|
@@ -1,6 +1,7 @@
|
|
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=9VwwLpUALaaVwn4LTnhSISJMT7MDym247sSKT5Rum0o,10989
|
4
|
+
TB2J/MAEGreen.py,sha256=SkDct7cD5hDAAYW9Y3oYQZVt1AyLA53xDqLL1mT5Nq0,3461
|
4
5
|
TB2J/Oiju.py,sha256=cNGv8N5uH_swGq7cnAt2OyiDfqtjLlLrwseGu0E4iaM,3383
|
5
6
|
TB2J/Oiju_epc.py,sha256=oytM3NYW7nWmklrGgNlqwIpI_JYv_hb7ZnR4o9nYNog,6809
|
6
7
|
TB2J/__init__.py,sha256=hcEWkag_UvLm1ZSbjsgcTWkGVlR3Bwmzg1QYAwsvf-g,24
|
@@ -10,13 +11,13 @@ TB2J/citation.py,sha256=gcQeyJZaT1Qrtsl8Y3s4neOH3-vvgmIcCvXeV2o3vj0,2891
|
|
10
11
|
TB2J/contour.py,sha256=4wFZSPV81WwuUrvn1MENMnP-cW5ICDy8azOdTO8HJdw,2877
|
11
12
|
TB2J/density_matrix.py,sha256=D5k8Oe21OCiLVORNYbo4TZOFG0slrQSbj91kJ3TMFjs,1514
|
12
13
|
TB2J/epc.py,sha256=zLbtqZJhDr8DnnGN6YENcXwrMb3Qxu6KB08mLy9Pw20,3474
|
13
|
-
TB2J/exchange.py,sha256=
|
14
|
+
TB2J/exchange.py,sha256=2uTz88pZf3NuKLLiFTHyXf5URhCZkzUlxkVJdtzZPHk,25252
|
14
15
|
TB2J/exchangeCL2.py,sha256=vJgVBpvtTE2K7Xf7hGQNc3C87VvVXTa689Qd5827ItE,11165
|
15
16
|
TB2J/exchange_params.py,sha256=zhOPyvgngPXlYbZ8TUEFXIpYak3MPh3Lh24m8WWWgnU,5846
|
16
17
|
TB2J/exchange_pert.py,sha256=jmFMtQbYa_uczM4VAeS6TijkIHRFIqEzZJswzE9Wfuo,8523
|
17
18
|
TB2J/exchange_qspace.py,sha256=ZL68qBGFUaQ9BsSPsJaaoWOr9RssPiqX34R_9I3nk_8,8436
|
18
19
|
TB2J/gpaw_wrapper.py,sha256=aJ--9Dtyq7jOP1Hkh-Sh1nWcfXm6zKcljOCO0DNCAr0,6890
|
19
|
-
TB2J/green.py,sha256=
|
20
|
+
TB2J/green.py,sha256=Dz189KtGsHlANBU4TiSTZpxGEpETFZaphwyIaNp3a5E,14721
|
20
21
|
TB2J/greentest.py,sha256=2ISSfhor9ecSEOi_E6b4Cv26wEIQlwlzca0ru8z44_E,1603
|
21
22
|
TB2J/io_merge.py,sha256=E1_GfAB2HGpW-ipaO2lqU9SvaslwkiLxssn4DqJpMT8,6899
|
22
23
|
TB2J/kpoints.py,sha256=6XK2KqTncidEq3o9GuO6VEZRPNTRtWeXg9QfcV-9smI,532
|
@@ -39,7 +40,7 @@ TB2J/interfaces/__init__.py,sha256=4tiLoXQ73Nlyi9L4j8jJXOYzXluVNPxQZkwfkQZEGHg,3
|
|
39
40
|
TB2J/interfaces/gpaw_interface.py,sha256=GCDlJ-hRWfChvWwsgBDYSmVqO4sH9HAuGZTV9GqgN6c,1504
|
40
41
|
TB2J/interfaces/lawaf_interface.py,sha256=PieLnmppdafOYsgeHznqOou1g9L1sam5jOm3KaObdqo,4408
|
41
42
|
TB2J/interfaces/manager.py,sha256=PQMLEfMCT5GnDWSl2nI4JOgRPm_fysyR-6Y6l97xWcw,860
|
42
|
-
TB2J/interfaces/siesta_interface.py,sha256=
|
43
|
+
TB2J/interfaces/siesta_interface.py,sha256=1XOTZYM0uRBqdsTbDo86PZOM0J_uaiDZ9-gPW2PXooE,7704
|
43
44
|
TB2J/interfaces/wannier90_interface.py,sha256=qzRgXUBb7t1Aiegrl_RV51BB8csdtVM0EP0Z4pjmTcs,4467
|
44
45
|
TB2J/interfaces/abacus/__init__.py,sha256=leas71oCvM_HxrF4gnO5A_VKcJmDAgsI1BUctLU3OBw,177
|
45
46
|
TB2J/interfaces/abacus/abacus_api.py,sha256=lNV4LNkLcKw7Zux4MQYM9wnh3eFTlcSqbf4Pb7pqhrk,7243
|
@@ -75,19 +76,19 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
|
|
75
76
|
TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
|
76
77
|
TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
|
77
78
|
TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
|
78
|
-
TB2J-0.9.
|
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.
|
79
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_downfold.py,sha256=i4BVqnpDdgrX_amookVWeLGefGBn-qeAutWiwuY9SfQ,2099
|
80
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
|
81
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
|
82
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
|
83
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
|
84
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
|
85
|
+
TB2J-0.9.7rc0.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
|
86
|
+
TB2J-0.9.7rc0.data/scripts/abacus2J.py,sha256=_Wiu0NekWKNZ1XVAEBNQOWTi8hE_KXg6iGxfHgcdKqI,4396
|
87
|
+
TB2J-0.9.7rc0.data/scripts/siesta2J.py,sha256=wQ9fbyiVyau7WwfusNvHxqBGfD_9_7GZmYZ6pqe6RaM,4806
|
88
|
+
TB2J-0.9.7rc0.data/scripts/wann2J.py,sha256=pTFDf6h72I_LN_NX5UivyCoJPgwvyAyHW175nSAJvLo,2987
|
89
|
+
TB2J-0.9.7rc0.dist-info/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
|
90
|
+
TB2J-0.9.7rc0.dist-info/METADATA,sha256=kFTVwu8e7Fcb9srTmKweSf8AmnGq636h4Fu3Ix-e5Tk,1482
|
91
|
+
TB2J-0.9.7rc0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
92
|
+
TB2J-0.9.7rc0.dist-info/entry_points.txt,sha256=Hdz1WC9waUzyFVmowKnbbZ6j-J4adHh_Ko6JpxGYAtE,131
|
93
|
+
TB2J-0.9.7rc0.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
|
94
|
+
TB2J-0.9.7rc0.dist-info/RECORD,,
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|