TB2J 0.9.9rc18__py3-none-any.whl → 0.9.9rc20__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.
Files changed (26) hide show
  1. TB2J/Jdownfolder.py +3 -2
  2. TB2J/MAEGreen.py +12 -14
  3. TB2J/exchange_params.py +1 -2
  4. TB2J/interfaces/siesta_interface.py +14 -10
  5. TB2J/io_exchange/io_exchange.py +40 -12
  6. TB2J/magnon/io_exchange2.py +10 -3
  7. TB2J/magnon/magnon3.py +204 -0
  8. TB2J/{mathutils/magnons.py → magnon/magnon_math.py} +8 -0
  9. TB2J/mathutils/__init__.py +2 -1
  10. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_magnon2.py +1 -0
  11. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/abacus2J.py +1 -1
  12. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/METADATA +1 -1
  13. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/RECORD +26 -25
  14. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_downfold.py +0 -0
  15. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_eigen.py +0 -0
  16. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_magnon.py +0 -0
  17. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_magnon_dos.py +0 -0
  18. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_merge.py +0 -0
  19. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_rotate.py +0 -0
  20. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/TB2J_rotateDM.py +0 -0
  21. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/siesta2J.py +0 -0
  22. {tb2j-0.9.9rc18.data → tb2j-0.9.9rc20.data}/scripts/wann2J.py +0 -0
  23. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/WHEEL +0 -0
  24. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/entry_points.txt +0 -0
  25. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/licenses/LICENSE +0 -0
  26. {tb2j-0.9.9rc18.dist-info → tb2j-0.9.9rc20.dist-info}/top_level.txt +0 -0
TB2J/Jdownfolder.py CHANGED
@@ -136,7 +136,7 @@ class JDownfolder_pickle:
136
136
  outpath,
137
137
  qmesh=[7, 7, 7],
138
138
  iso_only=False,
139
- method="pwf",
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,
TB2J/MAEGreen.py CHANGED
@@ -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
@@ -55,9 +54,8 @@ class MAEGreen(ExchangeNCL):
55
54
 
56
55
  def set_angles_xyz(self):
57
56
  """theta and phi are defined as the x, y, z, xy, yz, xz, xyz, x-yz, -xyz, -x-yz axis."""
58
- self.thetas = [ np.pi / 2, np.pi / 2, 0.0]
59
- self.phis = [ np.pi / 2, 0, 0.0]
60
-
57
+ self.thetas = [np.pi / 2, np.pi / 2, 0.0]
58
+ self.phis = [np.pi / 2, 0, 0.0]
61
59
 
62
60
  def set_angles_axis(self):
63
61
  """theta and phi are defined as the x, y, z, xy, yz, xz, xyz, x-yz, -xyz, -x-yz axis."""
@@ -255,11 +253,11 @@ class MAEGreen(ExchangeNCL):
255
253
  Path(output_path).mkdir(exist_ok=True)
256
254
  fname = f"{output_path}/MAE.dat"
257
255
  fname_orb = f"{output_path}/MAE_orb.dat"
258
- fname_tensor = f"{output_path}/MAE_tensor.dat"
259
- if figure3d is not None:
260
- fname_fig3d = f"{output_path}/{figure3d}"
261
- if figure_contourf is not None:
262
- fname_figcontourf = f"{output_path}/{figure_contourf}"
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}"
263
261
 
264
262
  # ouput with eigenvalues.
265
263
  if with_eigen:
@@ -284,18 +282,18 @@ class MAEGreen(ExchangeNCL):
284
282
  f.write(f"{ea*1e3:.8f} ")
285
283
  f.write("\n")
286
284
 
287
- #self.ani = self.fit_anisotropy_tensor()
288
- #with open(fname_tensor, "w") as f:
285
+ # self.ani = self.fit_anisotropy_tensor()
286
+ # with open(fname_tensor, "w") as f:
289
287
  # f.write("# Anisotropy tensor in meV\n")
290
288
  # f.write(f"{self.ani.tensor_strings(include_isotropic=False)}\n")
291
289
 
292
- #if figure3d is not None:
290
+ # if figure3d is not None:
293
291
  # self.ani.plot_3d(figname=fname_fig3d, show=False)
294
292
 
295
- #if figure_contourf is not None:
293
+ # if figure_contourf is not None:
296
294
  # self.ani.plot_contourf(figname=fname_figcontourf, show=False)
