TB2J 0.9.3rc0__tar.gz → 0.9.5rc0__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.
Files changed (90) hide show
  1. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/PKG-INFO +2 -3
  2. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/MAE.py +11 -8
  3. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/abacus_wrapper.py +8 -3
  4. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/gen_exchange_abacus.py +2 -1
  5. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/manager.py +21 -15
  6. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/pauli.py +30 -2
  7. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J.egg-info/PKG-INFO +2 -3
  8. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J.egg-info/SOURCES.txt +0 -1
  9. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J.egg-info/requires.txt +1 -2
  10. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/setup.py +3 -3
  11. tb2j-0.9.3rc0/TB2J/patch.py +0 -50
  12. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/LICENSE +0 -0
  13. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/README.md +0 -0
  14. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/Jdownfolder.py +0 -0
  15. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/Jtensor.py +0 -0
  16. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/Oiju.py +0 -0
  17. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/Oiju_epc.py +0 -0
  18. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/__init__.py +0 -0
  19. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/__init__.py +0 -0
  20. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/abacus_api.py +0 -0
  21. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/orbital_api.py +0 -0
  22. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/stru_api.py +0 -0
  23. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/test_density_matrix.py +0 -0
  24. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/test_read_HRSR.py +0 -0
  25. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/abacus/test_read_stru.py +0 -0
  26. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/basis.py +0 -0
  27. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/citation.py +0 -0
  28. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/contour.py +0 -0
  29. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/density_matrix.py +0 -0
  30. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/epc.py +0 -0
  31. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/exchange.py +0 -0
  32. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/exchangeCL2.py +0 -0
  33. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/exchange_pert.py +0 -0
  34. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/exchange_qspace.py +0 -0
  35. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/external/__init__.py +0 -0
  36. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/external/p_tqdm.py +0 -0
  37. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/gpaw_wrapper.py +0 -0
  38. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/green.py +0 -0
  39. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/greentest.py +0 -0
  40. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/__init__.py +0 -0
  41. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_exchange.py +0 -0
  42. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_multibinit.py +0 -0
  43. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_tomsasd.py +0 -0
  44. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_txt.py +0 -0
  45. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_uppasd.py +0 -0
  46. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_exchange/io_vampire.py +0 -0
  47. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/io_merge.py +0 -0
  48. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/kpoints.py +0 -0
  49. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/mathutils/__init__.py +0 -0
  50. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/mathutils/fermi.py +0 -0
  51. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/mathutils/kR_convert.py +0 -0
  52. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/mathutils/lowdin.py +0 -0
  53. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/mathutils/rotate_spin.py +0 -0
  54. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/myTB.py +0 -0
  55. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/orbmap.py +0 -0
  56. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/pert.py +0 -0
  57. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/plot.py +0 -0
  58. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/rotate_atoms.py +0 -0
  59. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/rotate_siestaDM.py +0 -0
  60. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/sisl_wrapper.py +0 -0
  61. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/__init__.py +0 -0
  62. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/base_parser.py +0 -0
  63. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/constants.py +0 -0
  64. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/hamiltonian.py +0 -0
  65. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/hamiltonian_terms.py +0 -0
  66. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/plot.py +0 -0
  67. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/qsolver.py +0 -0
  68. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/spin_api.py +0 -0
  69. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/spin_xml.py +0 -0
  70. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/spinham/supercell.py +0 -0
  71. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/tensor_rotate.py +0 -0
  72. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/utest.py +0 -0
  73. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/utils.py +0 -0
  74. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/versioninfo.py +0 -0
  75. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/wannier/__init__.py +0 -0
  76. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/wannier/w90_parser.py +0 -0
  77. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J/wannier/w90_tb_parser.py +0 -0
  78. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J.egg-info/dependency_links.txt +0 -0
  79. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/TB2J.egg-info/top_level.txt +0 -0
  80. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_downfold.py +0 -0
  81. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_eigen.py +0 -0
  82. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_magnon.py +0 -0
  83. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_magnon_dos.py +0 -0
  84. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_merge.py +0 -0
  85. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_rotate.py +0 -0
  86. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/TB2J_rotateDM.py +0 -0
  87. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/abacus2J.py +0 -0
  88. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/siesta2J.py +0 -0
  89. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/scripts/wann2J.py +0 -0
  90. {tb2j-0.9.3rc0 → tb2j-0.9.5rc0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TB2J
3
- Version: 0.9.3rc0
3
+ Version: 0.9.5rc0
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
@@ -21,7 +21,6 @@ Requires-Dist: ase>=3.19
21
21
  Requires-Dist: tqdm
22
22
  Requires-Dist: pathos
23
23
  Requires-Dist: packaging>=20.0
24
- Requires-Dist: pre-commit
25
- Requires-Dist: HamiltonIO>=0.1.4
24
+ Requires-Dist: HamiltonIO>=0.1.5
26
25
 
27
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.
@@ -11,8 +11,9 @@ import matplotlib.pyplot as plt
11
11
  from pathlib import Path
12
12
  from TB2J.mathutils.rotate_spin import spherical_to_cartesian
13
13
  from HamiltonIO.model.occupations import Occupations
14
- from TB2J.abacus.abacus_wrapper import AbacusSplitSOCParser
15
- from HamiltonIO.siesta import SislWrapper
14
+ #from TB2J.abacus.abacus_wrapper import AbacusSplitSOCParser
15
+ from HamiltonIO.abacus.abacus_wrapper import AbacusSplitSOCParser
16
+ from HamiltonIO.siesta import SislParser, SiestaHamiltonian
16
17
  import tqdm
17
18
 
18
19
 
@@ -75,7 +76,10 @@ class MAE:
75
76
  # e,rho = self.model.get_band_energy(dm=True)
76
77
  # self.calc_ref()
77
78
  # thetas = np.linspace(*angle_range, npoints)
78
- for i, (theta, phi) in tqdm.tqdm(enumerate(zip(thetas, phis))):
79
+ nangles = len(thetas)
80
+ for i in tqdm.trange(nangles):
81
+ theta = thetas[i]
82
+ phi = phis[i]
79
83
  self.model.set_Hsoc_rotation_angle([theta, phi])
80
84
  e = self.get_band_energy()
81
85
  es.append(e)
@@ -96,28 +100,27 @@ def abacus_get_MAE(
96
100
  outpath_nosoc=path_nosoc, outpath_soc=path_soc, binary=False
97
101
  )
98
102
  model = parser.parse()
99
- model.nel = 16
100
103
  ham = MAE(model, kmesh, gamma=gamma)
101
104
  es = ham.get_band_energy_vs_angles(thetas, psis)
102
105
  if outfile:
103
106
  with open(outfile, "w") as f:
104
107
  f.write("#theta, psi, energy\n")
105
108
  for theta, psi, e in zip(thetas, psis, es):
106
- f.write(f"{theta}, {psi}, {e}\n")
109
+ f.write(f"{theta:5.3f}, {psi:5.3f}, {e:10.9f}\n")
107
110
  return es
108
111
 
109
112
 
110
113
  def siesta_get_MAE(fdf_fname, kmesh, thetas, phis, gamma=True, outfile="MAE.txt"):
111
114
  """ """
112
- parser = SiestaParser(fdf_fname=fdf_fname, read_H_soc=True)
113
- model = parser.parse()
115
+ model= SislParser(fdf_fname=fdf_fname, read_H_soc=True).get_model()
114
116
  ham = MAE(model, kmesh, gamma=gamma)
115
117
  es = ham.get_band_energy_vs_angles(thetas, phis)
116
118
  if outfile:
117
119
  with open(outfile, "w") as f:
118
120
  f.write("#theta, psi, energy\n")
119
121
  for theta, psi, e in zip(thetas, phis, es):
120
- f.write(f"{theta}, {psi}, {e}\n")
122
+ #f.write(f"{theta}, {psi}, {e}\n")
123
+ f.write(f"{theta:5.3f}, {psi:5.3f}, {e:10.9f}\n")
121
124
  return es
122
125
 
123
126
 
@@ -36,6 +36,7 @@ class AbacusWrapper(AbstractTB):
36
36
  self.set_HR_soc(HR_soc=HR_soc, HR_nosoc=HR_nosoc, HR_full=HR)
37
37
  self.soc_rotation_angle = 0.0
38
38
 
39
+
39
40
  def set_HR_soc(self, HR_soc=None, HR_nosoc=None, HR_full=None):
40
41
  self.split_soc = True
41
42
  self.HR_soc = HR_soc
@@ -156,6 +157,9 @@ class AbacusParser:
156
157
  # read the information
157
158
  self.read_atoms()
158
159
  self.efermi = self.read_efermi()
160
+ self.nel = self.read_nel()
161
+ print(f"efermi: {self.efermi}")
162
+ print(f"nel: {self.nel}")
159
163
  self.read_basis()
160
164
 
161
165
  def read_spin(self):
@@ -254,10 +258,10 @@ class AbacusParser:
254
258
  nel = None
255
259
  with open(fname, "r") as myfile:
256
260
  for line in myfile:
257
- if "NELECT" in line:
258
- nel = float(line.split()[2])
261
+ if "number of electrons" in line:
262
+ nel = float(line.split()[-1])
259
263
  if nel is None:
260
- raise ValueError(f"NELECT not found in the {str(fname)} file.")
264
+ raise ValueError(f"number of electron not found in the {str(fname)} file.")
261
265
  return nel
262
266
 
263
267
  def get_basis(self):
@@ -306,6 +310,7 @@ class AbacusSplitSOCParser:
306
310
  nspin=2,
307
311
  HR_soc=HR_soc,
308
312
  HR_nosoc=HR_nosoc,
313
+ nel=self.parser_nosoc.nel,
309
314
  )
