corrected path to utils, added anisotropy and corrected exchange field calculation

class-solution
Daniel Pozsar 2 months ago
parent 1e8cea8729
commit 0aaccc4c4b

@ -10,7 +10,7 @@ from mpi4py import MPI
from numpy.linalg import inv from numpy.linalg import inv
from tqdm import tqdm from tqdm import tqdm
from src.grogu_magn.useful import * from grogu_magn.utils import *
""" """
# Some input parsing # Some input parsing
@ -190,14 +190,14 @@ hTRB = (hh - hTR) / 2
traced = [spin_tracer(hTRB[i]) for i in range(dh.lattice.nsc.prod())] # equation 77 traced = [spin_tracer(hTRB[i]) for i in range(dh.lattice.nsc.prod())] # equation 77
XCF = np.array( XCF = np.array(
[ [
np.array([f["x"] for f in traced]), np.array([f["x"] / 2 for f in traced]),
np.array([f["y"] for f in traced]), np.array([f["y"] / 2 for f in traced]),
np.array([f["z"] for f in traced]), np.array([f["z"] / 2 for f in traced]),
] ]
) # equation 77 ) # equation 77
# Check if exchange field has scalar part # Check if exchange field has scalar part
max_xcfs = abs(np.array(np.array([f["c"] for f in traced]))).max() max_xcfs = abs(np.array(np.array([f["c"] / 2 for f in traced]))).max()
if max_xcfs > 1e-12: if max_xcfs > 1e-12:
warnings.warn( warnings.warn(
f"Exchange field has non negligible scalar part. Largest value is {max_xcfs}" f"Exchange field has non negligible scalar part. Largest value is {max_xcfs}"
@ -509,6 +509,11 @@ if rank == root_node:
print("Pairs integrated.") print("Pairs integrated.")
# calculate magnetic parameters # calculate magnetic parameters
for mag_ent in magnetic_entities:
Kxx, Kyy, Kzz, consistency = calculate_anisotropy_tensor(mag_ent)
mag_ent["K"] = np.array([Kxx, Kyy, Kzz]) * sisl.unit_convert("eV", "meV")
mag_ent["K_consistency"] = consistency
for pair in pairs: for pair in pairs:
J_iso, J_S, D, J = calculate_exchange_tensor(pair) J_iso, J_S, D, J = calculate_exchange_tensor(pair)
pair["J_iso"] = J_iso * sisl.unit_convert("eV", "meV") pair["J_iso"] = J_iso * sisl.unit_convert("eV", "meV")

Loading…
Cancel
Save