Replica Exchange 1/t Wang-Landau Simulation for NiI2 Monolayer
Authors/Creators
Contributors
Researcher:
Description
REWL_NiPressure: Replica Exchange 1/t Wang-Landau Simulation for NiI2 Monolayer
This repository contains Fortran code for simulating the magnetic behavior of a NiI2 monolayer using a spin model on a triangular lattice with periodic boundary conditions. The simulation employs the Replica Exchange Wang-Landau (REWL) algorithm, transitioning from a regular Wang-Landau sampling phase to a 1/t update scheme for improved efficiency and accuracy in calculating the density of states. The code is parallelized using MPI to distribute the simulation across multiple processors and energy windows.
Features
-
Spin Model: Simulates magnetic spins on a triangular lattice.
-
Periodic Boundary Conditions (PBC): Ensures proper simulation of bulk material.
-
Replica Exchange Wang-Landau (REWL): A powerful Monte Carlo method for overcoming energy barriers and efficiently sampling phase space to compute the density of states.
-
1/t Update Scheme: Transitions from a constant factor update to a 1/t factor update for improved accuracy and convergence in the later stages of the Wang-Landau simulation.
-
MPI Parallelization: Utilizes Message Passing Interface for distributed computing across multiple CPU cores or nodes, enabling the simulation of larger systems or faster convergence.
-
Configurable Parameters: Simulation parameters are read from external input files, allowing for flexible setup and experimentation.
Prerequisites
To compile and run this code, you will need:
-
Fortran Compiler: A Fortran 90/95/2003/2008 compliant compiler (e.g.,
gfortranfrom GCC). -
MPI Library: An MPI implementation (e.g., OpenMPI, MPICH) for parallel execution. The
mpif90wrapper script is typically used for compilation.
Files
-
REWL_NiPressure.f90: The main Fortran source code for the simulation. -
inputREWL_parametersr.dat: Input file containing parameters for the Replica Exchange Wang-Landau algorithm. -
input_NipressureMonolayer.dat: Input file containing system-specific parameters (lattice size, interaction constants, energy range).
Compilation
Navigate to the directory containing the source code and compile using mpif90:
mpif90 -o NiPressure REWL_NiPressure.f90
This command will create an executable file named NiPressure.
Execution
Run the simulation using mpirun (or your MPI implementation's equivalent command), specifying the number of processes (N_PROCS):
mpirun -np N_PROCS ./NiPressure
Replace N_PROCS with the desired number of MPI processes. The code expects N_PROCS to be equal to nWindows * nWalkers as defined in inputREWL_parametersr.dat.
Example: If nWindows = 3 and nWalkers = 2 (from inputREWL_parametersr.dat), you would run with 6 processes:
mpirun -np 6 ./NiPressure
Input Files
inputREWL_parametersr.dat
This file defines the parameters for the Wang-Landau and Replica Exchange algorithms.
Format:
nEbins ireplica mcs_bin mcs_bin_term
lnf_min accept_min p
nWindows nWalkers
overlap_ratio increase_ratio
S_initial tcountMAx
Description of Parameters:
-
nEbins: Integer. The number of energy bins for the density of states histogram. -
ireplica: Integer. The number of Monte Carlo sweeps (MCS) between attempts to perform replica exchanges. -
mcs_bin: Integer. The number of Monte Carlo sweeps after which the histogram flatness is checked in the regular Wang-Landau phase. -
mcs_bin_term: Integer. The number of Monte Carlo sweeps after which the solid angle for spin trial moves might be adjusted (related to acceptance rate). -
lnf_min: Double Precision. The minimum value of the modification factor ln(f) in the Wang-Landau algorithm. When ln(f) drops below this value, the simulation typically transitions to the 1/t phase. -
accept_min: Double Precision. The target acceptance ratio for Monte Carlo moves. Used indefine_acceptance(if implemented) to adjust the solid angle of spin trial moves. -
p: Double Precision. The flatness criterion for the energy histogram. The histogram is considered flat if all bins are withinppercent of the average histogram count. -
nWindows: Integer. The total number of energy windows used in the Replica Exchange part of the simulation. -
nWalkers: Integer. The number of independent walkers (simulations) running within each energy window. -
overlap_ratio: Double Precision. A parameter related to the overlap between neighboring energy windows. -
increase_ratio: Double Precision. A parameter related to how the energy range increases between windows. -
S_initial: Double Precision. The initial size of the vector defining the solid angle for spin trial moves. This controls the magnitude of spin changes. -
tcountMAx: Integer. The maximum number of 1/t steps in the 1/t Wang-Landau phase.
input_NipressureMonolayer.dat
This file defines the physical parameters of the NiI2 monolayer system.
Format:
L
J1 J2 J3 Anis
Jxx Jyy Jzz Jyz
E_min_N E_max_N
Description of Parameters:
-
L: Integer. The linear size of the system (L x L lattice). The total number of sites will beL*L. -
J1,J2,J3: Double Precision. Isotropic Heisenberg exchange interaction parameters for 1st, 2nd, and 3rd nearest neighbors, respectively. -
Anis: Double Precision. The single-ion anisotropy constant. -
Jxx,Jyy,Jzz: Double Precision. Triaxial Spin Anisotropy (TSA) parameters for the x, y, and z components. -
Jyz: Double Precision. Triaxial Spin Anisotropy (TSA) parameter for the yz component. -
E_min_N: Double Precision. The minimum energy value for the overall density of states range (normalized by |J1|). -
E_max_N: Double Precision. The maximum energy value for the overall density of states range (normalized by |J1|).
Output Files
Each file contains two columns:
-
Energy Value: The center energy of the bin.
-
: The natural logarithm of the density of states (entropy).