Class Overview

freevirgil.hamiltonian([J, mu])

Class for Hamiltonian

freevirgil.spin_conf([N])

Class for generating spin configurations

API Documentation

class freevirgil.hamiltonian(J=-2.0, mu=1.0)[source]

Class for Hamiltonian

\[H = -J\sum_{\left<ij\right>} \sigma_i\sigma_j + \mu\sum_i\sigma_i\]
E(spin)[source]

Energy of configuration spin

\[E = \left<\hat{H}\right>\]
Parameters

spin (spin_conf) – Spin configuration

Returns

energy – Energy of configuration

Return type

float

__init__(J=-2.0, mu=1.0)[source]

Constructor

Parameters
  • J (float, optional) – Coupling strength

  • mu (float, optional) – Chemical potential

__weakref__

list of weak references to the object (if defined)

avg(conf, T)[source]

Exact average values

Parameters
  • spin (spin_conf) – Spin configuration

  • T (int) – Temperature

Returns

  • E (float) – Energy of configuration

  • M (float) – Magnetization of configuration

  • HC (float) – Heat capacity

  • MS (float) – Magnetic susceptability

class freevirgil.spin_conf(N=10)[source]
Class for generating spin configurations

of various dimensions

M()[source]

Magnetization of configuration

Returns

M – magnetization

Return type

float

__init__(N=10)[source]

Initialize configuration

Parameters

N (int, default: 10) – Amount of sites

__weakref__

list of weak references to the object (if defined)

dec_conf(dec)[source]

Convert decimal to binary (-1, 1) spin configuration

Parameters

dec (int) – Decimal number to convert to binary (0, 1) -> (-1, 1)