/* Monte-Carlo simulation code for statistical physics Copyright (C) 2001-2004 Sylvain Reynal Département de Physique Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA) 6, avenue du Ponceau, F-95014 CERGY CEDEX et Laboratoire de Physique Théorique et Modélisation (LPTM) Université de Cergy-Pontoise - Site de Neuville F-95031 CERGY CEDEX Tel : 00 +33 130 736 245 Fax : 00 +33 130 736 667 e-mail : reynal@ensea.fr web page : http://www.ensea.fr/staff/reynal/ */ package fr.ensea.montecarlo.model; import fr.ensea.chart.*; import fr.ensea.math.*; import fr.ensea.montecarlo.canonical.*; import fr.ensea.montecarlo.multicanonical.*; import fr.ensea.montecarlo.data.*; import java.util.*; /** * This class represents a lattice spin model with nearest-neighbor antiferromagnetic interactions, * and standard periodic boundary conditions. Each spin can take two values, namely +/- 1. * * This class holds the state of each spin, the lattice energy and the magnetization for each sublattice A and B, * from where the order parameter is readily derived. */ public class AFIsingLattice implements ILattice2D { public int size; public int size2; public int[][] spins; public int energy; public int magnetizationA, magnetizationB; // magnetization on each sublattice A and B. /** * Creates a 2D lattice with 10x10 spins, and random spin values. */ public AFIsingLattice() { init(10); } /** * Creates a 2D lattice with LxL spins, and random spin values. */ public AFIsingLattice(int L) { init(L); } /** * Reinit the lattice size. * @param L size of the lattice * @param Q N/A here */ public synchronized void init(int Q, int L){ init(L); } public synchronized void init(int L){ size = L; size2 = L*L; spins = new int[size][size]; createRandomConfiguration(); } /** * Generates a random configuration */ public synchronized void createRandomConfiguration(){ for(int i=0; i