hammer package

Submodules

hammer.CalcPlotCoefficients module

hammer.ConvertASCIIToBin module

ConvertASCIIToBin.py: Utility to convert state files in ASCII format to binary format.

hammer.ConvertASCIIToBin.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.ConvertBinToASCII module

ConvertBinToASCII.py: Utility to convert state files in binary format to ASCII format.

hammer.ConvertBinToASCII.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.ConvertBinToHDF module

ConvertBinToHDF.py: Script to convert a binary PETSc vector to a HDF5 version.

hammer.ConvertBinToHDF.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.CreateSuperposition module

CreateSuperposition.py: Utility to create a superposition of states with the provided phases.

hammer.CreateSuperposition.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.EvaluateStatesRealSpace module

EvaluateStatesRealSpace.py: Script to calculate the wave-function values of given state(s) at the provided positions.

hammer.EvaluateStatesRealSpace.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.FQHBasisManager module

FQHBasisManager.py: Module to manage basis objects to prevent duplication in scripts.

class hammer.FQHBasisManager.FQHBasisManager(Particles=4, NbrFlux=12, Momentum=2, COMMomentum=2, InversionSector=-1, Tau=1j, Sphere=False, Bosonic=False)

Class which provides utility functions for creating and managing basis objects.

GetBasis(Verbose=False, DimensionOnly=False)

Function to create and return an instance of the appropriate basis object.

Parameters:
  • Verbose (bool) – Flag to indicate that verbose output should be used.
  • DimensionOnly (bool) – Flag to indicate that we should just calculate the dimension and not the actual configurations.
GetBasisFilename()

Function that returns typical filename for a basis file.

Returns:The filename where a basis object with the given properties is written to by default.
Return type:str
GetDetailsDict()

Function to return parameters as a dictinary

GetFilenamePrefix(tau=None, ID=None)

Function that returns typical filename prefix from basis parameters and tau value.

Parameters:tau (complex) – Parameters that specifies torus shape. If not then note used (default=None).
Returns:The filename prefix that is used when writing quantities relating to this to disk.
Return type:str
GetSingleParticleWF()

Return an object for calculating single particle wave-functions with current basis settings.

Returns:A class instance which has a WFValue(z, orbital) function.
Return type:wf object
SetTorusDetailsFromDict(details)

Set the basis parameters from dictionary with the parameters of the basis.

Parameters:details (dict) – Dictionary which contains basis parameters.
SetTorusDetailsFromFilename(filename)

From the name of a vector file try to discover the number of particles, flux and momentum sector. Return as a dictionary

Parameters:filename (str) – The name of the filename from which to parse the arguments.
SetTorusDetailsFromOpts(args)

Set basis details from command line arguments.

Parameters:args (list of str objects) – List of arguments specifying basis.

hammer.FQHSphereBasis module

FQHSphereBasis.pyx: This is a cython implementation of code to work with the FQH basis on a Sphere.

class hammer.FQHSphereBasis.FQHSphereBasis

Bases: hammer.FQHTorusBasis.FQHTorusBasis

GetSingleParticleWF()

Return an object for calculating single particle wave-functions with current basis settings.

Returns:A class instance which has a WFValue(z, orbital) function.
Return type:wf object

hammer.FQHSphereCoefficients module

FQHSphereCoefficients.pyx: This is a cython implementation calculate FQH interaction coefficents for the sphere.

class hammer.FQHSphereCoefficients.FQHSphereInteractionCoefficients2Body

Class to group methods and data structures for calculating interaction coefficients for FQH systems on the sphere.

CalculateCoefficients()

High level function to calculate interaction coefficients and store for later use.

WriteAntiSymCoefficients()

Write anti-symmeterised cofficients to a csv file.

hammer.FQHSphereCoefficients.VkCoulomb()
hammer.FQHSphereCoefficients.VkDelta()
hammer.FQHSphereCoefficients.clebsch_gordan()

hammer.FQHSphereHamiltonian module

FQHSphereHamiltonian.pyx: This is a cython implementation construct Hamiltonian matrices for FQH systems on tori.

class hammer.FQHSphereHamiltonian.FQHSphereHamiltonian

Class to group methods and data structures for dealing constructing Hamiltonians for FQH systems on Tori

CreateSlepcHamiltonian()

Method to create and populate the PETSc matrix data structure.

mult()

Multiply operation, for use with petsc vector data types.

Parameters:
  • mat (na) – No used in example so unsure of its use.
  • X (petsc vec) – Vector to multiply
  • Y (petsc vec) – Result of matrix vector multiplication operation.

hammer.FQHThermalThinTorus module

hammer.FQHTorusBasis module

FQHTorusBasis.pyx: This is a cython implementation of code to work with the FQH basis on a Torus.

class hammer.FQHTorusBasis.FQHTorusBasis

Bases: object

A()

Apply annihilation operator to the site specified. Return 1 if site is occupied and zero otherwise.

AA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx and store the result in TmpState. It is always assumed that Orbital1 is greater than Orbital2. TODO: investigate popcnt implementation to make this more efficient.

AAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2 and Orbital3 to basis elements stored at index Idx and store the result in TmpState. TODO: investigate popcnt implementation to make this more efficient.

AAAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2, Orbital3 and Orbital4 to basis elements stored at index Idx and store the result in TmpState. TODO: investigate popcnt implementation to make this more efficient.

Ad()

Apply creation operator on site with momentum Orbital state TmpState and store result in TmpState2.

AdA_Element()

Annihilate on one site and create at another on a particular element. This is a hopping operation. The associated phase is also calculated and returned.

Parameters:
  • ad_pos (int) – The position to annihilate at.
  • a_pos (int) – The position to create at.
  • element (unsigned long) – The occupation representation of the configuration (limited to 64 bits orbitals).
Returns:

  • unsigned long – The element after the operation has been performed.
  • double – The phase picked up during the operation.

AdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2. It is always assumed that Orbital1 is greater than Orbital2. TODO: investigate popcnt implementation to make this more efficient.

AdAdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2. TODO: investigate popcnt implementation to make this more efficient.

AdAdAdAd()

Apply creation operators on sites with momentum Orbital1 ,Orbital2, Orbital3 and Orbital4 to state TmpState and store result in TmpState2. TODO: investigate popcnt implementation to make this more efficient.

ApproximateBasisPy()
ApproximateStateToFullState()

Given a state in the approximate basis, expand to the full basis.

Parameters:State (Vec) – The approximate state to expand.
BinaryArraySearchDescending()

Function to perform binary search on array of BasisElements for TmpState2 returns: item index or -1 if not found.

BinaryArraySearchDescendingState()

Function to perform binary search on array of BasisElements for TmpState2 returns: item index or -1 if not found.

CalcMonomialOfElement()

Calculate monomial representation of the provided basis element and store internally.

CalcParityOfElement()

Return partiy of sum of non zero element positions.

Parameters:Element (long) – Long number representing the element.
Returns:Parity, either 0 or 1
Return type:int
ConvertToInvertedState()

This method inverts the given state by reflecting all orbitals around the central orbital.

Parameters:
  • State (vec) – Vector object of state to convert.
  • IBasis (basis) – Basis object of PH conjugate or None if not given (default=None).
  • ReturnOp (bool) – Flag to indicate whether to return the operator that transforms a state to its particle hole conjugate (default=False).
Returns:

  • basis – Basis object of PH conjugate state.
  • vec – Vector containing coefficients of PH conjugate state.
  • mat – The operator that transforms the state, only returned in ReturnOp is True.

ConvertToPHConjugate()

This method converts the state given into the particle hole conjugate state.

Parameters:
  • State (vec) – Vector object of state to convert.
  • PHBasis (basis) – Basis object of PH conjugate or None if not given (default=None).
  • ReturnOp (bool) – Flag to indicate whether to return the operator that transforms a state to its particle hole conjugate (default=False).
Returns:

  • basis – Basis object of PH conjugate state.
  • vec – Vector containing coefficients of PH conjugate state.
  • mat – The operator that transforms the state, only returned in ReturnOp is True.

static EntanglementEntropy()
Given a dictionary of entanglement matrices, this method will return the entanglement entropy, S = -tr(

ho_a log( ho_a))

static EntanglementNorm()

Given a dictionary of entanglement matrices, this method will calculate the normal which corresponds to the trace of the density matrix.

static EntanglementSingularValues()

Given a dictionary of entanglement matrices, this method will return arrays of singular values from which entropies and other values can be calculated.

static EntanglementSpectrum()

Given a dictionary of entanglement matrices, this method will return the entanglement spectrum, as an array with corresponding particle and mometum counts.

EvaluateSlaterDeterminants()

Function to calculate the value of all slater determinants at the given positions.

Parameters:
  • Positions (2d complex array) – Array of positions at which to evaluate the wave-functions. Each row is a set of positions with each column the position of a different particle.
  • Verbose (bool) – Flag to indicate whether timings should be output on the console.
Returns:

The wave-function values, rows corresponding to position sets and columns the different states.

Return type:

2d complex array

EvaluateWaveFunction()

Function to calculate the value of the provided state at the given positions.

Parameters:
  • Positions (2d complex array) – Array of positions at which to evaluate the wave-functions. Each row is a set of positions with each column the position of a different particle.
  • States (vec or list of vecs) – PETSc vector object or list of PETSc vector objects containing the fock coefficients corresponding for each eigenstate.
  • WF (wf object) – Wave-function object with WFValue method that will evaluate the an orbital at a given position.
  • Verbose (bool) – Flag to indicate whether timings should be output on the console.
Returns:

The wave-function values, rows corresponding to position sets and columns the different states.

Return type:

2d complex array

EvaluateWaveFunctionShermanMorisson()