297
295
 
298
- #plt.close()
296
+ # plt.close()
299
297
  gc.collect()
300
298
 
301
299
  with open(fname_orb, "w") as f:
TB2J/exchange_params.py CHANGED
@@ -177,8 +177,7 @@ def add_exchange_args_to_parser(parser: argparse.ArgumentParser):
177
177
  )
178
178
 
179
179
  parser.add_argument(
180
- "--np",
181
- "--nproc",
180
+ "-np",
182
181
  help="number of cpu cores to use in parallel, default: 1",
183
182
  default=1,
184
183
  type=int,
@@ -4,8 +4,8 @@ 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
8
7
  from TB2J.io_merge import merge
8
+ from TB2J.MAEGreen import MAEGreen
9
9
 
10
10
  try:
11
11
  from HamiltonIO.siesta import SislParser
@@ -162,13 +162,13 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
162
162
  # include_orbs=include_orbs,
163
163
  **exargs,
164
164
  )
165
- #thetas = [0, np.pi / 2, np.pi, 3 * np.pi / 2]
166
- #phis = [0, 0, 0, 0]
167
- #MAE.set_angles(thetas=thetas, phis=phis)
165
+ # thetas = [0, np.pi / 2, np.pi, 3 * np.pi / 2]
166
+ # phis = [0, 0, 0, 0]
167
+ # MAE.set_angles(thetas=thetas, phis=phis)
168
168
  MAE.run(output_path=f"{output_path}_anisotropy", with_eigen=False)
169
- #print(
169
+ # print(
170
170
  # f"MAE calculation finished. The results are in {output_path} directory."
171
- #)
171
+ # )
172
172
 
173
173
  angle = {"x": (np.pi / 2, 0), "y": (np.pi / 2, np.pi / 2), "z": (0, 0)}
174
174
  for key, val in angle.items():
@@ -192,9 +192,13 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
192
192
  print(
193
193
  f"All calculation finished. The results are in {output_path_full} directory."
194
194
  )
195
-
196
195
 
197
- merge("TB2J_results_x", "TB2J_results_y", "TB2J_results_z", main_path=None, save=True, write_path='TB2J_results')
196
+ merge(
197
+ "TB2J_results_x",
198
+ "TB2J_results_y",
199
+ "TB2J_results_z",
200
+ main_path=None,
201
+ save=True,
202
+ write_path="TB2J_results",
203
+ )
198
204
  print("Final TB2J_results written to TB2J_results directory.")
199
-
200
-
@@ -335,7 +335,7 @@ Generation time: {now.strftime("%y/%m/%d %H:%M:%S")}
335
335
  )
336
336
  return Jtensor
337
337
 
338
- def get_full_Jtensor_for_one_R(self, R, iso_only=False):
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 get_full_Jtensor_for_Rlist(self, asr=False, iso_only=True):
355
- n3 = self.nspin * 3
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
- Jmat = np.zeros((nR, n3, n3), dtype=float)
358
- for iR, R in enumerate(self.Rlist):
359
- Jmat[iR] = self.get_full_Jtensor_for_one_R(R, iso_only=iso_only)
360
- if asr:
361
- iR0 = np.argmin(np.linalg.norm(self.Rlist, axis=1))
362
- assert np.linalg.norm(self.Rlist[iR0]) == 0
363
- for i in range(n3):
364
- sum_JRi = np.sum(np.sum(Jmat, axis=0)[i])
365
- Jmat[iR0][i, i] -= sum_JRi
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"):
@@ -11,7 +11,7 @@ It includes classes and functions for:
11
11
  import numpy as np
12
12
  from scipy.spatial.transform import Rotation
13
13
 
14
- from ..mathutils import generate_grid, get_rotation_arrays, round_to_precision, uz
14
+ from .magnon_math import generate_grid, get_rotation_arrays, round_to_precision, uz
15
15
  from .plot import BandsPlot
16
16
  from .structure import BaseMagneticStructure, get_attribute_array
17
17
 
@@ -112,8 +112,12 @@ def Hermitize(array):
112
112
  result = np.zeros((n, n) + array.shape[1:], dtype=complex)
113
113
  u_indices = np.triu_indices(n)
114
114
 
