Skip to content

A program specifically designed to simplify the computation of magnetic interaction matrix and simulate spin textures under various environmental conditions.

License

Notifications You must be signed in to change notification settings

A-LOST-WAPITI/Sym4state.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sym4state

A program specifically designed to simplify the computation of magnetic interaction matrix and simulate spin textures under various environmental conditions.

Stable Dev Build Status Coverage

Installation

Please proceed to acquire and install the appropriate version of Julia (version 1.9 or higher) for your specific platform by visiting this location.

And add the package by:

julia> import Pkg

julia> Pkg.add(url="https://github.com/A-LOST-WAPITI/Sym4state.jl")

Brief overview

The main functions are pre_process, post_process and Sym4state.MC.mcmc.

The pre_process function facilitates the streamlined computation of interacting matrices within a specified cutoff radius. To illustrate its usage, let's consider an example where we aim to evaluate all the interactions within a cutoff radius of 5 Å for a monolayer of $\ce{CrI3}$. To achieve this, you can effortlessly execute the following code snippet, assuming you have the required files such as POSCAR (containing the structure of $\ce{CrI3}$), as well as the POTCAR, INCAR, and KPOINTS files utilized in energy determination:

using Sym4state
Sym4state.pre_process(
    "./POSCAR",
    [24],
    5.0;
    incar_path="./INCAR",
    potcar_path="./POTCAR",
    kpoints_path="./KPOINTS"
)

Note that you should replace "POSCAR", "POTCAR", "INCAR", and "KPOINTS" with the actual filenames corresponding to your system's specific input files.

Upon invoking the pre_process function, it will automate the creation of magnetic configurations with the minimal number of energies required for interaction determination. These configurations will be saved in separate directories. Once all the DFT calculations have converged, you can employ the post_process function to obtain the interacting matrix. This process can be accomplished using the following Julia code snippet:

pair_mat, coeff_array = Sym4state.post_process("./cal.jld2")

The variable pair_mat contains the indices of atom pairs, while coeff_array holds the interacting matrix. With this information, you can establish a Monte Carlo simulation to further analyze the system by:

using Unitful, UnitfulAtomic, CUDA

mcconfig = Sym4state.MC.MCConfig{Float32}(
    lattice_size=[128, 128],
    magmom_vector=[3.5, 3.5],
    pair_mat=pair_mat,
    interact_coeff_array=coeff_array,
    temperature=collect(150:-2:0),
    magnetic_field=zeros(3),
    equilibration_step_num=100_000,
    measuring_step_num=100_000
)
(
    states_over_env,
    norm_mean_mag_over_env,
    susceptibility_over_env,
    specific_heat_over_env
) = Sym4state.MC.mcmc(
    mcconfig,
    backend=CUDABackend()
)

After the Monte Carlo simulation, one can illustrate the ultimate magnetic configuration simpily by:

using CairoMakie
fig = Sym4state.MC.plot(
    states_over_env[:, :, :, :, end],
    Float32[1 -1/2; 0 sqrt(3)/2],
    Float32[1/3 2/3; 2/3 1/3],
    1:24,
    1:24
)

It is important to note that the 2D cell matrix, the fractional coordinates of the magnetic atoms, and the desired plotting range of cells along the x- and y-axes must be supplied as inputs to this function.

About

A program specifically designed to simplify the computation of magnetic interaction matrix and simulate spin textures under various environmental conditions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages