pyspinw.batch_exchanges#

Functions and classes for automatically creating multiple exchanges

Functions

apply_naming_convention(naming_pattern, ...)

Convert a naming string into an actual name

approx_equal(v1, v2)

Are two vectors approximately the same (within tolerance)

approx_equal_direction(v1, v2)

Are two vectors in the same direction (within tolerance)

batch_exchanges(sites, unit_cell, max_distance)

Find all the exchanges within a certain distance

Classes

AbstractExchange(name, site_1, site_2, ...)

Used to internally represent some exchange properties, and some properties that are only needed internally

class pyspinw.batch_exchanges.AbstractExchange(name: str, site_1: Site, site_2: Site, cell_offset: CellOffset, distance: float, order: int)#

Bases: object

Used to internally represent some exchange properties, and some properties that are only needed internally

cell_offset: CellOffset#
distance: float#
name: str#
order: int#
site_1: Site#
site_2: Site#
pyspinw.batch_exchanges.apply_naming_convention(naming_pattern: str, name_1: str, name_2: str, type_symbol: str, order: int, xyz_direction: ndarray)#

Convert a naming string into an actual name

Parameters:
  • naming_pattern – string describing how to name things

  • name_1 – name of the first site - specified with $SITE1$

  • name_2 – name of the second site - specified with $SITE2$

  • type_symbol – string that denotes the type of the exchange (e.g. ‘J’, ‘DM’)

  • order – index of the “shell”, i.e. an index that increases with distance - use $ORDER$

  • xyz_direction – direction of exchange, use $DIRECTION$ to give a string that denotes this concisely (hopefully)

pyspinw.batch_exchanges.approx_equal(v1, v2)#

Are two vectors approximately the same (within tolerance)

pyspinw.batch_exchanges.approx_equal_direction(v1, v2)#

Are two vectors in the same direction (within tolerance)

pyspinw.batch_exchanges.batch_exchanges(sites: list[Site], unit_cell: UnitCell, max_distance: float, naming_pattern: str = '[type][order]:[site1]-[site2]', type_symbol: str = 'J', both_directions: bool = False)#

Find all the exchanges within a certain distance

Parameters:
  • sites – List of LatticeSite or ImpliedLatticeSite to find exchanges between

  • unit_cell – Unit cell, needed for working out cartesian distances

  • max_distance – Maximum distance to get exchanges for

  • naming_convention – Formatting string for the naming, see apply_naming_convention() for details

  • both_directions – Exchanges in both directions

Most of the work here is about constraining by order and giving it a sensible name