115
- result[*u_indices] = array
116
- result.swapaxes(0, 1)[*u_indices] = array.swapaxes(-1, -2).conj()
115
+ # for python>=3.11
116
+ # result[*u_indices] = array
117
+ # result.swapaxes(0, 1)[*u_indices] = array.swapaxes(-1, -2).conj()
118
+ # for python<3.11
119
+ result[u_indices[0], u_indices[1]] = array
120
+ result.swapaxes(0, 1)[u_indices[0], u_indices[1]] = array.swapaxes(-1, -2).conj()
117
121
 
118
122
  return result
119
123
 
@@ -395,11 +399,14 @@ class ExchangeIO(BaseMagneticStructure):
395
399
  tensor = np.zeros(shape, dtype=float)
396
400
 
397
401
  if anisotropic and not self.collinear:
402
+ # anisotropic exchange tensor
398
403
  tensor += self._exchange_values[:, :, 9:].reshape(shape)
404
+ # DMI
399
405
  pos_indices = ([1, 2, 0], [2, 0, 1])
400
406
  neg_indices = ([2, 0, 1], [1, 2, 0])
401
407
  tensor[:, :, *pos_indices] += self._exchange_values[:, :, 6:9]
402
408
  tensor[:, :, *neg_indices] -= self._exchange_values[:, :, 6:9]
409
+ # isotropic exchange
403
410
  diag_indices = ([0, 1, 2], [0, 1, 2])
404
411
  tensor[:, :, *diag_indices] += self._exchange_values[:, :, 3, None]
405
412
 