Function to calculate the value of the provided state at the given positions making use of the Sherman Morisson theorem so that full determinant not calculated each time. FIXME: Implementation currently very inefficient due to calls to numpy for linear algebra operations. Can be addressed using methods discussed at http://stackoverflow.com/questions/16114100/calling-dot-products-and-linear-algebra-operations-in-cython and http://stackoverflow.com/questions/31485576/fast-basic-linear-algebra-in-cython-for-recurrent-calls

Parameters:
  • Positions (2d complex array) – Array of positions at which to evaluate the wave-functions. Each row is a set of positions with each column the position of a different particle.
  • States (vec or list of vecs) – PETSc vector object or list of PETSc vector objects containing the fock coefficients corresponding for each eigenstate.
  • WF (wf object) – Wave-function object with WFValue method that will evaluate the an orbital at a given position.
  • Verbose (bool) – Flag to indicate whether timings should be output on the console.
Returns:

The wave-function values, rows corresponding to position sets and columns the different states.

Return type:

2d complex array

FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

FindBasisDimension()

Calculates the basis dimension for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasisDimension to calculate the dimension of the basis. TODO: Can possibly improve this by calculating for all desired momentums at once.

GenerateBasis()

Generate basis elements, first calculate the dimension, allocate space and then populate the basis array.

Parameters:
  • filename (str) – Filename to read basis from if it exists.
  • DimensionOnly (bool) – Flag that indicates that the dimension should only be calculated and not the elements.
GetBasisDetails()

Returns a dictionary object with parameters of the basis.

GetDimension()

Return the basis dimension

GetElement()

Return the basis element with index Idx

GetElementFromOccupationRep()

Return the encoded integer corresponding the suppilied occupation representation of the element.

GetElementFromOccupationVec()

Return the encoded integer corresponding the suppilied vector occupation representation of the element.

GetElementIdx()

Return the index of a supplied basis element, -1 if the basis element does not exist in the basis.

GetElementOfMonomial()

Return the encoded integer representation of the supplied monomial.

GetInvSector()

Get the momentum sector inverted basis.

Returns:List containing momentum at which to find the inverted basis.
Return type:list
GetMonomialOfElement()

Return monomial representation of the provided basis element.

GetMonomialRep()

Return the monomial representation buffer. Use CalcMonomialOfElement to modify this.

GetOccupationRep()

Return the basis element with index Idx in the occupation representation

GetOccupationRepOfElement()

Return the basis element with index Idx in the occupation representation.

GetOccupationVectorState()

Return the vector encoded occupation representation of the basis state with index Idx.

GetPHSector()

Get the particle number and momentum sector in which to find the PH conjugated basis.

Returns:List containing particle number and momentum at which to find PH conjugated basis.
Return type:list
GetSingleParticleWF()

Return an object for calculating single particle wave-functions with current basis settings.

Returns:A class instance which has a WFValue(z, orbital) function.
Return type:wf object
GetStateFullTotalMomentum()

Get the total momentum of the provided configuration. No modulo operation is performed in this case

GetStateTotalMomentum()

Get the total momentum of the provided configuration. This is modulo the number of flux

GetTmpState()

Return the internally stored variable TmpState

GetTmpState2()

Return the internally stored variable TmpState

InvertBits()

Method to invert the orbitals. For a particle in orbital u, move it to orbital Nphi - u.

Parameters:State (long) – The Fock configuration in binary form.
Returns:The inverted binary string.
Return type:long
IsApproximateBasis()
N()

Apply density operator to the site specified. Return 1 if site is occupied and zero otherwise.

NN()

Apply density density operator on the given sites to the configuration indexed by Idx.

NNN()

Apply density density operator on the given sites to the configuration indexed by Idx.

OrbitalDensityState()

Return the probability of finding each orbital occupied

state: petsc vector or numpy array

static OrbitalEntanglementEntropySuperposition()

Calculate the entanglement entropy due to a bipartite cut in orbital space for the given superposition of states.

Parameters:
  • Bases (list) – List of basis objects.
  • States (list) – List of state vectors.
  • Coefficients (list) – List of coefficients to create superposition with.
  • AOrbitalStart (int) – Starting orbital of cut (default=0).
  • AOrbitalEnd (int) – Ending orbital of cut, if -1 then will be such that subsystem spanned half of the system (default=-1).
  • AParticles (int) – The number of particles in the sub system. If -1 will calculate for all particle numbers (default=-1).
Returns:

Entanglement entropy.

Return type:

float

OrbitalEntanglementMatrices()

Calculate the entanglement matrices due to a bipartite cut in orbital space. Return dictionary containing matrices where they keys are tuples consisting of the number of particles and momentum of the A partition.

Parameters:
  • State (Vec) – State to calculate the entanglement matrices for.
  • AOrbitalStart (int) – The index of the first orbital in the A partition.
  • AOrbitalEnd (int) – The index of the first orbital of the B partition.
  • AParticles (int) – The number of particles in the A partition. If -1, then will consider all possible partitions of particles.
  • Fast (bool) – Flag to indicate whether to use the faster variant (default is True).
static OrbitalEntanglementMatricesSuperposition()

Calculate the entanglement matrices due to a bipartite cut in orbital space for the given superposition of states. Returns a dictionary containing matrices, with keys tuples consisting of the number of particles.

Parameters:
  • Bases (list) – List of basis objects.
  • States (list) – List of state vectors.
  • Coefficients (list) – List of coefficients to create superposition with.
  • AOrbitalStart (int) – Starting orbital of cut (default=0).
  • AOrbitalEnd (int) – Ending orbital of cut, if -1 then will be such that subsystem spanned half of the system (default=-1).
  • AParticles (int) – The number of particles in the sub system. If -1 will calculate for all particle numbers (default=-1).
Returns:

A dictionary of petsc matcies where the key is the number of particle in subsystem A.

Return type:

dict of matrices

static OrbitalEntanglementMatricesSuperpositionSymmetry()

Calculate the entanglement matrices due to a bipartite cut in orbital space for the given superposition of states. Returns a dictionary containing matrices, with keys tuples consisting of the number of particles and momentum of parition A modulos the difference in momentum between states. This assumes that the momentum of states are spaced evenely and given in ascending order (as is the case with ground states on the torus).

OrbitalEntanglementMatrix()

This method, given a state in the current basis will construct and return the Schmidt matrix corresponding to bipartitioning the system into two parts, one containing the A orbitals specified and the specified total momentum. Only works in serial.

OrbitalEntanglementMatrixFast()

This method, given a state in the current basis will construct and return the Schmidt matrix corresponding to bipartitioning the system into two parts, one containing the A orbitals specified and the specified total momentum. Only works in serial.

Parameters:
  • State (Vec) – State to calculate the entanglement for.
  • AOrbitalStart (int) – The index of the orbital where the A partition starts, from 0 to N_phi - 1.
  • AOrbitalEnd (int) – The index of the orbital where the B partition begins, from AOrbitalStart + 1 to N_phi - 1.
  • AMomentum (int) – The total momentum in the A partition.
  • AParticles (int) – The number of particles in the A parition (1 to overall number of particles).
static OrbitalEntanglementMatrixSuperposition()

This method, given a superposition of states in the current basis will construct and return the Schmidt matrix corresponding to a bipartition of the system.

static OrbitalEntanglementMatrixSuperpositionSymmetry()

This method, given a superposition of states in the current basis will construct and return the Schmidt matrix corresponding to a bipartition of the system, restricting momentum on A partition to those specified.

PrettyPrintBasis()
PrettyPrintState()

Print the given state with additional basis information.

Parameters:
  • state (petsc vector or numpy array) – State to print.
  • abs (bool) – Flag to print absolute value.
  • sort (bool) – Flag
  • phase (bool) – Flag to indicate that phase printed too.
  • rotate (bool) – Flag to indicate that coefficients should be rotated such that element with maximum magnitude is real.
PrettyPrintStateDiff()

Print differing coefficients with additional basis information.

Parameters:
  • state1 (petsc vector or numpy array) – State 1 to compare
  • state2 (petsc vector or numpy array) – State 2 to compare
  • sort (bool) – Flag to indicate that sorting by first state
PrintOccupationRep()

Print the basis element with index Idx in the occupation representation

ReadBasis()
RepresentativeConfiguration()

Certain configurations are the same as others up to a translation. A configuration is a representative configuration if it has the smallest numerical value of the configurations which can be related via translation.

Returns the index of the representative configuration.

SetTmpState()

Set the value of internal variable TmpState

SetTmpState2()

Set the value of internal variable TmpState2

StateAA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements provided and store the result in TmpState. It is always assumed that Orbital1 is greater than Orbital2. TODO: investigate popcnt implementation to make this more efficient.

ThreeBodyOperator()

This method implements a single two body intereaction, acting on the basis instance and connecting to basis2. O = a_o^+ a_p^+ a_q^+ a_r a_s a_t

TooManyConsecutiveParticlesOrHoles()

Function that checks the whether the number of consecutive holes or particles exceeds the specified amount.

Parameters:
  • Element (long) – The element to check
  • ConsecutiveParticles (int) – Number of consecutive particles to exclude a configuration. -1 to include all configurations.
  • ConsecutiveHoles (int) – Number of consecutive holes to exclude a configuration. -1 to include all configurations.
Translate()

Function that translates the given configuration by t orbitals.

TranslateState()

Translate the given state by the amount of orbitals specified. Returns the new basis and new state.

Parameters:
  • State (petscvec) – Vector containing Fock coefficients of the state to translate.
  • Amount (int) – The amount of orbitals by which to translate the state.
  • NewBasis (basis object) – A precomputed basis object at the translated momentum. New basis object created if None (default=None).
