You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grogu/test_module.ipynb

313 lines
9.6 KiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[Daniels-MacBook-Air.local:03366] shmem: mmap: an error occurred while determining whether or not /var/folders/yh/dx7xl94n3g52ts3td8qcxjcc0000gn/T//ompi.Daniels-MacBook-Air.501/jf.0/246480896/sm_segment.Daniels-MacBook-Air.501.eb10000.0 could be created.\n"
]
}
],
"source": [
"from grogupy.magnetism import *\n",
"from grogupy.constants import DEFAULT_PARAMETERS"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"DEFAULT_PARAMETERS[\"INFILE\"] = (\n",
" \"/Users/danielpozsar/Downloads/nojij/Fe3GeTe2/monolayer/soc/lat3_791/Fe3GeTe2.fdf\"\n",
")\n",
"DEFAULT_PARAMETERS[\"KSET\"] = 10\n",
"my_simulation = Simulation(DEFAULT_PARAMETERS)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
" 0%| | 0/100 [00:00<?, ?it/s]"
]
},
{
"data": {
"text/plain": [
"<grogupy.magnetism.KSpace at 0x16d808310>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kset = KSpace(DEFAULT_PARAMETERS[\"KDIRS\"], DEFAULT_PARAMETERS[\"KSET\"])\n",
"my_simulation.add_KSpace(kset)\n",
"kset"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<grogupy.magnetism.Contour at 0x16d4d42b0>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"contour = Contour(\n",
" DEFAULT_PARAMETERS[\"EBOT\"], DEFAULT_PARAMETERS[\"ESET\"], DEFAULT_PARAMETERS[\"ESETP\"]\n",
")\n",
"my_simulation.add_Contour(contour)\n",
"contour"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/danielpozsar/Documents/oktatás/elte/phd/grogu_project/src/grogupy/magnetism.py:170: UserWarning: Hamiltonian changed after symmetrization. Largest change is 1.1920928955078125e-07\n",
" warnings.warn(\n",
"/Users/danielpozsar/Documents/oktatás/elte/phd/grogu_project/src/grogupy/magnetism.py:174: UserWarning: Overlap matrix changed after symmetrization. Largest change is 1.1920928955078125e-07\n",
" warnings.warn(\n"
]
}
],
"source": [
"# read sile\n",
"fdf = sisl.get_sile(DEFAULT_PARAMETERS[\"INFILE\"])\n",
"\n",
"# read in hamiltonian\n",
"dh = fdf.read_hamiltonian()\n",
"hamiltonian = Hamiltonian()\n",
"hamiltonian.build_custom_H_and_S(dh)\n",
"my_simulation.add_Hamiltonian(hamiltonian)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"magnetic_entities = [\n",
" MagneticEntity(my_simulation.sislHamiltonian, atom=3, l=2),\n",
" MagneticEntity(my_simulation.sislHamiltonian, atom=4, l=2),\n",
" MagneticEntity(my_simulation.sislHamiltonian, atom=5, l=2),\n",
"]\n",
"my_simulation.add_magnetic_entities(magnetic_entities)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"my_simulation.add_pairs(\n",
" [\n",
" dict(ai=0, aj=1, Ruc=(0, 0, 0)),\n",
" dict(ai=0, aj=2, Ruc=(0, 0, 0)),\n",
" dict(ai=1, aj=2, Ruc=(0, 0, 0)),\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[array([0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01,\n",
" 0.01])]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_simulation.KSpace.parallel_weights"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,\n",
" 125, 126, 127, 128, 129, 130, 131])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_simulation.rotate_XCF()\n",
"my_simulation.pairs[2].M1.spin_box_indices"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 100/100 [01:55<00:00, 1.16s/it]\n"
]
}
],
"source": [
"my_simulation.solve()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[{'atom': 3, 'l': [2], 'orbital_indices': array([41, 42, 43, 44, 45, 46, 47, 48, 49, 50], dtype=int32), 'spin_box_indices': array([ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,\n",
" 95, 96, 97, 98, 99, 100, 101]), 'tags': ['[3]Fe([2])'], 'xyz': [array([-7.33915874e-06, 4.14927851e-06, 1.16575858e+01])], 'energies': array([[1.17772527, 1.17771974, 1.17772812],\n",
" [1.17764184, 1.177567 , 1.17761357],\n",
" [1.17892446, 1.17892335, 1.17892284]]), 'K': array([[-0.07483657, 0.00106563, -0.0091485 ],\n",
" [ 0.00106563, -0.00553059, -0.00561574],\n",
" [-0.0091485 , -0.00561574, 0. ]]), 'K_consistency': 6.819575556149537e-05}, {'atom': 4, 'l': [2], 'orbital_indices': array([56, 57, 58, 59, 60, 61, 62, 63, 64, 65], dtype=int32), 'spin_box_indices': array([112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,\n",
" 125, 126, 127, 128, 129, 130, 131]), 'tags': ['[4]Fe([2])'], 'xyz': [array([-7.32698766e-06, 4.15827452e-06, 8.91242254e+00])], 'energies': array([[1.17774 , 1.17766249, 1.17769662],\n",
" [1.1776063 , 1.17760676, 1.17759665],\n",
" [1.17893438, 1.17893546, 1.17893594]]), 'K': array([[ 0.00045681, -0.00101949, 0.00987698],\n",
" [-0.00101949, -0.07750577, 0.00462617],\n",
" [ 0.00987698, 0.00462617, 0. ]]), 'K_consistency': 7.687732837413641e-05}, {'atom': 5, 'l': [2], 'orbital_indices': array([71, 72, 73, 74, 75, 76, 77, 78, 79, 80], dtype=int32), 'spin_box_indices': array([142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,\n",
" 155, 156, 157, 158, 159, 160, 161]), 'tags': ['[5]Fe([2])'], 'xyz': [array([ 1.89546671, 1.09439132, 10.2850027 ])], 'energies': array([[0.82604465, 0.82600318, 0.82602942],\n",
" [0.82596082, 0.82597202, 0.82596098],\n",
" [0.83074663, 0.83074663, 0.83074663]]), 'K': array([[ 1.12053382e-02, -4.12902668e-06, 5.44290076e-03],\n",
" [-4.12902668e-06, -4.14783466e-02, -5.50288071e-03],\n",
" [ 5.44290076e-03, -5.50288071e-03, 0.00000000e+00]]), 'K_consistency': 5.2686617336705766e-05}]\n"
]
}
],
"source": [
"import pickle\n",
"\n",
"with open(\"./Fe3GeTe2_fdf_test.pickle\", \"rb\") as file:\n",
" out = pickle.load(file)\n",
"\n",
"print(out[\"magnetic_entities\"])"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[-8.92392323e-02 1.88623702e-04 -1.88607418e-04 -8.91422199e-02]\n",
" [-8.92537950e-02 8.30905002e-07 -6.97129733e-07 -8.91766857e-02]\n",
" [-7.49830910e-02 -1.42696825e-07 -1.41821186e-07 -7.49832472e-02]]\n"
]
},
{
"data": {
"text/plain": [
"array([[-1.03455039e-05, -3.23134167e-05, 1.51994558e-05,\n",
" 1.47670297e-05],\n",
" [-1.34560335e-04, -1.19127887e-04, 7.37198539e-07,\n",
" -2.50259864e-06],\n",
" [ 1.15312736e-06, -2.78200117e-08, -5.45059115e-07,\n",
" 2.19295071e-06]])"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(out[\"pairs\"][0][\"energies\"])\n",
"my_simulation.pairs[0]._energies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}