TB2J/magnon/magnon3.py ADDED
@@ -0,0 +1,204 @@
1
+ import numpy as np
2
+ from scipy.spatial.transform import Rotation
3
+
4
+ from TB2J.io_exchange import SpinIO
5
+
6
+ from ..mathutils import Hermitize, get_rotation_arrays, uz
7
+ from .plot import BandsPlot
8
+
9
+
10
+ class Magnon:
11
+ """ """
12
+
13
+ def __init__(self, exc: SpinIO, iso_only=False, asr=False):
14
+ self.exc = exc
15
+ self.nspin = exc.get_nspin()
16
+ self.ind_atoms = exc.ind_atoms
17
+ self.magmom = np.array([exc.spinat[exc.iatom(i)] for i in range(self.nspin)])
18
+ self.Rlist = exc.Rlist
19
+ self.JR = exc.get_full_Jtensor_for_Rlist(asr=asr, iso_only=iso_only)
20
+ self._Q = None
21
+ self._uz = np.array([[0.0, 0.0, 1.0]], dtype=float)
22
+ self._n = np.array([0, 0, 1], dtype=float)
23
+
24
+ def set_propagation_vector(self, Q):
25
+ self._Q = np.array(Q)
26
+
27
+ @property
28
+ def Q(self):
29
+ if self._Q is None:
30
+ raise ValueError("Propagation vector Q is not set.")
31
+ return self._Q
32
+
33
+ @Q.setter
34
+ def Q(self, value):
35
+ if not isinstance(value, (list, np.ndarray)):
36
+ raise TypeError("Propagation vector Q must be a list or numpy array.")
37
+ if len(value) != 3:
38
+ raise ValueError("Propagation vector Q must have three components.")
39
+ self._Q = np.array(value)
40
+
41
+ def Jq(self, kpoints):
42
+ """
43
+ Compute the exchange interactions in reciprocal space.
44
+
45
+ Parameters
46
+ ----------
47
+ kpoints : array_like
48
+ k-points at which to evaluate the exchange interactions
49
+ """
50
+ Rlist = np.array(self.Rlist)
51
+ JR = self.JR
52
+
53
+ for iR, R in enumerate(Rlist):
54
+ if self._Q is not None:
55
+ phi = 2 * np.pi * R @ self._Q
56
+ rv = phi * self._n
57
+ Rmat = Rotation.from_rotvec(rv).as_matrix()
58
+ JR[iR] = np.einsum("rijxy, yz -> rixzy", JR[iR], Rmat)
59
+
60
+ nkpt = kpoints.shape[0]
61
+ Jq = np.zeros((nkpt, self.nspin, self.nspin, 3, 3), dtype=complex)
62
+
63
+ for iR, R in enumerate(Rlist):
64
+ for iqpt, qpt in enumerate(kpoints):
65
+ phase = 2 * np.pi * R @ qpt
66
+ Jq[iqpt] += np.exp(1j * phase) * JR[iR]
67
+
68
+ # Hermitian
69
+ Jq[iqpt, :, :, :, :] += np.conj(Jq[iqpt, :, :, :, :].swapaxes(-1, -2))
70
+
71
+ # should we divide
72
+
73
+ # if self._Q is not None:
74
+ # phi = 2 * np.pi * vectors.round(3).astype(int) @ self._Q
75
+ # rv = np.einsum("ij,k->ijk", phi, self._n)
76
+ # R = (
77
+ # Rotation.from_rotvec(rv.reshape(-1, 3))
78
+ # .as_matrix()
79
+ # .reshape(vectors.shape[:2] + (3, 3))
80
+ # )
81
+ # np.einsum("nmij,nmjk->nmik", tensor, R, out=tensor)
82
+
83
+ # exp_summand = np.exp(2j * np.pi * vectors @ kpoints.T)
84
+ # Jexp = exp_summand[:, :, :, None, None] * tensor[:, :, None]
85
+ # Jq = np.sum(Jexp, axis=1)
86
+
87
+ # pairs = np.array(self._pairs)
88
+ # idx = np.where(pairs[:, 0] == pairs[:, 1])
89
+ # Jq[idx] /= 2
90
+
91
+ return Jq
92
+
93
+ def Hq(self, kpoints, anisotropic=True, u=uz):
94
+ """
95
+ Compute the magnon Hamiltonian in reciprocal space.
96
+
97
+ Parameters
98
+ ----------
99
+ kpoints : array_like
100
+ k-points at which to evaluate the Hamiltonian
101
+ anisotropic : bool, optional
102
+ Whether to include anisotropic interactions, default True
103
+ u : array_like, optional
104
+ Reference direction for spin quantization axis
105
+
106
+ Returns
107
+ -------
108
+ numpy.ndarray
109
+ Magnon Hamiltonian matrix at each k-point
110
+ """
111
+ magmoms = self.magmom.copy()
112
+ magmoms /= np.linalg.norm(magmoms, axis=-1)[:, None]
113
+
114
+ U, V = get_rotation_arrays(magmoms, u=u)
115
+
116
+ J0 = self.Jq(np.zeros((1, 3)), anisotropic=anisotropic)
117
+ J0 = -Hermitize(J0)[:, :, 0]
118
+ Jq = -Hermitize(self.Jq(kpoints, anisotropic=anisotropic))
119
+
120
+ C = np.diag(np.einsum("ix,ijxy,jy->i", V, 2 * J0, V))
121
+ B = np.einsum("ix,ijkxy,jy->kij", U, Jq, U)
122
+ A1 = np.einsum("ix,ijkxy,jy->kij", U, Jq, U.conj())
123
+ A2 = np.einsum("ix,ijkxy,jy->kij", U.conj(), Jq, U)
124
+
125
+ return np.block([[A1 - C, B], [B.swapaxes(-1, -2).conj(), A2 - C]])
126
+
127
+ def _magnon_energies(self, kpoints, anisotropic=True, u=uz):
128
+ H = self.Hq(kpoints, anisotropic=anisotropic, u=u)
129
+ n = H.shape[-1] // 2
130
+ I = np.eye(n)
131
+
132
+ min_eig = 0.0
133
+ try:
134
+ K = np.linalg.cholesky(H)
135
+ except np.linalg.LinAlgError:
136
+ try:
137
+ K = np.linalg.cholesky(H + 1e-6 * np.eye(2 * n))
138
+ except np.linalg.LinAlgError:
139
+ from warnings import warn
140
+
141
+ min_eig = np.min(np.linalg.eigvalsh(H))
142
+ K = np.linalg.cholesky(H - (min_eig - 1e-6) * np.eye(2 * n))
143
+ warn(
144
+ f"WARNING: The system may be far from the magnetic ground-state. Minimum eigenvalue: {min_eig}. The magnon energies might be unphysical."
145
+ )
146
+
147
+ g = np.block([[1 * I, 0 * I], [0 * I, -1 * I]])
148
+ KH = K.swapaxes(-1, -2).conj()
149
+
150
+ return np.linalg.eigvalsh(KH @ g @ K)[:, n:] + min_eig
151
+
152
+ def get_magnon_bands(
153
+ self,
154
+ kpoints: np.array = np.array([]),
155
+ path: str = None,
156
+ npoints: int = 300,
157
+ special_points: dict = None,
158
+ tol: float = 2e-4,
159
+ pbc: tuple = None,
160
+ cartesian: bool = False,
161
+ labels: list = None,
162
+ anisotropic: bool = True,
163
+ u: np.array = uz,
164
+ ):
165
+ pbc = self._pbc if pbc is None else pbc
166
+
167
+ if kpoints.size == 0:
168
+ from ase.cell import Cell
169
+
170
+ bandpath = Cell(self._cell).bandpath(
171
+ path=path,
172
+ npoints=npoints,
173
+ special_points=special_points,
174
+ eps=tol,
175
+ pbc=pbc,
176
+ )
177
+ kpoints = bandpath.kpts
178
+ spk = bandpath.special_points
179
+ spk[r"$\Gamma$"] = spk.pop("G", np.zeros(3))
180
+ labels = [
181
+ (i, symbol)
182
+ for symbol in spk
183
+ for i in np.where((kpoints == spk[symbol]).all(axis=1))[0]
184
+ ]
185
+ elif cartesian:
186
+ kpoints = np.linalg.solve(self._cell.T, kpoints.T).T
187
+
188
+ bands = self._magnon_energies(kpoints, anisotropic=anisotropic, u=u)
189
+
190
+ return labels, bands
191
+
192
+ def plot_magnon_bands(self, **kwargs):
193
+ """
194
+ Plot magnon band structure.
195
+
196
+ Parameters
197
+ ----------
198
+ **kwargs
199
+ Additional keyword arguments passed to get_magnon_bands and plotting functions
200
+ """
201
+ filename = kwargs.pop("filename", None)
202
+ kpath, bands = self.get_magnon_bands(**kwargs)
203
+ bands_plot = BandsPlot(bands, kpath)
204
+ bands_plot.plot(filename=filename)
@@ -19,6 +19,14 @@ def generate_grid(kmesh, sort=True):
19
19
  return grid
