From 0aaccc4c4bc1c816037238c7b2088a2769c0bf74 Mon Sep 17 00:00:00 2001 From: Daniel Pozsar Date: Fri, 8 Nov 2024 08:55:00 +0100 Subject: [PATCH] corrected path to utils, added anisotropy and corrected exchange field calculation --- test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test.py b/test.py index 9569cdf..8a5e94b 100644 --- a/test.py +++ b/test.py @@ -10,7 +10,7 @@ from mpi4py import MPI from numpy.linalg import inv from tqdm import tqdm -from src.grogu_magn.useful import * +from grogu_magn.utils import * """ # 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 XCF = np.array( [ - np.array([f["x"] for f in traced]), - np.array([f["y"] for f in traced]), - np.array([f["z"] for f in traced]), + np.array([f["x"] / 2 for f in traced]), + np.array([f["y"] / 2 for f in traced]), + np.array([f["z"] / 2 for f in traced]), ] ) # equation 77 # 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: warnings.warn( f"Exchange field has non negligible scalar part. Largest value is {max_xcfs}" @@ -509,6 +509,11 @@ if rank == root_node: print("Pairs integrated.") # 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: J_iso, J_S, D, J = calculate_exchange_tensor(pair) pair["J_iso"] = J_iso * sisl.unit_convert("eV", "meV")