flatspin.model
Module Contents
Classes
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
|
Ising spin lattice |
Attributes
- flatspin.model.normalize_rad
- flatspin.model.normalize_vertex_type
- flatspin.model.vertex_clist = [[0, 1, 0], [0, 0, 1], [1, 0, 0], [0.5, 0.5, 0.5]]
- flatspin.model.vertex_cmap
- class flatspin.model.LabelIndexer(labels)
- __getitem__(self, label)
- __repr__(self)
Return repr(self).
- class flatspin.model.SpinIce(*, size=(4, 4), lattice_spacing=1, hc=10, alpha=1.0, disorder=0, h_ext=(0, 0), neighbor_distance=1, switching='sw', sw_b=1, sw_c=1, sw_beta=3, sw_gamma=3, thermal_std=0, flip_mode='max', init='polarized', random_prob=0.5, random_seed=None, use_opencl=False, opencl_platform=0, opencl_device=0)
Bases:
object
Ising spin lattice
- _vertex_size = [2, 1]
- property N(self)
Alias for self.spin_count
- label(self, i)
Get the label of a given spin index or list of indices
- indexof(self, label)
Get the spin index of a given label or range of labels
Alias for self.L[label]
- indices(self)
Get all spin indices
- all_indices(self)
Get all spin indices as numpy integer array index See https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer-array-indexing
- _init_spin(self, init)
- _init_geometry(self)
- _init_threshold(self)
- _init_neighbor_list(self)
- _init_h_dip(self)
- __getstate__(self)
- __eq__(self, other)
Return self==value.
- property width(self)
- property height(self)
- property vectors(self)
Spin vectors
- set_spin(self, spin)
- set_spin_image(self, filename)
Set spin state from image
The image is resized to fit the default spin grid. Then the grayscale image is used to set spin state: * black maps to spin -1 * non-black maps to spin 1
- set_threshold(self, threshold)
- set_h_ext(self, h_ext)
Set external field to h_ext
h_ext can either be a single vector for a uniform field (h_ext.shape==(2,)) or a 2D array of vectors for a non-uniform field (h_ext.shape==(self.spin_count, 2))
- set_h_ext_grid(self, h_ext)
- set_temperature(self, std)
- randomize(self, prob=0.5)
- polarize(self)
- update_thermal_noise(self)
Resamples thermal noise. Samples x and y components of noise from normal distribution
- neighbors(self, i)
- spin_dipolar_field(self, i, j)
Calculate dipolar field between spin i and j relative to positive spin
- dipolar_field(self, i)
Calculate total dipolar field parallell to spin i
- dipolar_fields(self)
- property _h_dip(self)
- _h_dip_local(self, i)
- external_field(self, i)
Calculate external field parallel and perpendicular to spin i
- external_fields(self)
Calculate external fields parallel and perpendicular to all spins
- thermal_field(self, i)
- thermal_fields(self)
- total_field(self, i)
Calculate the total field parallel to spin i
- total_fields(self)
- flip(self, i)
- _switching_energy_budrikis(self)
- _switching_energy_sw(self)
- switching_energy(self)
- flippable_energy(self)
- flippable(self)
- step(self)
Perform a flip of one or more flippable spins
- relax(self)
Flip spins until equilibrium, return number of calls to step()
- energy(self)
- total_energies(self)
- total_energy(self)
- total_magnetization(self)
- find_vertices(self)
Find the vertices in this geometry
Returns a tuple (vi, vj, indices) where vi, vj are the vertex indices and indices is a list of spin indices corresponding to each vertex index.
- vertices(self)
Get the spin indices of all vertices
- vertex_indices(self)
Get all vertex indices
- vertex_type(self, v)
Get the vertex type for a vertex where v are the spin indices of the vertex
- vertex_count(self)
Count the number of vertices of each type
Returns a tuple (types, counts) where types are the different vertex types and counts are the corresponding counts.
- vertex_population(self)
Calculate the vertex type population as a fraction of all vertices
Returns a tuple (types, pops) where types are the different vertex types and pops are the corresponding fractions.
- vertex_pos(self, v)
Get the position of a vertex where v are the spin indices of the vertex
- vertex_mag(self, v)
Get the direction of a vertex v
- property _default_cell_size(self)
- grid(self, cell_size=None)
Map spin indices onto a regular grid
The spacing between each grid point is given by cell_size. If cell_size <= lattice_spacing, each grid cell will contain at most one spin. If cell_size > lattice_spacing, each grid cell may contain more than one spin. If cell_size is None, an optimal (geometry dependent) cell size is used
Returns a Grid object which allows quick lookup of spin index to grid index
- fixed_grid(self, grid_size)
Map spin indices onto a regular grid of fixed size
Like grid() but takes grid size (number of cells) as parameter instead of cell size.
- set_grid(self, attr, values)
Map grid values onto some spin attribute.
Valid attributes: spin, h_ext
- view_grid(self, attr, cell_size=None, method='sum')
Project some spin attribute onto a grid.
Valid attributes: spin, vectors, h_ext, threshold, pos
The spacing between each grid cell is given by cell_size. If cell_size <= lattice_spacing, each grid cell will contain at most one spin attribute. If cell_size > lattice_spacing, each grid cell will contain the sum of several spin attributes.
- spin_grid(self, cell_size=None)
Project the spin vectors onto a grid.
See view_grid() for information about cell_size
- plot(self, arrows=True, **kwargs)
- plot_energy(self, arrows=True)
- plot_vertices(self)
- plot_vertex_mag(self, arrows=True, **kwargs)
- _init_h_dip_cl(self)
- _init_cl(self)
- _total_fields_cl(self)
- _h_dip_local_cl(self)
- _external_fields_cl(self)
- class flatspin.model.SquareSpinIce(*, size=(4, 4), lattice_spacing=1, hc=10, alpha=1.0, disorder=0, h_ext=(0, 0), neighbor_distance=1, switching='sw', sw_b=1, sw_c=1, sw_beta=3, sw_gamma=3, thermal_std=0, flip_mode='max', init='polarized', random_prob=0.5, random_seed=None, use_opencl=False, opencl_platform=0, opencl_device=0)
Bases:
SpinIce
Ising spin lattice
- class flatspin.model.SquareSpinIceClosed(*, lattice_spacing=2 * np.cos(np.pi / 4), edge='symmetric', **kwargs)
Bases:
SquareSpinIce
Ising spin lattice
- _vertex_size = [3, 3]
- _init_geometry(self)
- _init_spin(self, init)
- property _default_cell_size(self)
- class flatspin.model.SquareSpinIceOpen(*, neighbor_distance=sqrt(2), **kwargs)
Bases:
SquareSpinIce
Ising spin lattice
- _vertex_size = [2, 2]
- _init_geometry(self)
- class flatspin.model.PinwheelSpinIceDiamond(*, spin_angle=45, neighbor_distance=10, **kwargs)
Bases:
SquareSpinIceClosed
Ising spin lattice
- _init_geometry(self)
- class flatspin.model.PinwheelSpinIceLuckyKnot(*, spin_angle=45, neighbor_distance=10 * sqrt(2), **kwargs)
Bases:
SquareSpinIceOpen
Ising spin lattice
- _init_geometry(self)
- class flatspin.model.PinwheelSpinIceRandom(*, spin_angle_disorder=0, **kwargs)
Bases:
PinwheelSpinIceDiamond
Ising spin lattice
- _init_geometry(self)
- class flatspin.model.KagomeSpinIce(*, size=(4, 4), lattice_spacing=1, hc=10, alpha=1.0, disorder=0, h_ext=(0, 0), neighbor_distance=1, switching='sw', sw_b=1, sw_c=1, sw_beta=3, sw_gamma=3, thermal_std=0, flip_mode='max', init='polarized', random_prob=0.5, random_seed=None, use_opencl=False, opencl_platform=0, opencl_device=0)
Bases:
SpinIce
Ising spin lattice
- _vertex_size = [2, 3]
- _init_geometry(self)
- property _default_cell_size(self)
- flatspin.model.hc = 11.25