20
20
 
21
21
 
22
+ # def JR_to_Jq(JR, Rlist, qpt, vecn):
23
+ # for iR, R in enumerate(Rlist):
24
+ # phase = 2 * np.pi * R @ qpt
25
+ # rv = phase * vecn
26
+ # Rot = Rotation.from_rotvec(rv.reshape(-1, 3)).as_matrix().reshape(R.shape[0], 3, 3)
27
+ #
28
+
29
+
22
30
  def get_rotation_arrays(magmoms, u=uz):
23
31
  dim = magmoms.shape[0]
24
32
  v = magmoms
@@ -1,2 +1,3 @@
1
1
  from .lowdin import Lowdin
2
- from .magnons import *
2
+
3
+ __all__ = ["Lowdin"]
@@ -1,3 +1,4 @@
1
+ #!python
1
2
  from TB2J.magnon import plot_tb2j_magnon_bands
2
3
 
3
4
 
@@ -50,7 +50,7 @@ def run_abacus2J():
50
50
  description=args.description,
51
51
  output_path=args.output_path,
52
52
  use_cache=args.use_cache,
53
- nproc=args.nproc,
53
+ nproc=args.np,
54
54
  exclude_orbs=args.exclude_orbs,
55
55
  orb_decomposition=args.orb_decomposition,
56
56
  index_magnetic_atoms=index_magnetic_atoms,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TB2J
3
- Version: 0.9.9rc18
3
+ Version: 0.9.9rc20
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
@@ -1,7 +1,7 @@
1
- TB2J/Jdownfolder.py,sha256=xs0gmcKwOA3ejXqk3JPPgnYVu8CvkK8cteuvHuu1oSk,9603
1
+ TB2J/Jdownfolder.py,sha256=n5BeQCYP4mD9JsAPeE1F3ZKKR3SUxADfDbaG_rzi77k,9658
2
2
  TB2J/Jtensor.py,sha256=t6OsqrSlYW6Im4H7ykVAW8Al_pFXN4C5yj2UEsV6r7g,3181
3
3
  TB2J/MAE.py,sha256=fM8U-Dgp9HcQOEeC_kyZV1oVrygBvcux9BraUXVouvY,10994