Returns:

  • BasisObject – The basis object of the Hilbert space of the translated state.
  • Vec – The petsc vector object containing the Fock coefficients of the translated state.

TwoBodyOperator()

This method implements a single two body intereaction, acting on the basis instance and connecting to basis2. O = a_p^+ a_q^+ a_r a_s

WriteBasis()

Function write the basis to a file on disk. TODO: Write version that writes in binary format instead, possibly hdf5

find_all_changing_orbitals()

Method to find all the changes in a the given basis for certain subset of elements. Calls the find changed orbitals method for each pair of consecutive elements.

Parameters:
  • start (int) – The starting element (default=0).
  • end (int) – The ending element, -1 for all (default=-1).
Returns:

  • tensor – Array of matrices containing details of the hopping operations between elements.
  • array – The number of operations between each pair of consecutive elements.
  • array – The phase picked up for each transition.

find_changed_orbitals()

Given the occupation representation of two elements find where the orbitals differ.

Parameters:
  • a_element (unsigned long) – The initial element.
  • b_element (unsigned long) – The element we wish to transform to.
  • max_changes (int) – The maximum number of changes between orbitals (nflux will be used if non provided).
Returns:

  • matrix – Matrix with details of changes, each row decribes a hopping operation.
  • int – The number of changes found.
  • double – The phase associated with the operation.

new_determinant()

Method that calculates the new determinant and new inverse using the Sherman Morrison theorm when a matrix is changed by the addition of vectors u and v.

Parameters:
  • det_A (double complex) – The initial determinant of A.
  • inv_A (matrix) – The initial inverse matrix for A.
  • u (vector) – The u vector that updates A.
  • v (vector) – The v vector that updates A.
Returns:

  • float – New determinant
  • matrix – The new inverse matrix

new_determinant_fast()

Method that calculates the new determinant and new inverse using the Sherman Morrison theorm when a matrix is changed by the addition of vectors u and v. In this particular version we know that u only contains a single non zero element and so can do this more efficiently if we only consider this.

Parameters:
  • det_A (double complex) – The initial determinant of A.
  • inv_A (matrix) – The initial inverse matrix for A.
  • u_nnz (int) – The index of the nonzero element of u.
  • v (vector) – The v vector that updates A.
Returns:

  • float – New determinant
  • matrix – The new inverse

hammer.FQHTorusBasisBosonic module

FQHTorusBasisBosonic.pyx: This is a cython implementation of code to work with the FQH basis on a Torus.

class hammer.FQHTorusBasisBosonic.FQHTorusBasisBosonic

Bases: object

Class to represent basis for Bosons in FQH effect. TODO: Replace mention of monomials with occupation representation as there is confusion.

AA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx and store the result in TmpState.

AAA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx and store the result in TmpState.

AAAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2, Orbital3 and Orbital4 to basis elements stored at index Idx and store the result in TmpState.

AdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state in Monomial1 and store the result in Monomail2.

AdAdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2.

AdAdAdAd()

Apply creation operators on sites with momentum Orbital1, Orbital2, Orbital3 and Orbital4 to state TmpState and store result in TmpState2.

BinaryArraySearchDescending()

Function to perform binary search on array of BasisElements for state in Monomial2 returns: item index or -1 if not found.

BinaryArraySearchDescendingElement()

Function to perform binary search on array of BasisElements for the provided state returns: item index or -1 if not found.

FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

GenerateBasis()

Generate basis elements, first calculate the dimension, allocate space and then populate the basis array.

Parameters:
  • filename (str) – Filename to read basis from if it exists. Not implmented yet for bosonic bases, but included for compatibity.
  • DimensionOnly (bool) – Flag that indicates that the dimension should only be calculated and not the elements.
GetBasisDetails()

Returns a dictionary object with parameters of the basis.

GetDimension()

Return the basis dimension

GetEffectiveMomentum()

Return the effective momentum

GetElement()

Return the basis element with index Idx

GetElementNorm()

Given a basis element, calculate the normal, defined as the sqrt(prod_i(factorial(m_i))), where m_i is the number of particles at orbital i.

GetElementSum()

Given two basis elements in binary representation, add the particles at each orbital together to get the composite elemnt.

GetFermionicOccupationRep()

Return the basis element with index Idx in the occupation representation

GetFermionicOccupationRepOfElement()

Return the basis element with index Idx in the occupation representation

GetFermionicRep1()

Convert from monomial representation to fermionic basis element.

GetFermionicRep2()

Convert from monomial representation to fermionic basis element.

GetMonomial1()
GetMonomial2()
GetMonomialRep()

Convert basis element to monomial representation and store in element monomial1.

GetOccupationRep()

Return the basis element with index Idx in the occupation representation

GetOccupationRepArray()

Return the basis element with index Idx in the occupation representation

GetOccupationRepOfElement()

Return the basis element with index Idx in the occupation representation

NN()

Apply density density operator on the given sites to the configuration indexed by Idx.

NNN()

Apply density density operator on the given sites to the configuration indexed by Idx.

OrbitalEntanglementMatrices()

Calculate the entanglement matrices due to a bipartite cut in orbital space. Return dictionary containing matrices where they keys are tuples consisting of the number of particles and momentum of the A partition.

static OrbitalEntanglementMatricesSuperposition()

Calculate the entanglement matrices due to a bipartite cut in orbital space for the given superposition of states. Returns a dictionary containing matrices, with keys tuples consisting of the number of particles.

OrbitalEntanglementMatrix()

This method, given a state in the current basis will construct and return the Schmidt matrix corresponding to bipartitioning the system into two parts, one containing the A orbitals specified and the specified total momentum. Only works in serial.

static OrbitalEntanglementMatrixSuperposition()

This method, given a superposition of states in the current basis will construct and return the Schmidt matrix corresponding to a bipartition of the system.

PrintOccupationRep()

Print the basis element with index Idx in the occupation representation

SetMonomialRep2()

Set the second stored monomial representation using the provided occupation representation.

TranslateState()

Translate the given state by the amount of orbitals specified. Returns the new basis and new state.

Parameters:
  • State (vector) – Fock coefficients of state to translate.
  • Amount (int) – The number of orbitals to translate by.

hammer.FQHTorusBasisBosonicCOMMomentum module

FQHTorusBasisBosonicCOMMomentum.pyx: This is a cython implementation of code to work with the FQH bosonic basis on a Torus taking into account centre of mass symmetry.

class hammer.FQHTorusBasisBosonicCOMMomentum.FQHTorusBasisBosonicCOMMomentum

Bases: hammer.FQHTorusBasisBosonic.FQHTorusBasisBosonic

AA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx and store the result in TmpState. TODO: investigate popcnt implementation to make this more efficient.

AAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2 and Orbital3 to basis elements stored at index Idx and store the result in TmpState.

AAAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2, Orbital3 and Orbital4 to basis elements stored at index Idx and store the result in TmpState.

AdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2.

AdAdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2.

AdAdAdAd()

Apply creation operators on sites with momentum Orbital1 ,Orbital2, Orbital3 and Orbital4 to state TmpState and store result in TmpState2.

BinaryArraySearchDescending()

Function to perform binary search on array of BasisElements for TmpState2 returns: item index or -1 if not found.

ConvertToFullBasis()

This method expands the state in the reduced centre of mass momentum basis to the full basis.

Parameters:
  • State (vector) – Vector of Fock coefficients.
  • FullBasis (basis object) – Basis object of full basis, if None will be computed (default=None).
Returns:

  • basis object – The basis for the full system.
  • vector – Vector of Fock coefficients for the full state.

FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

GetBasisDetails()

Returns a dictionary object with parameters of the basis.

GetNumberSectors()

Simple accessor method to return the number of momentum sectors.

GetPhases()

Simple accessor method to return the array of phases.

IsRepresentativeConfiguration()

Method to check if the configuration passed is a representative configuration for case with even numbers of particles.

NN()

Apply density operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx.

NNN()

Apply density operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx.

SimpleTranslate()

Function that translates the given configuration by t orbitals.

For bosons the algoritm is as follows 1. Iterate starting at lowest bit of fermionic representation until “(Steps * Distance)” orbitals have been counted (each zero corresponds to orbital). 2. Translate the state by the amount of bits that have been iterated over.

hammer.FQHTorusBasisBosonicCOMMomentumInversion module

FQHTorusBasisBosonicCOMMomentumInversion.pyx: This is a cython implementation of code to work with the FQH basis on a Torus, implements COMMomentum and inversion symmetries.

class hammer.FQHTorusBasisBosonicCOMMomentumInversion.FQHTorusBasisBosonicCOMMomentumInversion

Bases: hammer.FQHTorusBasisBosonicCOMMomentum.FQHTorusBasisBosonicCOMMomentum

ConvertToFullBasis()

This method expands the state in the reduced centre of mass momentum and inversion sector basis to the full basis.

Parameters:
  • State (vector) – Vector object containing Fock coefficients.
  • FullBasis (basis object) – Basis object for full basis. If None is recomputed (default=None).
Returns:

  • basis object – The full basis object.
  • vector – Vector of Fock coefficients for full state.

FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

GetNormalIdx()

Given the index of a basis element, calculate the normal

InvertBits()

Reflect the given state, taking into account it is an effective representation for a bosonic state.

SimpleCOMInversion()

Function that reflects positions of particles in the provided state around the COM point and retruns the resulting state.

hammer.FQHTorusBasisCOMMomentum module

FQHTorusBasisCOMMomentum.pyx: This is a cython implementation of code to work with the FQH basis on a Torus with centre of mass momentum symmetry.

class hammer.FQHTorusBasisCOMMomentum.FQHTorusBasisCOMMomentum

Bases: hammer.FQHTorusBasis.FQHTorusBasis

AA()

