A parallel C++ Library for Simulations in the Heisenberg Model
Public Member Functions | Public Attributes | List of all members
HB::Model Class Referenceabstract

An abstract class representing the model describing the spins. A model class has to derive from it an override the pure virtual functions. More...

#include <model.h>

Inheritance diagram for HB::Model:
Inheritance graph
[legend]

Public Member Functions

 Model ()=default
 
 Model (float J, float3 B)
 constructs a model describing spins on a grid More...
 
virtual ~Model ()=default
 
virtual float calcEnergy (const Grid< short int > &grid)=0
 calculates the overall energy of the underlying grid according to the model More...
 
virtual float calcMagnetization (const Grid< short int > &grid)=0
 calculates the overall magnetization of the underlying grid according to the model More...
 
float3 getBField () const
 returns the magnetic flux density of the model More...
 
float getCouplingConstant () const
 returns the coupling constant of the model More...
 
void setBField (const float3 B)
 sets the magnetic flux density of the model More...
 
void setCouplingConstant (const float J)
 sets the coupling constant of the model More...
 
virtual float calcEnergy (const Grid< short int > &grid, const dim3 index)=0
 returns the energy after one spin is flipped More...
 
virtual void flip (const dim3 index, Grid< short int > &grid)=0
 flips randomly a spin More...
 
virtual void simulate () const =0
 

Public Attributes

float3 mB
 
float mJ
 

Detailed Description

An abstract class representing the model describing the spins. A model class has to derive from it an override the pure virtual functions.

Definition at line 40 of file model.h.

Constructor & Destructor Documentation

◆ Model() [1/2]

HB::Model::Model ( )
default

◆ Model() [2/2]

HB::Model::Model ( float  J,
float3  B 
)
inline

constructs a model describing spins on a grid

Parameters
JCoupling constant
Bthree dimensional magnetic flux density with x component parallel to y direction of the grid and y component vice versa

Definition at line 51 of file model.h.

◆ ~Model()

virtual HB::Model::~Model ( )
virtualdefault

Member Function Documentation

◆ calcEnergy() [1/2]

virtual float HB::Model::calcEnergy ( const Grid< short int > &  grid)
pure virtual

calculates the overall energy of the underlying grid according to the model

Implemented in HB::Ising::Ising.

◆ calcEnergy() [2/2]

virtual float HB::Model::calcEnergy ( const Grid< short int > &  grid,
const dim3  index 
)
pure virtual

returns the energy after one spin is flipped

Parameters
indexIndex of the flipped spin

Implemented in HB::Ising::Ising.

◆ calcMagnetization()

virtual float HB::Model::calcMagnetization ( const Grid< short int > &  grid)
pure virtual

calculates the overall magnetization of the underlying grid according to the model

Implemented in HB::Ising::Ising.

◆ flip()

virtual void HB::Model::flip ( const dim3  index,
Grid< short int > &  grid 
)
pure virtual

flips randomly a spin

The function should define how a spin has to change for a Monte-Carlo accept-reject step.

Parameters
indexIndex of the spin to be flipped
rngPointer to the state of GSL RNG

Implemented in HB::Ising::Ising.

◆ getBField()

float3 HB::Model::getBField ( ) const
inline

returns the magnetic flux density of the model

Definition at line 70 of file model.h.

◆ getCouplingConstant()

float HB::Model::getCouplingConstant ( ) const
inline

returns the coupling constant of the model

Definition at line 75 of file model.h.

◆ setBField()

void HB::Model::setBField ( const float3  B)
inline

sets the magnetic flux density of the model

Parameters
BThree dimensional magnetic flux density with x component parallel to y direction of the grid and y component vice versa

Definition at line 83 of file model.h.

◆ setCouplingConstant()

void HB::Model::setCouplingConstant ( const float  J)
inline

sets the coupling constant of the model

Parameters
JCoupling constant

Definition at line 90 of file model.h.

◆ simulate()

virtual void HB::Model::simulate ( ) const
pure virtual

Implemented in HB::Ising::Ising.

Member Data Documentation

◆ mB

float3 HB::Model::mB

absolute value of an external, homogenous magnetic field

Definition at line 112 of file model.h.

◆ mJ

float HB::Model::mJ

coupling constant

Definition at line 113 of file model.h.


The documentation for this class was generated from the following file: