afqmctools.systems package#

Submodules#

afqmctools.systems.lattice module#

Lattice classes for Lattice Model Builder.

class afqmctools.systems.lattice.Boundary(L, direction=None, *args, **kwargs)#

Bases: object

Base class for representing a boundary.

Encapsulates the boundary condition.

is_allowed(position)#
Return type:

bool

returns True if the site at a given position is allowed by the boundaries.

all cites within the cell are “allowed”, but some image sites may not be “allowed” if there is one or more open boundary.

is_image(coordinate)#

returns True if the site at a given coordinate is an image.

Note: coordinate is expressed in units of the lattice vectors hat{a}_1, hat{a}_2

is_valid(position)#

returns True if the site at a given position is a valid image

Return type:

bool

( checks if site is an image first, a site that is not an image

is not a valid image )

is_valid_image(coordinate)#
class afqmctools.systems.lattice.CustomLattice(L, a1, a2, basis, axis1_boundary=None, axis2_boundary=None, **kwargs)#

Bases: Lattice

custom lattice implementation that allows the user to specify the lattice vectors and basis.

class afqmctools.systems.lattice.HoneycombLattice(L=None, build=True, metric=<function euclid_nd>, axis1_boundary=None, axis2_boundary=None, **kwargs)#

Bases: Lattice

Specialization of Lattice to a Honeycomb lattice. The underlying lattice is a triangular lattice with an “extra” site per cell

ROTATION_ANGLES = (2.0943951023931953, 4.1887902047863905, 6.283185307179586)#
ROTATION_GROUP = (array([[-0.5      , -0.8660254],        [ 0.8660254, -0.5      ]]), array([[-0.5      ,  0.8660254],        [-0.8660254, -0.5      ]]), array([[ 1.0000000e+00,  2.4492936e-16],        [-2.4492936e-16,  1.0000000e+00]]))#
pi = 3.141592653589793#
class afqmctools.systems.lattice.KagomeLattice(L=None, build=True, metric=<function euclid_nd>, axis1_boundary=None, axis2_boundary=None, **kwargs)#

Bases: Lattice

Specialization of Lattice to a Kagome lattice. The underlying lattice is a triangular lattice with 3 site per cell

ROTATION_ANGLES = (6.283185307179586,)#
ROTATION_GROUP = (array([[ 1.0000000e+00,  2.4492936e-16],        [-2.4492936e-16,  1.0000000e+00]]),)#
pi = 3.141592653589793#
class afqmctools.systems.lattice.Lattice(L=None, metric=<function euclid_nd>, axis1_boundary=None, axis2_boundary=None, build=True, twist=None, cyl_mode=None, basis=None, _dist_map_min_distance=None, **kwargs)#

Bases: object

Base class for representing lattices

ROTATION_GROUP = None#
add_site(coord)#

Interface for external Builder

build()#
get_kvecs()#

get b1,b2 the Bravais lattice vectors

get_nth_direct_neighbors(n=1)#

get nth-order direct neighbors within the home cell only

get_nth_image_neighbors(n=1, twist=None)#
get_nth_neighbors(n=1, twist=None)#

High-Level interface to get all nth-nearest neighbors

get_planewaves(returnKVecs=False)#

return unitary exp(ik*r) for each site, corresponding to the unit cell r. Currently fixed to PBC/PBC only

get_positions(sublattice_index=None)#

Get the positions of all sites in the lattice.

Parameters:

sublattice_index (int, optional) – index of the sublattice to get positions for. If None, returns positions for all sites in the lattice. Default is None.

Returns:

array of positions of all sites in the lattice

Return type:

np.ndarray

get_sites()#
is_image(r)#
metric(coord1, coord2)#
remove_distances()#

Removes cached distance matrix. Useful if low on memory and the lattice is large

class afqmctools.systems.lattice.LatticeSite(index, coord, position)#

Bases: object

Simple dataclass to hold basic metadata for each lattice site.

coord: ndarray#

Lattice coordinates.

index: int#

Ordered basis index.

position: ndarray#

Spatial position. For square lattices, this is the same as coord.

class afqmctools.systems.lattice.NeighborPair(i, j, _abs_r=None, _shift=None, phase=0.0, r_relative=None)#

Bases: object

Simple dataclass to relate a phase, given as phase, and used as

Exp[-i*phase], with a pair of neighbor indices, (i,j).

