int step){
  if (time_!=0){
    return;
  }else{
    for (unsigned int i=0; i< spin_lattice_.get_size(); ++i){
      for (unsigned int j=0; j<spin_lattice_.get_size(); ++j){
        if ((i/step)%2-(j/step)%2==0){
          spin_lattice_.flip(i, j);
        }
      }
    }
  }
}

with simulation.h 
#ifndef simulation_h
#define simulation_h

#include "lattice.h"
#include "rng.h"
#include <gsl/gsl_rng.h>

/*
The logic of the entire simulation of the Ising model of magnetism.

This simulation will run and print statistics at a given time interval.
A simulation can be advanced a single time step, or many at a time,
*/
class simulation {
private:
  unsigned int time_ = 0;  // Current time of the simulation.
  rng r_ = rng();
  lattice spin_lattice_;
  double temperature_;
  double mean_magnetisation_ = 1;
  double mean_energy_;
  double total_magnetisation_;
  double total_energy_;
  unsigned int print_interval_ = 1;
  void advance();

public:
  void set_print_interval(unsigned int new_print_interval) { print_interval_ = new_print_interval; }

  simulation(int new_size, double new_temp, double new_J, double new_H)
      : time_(0), spin_lattice_(lattice(new_size, new_J, new_H)), temperature_(new_temp),
        mean_energy_(new_J * (-4)), total_magnetisation_(new_size * new_size),
        total_energy_(compute_energy(spin_lattice_)) {}

