From 5a0f62bce283629eed63a750d5addbcfbf1174cf Mon Sep 17 00:00:00 2001 From: Daniel Pozsar Date: Wed, 30 Oct 2024 10:58:46 +0100 Subject: [PATCH] corrected DM and simmetric exchange in printing --- src/grogu_magn/useful.py | 2 +- test.ipynb | 66 ++++++++++++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/grogu_magn/useful.py b/src/grogu_magn/useful.py index 613dbf3..90a33cb 100644 --- a/src/grogu_magn/useful.py +++ b/src/grogu_magn/useful.py @@ -223,7 +223,7 @@ 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, np.concatenate([J_ii[:2] - J_ii.sum() / 3, J_S]).flatten(), D def print_atomic_indices(pair, magnetic_entities, dh): diff --git a/test.ipynb b/test.ipynb index 82c8c07..f2e2af9 100644 --- a/test.ipynb +++ b/test.ipynb @@ -9,7 +9,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "[Mac:47146] shmem: mmap: an error occurred while determining whether or not /var/folders/yh/dx7xl94n3g52ts3td8qcxjcc0000gn/T//ompi.Mac.501/jf.0/4070375424/sm_segment.Mac.501.f29d0000.0 could be created.\n" + "[Mac:47319] shmem: mmap: an error occurred while determining whether or not /var/folders/yh/dx7xl94n3g52ts3td8qcxjcc0000gn/T//ompi.Mac.501/jf.0/1258881024/sm_segment.Mac.501.4b090000.0 could be created.\n" ] } ], @@ -61,7 +61,7 @@ "# we can have some default for this\n", "ref_xcf_orientations = [\n", " dict(o=np.array([1, 0, 0]), vw=[np.array([0, 1, 0]), np.array([0, 0, 1])]),\n", - " dict(o=np.array([0, 1, 0]), vw=[np.array([0, 0, 1]), np.array([1, 0, 0])]),\n", + " dict(o=np.array([0, 1, 0]), vw=[np.array([1, 0, 1]), np.array([0, 0, 1])]),\n", " dict(o=np.array([0, 0, 1]), vw=[np.array([1, 0, 0]), np.array([0, 1, 0])]),\n", "]\n", "\n", @@ -122,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -213,6 +213,46 @@ "H_and_XCF_time = timer()" ] }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "84" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "NO" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 81, 84, 84)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "XCF.shape" + ] + }, { "cell_type": "code", "execution_count": 4, @@ -223,25 +263,29 @@ "for i, mag_ent in enumerate(magnetic_entities):\n", " parsed = parse_magnetic_entity(dh, **mag_ent) # parse orbital indexes\n", " magnetic_entities[i][\"orbital_indeces\"] = parsed\n", + " # calculate spin box indexes\n", " magnetic_entities[i][\"spin_box_indeces\"] = blow_up_orbindx(\n", " parsed\n", - " ) # calculate spin box indexes\n", + " )\n", + " # calculate size for Greens function generation\n", " spin_box_shape = len(\n", " mag_ent[\"spin_box_indeces\"]\n", - " ) # calculate size for Greens function generation\n", + " )\n", "\n", " mag_ent[\"energies\"] = [] # we will store the second order energy derivations here\n", "\n", " mag_ent[\"Gii\"] = [] # Greens function\n", " mag_ent[\"Gii_tmp\"] = [] # Greens function for parallelization\n", + " # These will be the perturbed potentials from eq. 100\n", " mag_ent[\"Vu1\"] = [\n", " list([]) for _ in range(len(ref_xcf_orientations))\n", - " ] # These will be the perturbed potentials from eq. 100\n", + " ]\n", " mag_ent[\"Vu2\"] = [list([]) for _ in range(len(ref_xcf_orientations))]\n", " for i in ref_xcf_orientations:\n", + " # Greens functions for every quantization axis\n", " mag_ent[\"Gii\"].append(\n", " np.zeros((eset, spin_box_shape, spin_box_shape), dtype=\"complex128\")\n", - " ) # Greens functions for every quantization axis\n", + " )\n", " mag_ent[\"Gii_tmp\"].append(\n", " np.zeros((eset, spin_box_shape, spin_box_shape), dtype=\"complex128\")\n", " )\n", @@ -249,11 +293,13 @@ "# for every site we have to store 2x3 Greens function (and the associated _tmp-s)\n", "# in the 3 reference directions, because G_ij and G_ji are both needed\n", "for pair in pairs:\n", - " spin_box_shape_i, spin_box_shape_j = len(\n", + " # calculate size for Greens function generation\n", + " spin_box_shape_i = len(\n", " magnetic_entities[pair[\"ai\"]][\"spin_box_indeces\"]\n", - " ), len(\n", + " )\n", + " spin_box_shape_j = len(\n", " magnetic_entities[pair[\"aj\"]][\"spin_box_indeces\"]\n", - " ) # calculate size for Greens function generation\n", + " )\n", "\n", " pair[\"energies\"] = [] # we will store the second order energy derivations here\n", "\n",