TB2Jflows 0.0.1__tar.gz → 0.2__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.
@@ -0,0 +1,129 @@
1
+ doc/refs/*.pdf
2
+ examples
3
+
4
+ # Latex
5
+ *.aux
6
+
7
+ # xyz files
8
+
9
+ .DS_Store
10
+
11
+ # Byte-compiled / optimized / DLL files
12
+ __pycache__/
13
+ *.py[cod]
14
+ *$py.class
15
+
16
+ # numpy results
17
+ *.npy
18
+
19
+ # png files
20
+
21
+ # C extensions
22
+ *.so
23
+ *.a
24
+
25
+ # Fortran extensions
26
+ *.fpp
27
+ *.mod
28
+ *.o
29
+
30
+ # F90wrap files
31
+ *.plist
32
+
33
+ # Distribution / packaging
34
+ .Python
35
+ env/
36
+ build/
37
+ develop-eggs/
38
+ dist/
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ lib64/
44
+ parts/
45
+ sdist/
46
+ var/
47
+ wheels/
48
+ *.egg-info/
49
+ *.egg-info/*
50
+ .installed.cfg
51
+ *.egg
52
+
53
+ # temporary files
54
+ temp/
55
+
56
+ # PyInstaller
57
+ # Usually these files are written by a python script from a template
58
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
59
+ *.manifest
60
+ *.spec
61
+
62
+ # Installer logs
63
+ pip-log.txt
64
+ pip-delete-this-directory.txt
65
+
66
+ # Unit test / coverage reports
67
+ htmlcov/
68
+ .tox/
69
+ .coverage
70
+ .coverage.*
71
+ .cache
72
+ nosetests.xml
73
+ coverage.xml
74
+ *.cover
75
+ .hypothesis/
76
+
77
+ # Translations
78
+ *.mo
79
+ *.pot
80
+
81
+ # Django stuff:
82
+ *.log
83
+ local_settings.py
84
+
85
+ # Flask stuff:
86
+ instance/
87
+ .webassets-cache
88
+
89
+ # Scrapy stuff:
90
+ .scrapy
91
+
92
+ # Sphinx documentation
93
+ docs/_build/
94
+
95
+ # PyBuilder
96
+ target/
97
+
98
+ # Jupyter Notebook
99
+ .ipynb_checkpoints
100
+
101
+ # pyenv
102
+ .python-version
103
+
104
+ # celery beat schedule file
105
+ celerybeat-schedule
106
+
107
+ # SageMath parsed files
108
+ *.sage.py
109
+
110
+ # dotenv
111
+ .env
112
+
113
+ # virtualenv
114
+ .venv
115
+ venv/
116
+ ENV/
117
+
118
+ # Spyder project settings
119
+ .spyderproject
120
+ .spyproject
121
+
122
+ # Rope project settings
123
+ .ropeproject
124
+
125
+ # mkdocs documentation
126
+ /site
127
+
128
+ # mypy
129
+ .mypy_cache/
@@ -0,0 +1,11 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.3.5
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ # --select I sorts imports
9
+ args: [ --fix, --extend-select, I ]
10
+ # Run the formatter.
11
+ - id: ruff-format
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: TB2Jflows
3
- Version: 0.0.1
3
+ Version: 0.2
4
4
  Summary: TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J
5
5
  Author: Xu He
6
6
  Author-email: mailhexu@gmail.com
@@ -23,6 +23,7 @@ Dynamic: author-email
23
23
  Dynamic: classifier
24
24
  Dynamic: description
25
25
  Dynamic: license
26
+ Dynamic: license-file
26
27
  Dynamic: requires-dist
27
28
  Dynamic: requires-python
28
29
  Dynamic: summary
@@ -24,6 +24,7 @@ class SiestaFlow:
24
24
  restart=True,
25
25
  metadata={},
26
26
  fdf_arguments={},
27
+ relax_arguments={},
27
28
  split_soc=False,
28
29
  **kwargs,
29
30
  ):
@@ -50,6 +51,7 @@ class SiestaFlow:
50
51
  self.root_path = root_path
51
52
  self.restart = restart
52
53
  self.kwargs = kwargs
54
+ self.relax_args = relax_arguments
53
55
 
54
56
  # paths
55
57
  self.metadata_path = os.path.join(self.root_path, "metadata.json")
@@ -158,6 +160,7 @@ class SiestaFlow:
158
160
  MaxStressTol=0.1,
159
161
  NumCGSteps=200,
160
162
  ):
163
+ print(f"Relaxation in {path}")
161
164
  if (
162
165
  self.restart
163
166
  and self.metadata["already_relaxed"]
@@ -169,20 +172,20 @@ class SiestaFlow:
169
172
  old_spin = self.spin
170
173
  if use_collinear:
171
174
  self.spin = "collinear"
172
- calc = self.get_calculator(atoms, path=self.relax_path, label=label)
173
- calc.atoms = atoms
174
- atoms = calc.relax(
175
- atoms,
176
- TypeOfRun=TypeOfRun,
177
- VariableCell=VariableCell,
178
- ConstantVolume=ConstantVolume,
179
- RelaxCellOnly=RelaxCellOnly,
180
- MaxForceTol=MaxForceTol,
181
- MaxStressTol=MaxStressTol,
182
- NumCGSteps=NumCGSteps,
183
- )
184
- self.spin = old_spin
185
- self.relaxed_atoms = atoms
175
+ calc = self.get_calculator(atoms, path=self.relax_path, label=label)
176
+ calc.atoms = atoms
177
+ atoms = calc.relax(
178
+ atoms,
179
+ TypeOfRun=TypeOfRun,
180
+ VariableCell=VariableCell,
181
+ ConstantVolume=ConstantVolume,
182
+ RelaxCellOnly=RelaxCellOnly,
183
+ MaxForceTol=MaxForceTol,
184
+ MaxStressTol=MaxStressTol,
185
+ NumCGSteps=NumCGSteps,
186
+ )
187
+ self.spin = old_spin
188
+ self.relaxed_atoms = atoms
186
189
  self.update_metadata(
187
190
  {
188
191
  "already_relaxed": True,
@@ -227,19 +230,20 @@ class SiestaFlow:
227
230
  def scf_calculatoin_split_soc(self, atoms, label="siesta", nscf=False):
228
231
  fdf_args = {
229
232
  "SOC_split_SR_SO": True,
230
- #"Spin.OrbitStrength": 3,
233
+ # "Spin.OrbitStrength": 3,
231
234
  "SaveHS.so": True,
232
235
  "SaveHS": True,
233
- "Spin.Fix": False,
236
+ "Spin.Fix": False,
237
+ }
238
+ nscf_args = {
239
+ "SCF.DM.Converge": True,
240
+ "SCF.DM.Tolerance": 1e4,
241
+ "SCF.H.Converge": False,
242
+ "SCF.EDM.Converge": False,
243
+ "SCF.Mix.First": False,
244
+ "SCF.Mix": "density",
245
+ "MaxSCFIterations": 1,
234
246
  }
235
- nscf_args={"SCF.DM.Converge": True,
236
- "SCF.DM.Tolerance": 1e4,
237
- "SCF.H.Converge": False,
238
- "SCF.EDM.Converge": False,
239
- "SCF.Mix.First": False,
240
- "SCF.Mix": "density",
241
- "MaxSCFIterations": 1,
242
- }
243
247
  if nscf:
244
248
  fdf_args.update(nscf_args)
245
249
 
@@ -288,14 +292,17 @@ class SiestaFlow:
288
292
  )
289
293
 
290
294
  def set_nonscf_params(self):
291
- nscf_params={"SCF.DM.Converge": False,
292
- "SCF.DM.Tolerance": 1e4,
293
- "SCF.H.Converge": False,
294
- "SCF.EDM.Converge": False,
295
- "SCF.Mix.First": False,
296
- "SCF.Mix": "density",
297
- "MaxSCFIterations": 1,
298
- }
295
+ nscf_params = {
296
+ "SCF.DM.Converge": False,
297
+ "SCF.DM.Tolerance": 1e4,
298
+ "SCF.H.Converge": False,
299
+ "SCF.EDM.Converge": False,
300
+ "SCF.Mix.First": False,
301
+ "SCF.Mix": "density",
302
+ "MaxSCFIterations": 1,
303
+ }
304
+
305
+ self.fdf_arguments.update(nscf_params)
299
306
 
300
307
  def run_TB2J_split_soc(self, **kwargs):
301
308
  path = os.path.join(self.scf_path, "split_soc")
@@ -352,9 +359,9 @@ class SiestaFlow:
352
359
  write_path=os.path.join(self.root_path, "TB2J_results_merged"),
353
360
  )
354
361
 
355
- def runall_collinear(self, atoms, relax=True, scf=True, TB2J=True, **kwargs):
362
+ def runall_collinear(self, atoms, relax=True, scf=True, TB2J=True, **kwargs):
356
363
  if relax:
357
- atoms = self.relax(atoms)
364
+ atoms = self.relax(atoms, **self.relax_args)
358
365
  if scf:
359
366
  self.scf_calculation_collinear(atoms, label="siesta")
360
367
  if TB2J:
@@ -364,7 +371,7 @@ class SiestaFlow:
364
371
  self, atoms, relax=True, scf=True, TB2J=True, rotate_type="structure", **kwargs
365
372
  ):
366
373
  if relax:
367
- atoms = self.relax(atoms)
374
+ atoms = self.relax(atoms, **self.relax_args)
368
375
  if scf:
369
376
  self.scf_calculation_with_rotations(
370
377
  atoms, rotate_type=rotate_type, label="siesta"
@@ -375,7 +382,7 @@ class SiestaFlow:
375
382
 
376
383
  def runall_split_soc(self, atoms, relax=True, scf=True, TB2J=True, **kwargs):
377
384
  if relax:
378
- atoms = self.relax(atoms)
385
+ atoms = self.relax(atoms, **self.relax_args)
379
386
  if scf:
380
387
  self.scf_calculatoin_split_soc(atoms, label="siesta")
381
388
  if TB2J:
@@ -52,6 +52,7 @@ def auto_siesta_TB2J(
52
52
  TB2J=True,
53
53
  rotate_type="structure",
54
54
  fincore=True,
55
+ relax_kwargs={},
55
56
  siesta_kwargs={},
56
57
  TB2J_kwargs={},
57
58
  fdf_kwargs={},
@@ -99,6 +100,7 @@ def auto_siesta_TB2J(
99
100
  fincore=fincore,
100
101
  Udict=Udict,
101
102
  split_soc=split_soc,
103
+ relax_arguments = relax_kwargs,
102
104
  **siesta_kwargs,
103
105
  )
104
106
  flow.write_metadata()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: TB2Jflows
3
- Version: 0.0.1
3
+ Version: 0.2
4
4
  Summary: TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J
5
5
  Author: Xu He
6
6
  Author-email: mailhexu@gmail.com
@@ -23,6 +23,7 @@ Dynamic: author-email
23
23
  Dynamic: classifier
24
24
  Dynamic: description
25
25
  Dynamic: license
26
+ Dynamic: license-file
26
27
  Dynamic: requires-dist
27
28
  Dynamic: requires-python
28
29
  Dynamic: summary
@@ -1,6 +1,9 @@
1
+ .gitignore
2
+ .pre-commit-config.yaml
1
3
  LICENSE
2
4
  README.md
3
5
  setup.py
6
+ upload_to_pip.sh
4
7
  TB2Jflows/__init__.py
5
8
  TB2Jflows/ase_siesta.py
6
9
  TB2Jflows/auto_siesta_TB2J.py
@@ -9,4 +12,6 @@ TB2Jflows.egg-info/PKG-INFO
9
12
  TB2Jflows.egg-info/SOURCES.txt
10
13
  TB2Jflows.egg-info/dependency_links.txt
11
14
  TB2Jflows.egg-info/requires.txt
12
- TB2Jflows.egg-info/top_level.txt
15
+ TB2Jflows.egg-info/top_level.txt
16
+ examples/SrMnO3/POSCAR
17
+ examples/SrMnO3/SMO_example.py
@@ -0,0 +1,13 @@
1
+ Sr Mn Ca O
2
+ 1.0000000000000000
3
+ 3.8099846261953436 -0.0000000000000000 -0.0000000000000000
4
+ 0.0000000000000000 3.8099846261953436 0.0000000000000000
5
+ 0.0000000000000000 0.0000000000000000 3.8099846261953436
6
+ Sr Mn O
7
+ 1 1 3
8
+ Cartesian
9
+ 0.0000000000000000 0.0000000000000000 0.0000000000000000
10
+ 1.9049923130976718 1.9049923130976718 1.9049923130976718
11
+ 1.9049923130976718 2.0049923130976718 0.0000000000000000
12
+ 0.0000000000000000 1.9049923130976718 1.9049923130976718
13
+ 1.9049923130976718 0.0000000000000000 1.9049923130976718
@@ -0,0 +1,42 @@
1
+ from ase.io import read
2
+ import numpy as np
3
+ from TB2Jflows import SiestaFlow
4
+
5
+
6
+ def calculate_siesta_TB2J_SrMnO3():
7
+ atoms = read('POSCAR')
8
+ atoms.set_initial_magnetic_moments([0, 3, 0, 0, 0])
9
+ flow = SiestaFlow(atoms,
10
+ spin='spin-orbit',
11
+ restart=True,
12
+ kpts=[6, 6, 6],
13
+ root_path='SrMnO3')
14
+ flow.write_metadata()
15
+
16
+ #atoms = flow.relax(atoms)
17
+ mz = [0, 3, 0, 0, 0]
18
+ #m = np.zeros((5, 3), dtype=float)
19
+ #m[1] = np.array([3, 3, 3])/1.732
20
+ # m[1]=np.array([0,0,3])
21
+ # atoms.set_initial_magnetic_moments(None)
22
+ atoms.set_initial_magnetic_moments(mz)
23
+ # flow.scf_calculation_single_noncollinear(atoms)
24
+ # flow.run_TB2J_single_noncollinear(magnetic_elements='Mn',
25
+ # nz=50,
26
+ # kmesh=[5, 5, 5],
27
+ # Rcut=18,
28
+ # np=3,
29
+ # use_cache=True)
30
+
31
+ flow.scf_calculation_with_rotations(atoms)
32
+ flow.run_TB2J(magnetic_elements='Mn',
33
+ nz=50,
34
+ kmesh=[7, 7, 7],
35
+ Rcut=18,
36
+ np=3,
37
+ use_cache=True)
38
+ flow.run_TB2J_merge()
39
+
40
+
41
+ if __name__ == '__main__':
42
+ calculate_siesta_TB2J_SrMnO3()
tb2jflows-0.2/setup.py ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env python
2
+ from setuptools import find_packages, setup
3
+
4
+ __version__ = "0.2"
5
+
6
+ long_description = """ TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J """
7
+
8
+ setup(
9
+ name="TB2Jflows",
10
+ version=__version__,
11
+ description="TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J",
12
+ long_description=long_description,
13
+ author="Xu He",
14
+ author_email="mailhexu@gmail.com",
15
+ license="BSD-2-clause",
16
+ packages=find_packages(),
17
+ scripts=[],
18
+ install_requires=["TB2J", "ase", "sisl", "pyDFTutils"],
19
+ classifiers=[
20
+ "Development Status :: 3 - Alpha",
21
+ "Programming Language :: Python :: 3",
22
+ "Operating System :: OS Independent",
23
+ "Intended Audience :: Science/Research",
24
+ "Topic :: Scientific/Engineering :: Chemistry",
25
+ "Topic :: Scientific/Engineering :: Physics",
26
+ "License :: OSI Approved :: BSD License",
27
+ ],
28
+ python_requires=">=3.6",
29
+ )
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ rm ./dist/*
3
+ #python3 setup.py sdist bdist_wheel
4
+ python -m build
5
+ python -m twine upload --repository pypi dist/* --verbose
tb2jflows-0.0.1/setup.py DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env python
2
- from setuptools import setup, find_packages
3
-
4
- __version__ = "0.0.1"
5
-
6
- long_description = """ TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J """
7
-
8
- setup(
9
- name='TB2Jflows',
10
- version=__version__,
11
- description=
12
- 'TB2Jflows: Workflows for automatically calculation of exchange parameters using TB2J',
13
- long_description=long_description,
14
- author='Xu He',
15
- author_email='mailhexu@gmail.com',
16
- license='BSD-2-clause',
17
- packages=find_packages(),
18
- scripts=[
19
- ],
20
- install_requires=['TB2J', 'ase', 'sisl', 'pyDFTutils'],
21
- classifiers=[
22
- 'Development Status :: 3 - Alpha',
23
- 'Programming Language :: Python :: 3',
24
- 'Operating System :: OS Independent',
25
- 'Intended Audience :: Science/Research',
26
- 'Topic :: Scientific/Engineering :: Chemistry',
27
- 'Topic :: Scientific/Engineering :: Physics',
28
- 'License :: OSI Approved :: BSD License',
29
- ],
30
- python_requires='>=3.6',
31
- )
File without changes
File without changes
File without changes
File without changes