Skip to content

Commit

Permalink
bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
mailhexu committed Jan 5, 2025
2 parents 082e77f + fe79e1e commit 60fa0ee
Show file tree
Hide file tree
Showing 54 changed files with 3,719 additions and 1,524 deletions.
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
repos:
- repo: https://github.com/ambv/black
rev: 23.9.1
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.5
hooks:
- id: black
language_version: python3
# Run the linter.
- id: ruff
# --select I sorts imports
args: [ --fix, --extend-select, I ]
# Run the formatter.
- id: ruff-format
78 changes: 78 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 88
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
ignore = ["E741"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

20 changes: 11 additions & 9 deletions TB2J/Jdownfolder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
from collections import defaultdict

import numpy as np
from ase.dft.kpoints import monkhorst_pack

from TB2J.io_exchange import SpinIO
from TB2J.Jtensor import decompose_J_tensor

Expand Down Expand Up @@ -73,8 +75,8 @@ def downfold_oneq(self, J):
class PWFDownfolder:
def __init__(self, JR, Rlist, iM, iL, qmesh, atoms=None, iso_only=False, **kwargs):
from lawaf.interfaces.magnon.magnon_downfolder import (
MagnonWrapper,
MagnonDownfolder,
MagnonWrapper,
)

model = MagnonWrapper(JR, Rlist, atoms)
Expand All @@ -92,13 +94,13 @@ def __init__(self, JR, Rlist, iM, iL, qmesh, atoms=None, iso_only=False, **kwarg
# anchors={(0, 0, 0): (-1, -2, -3, -4)},
# anchors={(0, 0, 0): ()},
# use_proj=True,
enhance_Amn=2.0,
enhance_Amn=0.0,
)
params.update(kwargs)
wann.set_parameters(**params)
print("begin downfold")
ewf = wann.downfold()
ewf.save_hr_pickle("downfolded_JR.pickle")
# ewf.save_hr_pickle("downfolded_JR.pickle")

# Plot the band structure.
wann.plot_band_fitting(
Expand Down Expand Up @@ -135,7 +137,7 @@ def __init__(
qmesh=[7, 7, 7],
iso_only=False,
method="pwf",
**kwargs
**kwargs,
):
self.exc = SpinIO.load_pickle(path=inpath, fname="TB2J.pickle")

Expand Down Expand Up @@ -193,7 +195,7 @@ def _downfold(self, **kwargs):
qmesh=self.qmesh,
atoms=self.atoms,
iso_only=self.iso_only,
**kwargs
**kwargs,
)
Jd, Rlist = d.get_JR()
return Jd, Rlist
Expand Down Expand Up @@ -274,10 +276,10 @@ def _prepare_index_spin(self):
def test():
# pass
# inpath = "/home/hexu/projects/NiCl2/vasp_inputs/TB2J_results"
# inpath = "/home/hexu/projects/TB2J_example/CrI3/TB2J_results"
inpath = "/home/hexu/projects/TB2J_projects/NiCl2/TB2J_NiCl/TB2J_results"
fname = os.path.join(inpath, "TB2J.pickle")
p = JDownfolder_pickle(
inpath = "/home/hexu/projects/TB2J_example/CrI3/TB2J_results"
# inpath = "/home/hexu/projects/TB2J_projects/NiCl2/TB2J_NiCl/TB2J_results"
_fname = os.path.join(inpath, "TB2J.pickle")
_p = JDownfolder_pickle(
inpath=inpath, metals=["Ni"], ligands=["Cl"], outpath="TB2J_results_downfolded"
)

Expand Down
Loading

0 comments on commit 60fa0ee

Please sign in to comment.