qrem.common.external.CBB.spin_models

Created on Thu Apr 19 15:21:03 2018

@author: flaviobaccari

Module Contents

Functions

generate_commuting_variables(party, label)

Generates the list of symbolic variables representing the spins

get_square2D_spins(k, l[, configuration])

Genrates the list of symbolic variables representing the spins

get_2Dsquare_localdisorder(k, l, sigma)

Generates random local magnetic field values for a 2D square lattice

get_2Dsquare_ferromagneticdisorder_hamiltonian(k, l, ...)

Generates the hamiltonian of a ferromagnetic 2D Ising model and local

get_lattice_spins(lattice, configuration)

Generates a dictionary of symbolic variables representing the

get_lattice_localdisorder(lattice, sigma)

Generates the random magneitc field on each node of the lattice, according to

get_lattice_ferromangetic(lattice)

Generates the ferromagnetic couplings for each edge in the lattice

get_lattice_hamiltonian(lattice, h, J, s_variables)

Generates the hamiltonian for the given lattice with the given local fields h

qrem.common.external.CBB.spin_models.generate_commuting_variables(party, label)

Generates the list of symbolic variables representing the spins for a given site. The variables are treated as commuting. :param party: configuration indicating the configuration of number m

of measurements and outcomes d for each measurement. It is a list with m integers, each of them representing the number of outcomes of the corresponding measurement.

Parameters:

label (str) – label to represent the given party

Returns:

list of sympy.core.symbol.Symbol

qrem.common.external.CBB.spin_models.get_square2D_spins(k, l, configuration=None)

Genrates the list of symbolic variables representing the spins arranged in a 2D square lattice of size kxl. The variables are treated as commuting.

Parameters:
  • k (int) – horizontal size of the lattice

  • l (int) – vertical size of the lattice

  • coniguration – number of spins per site with corresponding levels [d…d]

Returns:

list of sympy.core.symbol.Symbol

qrem.common.external.CBB.spin_models.get_2Dsquare_localdisorder(k, l, sigma)

Generates random local magnetic field values for a 2D square lattice distributed according to a Gaussian with zero mean and variance sigma

Parameters:
  • k (int) – horizontal size of the lattice

  • l (int) – vertical size of the lattice

  • sigma (float) – variance of the gaussian distribution

Returns:

the magnetic field values h as list of float

qrem.common.external.CBB.spin_models.get_2Dsquare_ferromagneticdisorder_hamiltonian(k, l, local, s_variables)

Generates the hamiltonian of a ferromagnetic 2D Ising model and local mangetic fields as a polynomial in the spin variables

Parameters:
  • k (int) – horizontal size of the lattice

  • l (int) – vertical size of the lattice

  • local (list of float) – local magnetic field values

  • s_variables (list of sympy.core.symbol.Symbol) – list of spin variables

Returns:

the hamiltonian as sympy.core.add.Add

qrem.common.external.CBB.spin_models.get_lattice_spins(lattice, configuration)

Generates a dictionary of symbolic variables representing the spin in the given lattice

Parameters:
  • lattice (networkx.classes.graph.Graph) – the lattice structure

  • coniguration – number of spins per site with corresponding levels [d…d]

Returns:

the spin variables as dict with tuple as keys representing the nodes

and sympy.core.symbol.Symbol as values representing the spins

qrem.common.external.CBB.spin_models.get_lattice_localdisorder(lattice, sigma)

Generates the random magneitc field on each node of the lattice, according to a gaussian distribution with zero mean and variance sigma

Parameters:
  • lattice (networkx.classes.graph.Graph) – the lattice structure

  • sigma (float) – variance of the gaussian distribution

Returns:

the local field as dictionary with tuple as keys representing the nodes

and float as values

qrem.common.external.CBB.spin_models.get_lattice_ferromangetic(lattice)

Generates the ferromagnetic couplings for each edge in the lattice

Parameters:

lattice (networkx.classes.graph.Graph) – the lattice structure

Returns:

the couplings as dictionary with tuple as keys representing the edges

and float as values

qrem.common.external.CBB.spin_models.get_lattice_hamiltonian(lattice, h, J, s_variables)

Generates the hamiltonian for the given lattice with the given local fields h and couplings J as a polynomial in the spin variables

Parameters:
  • lattice (networkx.classes.graph.Graph) – the lattice structure

  • h (dict) – the local fields h_i

  • J (dict) – the couplings J_{ij}

  • s_variables (list of sympy.core.symbol.Symbol) – list of spin variables

Returns:

the hamiltonian as sympy.core.add.Add