Apply annihilation operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx and store the result in TmpState. TODO: investigate popcnt implementation to make this more efficient.

AAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2 and Orbital3 to basis elements stored at index Idx and store the result in TmpState.

AAAA()

Apply annihilation operators on sites with momentum Orbital1, Orbital2, Orbital3 and Orbital4 to basis elements stored at index Idx and store the result in TmpState.

AdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2.

AdAdAd()

Apply creation operators on sites with momentum Orbital1 and Orbital2 to state TmpState and store result in TmpState2.

AdAdAdAd()

Apply creation operators on sites with momentum Orbital1 ,Orbital2, Orbital3 and Orbital4 to state TmpState and store result in TmpState2.

BinaryArraySearchDescending()

Function to perform binary search on array of BasisElements for TmpState2 returns: item index or -1 if not found.

ConvertFromFullBasis()

This method projects the given state in the full basis onto the subspace spanned by this basis.

Parameters:
  • FullState (vector) – Vector of Fock coefficients of state to convert.
  • FullBasis (basis object) – Basis object of full basis. If None basis is constructed.
  • ReturnOp (bool) – Flag to indicate that the projection operator should be returned.
Returns:

  • basis object – Full basis.
  • vector – Full state vector.
  • matrix – If ReturnOp is true the projection operator is returned.

ConvertToFullBasis()

This method expands the state in the reduced centre of mass momentum basis to the full basis.

Parameters:
  • State (vector) – Vector of Fock coefficients of state to convert.
  • FullBasis (basis object) – Basis object of full basis. If None basis is constructed.
  • ReturnOp (bool) – Flag to indicate that the projection operator should be returned.
Returns:

  • basis object – Full basis.
  • vector – Full state vector.
  • matrix – If ReturnOp is true the projection operator is returned.

ConvertToInvertedState()

This method inverts the given state by reflecting all orbitals around the central orbital. Currently works by expanding to full basis, inverting and then converting back.

Parameters:
  • State (vec) – Vector object of state to convert.
  • IBasis (basis) – Basis object of PH conjugate or None if not given (default=None).
  • ReturnOp (bool) – Flag to indicate whether to return the operator that transforms a state to its particle hole conjugate. Not implemented yet, returns None (default=False).
Returns:

  • basis – Basis object of PH conjugate state.
  • vec – Vector containing coefficients of PH conjugate state.
  • mat – The operator that transforms the state, only returned in ReturnOp is True (not implemented returns None).

ConvertToPHConjugate()

This method converts the state given into the particle hole conjugate state.

Parameters:
  • State (vec) – Vector object of state to convert.
  • PHBasis (basis) – Basis object of PH conjugate or None if not given (default=None).
  • ReturnOp (bool) – Flag to indicate whether to return the operator that transforms a state to its particle hole conjugate (default=False).
Returns:

  • basis – Basis object of PH conjugate state.
  • vec – Vector containing coefficients of PH conjugate state.
  • mat – The operator that transforms the state, only returned in ReturnOp is True.

CreateConversionToFullOp()

This method creates the operator that will convert a state in this basis to the full basis given.

Parameters:FullBasis (basis object) – Basis object of full basis.
Returns:If ReturnOp is true the projection operator is returned.
Return type:matrix
FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

FindBasisDimension()

Calculates the basis dimension for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasisDimension to calculate the dimension of the basis.

GetBasisDetails()

Returns a dictionary object with parameters of the basis.

GetInvSector()

Get the momentum sector inverted basis.

Returns:List containing momentum and COM momentum at which to find the inverted basis.
Return type:list
GetPHSector()

Get the particle number and momentum sector in which to find the PH conjugated basis.

Returns:List containing particle number, momentum and COM momentum at which to find PH conjugated basis.
Return type:list
GetPhase()

Returns the phase corresponding to the provided index, or 0 if out of range

GetRepresentative()

Try to find the index of the representative of element TmpState2

GetRepresentativePhase()

Try to find phase relating the configuration in tmpstate2 and its representative configuration.

NN()

Apply density operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx.

NNN()

Apply density operators on sites with momentum Orbital1 and Orbital2 to basis elements stored at index Idx.

SimpleTranslate()

Function that translates the given configuration by t orbitals.

TranslatePhase()

Function that gives the phase due to parity of particles in the overflow section.

hammer.FQHTorusBasisCOMMomentumInversion module

This is a cython implementation of code to work with the FQH basis on a Torus, implements COMMomentum and inversion symmetries

class hammer.FQHTorusBasisCOMMomentumInversion.FQHTorusBasisCOMMomentumInversion

Bases: hammer.FQHTorusBasisCOMMomentum.FQHTorusBasisCOMMomentum

COMInversionPhase()

Function that reflects positions of particles in the provided state around the COM point and retruns the resulting phase.

ConvertToPHConjugate()

This method converts the state given into the particle hole conjugate state.

Parameters:
  • State (vec) – Vector object of state to convert.
  • PHBasis (basis) – Basis object of PH conjugate or None if not given (default=None).
  • ReturnOp (bool) – Flag to indicate whether to return the operator that transforms a state to its particle hole conjugate (default=False).
Returns:

  • basis – Basis object of PH conjugate state.
  • vec – Vector containing coefficients of PH conjugate state.
  • mat – The operator that transforms the state, only returned in ReturnOp is True.

CreateConversionToFullOp()

This method creates the operator that will convert a state in this basis to the full basis given.

Parameters:FullBasis (basis object) – Basis object of full basis.
Returns:If ReturnOp is true the projection operator is returned.
Return type:matrix
FindBasis()

Calculates the basis elements for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasis to calculate the basis elements and populate the BasisElements array. TODO: Can possibly improve this by calculating for all desired momentums at once.

FindBasisDimension()

Calculates the basis dimension for momentum J, flux Nphi and Ne electrons. Makes call to recursive function FindSubBasisDimension to calculate the dimension of the basis.

GetBasisDetails()

Returns a dictionary object with parameters of the basis.

GetNormalIdx()

Given the index of a basis element, calculate the normal

GetRepresentative()

Try to find the index of the representative of element TmpState2

GetRepresentativePhase()

Try to find phase relating the configuration in tmpstate2 and its representative configuration.

SimpleCOMInversion()

Function that reflects positions of particles in the provided state around the COM point and retruns the resulting state.

hammer.FQHTorusCoefficients module

This is a cython implementation calculate FQH interaction coefficents for the torus

hammer.FQHTorusCoefficients.AntiSymmetrise()

Given a list of values, return the list of all combinations along with antisymmetric tensor values.

hammer.FQHTorusCoefficients.CombinationNorm()
class hammer.FQHTorusCoefficients.FQHTorusInteractionCoefficients2Body

Class to group methods and data structures for calculating interaction coefficients for FQH systems on tori.

CalcInteractionDetails()

Given the separation k, hopping m and using reference orbital self.RefOrbital, returns a list with 6 elements with j1,j2,j3,j4,separation,hopping, where ji are specific orbitals and separation and hopping are signed values.

CalculateCoefficients()

Higher level function to calculate interaction coefficients and store for later use.

CoefficientCount()

Return the number of (non anti-symmeterised) coefficients

EvaluatePseudoPotentials()

Evaluate V corresponding to the provided pseudopotentials

GetCoefficientByIndex()

Return coefficient corresponding to given index

GetHoppingByIndex()

Return hopping distance corresponding to given index

GetSeparationByIndex()

Return separation distance corresponding to given index

PrintDetails()

Print some details about the torus

PseudoPotentialsAndCoulomb()

Evaluate both Coulomb and pseudopotentials

TwoBodyCoefficient()

Calculates the two body Coulomb interaction coefficients A_j1j2j3j4 between particles with momentum j3, j4 anad paticles with momentum j1, j2.

Consists of iterations in two directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

TODO: precalculate and type terms involving member variables to get further gains in efficiency.

TwoBodyCoefficientMP()

Calculates the two body Coulomb interaction coefficients A_j1j2j3j4 between particles with momentum j3, j4 anad paticles with momentum j1, j2 using multiprecision library for greater accuracy.

TODO: Make more use of cython to increase efficiency. This method is slow compared to regular method.

V1V3()

Laguerre polynomial 5 for args.

V3()

Laguerre polynomial 5 for args.

VCoulomb()

Calculates the Fourier series coefficients of the Coulomb interaction at recipricol lattice point qx, qy. TODO: Look at inlining for further speed gains.

Currently the potential is defined as V=1/(2*k), which corresponds to V = 1/(4*pi*r) As the physical potential is V = e^2/(4*pi*epsilon_0*r) There is an (understood) factor of e^2/(epsilon_0)=1 in the potential.

VCoulombMP()

Calculates the Fourier series coefficients of the Coulomb interaction at recipricol lattice point qx, qy. Using multiprecision module.

Currently the potential is defined as V=1/(2*k), which corresponds to V = 1/(4*pi*r) As the physical potential is V = e^2/(4*pi*epsilon_0*r) There is an (understood) factor of e^2/(epsilon_0)=1 in the potential.

VDelta()

Calculates the Fourier series coefficients of the Delta interaction at recipricol lattice point qx, qy.

TODO: Look at inlining for further speed gains.

WriteAntiSymCoefficients()

Write anti-symmeterised cofficients to a csv file.

WriteCoefficients()

Write cofficients to a csv file.

class hammer.FQHTorusCoefficients.FQHTorusInteractionCoefficients3Body

Class to group methods and data structures for calculating 3-body interaction coefficients for FQH systems on tori.

CalcInteractionDetails()

Given the separations k1 and k2, hopping distances m1 and m2 and using reference orbital self.RefOrbital, returns a list with 10 elements with j1,j2,j3,j4,j5,j6,separation1,separation2,hopping1,hopping2 where ji are specific orbitals and separation and hopping are signed values.

