CUDA-METRO · Reference

Configuration

Every run is defined by three files — a JSON config, a material parameter file, and a script that binds them. This page covers the first two.

Config file

Copy a template from /configstest_config.json for a single run, tc_config.json for a temperature sweep.

KeyTypeMeaning
Single_Mat_Flagint1 for a single material, 0 otherwise.
DMI_Flagint1 to run in DMI mode. Mutually exclusive with TC_Flag.
TC_Flagint1 to run in critical-temperature mode. Mutually exclusive with DMI_Flag.
Static_T_Flagint1 if the simulation runs at a single temperature.
FM_Flagint1 to start from a ferromagnetic state, 0 for a randomised (diamagnetic) start.
Input_flagint1 to resume from a saved .npy state.
Input_FilestringFilename of that starting state, when Input_flag is 1.
TempsarrayTemperatures to sweep. Critical-temperature mode only.
MaterialstringMaterial name, without the .csv extension.
Multiple_MaterialsstringFilename holding several materials, without .csv.
SIZEintLattice edge length. The supercell is SIZE2.
BlocksintHow much to parallelise — the spins proposed per step. The core tuning knob.
ThreadsintFixed at 2. Do not change.
BdoubleExternal magnetic field. Quote the value.
stability_runsintPhase 1 batch count.
stability_wrapintPhase 1 batch size.
calculation_runsintPhase 2 batch count.
calculation_wrapintPhase 2 batch size.
PrefixstringString prepended to the output folder name.
Deprecated
Animation_Flags, Box and Cmpl_Flag remain in the template for backwards compatibility and are no longer read.

Monte Carlo phases

The total number of raw MC steps is:

Blocks × (stability_runs × stability_wrap
        + calculation_runs × calculation_wrap)

The split into two phases exists for critical-temperature work. Phase 1 lets the lattice settle; Phase 2 is the data-collection window from which statistical properties are drawn. For a raw simulation where you want the state evolution from start to finish, keep one phase and zero the other.

Out of memory
Blocks governs VRAM use as well as parallelisation. If a run crashes or reports an out-of-memory error, lower it first.

Material parameters

Material files live in /inputs as CSV, and hold one vector of 24 entries describing the interactions and crystal configuration:

[name, spin,
 J1, J2, J3, J4,
 K1x, K1y, K1z,  K2x, K2y, K2z,
 K3x, K3y, K3z,  K4x, K4y, K4z,
 Ax, Ay, Az,
 Tc, structure, DMI]

J are isotropic exchange parameters and K the anisotropic ones, subscripted by neighbour shell — J1 is the first nearest neighbour, J2 the second, and so on to the fourth. A is single-ion anisotropy, Tc the experimental Curie temperature for reference, and DMI the Dzyaloshinskii–Moriya parameter.

Interactions stop at the fourth shell: in 2D materials the interaction energy is expected to have died away past that.

Spin Hamiltonian

Each atom is a 3D spin vector on a periodic lattice. The energy of atom i sums over four neighbour shells — {j}, {k}, {l}, {m} — each contributing an isotropic exchange term and three anisotropic ones:

Hexchange
4Σn=1 Σj∈n [ Jn (si·sj)+ Knx sixsjx+ Kny siysjy+ Knz sizsjz ]
Hself
− [ Ax (six)2+ Ay (siy)2+ Az (siz)2 ]
HZeeman
B siz
HDMI
 Σj∈1 Dij · (si × sj)
Htotal
= Hexchange+Hself+HZeeman+HDMI

Everything except B is material-specific and comes from the input file.

Reading the code, not the paper
Three details differ from the general expression quoted in the repository README, and the form above follows montecarlo.py. Single-ion anisotropy is applied per axis on squared components using the separate Ax, Ay, Az inputs, not as a single scalar A s_i·s_i — which for unit spins would be a constant. The field enters as B sᶻ, coupling to the z component alone rather than as a vector dot product. And there is no biquadratic term in the kernels, so the λ(s_i·s_j)2 term from the README is omitted here. The DMI term is present only in the dm1 and dm2 kernels, which take the neighbour-vector array.