4
- TB2J/MAEGreen.py,sha256=IhclMJU6TOp97fYogXWq-3dyyAW8iDJqu1FGRDdi6hM,15551
4
+ TB2J/MAEGreen.py,sha256=Iq4hlZrKEOycPvpV66_t13WIcJ1FJgBS79NleXYpFzw,15528
5
5
  TB2J/Oiju.py,sha256=cNGv8N5uH_swGq7cnAt2OyiDfqtjLlLrwseGu0E4iaM,3383
6
6
  TB2J/Oiju_epc.py,sha256=oytM3NYW7nWmklrGgNlqwIpI_JYv_hb7ZnR4o9nYNog,6809
7
7
  TB2J/__init__.py,sha256=hcEWkag_UvLm1ZSbjsgcTWkGVlR3Bwmzg1QYAwsvf-g,24
@@ -13,7 +13,7 @@ TB2J/density_matrix.py,sha256=D5k8Oe21OCiLVORNYbo4TZOFG0slrQSbj91kJ3TMFjs,1514
13
13
  TB2J/epc.py,sha256=zLbtqZJhDr8DnnGN6YENcXwrMb3Qxu6KB08mLy9Pw20,3474
14
14
  TB2J/exchange.py,sha256=HSvB_keITEeaoNG661feoEcCwjkQlavQQiIi1ONsI3Y,27035
15
15
  TB2J/exchangeCL2.py,sha256=P7bklMXVYX_tn9DbjEPqeTir1SeZyfPBIP1fhWUzLmY,11419
16
- TB2J/exchange_params.py,sha256=d1nFBFwut9SvxUmPRzPzRxD6y0KAP2IvGoEOQ2Jec9U,8049
16
+ TB2J/exchange_params.py,sha256=VW9nGVio6M_Ub9-36L_LExhjgdD1E_joYpI8AxmM360,8029
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
@@ -43,7 +43,7 @@ TB2J/interfaces/__init__.py,sha256=4tiLoXQ73Nlyi9L4j8jJXOYzXluVNPxQZkwfkQZEGHg,3
43
43
  TB2J/interfaces/gpaw_interface.py,sha256=GCDlJ-hRWfChvWwsgBDYSmVqO4sH9HAuGZTV9GqgN6c,1504
44
44
  TB2J/interfaces/lawaf_interface.py,sha256=PieLnmppdafOYsgeHznqOou1g9L1sam5jOm3KaObdqo,4408
45
45
  TB2J/interfaces/manager.py,sha256=PQMLEfMCT5GnDWSl2nI4JOgRPm_fysyR-6Y6l97xWcw,860
46
- TB2J/interfaces/siesta_interface.py,sha256=DACmRG89IKt_MHfmZDTORCjaUhQ6LRloLzoE1x-5IQM,7625
46
+ TB2J/interfaces/siesta_interface.py,sha256=nCrVWKXua-QzikSPhrvdFVw3OpjeKYPzLzMa7Hqc6Yc,7714
47
47
  TB2J/interfaces/wannier90_interface.py,sha256=qzRgXUBb7t1Aiegrl_RV51BB8csdtVM0EP0Z4pjmTcs,4467
48
48
  TB2J/interfaces/abacus/__init__.py,sha256=leas71oCvM_HxrF4gnO5A_VKcJmDAgsI1BUctLU3OBw,177
49
49
  TB2J/interfaces/abacus/abacus_api.py,sha256=lNV4LNkLcKw7Zux4MQYM9wnh3eFTlcSqbf4Pb7pqhrk,7243
@@ -55,22 +55,23 @@ 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=LqEnG67qDVKt4hCUywDEQvUIJ7jsQjmtueOW_J16NOE,54
58
- TB2J/io_exchange/io_exchange.py,sha256=6fefcfYAyRojkCJA5bFwAa2Hjwx6epysfyX8Snj9DWc,20102
58
+ TB2J/io_exchange/io_exchange.py,sha256=YEFJT8nPy-aGUgGRhIgrC73pf6IQfL7bgGovUkGKv60,21273
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
62
62
  TB2J/io_exchange/io_uppasd.py,sha256=bI4iPEgnK4TvCZNvb6x2xYXgjW7pEehCqmcizy2pqFU,3301
63
63
  TB2J/io_exchange/io_vampire.py,sha256=UllC4twf06_q2vBCnAYFzEDGvS8mSefwQXDquBuyc0M,5583