CalculateCoefficients()

Higher level function to calculate interaction coefficients and store for later use.

GetCoefficientByIndex()

Return coefficient corresponding to given index

GetHoppingByIndex()

Return hopping distance corresponding to given index

GetSeparationByIndex()

Return separation distance corresponding to given index

PrintDetails()

Print some details about the torus

ThreeBodyDeltaBosonic()

Calculates the three body delta interaction coefficients A_j1j2j3j4j5j6 between particles with momentum j4, j5, j6 anad paticles with momentum j1, j2, j3.

Consists of iterations in four directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

TODO: precalculate and type terms involving member variables to get further gains in efficiency.

ThreeBodyDeltaFermionic()

Calculates the three body delta interaction coefficients A_j1j2j3j4j5j6 from differences j2 - j1, j1 - j3, j5 - j2 and j3 - j4

Consists of iterations in four directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

ThreeBodyDeltaFermionicFull()

Calculates the three body delta interaction coefficients A_j1j2j3j4j5j6 between particles with momentum j4, j5, j6 anad paticles with momentum j1, j2, j3.

WriteAntiSymCoefficients()

Write anti-symmeterised cofficients to a csv file.

WriteCoefficients()

Write cofficients to a csv file.

class hammer.FQHTorusCoefficients.FQHTorusInteractionCoefficients4Body

Class to group methods and data structures for calculating 4-body interaction coefficients for FQH systems on tori.

CalculateCoefficients()

Higher level function to calculate interaction coefficients and store for later use.

FourBodyDeltaBosonic()

Calculates the four body delta interaction coefficients A_j1...j8 from differences provided.

Consists of iterations in six directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

FourBodyDeltaBosonicFull()
FourBodyDeltaBosonicTesting()

Calculates the four body delta interaction coefficients A_j1...j8 from differences provided.

Consists of iterations in six directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

FourBodyDeltaFermionic()

Calculates the four body delta interaction coefficients A_j1...j8 from differences provided.

Consists of iterations in six directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

FourBodyDeltaFermionicFull()

Calculates the three body delta interaction coefficients A_j1j2j3j4j5j6 between particles with momentum j4, j5, j6 anad paticles with momentum j1, j2, j3.

FourBodyDeltaFermionicTesting()

Calculates the four body delta interaction coefficients A_j1...j8 from differences provided.

Consists of iterations in six directions, stopping criteria is when prefactor before phase term decays to zero or is lower than self.Threshold.

PrintDetails()

Print some details about the torus

WriteAntiSymCoefficients()

Write anti-symmeterised cofficients to a csv file.

WriteCoefficients()

Write cofficients to a csv file.

hammer.FQHTorusCoefficients.NextPermutation()

Given an array of values, return the next permutation up until the array is descending in value. Algorithm works as follows: 1. Start from the last item n. If this is less than the previous item n-1, proceed to n-1 and repeat this step. 2. If item n is greater than item n-1. Swap n and n-1 and return new array.

hammer.FQHTorusCoefficients.Symmetrise()

Given a list of values, return the list of all combinations along with symmetric tensor values.

hammer.FQHTorusHamiltonian module

This is a cython implementation construct Hamiltonian matrices for FQH systems on tori.

class hammer.FQHTorusHamiltonian.FQHTorusHamiltonian

Class to group methods and data structures for dealing constructing Hamiltonians for FQH systems on Tori

CalculateDiagonal()

Method to calculate the values on the diagonal only.

CreateSlepc3BodyHamiltonian()

Method to create and populate the PETSc matrix data structure.

Performance tracking log

CreateSlepc4BodyHamiltonian()

Method to create and populate the PETSc matrix data structure.

Can try:

Performance tracking log

CreateSlepcHamiltonian()

Method to create and populate the PETSc matrix data structure.

TODO: Further optimise to make 10 particles tractable. Can try: - Using setValues to set the values from arrays instead of individually. - Remove duplicates when setting the memory preallocation. - Further type and cythonise the code. - Profile in more detail to find bottle necks. - Matrix is Hermitian so only need to set upper or lower half.

Performance tracking log 10/03/2014: Ne=8, Ns=20: 1.22s on single core. Change was to change coefficient data structures to c datatypes. 01/03/2014: Ne=8, Ns=20: 7.4s on single core. Change was to change dnnz and odnnz to c arrays for the preallocation loop. 28/02/2014: Ne=8, Ns=20: 14s on single core. Change was to redefine AA and Add with cpdef and specify types. 28/02/2014: Ne=8, Ns=20: 31s on single core.

hammer.FQHTorusProductWF module

This is a cython implementation of code to calculate product wave-functions.

hammer.FQHTorusProductWF.BosonicProductWF()

Function to calculate the wave-function products for bosonic wave-functions.

hammer.FQHTorusProductWF.OccupationNorm()

Function to calculate the normal of a given configuration. Given by the product of square roots of the factorials of the occupation counts.

hammer.FQHTorusRange module

FQHTorusRange.py: Some code to manage torus object (not maintained).

class hammer.FQHTorusRange.FQHTorusRange
AddPrefix(Prefix)
AddTorus(TorusObj)
AddXAxis(XAxis, scale='log')
AddXAxisLabel(XLabel)
GetCoefficientsByIndex(Idx, antisym=False)
GetHoppingByIndex(Idx)
GetSeparationByIndex(Idx)

hammer.FQHTorusWF module

FQHTorusWF.pyx: Cython code for calculating values of single particle torus wave-functions.

__author__ = “Niall Moran” __copyright__ = “Copyright 2016” __license__ = “GPL” __version__ = “0.1” __email__ = “niall.moran@gmail.com

hammer.FQHTorusWF.ConvertFromSquareCoordinates()

Given coordinates defined on square, convert these to coordinates defined on torus unit cell. Coordinated: This is a list of arrays of complex numbers where the real and imaginary parts are between -0.5 and 0.5.

class hammer.FQHTorusWF.FQHTorusWF

Bases: object

This class represents a single particle wave-function for a torus wave-function which is an eigenstate of the translation operator in the x direction. Here we assume that the tau-gauge is used which in reduced coordinates z=L(x+tau*y) reads A = B(-y,0)

GetNumOrbitals()

Return the number of orbitals

GetTorusSides()

Return tuple with side lengths L1 and L2.

PreComputeWFs()

Precompute the values of the wave-function for each momentum at points on a grid of dimension GridDims spanning the unit cell.

Rho()
RhoArray()

Method to calculate the density for an array of an nxn array of points covering the torus.

RhoSuperposition()

Method to calculate the density of the provided superposition of states at z

RhoSuperpositionArray()

Method to calculate the density of the provided superposition of states at points on an evenly space nxn grid over the torus unit cell.

SingleParticleEnergy()

Function to calculate the single particle contribution to the Coulomb energy for the specified torus. Uses formalism described in Yoshioka and Halperin (1983) and the expression for the constant that is needed is in Bonsall and Maradudin (1977). Only implemented for rectangular tori for the moment. Uses implementation of incomplete gamma function from scipy.special module. The constant we return here is half that given the Bonsall paper, which makes the results match exactly those in Yoshioka et. al.

ThreeBodyArrayUsingOperators()

Calculate the three body correlator between points z_1, z_2 and a third point evenly spaced out over the torus unit cell. Use matrix operators to make to optimise.

TorusPlotData()

Pad the provided data array so that when drawn, the shape of the torus is correct.

TwoBody()
TwoBodyArray()

Calculate the two body correlator between points z and points evenly spaced out over the torus unit cell.

TwoBodyArrayUsingOperators()

Calculate the two body correlator between points z and points evenly spaced out over the torus unit cell.

Parameters:
  • z (complex) – Fixed position to calculate two point correlator from.
  • Basis (Basis instance) – Object containing fock configurations and methods for acting on them.
  • State (Vector object) – Vector object containing fock coefficients.
  • n (int) – The number of grid points in each direction to use.
TwoBodySuperposition()

Calculate the two body correlator between points z1 and z2 of the specified superposition of states.

TwoBodySuperpositionArray()

Calculate the two body correlator between points z1 and z2 of the specified superposition of states.

WFValue()

Calculate the value of the wave-function at xy

WFValueGeneral()

Calculate the value of the wave-function at z

WFValueJT()

Evaulate the wave-function using the external JacobiTheta module one value at a time

WFValueLLL()

Calculate the value of the wave-function at z

WFValueSLL()

Calculate the value of the wave-function at xy

hammer.FQHTorusWF.HermitePolynomialVector()

Gives the Hermite monomial coefficents for the polynomial of degree LL

hammer.FQHTorusWF.ReadCoordinatesColumnFormat()

This function reads coordinates (2D) from the provided files which are in column format and returns a two dimensional array of complex numbers, with rows cooresponding to different coordinate sets and columns cooresponding to different particles.

hammer.FQHTorusWF.ReadWaveFunctionValuesColumnFormat()

This function reads wave-function values from the files indicated by the given prefix. Attempts to read the real parts from ‘<Prefix>_re.rnd’ and the imaginary parts from ‘<Prefix>_im.rnd’. A list of complex values is returned.

Parameters:Prefix (string) – Prefix of files to read.
hammer.FQHTorusWF.ReadWaveFunctionValuesSpaceSeparatedFile()

This function reads wave-function values from a single file which is specified with real and imaginary parts alternating in space separated columns.

Parameters:Filename (str) – Filename to read from.
hammer.FQHTorusWF.WriteWaveFunctionValuesColumnFormat()

This function writes the provided values to files in column format. The real parts will be written to a filenamed ‘Prefix’_re.rnd and the imaginary parts to a file names ‘Prefix’_im.rnd.

hammer.HammerArgs module