310
315
  model.efermi = self.parser_soc.efermi
311
316
  model.basis = self.parser_nosoc.basis
@@ -6,7 +6,8 @@ The main function to compute exchange interaction from abacus data
6
6
 
7
7
  import os
8
8
  from pathlib import Path
9
- from TB2J.abacus.abacus_wrapper import AbacusParser
9
+ #from TB2J.abacus.abacus_wrapper import AbacusParser
10
+ from HamiltonIO.abacus import AbacusParser
10
11
  from TB2J.exchange import ExchangeNCL, ExchangeCL
11
12
  from TB2J.exchangeCL2 import ExchangeCL2
12
13
 
@@ -7,11 +7,15 @@ from TB2J.exchange_qspace import ExchangeCLQspace
7
7
  from TB2J.utils import read_basis, auto_assign_basis_name
8
8
  from ase.io import read
9
9
 
10
- #from TB2J.sisl_wrapper import SislWrapper
10
+ # from TB2J.sisl_wrapper import SislWrapper
11
+
12
+ from HamiltonIO.siesta import SislParser
11
13
  try:
12
- from HamiltonIO.siesta import SislWrapper
14
+ from HamiltonIO.siesta import SislParser
13
15
  except ImportError:
14
- print("Cannot import SislWrapper from HamiltonIO.siesta. Please install HamiltonIO first.")
16
+ print(
17
+ "Cannot import SislWrapper from HamiltonIO.siesta. Please install HamiltonIO first."
18
+ )
15
19
  from TB2J.sisl_wrapper import SislWrapper