64
64
  TB2J/magnon/__init__.py,sha256=jdUFkOlhrpHRmKavAXVcFdZgtY7lKZVzMPFlLmmCErM,113
65
- TB2J/magnon/io_exchange2.py,sha256=vKKQXhPSvoeKNIc0Kh0GaTFph36jSW0Z46nAAbSEcAg,22993
65
+ TB2J/magnon/io_exchange2.py,sha256=EcC3x6H13qq61WBsr__xKzHDtSvy_dMz1tEdUaqSG2I,23265
66
+ TB2J/magnon/magnon3.py,sha256=AsPTsbaMxvoPHvgi1nKSxqeN32QIJccm0os65u6o4uQ,6784
67
+ TB2J/magnon/magnon_math.py,sha256=hJ2k24eR4TzdaFMxfxgCr10lWV4GEcfaf2WxhWj-uUk,1320
66
68
  TB2J/magnon/plot.py,sha256=kwq9LL0FRVo-SLYNkE-ghlyjz8DZD-c4LAWg8si5GJo,1674
67
69
  TB2J/magnon/structure.py,sha256=rKefzXgQlEjVvV-A7E2IogVDWwf5egZr3Wxxu6HuJU4,7685
68
- TB2J/mathutils/__init__.py,sha256=u3QCXBUmKOtJc5PWMFS65e1WhP43UpSf48S7aJZCohc,50
70
+ TB2J/mathutils/__init__.py,sha256=E70Mx8mLXh3DJGmdN3TLWmGYMcsbvKxmgxUbAI6Mzmo,49
69
71
  TB2J/mathutils/fermi.py,sha256=72tZ5CptGmYaBUD0xLWltuH7LBXcrMUwODyW6-WqlzI,638
70
72
  TB2J/mathutils/fibonacci_sphere.py,sha256=l0USn25ZCAWF6l4UleyWaeLthsj9TThV9iWmfi6DbaM,2344
71
73
  TB2J/mathutils/kR_convert.py,sha256=p_9XWJVNanTzTK2rI6KRjTkbSq42la6N448-zJOsMwY,2671
72
74
  TB2J/mathutils/lowdin.py,sha256=RYbm9OcnFnjcZFdC5YcNUsI9cOJmoDLsWSSCaP0GqKQ,499
73
- TB2J/mathutils/magnons.py,sha256=o9O7OR39RK1cl46MtiUO9Kd1IZYDOR3ANe82FZ7laY8,1085
74
75
  TB2J/mathutils/rotate_spin.py,sha256=lbGzve_36FyNjanXqdxYDb102kA4_5OycRlBcm-tH-g,8360
75
76
  TB2J/spinham/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
77
  TB2J/spinham/base_parser.py,sha256=oQRHvFE_BlUtTaTZykKgvicu40oXcbICB-D1aAt-qlA,2196
@@ -85,20 +86,20 @@ TB2J/spinham/supercell.py,sha256=y17uUC6r3gQb278FhxIW4CABihfLTvKFj6flyXrCPR8,122
85
86
  TB2J/wannier/__init__.py,sha256=7ojCbM84PYv1X1Tbo4NHI-d3gWmQsZB_xiYqbfxVV1E,80
86
87
  TB2J/wannier/w90_parser.py,sha256=dbd63LuKyv2DVUzqRINGsbDzEsOxsQyE8_Ear_LQIRg,4620
87
88
  TB2J/wannier/w90_tb_parser.py,sha256=qt8pnuprmPp9iIAYwPkPbmEzk6ZPgMq2xognoQp7vwc,4610