class hammer.HammerArgs.HammerArgsParser

Class to parse command line arguments. Also serves to save options and pass between functions and classes.

TODO: Change to use dict datatype intenally or even to be a subclass of dict to make more extensible.

BasisParser()

Flags related to the size of the basis being built.

GeometryParser()

Flags related to the geometry of the torus.

InteractionParser()

Flags related to the interaction Hamiltonian.

getEnergiesFilename()

Method which returns the filename that will be used to store the calculated energies.

getVectorFilename(State)

Method which returns the filename that will be used to store the calculated state.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

writeRunDetailsEnd()

Method log the details of a run to a file at the start.

writeRunDetailsStart()

Method log the details of a run to a file at the start.

hammer.MCImportanceOverlaps module

MCImportanceOverlaps.py: Script to calculate the overlap from samples using importance sampling.

hammer.MCImportanceOverlaps.CalculateOverlaps(Data, NbrGroups=-1, BinningLevel=1)

Calculate the overlap for each state.

Parameters:
  • Data (dict) – Dictionary containing mus, nus and deltas for samples.
  • NbrGroups (int) – The number of groups to use when calculating norm for overlaps(default same number of groups as number of bins).
  • BinningLevel (int) – Number of bins to use in a ‘super-bin’ when binning for error calculation.
Returns:

Dictionary containing overlap, overlap error (both normalised and unnormalised) as well as the normalisation and normalisation error.

Return type:

dict

hammer.MCImportanceOverlaps.CompressDataLists(ProbLogMaximums, CFTLogMaximums, EDLogMaximums, NbrStates, mus, nus, deltas)

Takes the list of mu,nu,deltas and the maxmimums of the cft,ed and probabilities and outputs a dictinoary with the data compresed.

ProbLogMaximums: numpy.array
List of maximum of underlying probability for each bin
CFTLogMaximums: numpy.array
List of maximum of underlying CFT for each bin
EDLogMaximums: numpy.array
List of maximum of underlying ED wave functoin for each bin
NbrStates: int
The number of ED-states
mus: numpy.array
Array with mu-values
nus: numpy.array
Array with nu-values
deltas: numpy.array
Array with delta-values
hammer.MCImportanceOverlaps.CreateSuperposition(Overlaps, EDFilenames, Prefix, Slaters=False, BaseName=None)

Function to create a superposition of eigenstates.

Parameters:
  • Overlaps (dict) – Dictionary of overlap data.
  • EDFilenames (list) – List of filenames of the eigenstates.
  • Prefix (str) – Prefix for output vector.
  • Slaters (bool) – Flag to indicate that overlap is with Slaters (default=False).
hammer.MCImportanceOverlaps.ErrorFlagClash(Flag1, Flag2, parser)
hammer.MCImportanceOverlaps.ErrorFlagMissing(Flag1, parser)
hammer.MCImportanceOverlaps.EstimateEnergy(Data, Overlaps, Energies, NbrGroups=1, BinningLevel=1)

Estimate the energy from energies of eigenstates.

Parameters:
  • Data (dict) – Dictionary containing mus, nus and deltas for samples.
  • Overlaps (dict) – Dictionary of overlap data and errors.
  • Energies (array) – 1D array of energies for each of the eigenstates.
  • NbrGroups (int) – The number of groups to use.
  • BinningLevel (int) – Number of levels to use when binning for error calculation.
Returns:

Dictionary containing the energy estimate, energy estimate from error propagation and energy error from binning.

Return type:

dict

hammer.MCImportanceOverlaps.FindDatasetDimensions(Filenames, DatasetName)

Function to find the dimensions of each of the datasets in the given files.

Parameters Filenames: list

List of filenames to read dataset dimensions from.
DatasetName: str
The dataset name to look at in each.
Returns:List containing shape information for the dataset in each file.
Return type:list
hammer.MCImportanceOverlaps.GetSampleCount(Dims)
hammer.MCImportanceOverlaps.LoadDataToBin(Files, FileCounts, BinStarts, BinEnds, Dsets, Samples, SamplesPerBin, Verbose, Pair=0)
hammer.MCImportanceOverlaps.MergeCompressedData(DataList)
hammer.MCImportanceOverlaps.ReadAndCompressSamples(CFTWfnFiles, ProbFiles, EDFiles, NbrSamplesToUse, Offset, Bins, DsetName='wf_values', Verbose=False, logscale=(True, True, False))

Read the requested number of samples from the files given in the lists. Compress these into arrays of mus, nus and deltas for each bin. Also record the maximum in each bin that is used to normalise the bin values.

CFTWfnFiles: list
List of filenames where wave-function values are stored.
ProbFiles: list
List of filenames where MC probability values are stored.
EDFiles: list
List of filenames where ED wave-function values are stored.
NbrSamplesToUse: int
The number of samples to read.
Offset: int
The offset before one starts to read samples.
Bins: int
The number of bins to divide the samples into.
linlog: (Bool,Bool,Bool)
Tuple of bools specifying if the data is in log scale. Each element corresponds to CFT, probabilities and ED (default=(True,True, False)).
hammer.MCImportanceOverlaps.ReadCompressedSamplesData(Filename)

Read the compressed samples data from the given filename.

Parameters:Filename (str) – Name of file containing data.
Returns:Dictionary containing data.
Return type:dict
hammer.MCImportanceOverlaps.ReadFileNamesFromList(InputList)

Read the names of the input files from input as comma separated list.

Parameters:
  • InputList (str) – comma separated list.
  • Returns
  • FileList – List of files.
hammer.MCImportanceOverlaps.WriteCompressedSamplesData(Data, OutputPrefix, csv_format=False)

Write the compressed samples data to disk.

Parameters:
  • Data (dict) – Dictionary containing data.
  • OutputPrefix (str) – Prefix to use for output files.
  • csv_format (bool) – Flag to indicate whether csv format should be used (default=False).
hammer.MCImportanceOverlaps.WriteEnergyData(EnergyData, Prefix)

Write the energy estimates and error estimates to a csv file.

Parameters:
  • EnergyData (dict) – Dictionary containing energy values and error estimates.
  • Prefix (str) – Prefix to use for filename.
hammer.MCImportanceOverlaps.WriteMetaData(NbrSamples, Norm, NormBinError, Bins, NbrBinGroups, BinLevel, Prefix)

Write some meta data to a csv file.

Parameters:
  • NbrSamples (int) – Number of samples used.
  • Norm (float) – Sum squared of overlaps.
  • NormBinError (float) – Error on the norm, from binning.
  • Bins (int) – Number of bins that were used.
  • NbrBinGroups (int) – The number of bin groups used.
  • BinLevel (int) – The binning level.
  • Prefix (str) – The prefix to use for the filename.
hammer.MCImportanceOverlaps.WriteOverlaps(Overlaps, Prefix)

Function to write the calculated overlaps to a csv file on disk.

Parameters:
  • Overlaps (dict) – Dictionary of overlaps and errors.
  • Prefix (str) – Prefix to use for output file.
hammer.MCImportanceOverlaps.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.MCImportanceOverlaps.same_shapes(DataList, Key)
hammer.MCImportanceOverlaps.same_values(DataList, Key)
hammer.MCImportanceOverlaps.scale_and_linearize(Samples, logscale)
hammer.MCImportanceOverlaps.set_loglin_to_bool(String)

hammer.MC_combine_trans module

hammer.MergeHDF5 module

MergeHDF5.py: Script to merge hdf5 files.

hammer.MergeHDF5.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.ModularTransformState module

ModularTransformState.py: Script that applies a modular transformation (or serries thereof) to coordinates and also applies the corresponding gauge transformation to the wave function.

hammer.ModularTransformState.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.ModularTransformState.ensure_flag_dep(F1, FName1, F2, FName2)

hammer.Overlap module

Overlap.py: Script to get the overlap of two PETSc vectors that are stored in binary formats.

hammer.Overlap.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.PlotCoefficients module

hammer.Plotting module

Plotting.py:Some utility functions for creating plots from the outout data.

hammer.Plotting.CreateEnergyPlots(ArgsList, Titles, Taus, Ks, xaxis, filename, scale='log', legend=True, figw=0.8, figh=0.8, N=2, prefix='.', xlabel='$\\tau_2$', xlimits=None)
hammer.Plotting.GetEnergies(Args, path='')

Read the energies for the run specified by Args at the given path.

class hammer.Plotting.MultiPanelPlot(rows, cols, figw=0.8, figh=0.8)

Class to setup multipanel plotting with desired number of plots. Note that it only supports proper placement of legend with up to 2 rows and 2 columns currently.

LegendAxes()

This will return the axes for creating the legend on the centre right hand side.

SetupPlot(idx)
hammer.Plotting.PlotEnergies(Tau2s, Taus, Args, Ks, N, Thres=1e-09, prefix='', PlotGaps=True)

Function to plot the energies or energy gaps for the specified parameters. Tau2s: Tau2 values, used as x-axis. Taus: Tau values to use. Args: Instance of HammerArgsParser class containging other parameter identifying data to plot. Ks: Array of the momentum sectors to consider. N: Number of energy bands in each sector to plot. Thres: The threshold to use when deciding whether energy levels are degenerate. prefix: Path prefix to location where data files can be found. PlotGaps: Flag to indicate whether we should plot gaps or the raw energy values.

hammer.Plotting.PlotFundamentalDomain(Taus, Values, NbrFlux, WithL1=True, Pixels=(1000, 1000), InterpolationMethod='linear', Cmap=None, Limits=None, Colorbar=True)

Function to plot the provided values over the fundamental domain of the complex plane.