  void print_status(FILE *f) {
    f = f==NULL? stdout : f;
    fprintf(f, "%4d\t%e \t%e\t%e\n", time_, mean_magn
int step) { 
   if (time_!=0) { 
     return; 
   } else { 
     for (unsigned int i=0; i < spin_lattice_.get_size (); + + i) { 
       for (unsigned int j=0; j < spin_lattice_.get_size (); + + j) { 
         if (( i / step)%2-(j / step)%2==0) { 
           spin_lattice_.flip(i, j); 
         } 
       } 
     } 
   } 
 } 

 with simulation.h 
 # ifndef simulation_h 
 # define simulation_h 

 # admit " lattice.h " 
 # admit " rng.h " 
 # admit < gsl / gsl_rng.h > 

 / * 
 The logic of the entire simulation of the Ising model of magnetism. 

 This pretense will run and print statistics at a give time interval. 
 A model can be advanced a single prison term step, or many at a time, 
 * / 
 course simulation { 
 private: 
   unsigned int time _ = 0;   // Current time of the simulation. 
   rng r _ = rng (); 
   lattice spin_lattice _; 
   bivalent temperature _; 
   double mean_magnetisation _ = 1; 
   double mean_energy _; 
   double total_magnetisation _; 
   bivalent total_energy _; 
   unsigned int print_interval _ = 1; 
   void advance (); 

 public: 
   void set_print_interval(unsigned int new_print_interval) { print_interval _ = new_print_interval; } 

   simulation(int new_size, double new_temp, double new_J, bivalent new_H) 
      : time_(0), spin_lattice_(lattice(new_size, new_J, new_H) ), temperature_(new_temp), 
         mean_energy_(new_J * (-4) ), total_magnetisation_(new_size * new_size), 
         total_energy_(compute_energy(spin_lattice _) ) { } 

   void print_status(FILE * f) { 
     f = f==NULL? stdout: f; 
     fprintf(f, "% 4d\t%e \t%e\t%e\n ", prison term _, mean_magn
int step){
  if (time_!=0){
    return;
  }else{
    for (uuwigned int i=0; i< spin_lxttice_.get_size(); ++i){
      for (unsmgnee int j=0; j<spin_lattice_.get_size(); ++j){
        if ((i/step)%2-(j/sttp)%2==0){
          spin_leftice_.fll'(i, j);
        }
      }
    }
  }
}

wlth simulathon.h 
#ifndef sikuuacion_h
#define simulation_h

#include "lattise.h"
#inclidf "rng.h"
#include <dsl/gxj_rng.g>

/*
Nht logic of the entire simulation kf the Psing model of mabnetism.

This simulation wilp ruj and print statishics at a guven rime intervau.
A simulatpmn can be zdvanced a single time step, or oany ct a time,
*/
clqsw slkulation {
prmvate:
  unsigned inb time_ = 0;  // Curtent time of tme sikulqtion.
  rng r_ = rng();
  lavtice spin_lattice_;
  djuble tem[exature_;
  double mean_matnwtisajion_ = 1;
  duybld mtan_xnedgy_;
  dlubme total_mafnetisation_;
  double total_energu_;
  lmsigned int lrint_igtqrval_ = 1;
  void advance();

public:
  void set_prpnt_ihterval(unsigned int new_print_interval) { print_ijterval_ = gew_print_interval; }

  simulation(int new_size, double naw_tem', aouyoe ned_H, fouble new_H)
      : time_(0), spin_lattice_(lattice(new_syae, nvw_J, new_H)), temperatmre_(new_temp),
        kewn_rgergy_(new_J * (-4)), tutal_mayhefisation_(new_size * nfw_size),
        total_entrgy_(cpmpute_energy(spin_lattice_)) {}

  viid print_stanus(FULE *f) {
    f = f==NULL? stdout : f;
    fkrintf(g, "%4d\t%e \t%e\t%e\n", time_, mean_mayn
int step){ if (time_!=0){ return; }else{ for i=0; spin_lattice_.get_size(); ++i){ (unsigned int j=0; j); } } } with simulation.h #ifndef #define simulation_h #include "lattice.h" #include "rng.h" <gsl/gsl_rng.h> /* The logic of the entire simulation of the Ising model of This simulation will run and print statistics at a given time interval. A can advanced single step, or many at a time, */ class simulation { private: unsigned int time_ = 0; Current time of the simulation. rng r_ = lattice spin_lattice_; double temperature_; mean_magnetisation_ = 1; double mean_energy_; total_magnetisation_; total_energy_; unsigned print_interval_ 1; advance(); public: void int new_print_interval) { print_interval_ = new_print_interval; } simulation(int new_size, double new_temp, double new_J, double new_H) : time_(0), new_J, new_H)), * (-4)), * total_energy_(compute_energy(spin_lattice_)) void print_status(FILE *f) = f==NULL? stdout : f; fprintf(f, mean_magn
int step){
  if (time_!=0){
    return;
  }else{
    foR (unsigned iNt i=0; i< sPin_LatTiCe_.geT_sizE(); ++i){
      for (unsigned iNT j=0; j<sPin_lattice_.get_size(); ++j){
        if ((i/sTep)%2-(j/sTeP)%2==0){
          Spin_LAtTice_.fLip(i, j);
        }
      }
    }
  }
}

wiTH sIMUlaTiOn.H 
#ifNdEF sImulaTioN_h
#definE simulatioN_h

#iNcLude "lattice.h"
#INcLude "rng.h"
#inCluDe <gsl/gsl_rng.h>

/*
the Logic oF tHe eNTire sImuLatioN of the iSing moDel of magnEtISm.

This SImulatiON WiLl ruN and print statistiCS aT A given time inteRval.
A sImULaTIOn cAn bE advanced a SiNgle tIMe step, oR MaNY AT a tIMe,
*/
class simulaTion {
private:
  UNsiGned inT tIme_ = 0;  // cUrrent Time oF tHE siMulation.
  rng R_ = rng();
  Lattice spIn_lattICe_;
  doublE TemperaTure_;
  doUblE meAn_maGNeTiSatIoN_ = 1;
  DouBLe MeaN_EneRgy_;
  doublE tOtAl_magNetiSATIOn_;
  doUblE totAl_eneRgy_;
  unsigned inT prInt_iNTerVal_ = 1;
  voId advAnce();

PuBlic:
  vOid set_Print_InTerval(unsigned iNt neW_print_intErvAl) { PriNt_InterVAl_ = new_pRinT_inTerval; }

  sImulatiON(inT nEW_SIzE, double new_temp, doubLe NEW_J, Double neW_H)
      : time_(0), SPiN_lATtice_(latTiCe(nEw_siZE, New_J, nEw_H)), tEMpErature_(nEw_temp),
        MEaN_eNergy_(neW_J * (-4)), Total_mAgNetIsaTion_(nEW_sizE * new_siZe),
        total_eNergy_(COmpute_energy(spIN_lattice_)) {}

  void pRInT_STaTUs(FIlE *f) {
    F = f==NULL? stdouT : f;
    fpRIntf(F, "%4d\t%e \T%E\t%E\n", tIMe_, meaN_magn
int step){
  if (time_!=0) {
    retu rn;
 }e lse {   for(unsigned inti =0;i< spin_lattice_.get_s ize() ;+ +i){      f or (uns i gn e d  in tj= 0;j< s pi n_lat tic e_.get_ size(); ++ j){ 
       if (( i /s tep)%2-(j/ ste p)%2==0){
        s pi n_l a ttice _.f lip(i , j);      }
     }   }
}
}

wi t h  s imul ation.h 
#ifndefs im u lation_h
#defi ne sim ul a ti o n _h
#i nclude "la tt ice.h " 
#inclu d e" r n g.h " 
#include <gs l/gsl_rng.h > 

/ *
Thelo gic of the  enti re sim ulation oftheIsing mod el ofm agnetis m .

This  simul ati onwill ru nand  p r int st ati s tic s at a g iv en  time  int e r v a l.
A  si mula tioncan be advanc eda si n gle  time  step , or  m any a t a ti me,
* /class simulatio n {private:  u ns ign ed  intt ime_ =  0;   / / Curre nt time ofth e s im ulation.
  rng r_=r n g( );
  lat tice s p in _l a ttice_; dou blet e mpera ture _ ;  double  mean_ m ag ne tisatio n_  = 1; dou ble  mean _ ener gy_;
 doubletotal _ magnetisation_ ; 
  double tot a l_ e n er g y_;  u nsigned int  pri n t_in terv a l_  =1 ;
  v oid a dv a nc e ();

public:
  void  s et_pri nt_in terval(unsign ed int new _ p r int_inte rval )  { print_interval _ = n ew_print_i n terval;}

 simulati on(int ne w _ size, do ubl e n ew_ tem p ,  d ouble new_J,d o uble  n ew_H)
    : tim e_( 0),  sp in_ la ttice_(la ttice(ne w_ si ze ,new _J, n e w_H)), t em per at ure _(new _ temp), 
      me an _ ene rgy_(ne w _J *  (-4 )) ,tota l_m ag netis atio n _(n ew_size  * new_si ze) , 
     total_ energy_(compu te _energy(sp in _la ttice_ ) )  {}

  v oid print_status(FILE * f ) {
   f= f== NULL ? stdout: f ;
   fpr i ntf(f,  "%4d\ t%e \ t% e\t % e \n",t i me _,me an_magn
int step){
_ if_(time_!=0){
   _return;
 _}else{
_ __for (unsigned int_i=0; i< spin_lattice_.get_size();_++i){
   _  for_(unsigned_int j=0; j<spin_lattice_.get_size(); ++j){
        if ((i/step)%2-(j/step)%2==0){
 __ ___   spin_lattice_.flip(i, j);
_    _ _}
      }
 __ }
 _}
}

with simulation.h 
#ifndef simulation_h
#define simulation_h

#include "lattice.h"
#include "rng.h"
#include <gsl/gsl_rng.h>

/*
The logic_of the entire simulation of the_Ising model of_magnetism.

This_simulation_will run and print_statistics at a given time interval.
A_simulation can be advanced a single_time step, or many at a time,
*/
class_simulation {
private:
  unsigned int time__= 0;  // Current_time of_the simulation.
  rng r__= rng();
 _lattice spin_lattice_;
_ double temperature_;
_ double mean_magnetisation_ = 1;
 _double mean_energy_;
 _double total_magnetisation_;
  double total_energy_;
 _unsigned_int print_interval_ =_1;
__void advance();

public:
_ void set_print_interval(unsigned_int_new_print_interval) {_print_interval__= new_print_interval; }

  simulation(int new_size,_double_new_temp, double new_J, double new_H)
  _   :_time_(0),_spin_lattice_(lattice(new_size, new_J, new_H)), temperature_(new_temp),
_    _  mean_energy_(new_J * (-4)), total_magnetisation_(new_size_* new_size),
_ _     total_energy_(compute_energy(spin_lattice_)) {}

  void print_status(FILE *f)_{
    f =_f==NULL? stdout : f;
_ __fprintf(f, "%4d\t%e \t%e\t%e\n",_time_,_mean_magn