TB2J 0.8.2.7__py3-none-any.whl → 0.8.2.8__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/green.py +16 -6
- TB2J/spinham/h_matrix.py +68 -0
- TB2J/spinham/obtain_J.py +79 -0
- {TB2J-0.8.2.7.dist-info → TB2J-0.8.2.8.dist-info}/METADATA +1 -1
- {TB2J-0.8.2.7.dist-info → TB2J-0.8.2.8.dist-info}/RECORD +18 -16
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_downfold.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_eigen.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_magnon.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_magnon_dos.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_merge.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/TB2J_rotate.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/abacus2J.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/siesta2J.py +0 -0
- {TB2J-0.8.2.7.data → TB2J-0.8.2.8.data}/scripts/wann2J.py +0 -0
- {TB2J-0.8.2.7.dist-info → TB2J-0.8.2.8.dist-info}/LICENSE +0 -0
- {TB2J-0.8.2.7.dist-info → TB2J-0.8.2.8.dist-info}/WHEEL +0 -0
- {TB2J-0.8.2.7.dist-info → TB2J-0.8.2.8.dist-info}/top_level.txt +0 -0
TB2J/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.8.2.
|
1
|
+
__version__ = "0.8.2.8"
|
TB2J/green.py
CHANGED
@@ -225,12 +225,22 @@ class TBGreen:
|
|
225
225
|
|
226
226
|
def get_density_matrix(self):
|
227
227
|
rho = np.zeros((self.nbasis, self.nbasis), dtype=complex)
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
228
|
+
if self.is_orthogonal:
|
229
|
+
for ik, _ in enumerate(self.kpts):
|
230
|
+
rho += (
|
231
|
+
(self.get_evecs(ik) * fermi(self.evals[ik], self.efermi))
|
232
|
+
@ self.get_evecs(ik).T.conj()
|
233
|
+
* self.kweights[ik]
|
234
|
+
)
|
235
|
+
else:
|
236
|
+
for ik, _ in enumerate(self.kpts):
|
237
|
+
rho += (
|
238
|
+
(self.get_evecs(ik) * fermi(self.evals[ik], self.efermi))
|
239
|
+
@ self.get_evecs(ik).T.conj()
|
240
|
+
@ self.get_Sk(ik)
|
241
|
+
* self.kweights[ik]
|
242
|
+
)
|
243
|
+
|
234
244
|
return rho
|
235
245
|
|
236
246
|
def get_rho_R(self, Rlist):
|
TB2J/spinham/h_matrix.py
ADDED
@@ -0,0 +1,68 @@
|
|
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
ADDED
@@ -0,0 +1,79 @@
|
|
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
|
@@ -2,7 +2,7 @@ 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=am9nQoXsrjfFlI37cMwyeG0iWxg4QrTRX090gUPnDJ4,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
|
@@ -14,7 +14,7 @@ TB2J/exchangeCL2.py,sha256=TIr-d2X56AiGe4qEhyXyZhRuwXvQG6clJMwDmjnTOaE,10985
|
|
14
14
|
TB2J/exchange_pert.py,sha256=jmFMtQbYa_uczM4VAeS6TijkIHRFIqEzZJswzE9Wfuo,8523
|
15
15
|
TB2J/exchange_qspace.py,sha256=ZL68qBGFUaQ9BsSPsJaaoWOr9RssPiqX34R_9I3nk_8,8436
|
16
16
|
TB2J/gpaw_wrapper.py,sha256=aJ--9Dtyq7jOP1Hkh-Sh1nWcfXm6zKcljOCO0DNCAr0,6890
|
17
|
-
TB2J/green.py,sha256=
|
17
|
+
TB2J/green.py,sha256=X-D8UZcIyz6zh_0W9VgUUv5yXPP3KWJ6C03m6CMWE3o,13377
|
18
18
|
TB2J/greentest.py,sha256=2ISSfhor9ecSEOi_E6b4Cv26wEIQlwlzca0ru8z44_E,1603
|
19
19
|
TB2J/io_merge.py,sha256=2dYrQFHSnb_8fwbQiVod9GyaT-BotawA26eagXWUyMg,15265
|
20
20
|
TB2J/kpoints.py,sha256=6XK2KqTncidEq3o9GuO6VEZRPNTRtWeXg9QfcV-9smI,532
|
@@ -53,8 +53,10 @@ TB2J/io_exchange/io_vampire.py,sha256=UllC4twf06_q2vBCnAYFzEDGvS8mSefwQXDquBuyc0
|
|
53
53
|
TB2J/spinham/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
54
|
TB2J/spinham/base_parser.py,sha256=oQRHvFE_BlUtTaTZykKgvicu40oXcbICB-D1aAt-qlA,2196
|
55
55
|
TB2J/spinham/constants.py,sha256=y4-hRyl5EAR42k24Oa5XhAsUQtKVn1MAgyqNf-p3PrM,762
|
56
|
+
TB2J/spinham/h_matrix.py,sha256=MfHIz6RViKkEB3Mu-WcwNx5uk7A5sjAlbqVG9wYA4xk,2784
|
56
57
|
TB2J/spinham/hamiltonian.py,sha256=OfsjlGIgFwpXaohopZcgPamSfjm3X46_zc245eyTr_A,16607
|
57
58
|
TB2J/spinham/hamiltonian_terms.py,sha256=7e84tfEjvAfZltUkrSWi1sUEiW_itLKy83lxi5iBpcQ,9714
|
59
|
+
TB2J/spinham/obtain_J.py,sha256=sg8tiCRRLEN57Olb3MHIuqkDhAkmu-w87AkM00ylXtA,2401
|
58
60
|
TB2J/spinham/plot.py,sha256=tLLNqFAATVrP1kmSVLPKzn686i-CUyqu4qgOcs-okHI,6599
|
59
61
|
TB2J/spinham/qsolver.py,sha256=Sr9I3aGfVNYn5wzwPx1QonHe6ZZUXBAujWRa7nTA5u4,4986
|
60
62
|
TB2J/spinham/spin_api.py,sha256=oN3AKg1WQl0YzR4f5ealcJOaVoAy8d7HodIwrbXvQeY,2219
|
@@ -63,17 +65,17 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
|
|
63
65
|
TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
|
64
66
|
TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
|
65
67
|
TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
|
66
|
-
TB2J-0.8.2.
|
67
|
-
TB2J-0.8.2.
|
68
|
-
TB2J-0.8.2.
|
69
|
-
TB2J-0.8.2.
|
70
|
-
TB2J-0.8.2.
|
71
|
-
TB2J-0.8.2.
|
72
|
-
TB2J-0.8.2.
|
73
|
-
TB2J-0.8.2.
|
74
|
-
TB2J-0.8.2.
|
75
|
-
TB2J-0.8.2.
|
76
|
-
TB2J-0.8.2.
|
77
|
-
TB2J-0.8.2.
|
78
|
-
TB2J-0.8.2.
|
79
|
-
TB2J-0.8.2.
|
68
|
+
TB2J-0.8.2.8.data/scripts/TB2J_downfold.py,sha256=F9oImXFysejCMP7eIBjbCX2jdHFOCvDW5beF1sG-UM8,1854
|
69
|
+
TB2J-0.8.2.8.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
|
70
|
+
TB2J-0.8.2.8.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
|
71
|
+
TB2J-0.8.2.8.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
|
72
|
+
TB2J-0.8.2.8.data/scripts/TB2J_merge.py,sha256=uZKLM__EyCHwxrQvx3Wd73dOEADp_SqfYC8KQvA-N9g,1622
|
73
|
+
TB2J-0.8.2.8.data/scripts/TB2J_rotate.py,sha256=XPacPb7-DaFafBXFdWuNW_eNbjd5XPdNhBRNYhge_cg,634
|
74
|
+
TB2J-0.8.2.8.data/scripts/abacus2J.py,sha256=M4B07lvTCDczTPTqvnDh_PERzCARAd09TLKv4aIdSQM,4408
|
75
|
+
TB2J-0.8.2.8.data/scripts/siesta2J.py,sha256=hBzS7ZgoHM3oXlTCQd-xVA07Ks2FiIwyRpQWUFITRPE,4303
|
76
|
+
TB2J-0.8.2.8.data/scripts/wann2J.py,sha256=2t2hWwyELskYCwkGDziCgiIAnfr6odLLJ6cQBJ2RQwQ,5714
|
77
|
+
TB2J-0.8.2.8.dist-info/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
|
78
|
+
TB2J-0.8.2.8.dist-info/METADATA,sha256=GayTSi2vZJDVZpowe31iXUsOHyUHO5b-hYG_2_H_MnA,1464
|
79
|
+
TB2J-0.8.2.8.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
80
|
+
TB2J-0.8.2.8.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
|
81
|
+
TB2J-0.8.2.8.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
|