Parameters:
  • Taus (ndarray[dtype=np.complex128, ndim=1]) – Tau values for each point..
  • Values (ndarray[dtype=np.float64, ndim=1]) – The values to plot.
  • NbrFlux (int) – The number of flux through the torus.
  • WithL1 (bool) – Flag to indicate to plot vs L1 instead of imag(Tau) (default=True).
  • Pixels (tuple) – Resolution to use in each direction (default =(1000,1000)).
  • InterpolationMethod (string) – Interpolation method to use (default = ‘linear’).
  • Cmap (colormap) – Colormap to use for image plot. None will use currently selected colormap (default = ‘None’).
  • Limits (tuple) – Tuple of two numbers which are upper and lower limits to plot.
  • Colorbar (bool) – Draw colorbar (default = True).
hammer.Plotting.PlotFundamentalDomain3D(Taus, Values, NbrFlux, WithL1=True, Pixels=(500, 500), InterpolationMethod='linear', Cmap=None, Limits=None, Colorbar=False)

Function to plot the provided values over the fundamental domain of the complex plane. :param Taus: Tau values for each point.. :type Taus: ndarray[dtype=np.complex128, ndim=1] :param Values: The values to plot. :type Values: ndarray[dtype=np.float64, ndim=1] :param NbrFlux: The number of flux through the torus. :type NbrFlux: int :param WithL1: Flag to indicate to plot vs L1 instead of imag(Tau) (default=True). :type WithL1: bool :param Pixels: Resolution to use in each direction (default =(1000,1000)). :type Pixels: tuple :param InterpolationMethod: Interpolation method to use (default = ‘linear’). :type InterpolationMethod: string :param Cmap: Colormap to use for image plot. None will use currently selected colormap (default = ‘None’). :type Cmap: colormap :param Limits: Tuple of two numbers which are upper and lower limits to plot. :type Limits: tuple :param Colorbar: Draw colorbar (default = True).

hammer.Plotting.PlotOverlaps(MyArgs, Taus, Tau2s, figw=0.8, figh=0.8, legend=True)
hammer.Plotting.ReadAllEnergiesFilesUnder(path)

Function to read all the output csv files containing energy values under the given path and return in a pandas dataframe.

Parameters:path (str) – The path to recursively search under.
hammer.Plotting.getNColours(N=5, set='Set1')

Function to get N distinct colours that span the Hue of the HSL colour space. Returned in hexadecimal format.

hammer.ProductWF module

ProductWF.py: Script to take the product of provided vectors.

hammer.ProductWF.BosonicProductWF(States, Bases, FinalBasis, Normalise=True)

Function to calculate the wave-function products for bosonic wave-functions.

hammer.ProductWF.OccupationNorm(Occupation)

Function to calculate the normal of a given configuration. Given by the product of square roots of the factorials of the occupation counts.

hammer.ProductWF.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.RealSpaceTorusCorrelations module

RealSpaceTorusCorrelations.py: Script to calculate real space torus correlations from wave-function samples.

class hammer.RealSpaceTorusCorrelations.RealSpaceCorrelationsArgsParser

Class to parse command line arguments specific to correlations calculation utility.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.RealSpaceTorusCorrelations.TorusCorrelations(Opts)

hammer.ShowBasis module

ShowBasis.py: Utility to access the basis building functionality of Hammer.

hammer.ShowBasis.ShowBasis(Opts)
class hammer.ShowBasis.ShowBasisArgsParser

Class to parse command line arguments specific to show basis utility.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.SphereDiagonalise module

SphereDiagonalise.py: Utility perform exact diagonalisation on spherical FQH systems.

hammer.SphereDiagonalise.ReadPseudoPotentialsFile(filename)
class hammer.SphereDiagonalise.SphereArgsParser

Class to parse command line arguments specific to sphere diagonalisation.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.SphereDiagonalise.SphereDiagonalise(Opts)
hammer.SphereDiagonalise.get_state_list(states, states_file, key)

Function to extract list of states from command line list arguement and filename arguement. If both are given an error is given. If list is valid, then this is returned, otherwise the file is loaded into a list and this is returned.

Parameters:
  • states (list) – List of arguements or None.
  • states_fiel (str) – Name of file containing staets.
  • key (str) – Identifying string for states.
Returns:

List of the filenames of the states.

Return type:

list

hammer.SplitHDF5 module

SplitHDF5.py: Script to split hdf5 files.

hammer.SplitHDF5.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.SqueezedWeight module

SqueezedWeight.py: Script the weight in configurations squeezed from supplied configuration(s) of a binary PETSc.

hammer.SqueezedWeight.GetCOM(Configuration, Basis, From=0)
hammer.SqueezedWeight.ParseConfiguration(Configuration, ConfigurationFile, Basis, OccupationRep)

This function parses the supplied configuration (if given) and ensures it is a valid basis configuration. If a filename is given instead of a single configuration, it attempts to read configurations from the supplied file and checks each of these. Basis configurations are returned in the integer representation.

hammer.SqueezedWeight.SimpleSqueezeConfiguration(Configuration, Basis, SqueezedConfigurations)
hammer.SqueezedWeight.SqueezeConfiguration(Configuration, Basis, COM, SqueezedConfigurations)
hammer.SqueezedWeight.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.TauValue module

TauValue.py: Script the return the tau value of a certain range. Convenient for use with scripts to scan tau space.

hammer.TauValue.TauValue(MinExponent, MaxExponent, NumPoints, PointIdx)

Function tau2 value withint range.

Parameters:
  • MinExponent (float) – Minimum value of tau2 exponent.
  • MaxExponent (float) – Maximum value of tau2 exponent.
  • NumPoints (int) – The number of equally spaced points between min and max exponent values.
  • PointIdx (int) – The index of the poitn to print.

hammer.TorusCorrelations module

TorusCorrelations.py: Script the calculate one and two point correlators for torus wave-funtions.

class hammer.TorusCorrelations.CorrelationsArgsParser

Class to parse command line arguments specific to correlations calculation utility.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.TorusCorrelations.PlotCorrelations(G, WF, Prefix, ylabel)

Given a mesh of correlator values, a WF object and a filename prefix, this function creates plots of the given values.

hammer.TorusCorrelations.TorusCorrelations(Opts)

hammer.TorusDiagonalise module

Diagonalise.py: Utility diagonalise torus FQH systems.

hammer.TorusDiagonalise.BuildBasis(Opts)

This utility function builds a basis accoding to the options specified in the supplied HammerArgs object.

hammer.TorusDiagonalise.TorusCoulombGroundState(Particles, NbrFlux, LL=0, Momentum=0, COMMomentum=-1, Bosonic=False, Tau=1j, InversionSector=-1)

Function to calculate Coulomb ground state with specified number of particles, flux and Landau levels.

Parameters:
  • Particles (int) – Number of particles.
  • NbrFlux (int) – Number of flux.
  • LL (int) – Landau level index, 0 for LLL (default=0).
  • Momentum (int) – Total momentum (default=0).
  • COMMomentum (int) – Centre of mass momentum, -1 to not use symmetry (default=-1).
  • Bosonic (flag) – Flag to indicate that Bosonic system should be considered (default=False).
  • Tau (complex) – Torus geometry parameter.
  • InversionSector (int) – The inversion sector to diagonalise in, -1 to not use this symmetry (default=-1).
Returns:

  • Basis object – The basis in the space.
  • PETSc vector – The ground state vector.

hammer.TorusDiagonalise.TorusCoulombHamiltonian(Particles, NbrFlux, Momentum=0, COMMomentum=-1, Bosonic=False, Tau=1j, InversionSector=-1, numpy=False, Basis=False)

Function to return the Coulomb Hamiltonian in the given sector.

Parameters:
  • Particles (int) – Number of particles.
  • NbrFlux (int) – Number of flux.
  • Momentum (int) – Total momentum (default=0).
  • COMMomentum (int) – Centre of mass momentum, -1 to not use symmetry (default=-1).
  • Bosonic (flag) – Flag to indicate that Bosonic system should be considered (default=False).
  • Tau (complex) – Torus geometry parameter.
  • InversionSector (int) – The inversion sector to diagonalise in, -1 to not use this symmetry (default=-1).
  • numpy (bool) – Flag to indicate that it should be returned as a numpy array, other wise a SLEPc sparse matrix is returned (default=False).
Returns:

The Hamiltonian matrix in slepc sparse matrix format by default or as a numpy ndarray.

Return type:

matrix

hammer.TorusDiagonalise.TorusCoulombStates(Particles, NbrFlux, LL=0, Momentum=0, COMMomentum=-1, Bosonic=False, Tau=1j, InversionSector=-1, NStates=-1, Energies=False)

Function to calculate Coulomb ground state with specified number of particles, flux and Landau levels.

Parameters:
  • Particles (int) – Number of particles.
  • NbrFlux (int) – Number of flux.
  • LL (int) – Landau level index, 0 for LLL (default=0).
  • Momentum (int) – Total momentum (default=0).
  • COMMomentum (int) – Centre of mass momentum, -1 to not use symmetry (default=-1).
  • Bosonic (flag) – Flag to indicate that Bosonic system should be considered (default=False).
  • Tau (complex) – Torus geometry parameter.
  • InversionSector (int) – The inversion sector to diagonalise in, -1 to not use this symmetry (default=-1).
  • Nstates (int) – The number of eigenstates to get, if -1 get all (default=-1).
  • Energies (bool) – Flag to indicate that the energies should also be returned.
Returns:

  • Basis object – The basis in the space.
  • list of PETSc vectors – List of eigenstates.
  • array – Array of energy corresponding energy eigen values (only if Energies argument is true).

hammer.TorusDiagonalise.TorusDiagonalise(Opts, Log=False, BasisObj=None)
hammer.TorusDiagonalise.TorusLaughlinGroundState(Particles, Bosonic=False, Tau=1j)