16
20
  from TB2J.gpaw_wrapper import GPAWWrapper
17
21
  from TB2J.wannier import parse_atoms
@@ -283,14 +287,16 @@ def gen_exchange_siesta(
283
287
  include_orbs[element] = None
284
288
  magnetic_elements = list(include_orbs.keys())
285
289
 
286
- fdf = sisl.get_sile(fdf_fname)
290
+ #fdf = sisl.get_sile(fdf_fname)
287
291
  # geom = fdf.read_geometry()
288
- H = fdf.read_hamiltonian()
289
- geom = H.geometry
290
- if H.spin.is_colinear:
292
+ #H = fdf.read_hamiltonian()
293
+ #geom = H.geometry
294
+ parser=SislParser(fdf_fname=fdf_fname, ispin=None, read_H_soc=False)
295
+ if parser.spin.is_colinear:
291
296
  print("Reading Siesta hamiltonian: colinear spin.")
292
- tbmodel_up = SislWrapper(fdf_fname=None,sisl_hamiltonian=H, spin=0, geom=geom)
293
- tbmodel_dn = SislWrapper(fdf_fname=None, sisl_hamiltonian=H, spin=1, geom=geom)
297
+ #tbmodel_up = SislWrapper(fdf_fname=None, sisl_hamiltonian=H, spin=0, geom=geom)
298
+ #tbmodel_dn = SislWrapper(fdf_fname=None, sisl_hamiltonian=H, spin=1, geom=geom)
299
+ tbmodel_up, tbmodel_dn = parser.get_model()
294
300
  basis = dict(zip(tbmodel_up.orbs, list(range(tbmodel_up.norb))))
295
301
  print("Starting to calculate exchange.")
296
302
  description = f""" Input from collinear Siesta data.
@@ -320,7 +326,7 @@ def gen_exchange_siesta(
320
326
  print("\n")
321
327
  print(f"All calculation finsihed. The results are in {output_path} directory.")
322
328
 
323
- elif H.spin.is_colinear and False:
329
+ elif parser.spin.is_colinear and False:
324
330
  print(
325
331
  "Reading Siesta hamiltonian: colinear spin. Treat as non-colinear. For testing only."
326
332
  )
@@ -355,10 +361,10 @@ def gen_exchange_siesta(
355
361
  print("\n")
356
362
  print(f"All calculation finsihed. The results are in {output_path} directory.")
357
363
 
358
- elif H.spin.is_spinorbit or H.spin.is_noncolinear:
364
+ elif parser.spin.is_spinorbit or H.spin.is_noncolinear:
359
365
  print("Reading Siesta hamiltonian: non-colinear spin.")
360
- tbmodel = SislWrapper(fdf_fname=None, sisl_hamiltonian=H, spin=None, geom=geom)
361
- basis = dict(zip(tbmodel.orbs, list(range(tbmodel.nbasis))))
366
+ model = parser.get_model()
367
+ basis = dict(zip(model.orbs, list(range(model.nbasis))))
362
368
  print("Starting to calculate exchange.")
363
369
  description = f""" Input from non-collinear Siesta data.
364
370
  working directory: {os.getcwd()}
@@ -368,8 +374,8 @@ Warning: The DMI component parallel to the spin orientation, the Jani which has
368
374
  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.
369
375
  \n"""
370
376
  exchange = ExchangeNCL(
371
- tbmodels=tbmodel,
372
- atoms=tbmodel.atoms,
377
+ tbmodels=model,
378
+ atoms=model.atoms,
373
379
  basis=basis,
374
380
  efermi=0.0,
375
381
  magnetic_elements=magnetic_elements,
@@ -143,11 +143,39 @@ def pauli_block_all(M):
143
143
  return MI, Mx, My, Mz
144
144
 
145
145
 
146
- def gather_pauli_blocks(MI, Mx, My, Mz):
146
+ def gather_pauli_blocks(MI, Mx, My, Mz, coeffs=[1.0, 1.0, 1.0, 1.0]):
147
147
  """
148
148
  Gather the I, x, y, z component of a matrix.
149
149
  """
150
- return np.kron(MI, s0) + np.kron(Mx, s1) + np.kron(My, s2) + np.kron(Mz, s3)
150
+ cI, cx, cy, cz = coeffs
151
+ return cI*np.kron(MI, s0) + cx*np.kron(Mx, s1) + cy*np.kron(My, s2) + cz*np.kron(Mz, s3)
152
+
153
+ def pauli_part(M, coeffs=[1.0, 1.0, 1.0, 1.0]):
154
+ """
155
+ Get the I, x, y, z part of a matrix.
156
+ """
157
+ MI, Mx, My, Mz = pauli_block_all(M)
158
+ return gather_pauli_blocks(MI, Mx, My, Mz, coeffs=coeffs)
159
+
160
+ def chargepart(M):
161
+ """
162
+ Get the charge part of a matrix.
163
+ """
164
+ MI = (M[::2, ::2] + M[1::2, 1::2]) / 2.0
165
+ Mcopy = np.zeros_like(M)
166
+ Mcopy[::2, ::2] = MI
167
+ Mcopy[1::2, 1::2] = MI
168
+ return Mcopy
169
+
170
+ def spinpart(M):
171
+ """
172
+ Get the spin part of a matrix.
173
+ """
174
+ MI = (M[::2, ::2] + M[1::2, 1::2]) / 2.0
175
+ Mcopy = M.copy()
176
+ Mcopy[::2, ::2] -= MI
177
+ Mcopy[1::2, 1::2] -= MI
178
+ return Mcopy
151
179
 
152
180
 
153
181
  def test_gather_pauli_blocks():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TB2J
3
- Version: 0.9.3rc0
3
+ Version: 0.9.5rc0
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
@@ -21,7 +21,6 @@ Requires-Dist: ase>=3.19
21
21
  Requires-Dist: tqdm
22
22
  Requires-Dist: pathos
23
23
  Requires-Dist: packaging>=20.0
24
- Requires-Dist: pre-commit
25
- Requires-Dist: HamiltonIO>=0.1.4
24
+ Requires-Dist: HamiltonIO>=0.1.5
26
25
 
27
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.
@@ -24,7 +24,6 @@ TB2J/kpoints.py
24
24
  TB2J/manager.py
25
25
  TB2J/myTB.py
26
26
  TB2J/orbmap.py
27
- TB2J/patch.py
28
27
  TB2J/pauli.py
29
28
  TB2J/pert.py
30
29
  TB2J/plot.py
@@ -5,5 +5,4 @@ ase>=3.19
5
5
  tqdm
6
6
  pathos
7
7
  packaging>=20.0
8
- pre-commit
9
- HamiltonIO>=0.1.4
8
+ HamiltonIO>=0.1.5
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  from setuptools import setup, find_packages
3
3
 
4
- __version__ = "0.9.3_pre"
4
+ __version__ = "0.9.5_pre"
5
5
 
6
6
  long_description = """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. """
7
7
 
@@ -34,8 +34,7 @@ setup(
34
34
  "tqdm",
35
35
  "pathos",
36
36
  "packaging>=20.0",
37
- "pre-commit",
38
- "HamiltonIO>=0.1.4"
37
+ "HamiltonIO>=0.1.5",
39
38
  ],
40
39
  classifiers=[
41
40
  "Development Status :: 3 - Alpha",
@@ -47,4 +46,5 @@ setup(
47
46
  "License :: OSI Approved :: BSD License",
48
47
  ],
49
48
  python_requires=">=3.6",
49
+
50
50
  )
@@ -1,50 +0,0 @@
1
- import types
2
- from unittest import mock
3
-
4
- class A(object):#but seems to work for old style objects too
5
- def funcx(self,x):
6
- print("x1=",x)
7
- print("called from", self)
8
-
9
- def method(self,x):
10
- print("xmethod=",x)
11
- print("called from", self)
12
-
13
- def patch_me(target):
14
- def method(target,x):
15
- print("x=",x)
16
- print("called from", target)
17
- target.method = types.MethodType(method,target)
18
-
19
- def method(self,x):
20
- print("x=",x)
21
- print("called from", self)
22
-
23
- @mock.patch("__main__.A")
24
- def funcx(self,x):
25
- print("new x=",x)
26
- print("called from", self)
27
-
28
- A.method=method
29
- #add more if needed
30
- a = A()
31
- print(A.__dict__)
32
- print(a)
33
- #out: <__main__.A object at 0x2b73ac88bfd0>
34
-
35
- @mock.patch("__main__.a")
36
- def funcx(self,x):
37
- print("x=",x)
38
- print("called from", self)
39
-
40
- a.funcx(3)
41
- patch_me(a) #patch instance
42
- a.method=method
43
- #a.method(5)
44
- #out: x= 5
45
- #out: called from <__main__.A object at 0x2b73ac88bfd0>
46
- patch_me(A)
47
-
48
- a.method(6) #can patch class too
49
- #out: x= 6
50
- #out: called from <class '__main__.A'>
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
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
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
File without changes
File without changes
File without changes
File without changes