We have chosen to reject the case where i == j on the grounds

that it usually does not make sense to regard a site as its own neighbor.

i: int#
j: int#
phase: float = 0.0#
r_relative: tuple#
class afqmctools.systems.lattice.OpenBoundary(L, direction=None, **kwargs)#

Bases: Boundary

concrete class for open boundary

all images are invalid for open b.c.

is_allowed(position)#
Return type:

bool

returns True if the site at a given position is allowed by the boundaries.

all cites within the cell are “allowed”, but some image sites may not be “allowed” if there is one or more open boundary.

is_valid(position)#

returns True if the site at a given position is a valid image

Return type:

bool

( checks if site is an image first, a site that is not an image

is not a valid image )

class afqmctools.systems.lattice.PBCBoundary(*args, **kwargs)#

Bases: Boundary

Concrete class for periodic boundary condition

Parameters:
  • L (int) – size of the lattice in the direction of the boundary

  • direction (int) – direction of the boundary (i.e. along a1 or a2)

  • phase (iterable(ints)) – phase angle for the boundary (i.e. the twist angle) if phase is not given, it is assumed to be (0,0); if phase is a 1-d iterable of length 2, it is interpreted as (phase1,phase2) where phase1 is applied when crossing the boundary along the a1 direction and phase2 is applied when crossing the boundary along the a2 direction.

is_allowed(position)#
Return type:

bool

returns True if the site at a given position is allowed by the boundaries.

all cites within the cell are “allowed”, but some image sites may not be “allowed” if there is one or more open boundary.

is_valid(position)#

returns True if the site at a given position is a valid image

( checks if site is an image first, a site that is not an image

is not a valid image )

class afqmctools.systems.lattice.SquareLattice(L=None, build=True, *args, **kwargs)#

Bases: Lattice

Specialization of Lattice to a square lattice.

Here, we define a square lattice as a lattice in

which sites are equidistant in the x-, and y-directions.

ROTATION_ANGLES = (1.5707963267948966, 3.141592653589793, 4.71238898038469, 6.283185307179586)#
ROTATION_GROUP = (array([[ 6.123234e-17, -1.000000e+00],        [ 1.000000e+00,  6.123234e-17]]), array([[-1.0000000e+00, -1.2246468e-16],        [ 1.2246468e-16, -1.0000000e+00]]), array([[-1.8369702e-16,  1.0000000e+00],        [-1.0000000e+00, -1.8369702e-16]]), array([[ 1.0000000e+00,  2.4492936e-16],        [-2.4492936e-16,  1.0000000e+00]]))#
get_directed_pairs(directions=None)#

Get directed pairs - i.e. for making pair correlators

for now, we only have square lattice pair ‘directions’ implemented

i.e. +/-x, +/-y. will need to work out the Triangular lattice possibilities.

class afqmctools.systems.lattice.TriangularLattice(L=None, build=True, metric=<function euclid_nd>, axis1_boundary=None, axis2_boundary=None, **kwargs)#

Bases: Lattice

Specialization of Lattice to a triangular lattice.

ROTATION_ANGLES = (1.0471975511965976, 2.0943951023931953, 3.141592653589793, 4.1887902047863905, 5.235987755982989, 6.283185307179586)#
ROTATION_GROUP = (array([[ 0.5      , -0.8660254],        [ 0.8660254,  0.5      ]]), array([[-0.5      , -0.8660254],        [ 0.8660254, -0.5      ]]), array([[-1.0000000e+00, -1.2246468e-16],        [ 1.2246468e-16, -1.0000000e+00]]), array([[-0.5      ,  0.8660254],        [-0.8660254, -0.5      ]]), array([[ 0.5      ,  0.8660254],        [-0.8660254,  0.5      ]]), array([[ 1.0000000e+00,  2.4492936e-16],        [-2.4492936e-16,  1.0000000e+00]]))#
pi = 3.141592653589793#
afqmctools.systems.lattice.euclid_nd(coord1, coord2)#
Compute the N-dimensional Euclidean

distance between coordinate 1 and coordinate 2.

afqmctools.systems.lattice.get_directed_pairs(lattice, directions=None)#
afqmctools.systems.lattice.get_lattice(params, build=None)#
get a lattice instance from the input parameters

in ‘params’

afqmctools.systems.lattice.valid_L(L)#

Module contents#