Function to calculate 1/3 (or 1/2 in bosonic case) Laughlin state by diagonalising model pseudopotential Hamiltonian.

Parameters:
  • Particles (int) – Number of particles.
  • Bosonic (flag) – Flag to indicate that we want the bosonic Laughlin rather than the fermionic Laughlin (default = False).
  • Tau (complex) – The complex parameter which specifies the shape of the torus (default=i).
Returns:

  • Basis object – The basis object of the Hilbert space where the Laughlin is found.
  • Vec – The petsc vector object containing the Fock coefficients of the Laughlin state in the first momentum sector.

hammer.TorusDiagonalise.TorusLaughlinHamiltonian(Particles, NbrFlux, Momentum=0, COMMomentum=-1, Bosonic=False, Tau=1j, InversionSector=-1, numpy=False, Basis=False)

Function to return the Laughlin pseudopotential Hamiltonian in the given sector.

Parameters:
  • Particles (int) – Number of particles.
  • NbrFlux (int) – Number of flux.
  • Momentum (int) – Total momentum (default=0).
  • COMMomentum (int) – Centre of mass momentum, -1 to not use symmetry (default=-1).
  • Bosonic (flag) – Flag to indicate that Bosonic system should be considered (default=False).
  • Tau (complex) – Torus geometry parameter.
  • InversionSector (int) – The inversion sector to diagonalise in, -1 to not use this symmetry (default=-1).
  • numpy (bool) – Flag to indicate that it should be returned as a numpy array, other wise a SLEPc sparse matrix is returned (default=False).
Returns:

The Hamiltonian matrix in slepc sparse matrix format by default or as a numpy ndarray.

Return type:

matrix

hammer.TorusDiagonalise.TorusPfaffianGroundState(Particles, Bosonic=False, Tau=1j, StateNo=0)

Function to calculate 1/2 Pfaffian state by diagonalising model tree-body interaction Hamiltonian.

Parameters:
  • Particles (int) – Number of particles.
  • Bosonic (flag) – Flag to indicate that we want the bosonic Pfaffian rather than the fermionic Pfaffian (default = False).
  • Tau (complex) – The complex parameter which specifies the shape of the torus (default=i).
  • StateNo (int) – Enumerating the Pfaffian states: If Ne=2*N, and Ns=4*N then 0-> (0,N) , 1 -> (N,0), 2 -> (N,N), 3-> (2N,N) , 4 -> (3N,0), 5 -> (3N,N) (default = 0)
Returns:

  • Basis object – The basis object of the Hilbert space where the Pfaffian is found.
  • Vec – The petsc vector object containing the Fock coefficients of the Pfaffian state in the first momentum sector.

hammer.TorusEntanglement module

TorusEntanglement.py: Script the entanglement spectrum and entropy for orbital cut of torus wave-functons.

class hammer.TorusEntanglement.EntanglementArgsParser

Class to parse command line arguments specific to entanglement calculation utility.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.TorusEntanglement.TorusEntanglement(Opts)

hammer.TransformState module

TransformState.py: A utility to transform states between different formats and representations.

hammer.TransformState.__main__()

Main driver function, if script called from the command line it will use the command line arguments as the vector filenames.

hammer.Viscosity module

Viscosity.py: Utility functions for interfacing with vectors returned by Hammer.

hammer.Viscosity.DiagonaliseByOverlap(Vecs1, Vecs2, Verbose=False)

Given two lists of vectors Vecs1 and Vecs2, this method tries to return a list of vectors, each of which is a linear super-position of the vectors in Vecs2, in such a way that the overlap matrix between the sets of vectors is diagonalised.

hammer.Viscosity.GetNextStates(Opts, ViscosityOpts, BasisObj=None)
hammer.Viscosity.GetSubSpace(Opts, SubSpaceDimension, BasisObj=None)

Get the required number of eigenvectors.

hammer.Viscosity.Viscosity(Opts, ViscosityOpts)

Main viscosity function.

class hammer.Viscosity.ViscosityArgsParser

Class to parse command line arguments specific to viscosity calculation utility.

TODO: Change to use dict datatype intenally or even to be a subclass of dict to make more extensible.

parseArgs(argv)

Method to parse the arguments in the array argv and store them in internal class members.

hammer.Viscosity.__main__(argv)

Entry function if script is called from command line.

hammer.matrixutils module

matrixutils.py: Utility functions for interfacing with matrices via Hammer.

hammer.matrixutils.ExpectationValue(Operator, Vector)

Calculate the expectation value of the provided operator in the given state.

hammer.matrixutils.PETScMatToNumpyArray(Matrix)

Given a PETSc matrix data struction, this function will return a numpy ndarray version of this matrix. Does not work in parallel.

Parameters:Matrix (Mat) – The PETSc matrix that we want to convert.
hammer.matrixutils.ProjectMatrix(Matrix, Vectors)

Project the given matrix onto the provided supspace and return the projected matrix.

hammer.utils module

utils.py: General utility functions for Hammer.

hammer.utils.FundamentalDomainCoveringTaus(MaxRatio, Xdim, Ydim)

Generate a list of taus that will cover a fundamental domain up to the specified maximum ratio with the specified number of points in each direction.

Parameters:
  • MaxRatio (float) – The maximum ratio between the torus sides.
  • Xdim (int) – Dimension in x direction.
  • Ydim (int) – Dimension in y direction.
hammer.utils.FundamentalDomainTausAroundL1(L1, Width, Xdim, Ydim, NbrFlux)

Generate a list of taus that cross the fundamental domain with specified width around the specified L1 point.

Parameters:
  • L1 (float) – The value of L1 to generate points around.
  • Width (float) – The space around L1 to span, on L1 scale.
  • Xdim (int) – Dimension in x direction.
  • Ydim (int) – Dimension in y direction.
  • NbrFlux (int) – The number of flux on the torus.
hammer.utils.GetLengths(Tau, Ns, MagLength=1.0)

Given the modular parameter tau and the number of flux return [L1, L2].

hammer.utils.ReadCSVFile(filename)

Function to read a CSV file and return a list of the rows.

hammer.vectorutils module

vectorutils.py: Utility functions for interfacing with vectors returned by Hammer.

hammer.vectorutils.GetGlobalValue(A, Index)

Since the petsc api does not have the ability to get values from non local portions, we implement ourselves using mpi.

hammer.vectorutils.Orthogonalise(Vecs, Verbose=False)

Given a list of vectors Vecs, this method returns a list of superpositions of these which are mutually orthogonal.

hammer.vectorutils.OrthogonaliseGramSchmidt(Vecs)

Given a list of non-orthogonal vectors, this method returns a list of orthogonal vectors obtained using the Gram Schmidt process.

Parameters:Vecs (list of PETSc Vectors) – Vectors to orthogonalise.
hammer.vectorutils.Overlap(State1, State2, Verbose=False, Absolute=False, conjugate=False)

Given the filenames or two PETSc vectors, this method will read the vectors and return their overlap, which is the absolute value of their inner product. Note that it is the first vector that is conjugated.

Parameters:
  • State1 (str or vector) – Filename or vector object of first state.
  • State2 (str or vector) – Filename or vector object of second state.
  • Absolute (bool) – Flag to indicate that absolute value should be returned.
  • Conjugate (bool) – Flag to indicate that the conjugate of the second vector should be taken before calculating the overlap.
Returns:

Overlap (inner-product) between vectors.

Return type:

scalar

hammer.vectorutils.ReadASCIIPETScVector(filename)

Given the filename of an ASCII PETSc vector this will read it and return a vector object.

hammer.vectorutils.ReadBinaryPETScVector(filename)

Given the filename of a binary PETSc vector this will read it and return a vector object.

hammer.vectorutils.ReadPlainASCIIVector(filename)

Open vector file that is a list in plain text and create petsc vector object for it.

hammer.vectorutils.RotateToMakeReal(A)

Apply a global rotation to make the vector real. Not possible in all cases. Uses the phase on the vector coefficient with the maximum absolute value.

Parameters:A (petsc vec) – Vector object to rotate.
hammer.vectorutils.RotateVector(State)

Rotate the vector such that the coefficient with maximum value is real.

Parameters State: Petsc vector

Vector to rotate.
hammer.vectorutils.SpaceOverlap(States1, States2, Verbose=False, Absolute=False)

Given two lists of filenames or vector objects, this method will find the overlap between the spaces spanned by each list. It is assumed that vectors in each list are orthogonal.

Parameters:
  • States1 (list of strs or vectors) – List of filenames or vector objects spanning first space.
  • States2 (list strs or vectors) – List of filenames or vector objects spanning second space.
  • Absolute (bool) – Flag to indicate that absolute value should be returned.
Returns:

  • matrix – The overlap matrix between lists of states.
  • scalar – Overlap (inner-product) between vector spaces.

hammer.vectorutils.Superposition(States, Coefficients)

Calculate the superposition of the provided states using the supplied coefficients.

hammer.vectorutils.WriteFockCoefficients(State, Filename)

Method to write the specified state to the provided filename. Format is two space separated columns with real part in the first and imaginary in the second.

hammer.vectorutils.writeASCIIPETScFile(A, filename)

Write the vector A to ‘filename’ in ascii format.

hammer.vectorutils.writeBinaryPETScFile(A, filename)

Write the vector A to ‘filename’ in binary format.

hammer.vectorutils.writeHDF5File(A, filename, dataset='fock_coefs')

Write the vector A to ‘filename’ in HDF5 format.

Parameters:
  • A (PETSc vector) – Vector to write.
  • filename (str) – Filename to write to.
  • dataset (str) – Name of dataset to use in hdf5 file (default=fock_coefs).

Module contents

__init__.py: Initialisation for hammer module.

hammer.exit(code)

Function to with given error code.