88
- tb2j-0.9.9rc18.data/scripts/TB2J_downfold.py,sha256=i4BVqnpDdgrX_amookVWeLGefGBn-qeAutWiwuY9SfQ,2099
89
- tb2j-0.9.9rc18.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
90
- tb2j-0.9.9rc18.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
91
- tb2j-0.9.9rc18.data/scripts/TB2J_magnon2.py,sha256=9HKNXwPlwaEnAlJXVLrbQFhWj3fGLlBAp-nMXWDTbE0,1911
92
- tb2j-0.9.9rc18.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
93
- tb2j-0.9.9rc18.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
94
- tb2j-0.9.9rc18.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
95
- tb2j-0.9.9rc18.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
96
- tb2j-0.9.9rc18.data/scripts/abacus2J.py,sha256=VD1ldQP-PIMyxo3Rzzwk_06fJEbbU7oiU3aRXNHK0a0,1826
97
- tb2j-0.9.9rc18.data/scripts/siesta2J.py,sha256=QJ6c0DbqxaqYEesxiL5R9nK9-flNLrr7hajKfCwirYc,2318
98
- tb2j-0.9.9rc18.data/scripts/wann2J.py,sha256=OA31VHEXbQMD-JozoLUHDF6vB9Sr62d804OApSKtSnU,3240
99
- tb2j-0.9.9rc18.dist-info/licenses/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
100
- tb2j-0.9.9rc18.dist-info/METADATA,sha256=wvdtn-fBIkBMcOJlL_j812z31FWaGEAWdmLoQMc0yOA,1688
101
- tb2j-0.9.9rc18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
102
- tb2j-0.9.9rc18.dist-info/entry_points.txt,sha256=Hdz1WC9waUzyFVmowKnbbZ6j-J4adHh_Ko6JpxGYAtE,131
103
- tb2j-0.9.9rc18.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
104
- tb2j-0.9.9rc18.dist-info/RECORD,,
89
+ tb2j-0.9.9rc20.data/scripts/TB2J_downfold.py,sha256=i4BVqnpDdgrX_amookVWeLGefGBn-qeAutWiwuY9SfQ,2099
90
+ tb2j-0.9.9rc20.data/scripts/TB2J_eigen.py,sha256=Qs9v2hnMm2Tpfoa4h53muUKty2dZjwx8948MBoQooNg,1128
91
+ tb2j-0.9.9rc20.data/scripts/TB2J_magnon.py,sha256=q7UwAmorRcFNk4tfE7gl_ny05l6p7pbD9Wm_LkIpKEw,3101
92
+ tb2j-0.9.9rc20.data/scripts/TB2J_magnon2.py,sha256=tMa7Fg_Wd2UytnrH3C_AsgGM7BciUW0iy6NiPlWvar8,1920
93
+ tb2j-0.9.9rc20.data/scripts/TB2J_magnon_dos.py,sha256=TMXQvD2dIbO5FZ4tUMmxJgCgH2O2hDAPUNfEKO4z-x4,110
94
+ tb2j-0.9.9rc20.data/scripts/TB2J_merge.py,sha256=y834SF4rIRn1L1ptkhczvavQpC-8Px6DTmDOOSaq_DE,1854
95
+ tb2j-0.9.9rc20.data/scripts/TB2J_rotate.py,sha256=zgiDFuYZNmzKK0rwDmTaYD2OpRlmKA_VGeBx83w2Xwc,873
96
+ tb2j-0.9.9rc20.data/scripts/TB2J_rotateDM.py,sha256=kCvF7gotuqAX1VnJ06cwfVm7RrhrdtiV5v7d9P2Pn_E,567
97
+ tb2j-0.9.9rc20.data/scripts/abacus2J.py,sha256=4vCY7eih6JBc92rG6WZhUfcgf_GMJq2H21TweRaWG3s,1823
98
+ tb2j-0.9.9rc20.data/scripts/siesta2J.py,sha256=QJ6c0DbqxaqYEesxiL5R9nK9-flNLrr7hajKfCwirYc,2318
99
+ tb2j-0.9.9rc20.data/scripts/wann2J.py,sha256=OA31VHEXbQMD-JozoLUHDF6vB9Sr62d804OApSKtSnU,3240
100
+ tb2j-0.9.9rc20.dist-info/licenses/LICENSE,sha256=CbZI-jyRTjiqIcWa244cRSHJdjjtUNqGR4HeJkgEwJw,1332
101
+ tb2j-0.9.9rc20.dist-info/METADATA,sha256=v2EEKox-l5DApWhNUQFBIt_XvjTDyMEWPzB-ZA7Ykj8,1688
102
+ tb2j-0.9.9rc20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
103
+ tb2j-0.9.9rc20.dist-info/entry_points.txt,sha256=Hdz1WC9waUzyFVmowKnbbZ6j-J4adHh_Ko6JpxGYAtE,131
104
+ tb2j-0.9.9rc20.dist-info/top_level.txt,sha256=whYa5ByLYhl5XnTPBHSWr-IGD6VWmr5Ql2bye2qwV_s,5
105
+ tb2j-0.9.9rc20.dist-info/RECORD,,