changed pre-commit

class-solution
Daniel Pozsar 3 months ago
parent 18d42b11c8
commit 21ab0dca84

2
.gitignore vendored

@ -20,7 +20,7 @@ docs/source/api/generated
# Debug
tmp*
.coverage
*.coverage
# Mac stuff
*.DS_Store*

@ -22,16 +22,16 @@ repos:
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
language_version: python3.9
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: ./.venv/bin/pytest
language: system
pass_filenames: false
always_run: true
#- repo: https://github.com/psf/black-pre-commit-mirror
# rev: 24.4.2
# hooks:
# - id: black
# language_version: python3.9
#- repo: local
# hooks:
# - id: pytest-check
# name: pytest-check
# entry: ./.venv/bin/pytest
# language: system
# pass_filenames: false
# always_run: true

@ -2,21 +2,28 @@
# TODO
[x] Definition of magnetic entities:
- Definition of magnetic entities:
* Through simple sequence o forbitals in the unit cell
* Through atom specification
* Through atom and orbital specification
[x] Separation of TR and TRB components of the Hamiltonian, Identification of the exchange field.
[x] Definition of commutator expressions, old projection matrix elements
[x] Efficient calculation of Green's functions
[] Calculation of energy and momentum resolved derivatives
[] Parallel BZ and serial energy integral
- Separation of TR and TRB components of the Hamiltonian, Identification of the exchange field.
- Definition of commutator expressions, old projection matrix elements
- Efficient calculation of Green's functions
- Calculation of energy and momentum resolved derivatives
- Parallel BZ and serial energy integral
# Building wheel
https://packaging.python.org/en/latest/tutorials/packaging-projects/
See detailed documentation on [PYPI](https://packaging.python.org/en/latest/tutorials/packaging-projects/).
Use the following commands for a quick setup:
Build wheel: python -m build
- Build wheel
```
python -m build
```
Build wheel:
Push to pypi(testpypi for beginners): python3 -m twine upload --repository testpypi dist/*
@ -25,4 +32,3 @@ You will be prompted for a username and password. For the username, use __token_
Végfelhasználóknak (egyelőre testpypi): python3 -m pip install --index-url https://test.pypi.org/simple/ example-package-YOUR-USERNAME-HERE

@ -2829,4 +2829,3 @@
0.159623499658E-47 0.394685762244E-48 0.959152537476E-49 0.229037992853E-49
0.537289950000E-50 0.123783348782E-50 0.280097688343E-51 0.624177220781E-52
0.136516118863E-52 0.292975523658E-53 0.616797664740E-54

@ -6823,4 +6823,3 @@ spec = Atomic species label
isc = Unit cell indexes to which orbital belongs:
center(io) = center(iuo) + sum_(i=1:3) cell_vec(i) * isc(i)
iuo = Equivalent orbital in first unit cell

@ -21,4 +21,3 @@
issue = {086005},
doi = {10.1088/0953-8984/24/8/086005},
}

@ -72,4 +72,3 @@ Tot.tot: total CPU time in all programs in one node
Nod.avg: average calculation time in one program across nodes
Nod.max: maximum calculation time in one program across nodes
Calculation time: CPU time excluding communications

@ -72,4 +72,3 @@ Tot.tot: total CPU time in all programs in one node
Nod.avg: average calculation time in one program across nodes
Nod.max: maximum calculation time in one program across nodes
Calculation time: CPU time excluding communications

@ -223,7 +223,8 @@ def calculate_exchange_tensor(pair):
J_ii = np.array([o2[-1], o3[0], o1[0]]) # xx, yy, zz
J_S = -0.5 * np.array([o3[1] + o3[2], o2[1] + o2[1], o1[1] + o1[2]]) # yz, zx, xy
D = 0.5 * np.array([o1[1] - o1[2], o2[2] - o2[1], o3[1] - o3[2]]) # x, y, z
return J_ii.sum() / 3, D, np.concatenate([J_ii[:2] - J_ii.sum()/3, J_S]).flatten()
return J_ii.sum() / 3, D, np.concatenate([J_ii[:2] - J_ii.sum() / 3, J_S]).flatten()
def print_atomic_indices(pair, magnetic_entities, dh):
atomic_indices = ""
@ -231,17 +232,27 @@ def print_atomic_indices(pair, magnetic_entities, dh):
if "l" not in atoms.keys():
atoms["l"] = "all"
if isinstance(atoms["atom"], int):
atomic_indices += f"[{atoms['atom']}]{dh.atoms[atoms['atom']].tag}({atoms['l']})"
atomic_indices += (
f"[{atoms['atom']}]{dh.atoms[atoms['atom']].tag}({atoms['l']})"
)
if isinstance(atoms, list):
atomic_indices += [f"[{atoms['atom']}]{dh.atoms[atom['atom']].tag}({atom['l']})" for atom in atoms["atom"]]
atomic_indices += [
f"[{atoms['atom']}]{dh.atoms[atom['atom']].tag}({atom['l']})"
for atom in atoms["atom"]
]
atoms = magnetic_entities[pair["aj"]]
if "l" not in atoms.keys():
atoms["l"] = "all"
atomic_indices += " "
if isinstance(atoms["atom"], int):
atomic_indices += f"[{atoms['atom']}]{dh.atoms[atoms['atom']].tag}({atoms['l']})"
atomic_indices += (
f"[{atoms['atom']}]{dh.atoms[atoms['atom']].tag}({atoms['l']})"
)
if isinstance(atoms, list):
atomic_indices += [f"[{atoms['atom']}]{dh.atoms[atom['atom']].tag}({atom['l']})" for atom in atoms["atom"]]
atomic_indices += [
f"[{atoms['atom']}]{dh.atoms[atom['atom']].tag}({atom['l']})"
for atom in atoms["atom"]
]
atomic_indices += f" {pair['Ruc']} d [Ang] Not yet."
return atomic_indices

@ -1,27 +1,28 @@
import os
from sys import stdout
from tqdm import tqdm
from timeit import default_timer as timer
from tqdm import tqdm
os.environ["OMP_NUM_THREADS"] = "1" # export OMP_NUM_THREADS=4
os.environ["OPENBLAS_NUM_THREADS"] = "1" # export OPENBLAS_NUM_THREADS=4
os.environ["MKL_NUM_THREADS"] = "1" # export MKL_NUM_THREADS=6
os.environ["VECLIB_MAXIMUM_THREADS"] = "1" # export VECLIB_MAXIMUM_THREADS=4
os.environ["NUMEXPR_NUM_THREADS"] = "1" # export NUMEXPR_NUM_THREADS=6
import warnings
import numpy as np
import sisl
from grogu.useful import *
from mpi4py import MPI
from numpy.linalg import inv
import warnings
from grogu.useful import *
start_time = timer()
# this cell mimicks an input file
fdf = sisl.get_sile(
"./lat3_791/Fe3GeTe2.fdf"
)
fdf = sisl.get_sile("./lat3_791/Fe3GeTe2.fdf")
# this information needs to be given at the input!!
scf_xcf_orientation = np.array([0, 0, 1]) # z
# list of reference directions for around which we calculate the derivatives
@ -35,22 +36,22 @@ ref_xcf_orientations = [
]
# human readable definition of magnetic entities
#magnetic_entities = [
# magnetic_entities = [
# dict(atom=0, ),
# dict(atom=1, ),
# dict(atom=2, ),
# dict(atom=3, l=2),
# dict(atom=4, l=2),
# dict(atom=5, l=2),
#]
#pairs = [
# ]
# pairs = [
# dict(ai=3, aj=4, Ruc=np.array([0, 0, 0])), # isotropic should be -82 meV
# dict(ai=3, aj=5, Ruc=np.array([0, 0, 0])), # these should all be around -41.9 in the isotropic part
# dict(ai=4, aj=5, Ruc=np.array([0, 0, 0])),
# dict(ai=3, aj=0, Ruc=np.array([0, 0, 0])),
# dict(ai=3, aj=1, Ruc=np.array([0, 0, 0])),
# dict(ai=3, aj=2, Ruc=np.array([0, 0, 0])),
#]
# ]
magnetic_entities = [
dict(atom=3, l=2),
dict(atom=4, l=2),
@ -60,7 +61,9 @@ magnetic_entities = [
# pair information
pairs = [
dict(ai=0, aj=1, Ruc=np.array([0, 0, 0])), # isotropic should be -82 meV
dict(ai=0, aj=2, Ruc=np.array([0, 0, 0])), # these should all be around -41.9 in the isotropic part
dict(
ai=0, aj=2, Ruc=np.array([0, 0, 0])
), # these should all be around -41.9 in the isotropic part
dict(ai=1, aj=2, Ruc=np.array([0, 0, 0])),
dict(ai=0, aj=1, Ruc=np.array([-1, 0, 0])),
dict(ai=0, aj=2, Ruc=np.array([-1, 0, 0])),
@ -89,15 +92,17 @@ root_node = 0
if rank == root_node:
print("Number of nodes in the parallel cluster: ", size)
simulation_parameters = dict(path="Not yet specified.",
scf_xcf_orientation=scf_xcf_orientation,
ref_xcf_orientations=ref_xcf_orientations,
kset=kset,
kdirs=kdirs,
ebot=ebot,
eset=eset,
esetp=esetp,
parallel_size=size)
simulation_parameters = dict(
path="Not yet specified.",
scf_xcf_orientation=scf_xcf_orientation,
ref_xcf_orientations=ref_xcf_orientations,
kset=kset,
kdirs=kdirs,
ebot=ebot,
eset=eset,
esetp=esetp,
parallel_size=size,
)
# digestion of the input
# read in hamiltonian
@ -265,7 +270,7 @@ site_and_pair_dictionaries_time = timer()
kset = make_kset(dirs=kdirs, NUMK=kset) # generate k space sampling
wkset = np.ones(len(kset)) / len(kset) # generate weights for k points
kpcs = np.array_split(kset, size) # split the k points based on MPI size
kpcs[root_node] = tqdm(kpcs[root_node], desc='k loop', file=stdout)
kpcs[root_node] = tqdm(kpcs[root_node], desc="k loop", file=stdout)
k_set_time = timer()
@ -411,43 +416,66 @@ if rank == root_node:
end_time = timer()
print("############################### GROGU OUTPUT ###################################")
print("================================================================================")
print(
"############################### GROGU OUTPUT ###################################"
)
print(
"================================================================================"
)
print("Input file: ")
print(simulation_parameters["path"])
print("Number of nodes in the parallel cluster: ", simulation_parameters["parallel_size"])
print("================================================================================")
print(
"Number of nodes in the parallel cluster: ",
simulation_parameters["parallel_size"],
)
print(
"================================================================================"
)
try:
print("Cell [Ang]: ")
print(simulation_parameters["geom"].cell)
except:
print("Geometry could not be read.")
print("================================================================================")
print(
"================================================================================"
)
print("DFT axis: ")
print(simulation_parameters["scf_xcf_orientation"])
print("Quantization axis and perpendicular rotation directions:")
for ref in ref_xcf_orientations:
print(ref["o"], " --» ", ref["vw"])
print("================================================================================")
print(
"================================================================================"
)
print("number of k points: ", simulation_parameters["kset"])
print("k point directions: ", simulation_parameters["kdirs"])
print("================================================================================")
print(
"================================================================================"
)
print("Parameters for the contour integral:")
print("Ebot: ", simulation_parameters["ebot"])
print("Eset: ", simulation_parameters["eset"])
print("Esetp: ", simulation_parameters["esetp"])
print("================================================================================")
print(
"================================================================================"
)
print("Atomic informations: ")
print("")
print("")
print("Not yet specified.")
print("")
print("")
print("================================================================================")
print(
"================================================================================"
)
print("Exchange [meV]")
print("--------------------------------------------------------------------------------")
print(
"--------------------------------------------------------------------------------"
)
print("Atom1 Atom2 [i j k] d [Ang]")
print("--------------------------------------------------------------------------------")
print(
"--------------------------------------------------------------------------------"
)
for pair in pairs:
J_iso, J_S, D = calculate_exchange_tensor(pair)
J_iso = J_iso * sisl.unit_convert("eV", "meV")
@ -460,14 +488,28 @@ if rank == root_node:
print("Symmetric-anisotropy: ", J_S)
print("")
print("================================================================================")
print(
"================================================================================"
)
print("Runtime information: ")
print("Total runtime: ", end_time - start_time)
print("--------------------------------------------------------------------------------")
print(
"--------------------------------------------------------------------------------"
)
print("Initial setup: ", setup_time - start_time)
print(f"Hamiltonian conversion and XC field extraction: {H_and_XCF_time - setup_time:.3f} s")
print(f"Pair and site datastructure creatrions: {site_and_pair_dictionaries_time - H_and_XCF_time:.3f} s")
print(f"k set cration and distribution: {k_set_time - site_and_pair_dictionaries_time:.3f} s")
print(
f"Hamiltonian conversion and XC field extraction: {H_and_XCF_time - setup_time:.3f} s"
)
print(
f"Pair and site datastructure creatrions: {site_and_pair_dictionaries_time - H_and_XCF_time:.3f} s"
)
print(
f"k set cration and distribution: {k_set_time - site_and_pair_dictionaries_time:.3f} s"
)
print(f"Rotating XC potential: {reference_rotations_time - k_set_time:.3f} s")
print(f"Greens function inversion: {green_function_inversion_time - reference_rotations_time:.3f} s")
print(f"Calculate energies and magnetic components: {end_time - green_function_inversion_time:.3f} s")
print(
f"Greens function inversion: {green_function_inversion_time - reference_rotations_time:.3f} s"
)
print(
f"Calculate energies and magnetic components: {end_time - green_function_inversion_time:.3f} s"
)

Loading…
Cancel
Save