Class Overview

API Documentation

MonteCarlo.Ising.calculateHeatCapacity(averageEnergySquared, averageEnergy, temperature)[source]

function to calculate heat capacity (<EE> - <E><E> ) / (kTT)

MonteCarlo.Ising.calculateMagneticSusceptibilty(averageMagnetismSquared, averageMagnetism, temperature)[source]

function to calculate magnetic susceptibility (<MM> - <M><M> ) / (kT)

MonteCarlo.Ising.calculateValues(temperature, J, mu, latticeLength)[source]

calculates averageEnergy, averageMagnetism, HeatCapacity, and Magnetic Susceptibility

Parameters
  • temperature – temperature of system

  • J – a constant that determines the energy scale

  • mu – a constant that represents the magnetic moment of the system

  • latticeLength – number of sites in spinConfigurations

MonteCarlo.Ising.generateSpinConfigurations(n)[source]

Calculates a list of all possible spin configurations with a given number of sites

Parameters

n (int) – number of sites in each spin configuration

Return type

List[spinConfiguration]

MonteCarlo.Ising.plotValues(maxTemp, J, mu, latticeLength)[source]

Calculate and plot values

Parameters
  • maxTemp – maximum tempurate that energy will be plotted to

  • J – a constant that determines the energy scale

  • mu – a constant that represents the magnetic moment of the system

  • latticeLength – number of sites in spinConfigurations

MonteCarlo.Ising.printValues(temp, J, mu, latticeLength)[source]

Calculate and print values to output

class MonteCarlo.SingleDimensionHamiltonian.SingleDimensionHamiltonian(J, mu, spinConfiguration)[source]

Bases: object

Class for Single Dimension Hamiltonian

NOTE: k constant is set to one

Parameters
  • J – a constant that determines the energy scale

  • mu – a constant that represents the magnetic moment of the system

  • spinConfiguration (spinConfiguration) – the spin configuration of the system

calculateEnergy()[source]

Calculates the energy of this system using:

\[H = -J\sum_{ij} \sigma_i\sigma_j - \mu\sum_{j}\sigma_j\]
calculateHamiltonian()[source]

Helper function to calculate Ising hamiltonian value of spinConfiguration attribute using

\[\hat{H}'=\frac{\hat{H}}{k} = -\frac{J}{k}\sum_{<ij>} s_is_j\]

where, $$s_i=1$$ if the $$i^{th}$$ spin is up and $$s_i=-1$$ if it is down

Returns

Ising Hamiltonian Value of given spin configuration

Return type

float

class MonteCarlo.SpinConfiguration.spinConfiguration(binaryConfiguration, numElements)[source]

Bases: object

Class for Spin Configuration

Parameters
  • binaryConfiguration (int) – the binary representation of the spins of each component of the system where 0 is ‘down’ and 1 is ‘up’

  • numElements (int) – number of components in system

calculateMagnetism()[source]

Calculates the magnetism of this spinConfiguration

\[M(\alpha) = N_{\text{up}}(\alpha) - N_{\text{down}}(\alpha)\]
getNumElements()[source]
Returns

numberElements property of this spinConfiguration

getSpins(binaryConfiguration)[source]

Helper function to convert the binaryConfiguration as an integer into a list of integers where 1 represents up and -1 represents down

Return type

List[int]

class MonteCarlo.MonteCarloSampling.MonteCarloSampling(steps, sites, J, mu, temperature, plot=False)[source]

Bases: object

Class for Monte Carlo Sampling

Parameters
  • steps – number of samples that will be taken during the sweep

  • sites – number of sites in Spin Configuration being samples

  • J – a constant that determines the energy scale

  • mu – a constant that represents the magnetic moment of the system

  • temperature – temperature of the system

sweep()[source]

Function for using random sampling to estimate the energy of a spin configuration