magnopy.Convention#

class magnopy.Convention(multiple_counting: bool = None, spin_normalized: bool = None, c1: float = None, c21: float = None, c22: float = None, c31: float = None, c32: float = None, c33: float = None, c41: float = None, c42: float = None, c43: float = None, c44: float = None, c45: float = None, name: str = 'custom')[source]#

Convention of the spin Hamiltonian.

For more details see Convention of the Hamiltonian and Spin Hamiltonian.

Parameters:
multiple_countingbool, optional

Whether the pairs of spins are counted multiple times in the Hamiltonian's sums.

spin_normalizedbool, optional

Whether spin vectors/operators are "normalized" to 1. If True, then spin vectors/operators are "normalized".

c1float, optional

Numerical factor before the sum over sites in the spin Hamiltonian (( 1 ) terms).

c21float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((2, 1) terms).

c22float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((2, 2) terms).

c31float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 1) terms).

c32float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 2) terms).

c33float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 3) terms).

c41float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 1) terms).

c42float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 2) terms).

c43float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 3) terms).

c44float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 4) terms).

c45float, optional

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 5) terms).

namestr, default "custom"

A label for the convention. Any string, case-insensitive.

Examples

Creating conventions

>>> import magnopy
>>> conv_1 = magnopy.Convention(True, True, c21=1, c22=-0.5, name="conv #1")
>>> conv_2 = magnopy.Convention(False, True, c21=1, c22=-0.5, name="conv #2")
>>> conv_3 = magnopy.Convention(False, True, c22=-0.5, name="conv #3")

Individual properties of the convention

>>> conv_1.multiple_counting
True
>>> conv_3.c21
Traceback (most recent call last):
...
magnopy._exceptions.ConventionError: Convention of spin Hamiltonian has an undefined property 'c21':
"conv #3" convention where
  * Bonds are counted once in the sum;
  * Spin vectors are normalized to 1;
  * Undefined c1 factor;
  * Undefined c21 factor;
  * c22 = -0.5;
  * Undefined c31 factor;
  * Undefined c32 factor;
  * Undefined c33 factor;
  * Undefined c41 factor;
  * Undefined c42 factor;
  * Undefined c43 factor;
  * Undefined c44 factor;
  * Undefined c45 factor.
>>> conv_3.name
'conv #3'

Full summary of the convention

>>> print(conv_1)
"conv #1" convention where
  * Bonds are counted multiple times in the sum;
  * Spin vectors are normalized to 1;
  * Undefined c1 factor;
  * c21 = 1.0;
  * c22 = -0.5;
  * Undefined c31 factor;
  * Undefined c32 factor;
  * Undefined c33 factor;
  * Undefined c41 factor;
  * Undefined c42 factor;
  * Undefined c43 factor;
  * Undefined c44 factor;
  * Undefined c45 factor.

Comparing conventions

>>> conv_1 == conv_2
False
>>> conv_1 != conv_3
True

Methods

get_modified([multiple_counting, ...])

Returns a new instance of the Convention class.

get_predefined(name)

Returns one of the predefined conventions.

summary([return_as_string])

Gives human-readable summary of the convention.

Properties

c1

Numerical factor before the sum over sites in the spin Hamiltonian (( 1 ) terms).

c21

Numerical factor before the sum over sites in the spin Hamiltonian ((2, 1) terms).

c22

Numerical factor before the sum over sites in the spin Hamiltonian ((2, 2) terms).

c31

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 1) terms).

c32

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 2) terms).

c33

Numerical factor before the sum over sites in the spin Hamiltonian ((3, 3) terms).

c41

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 1) terms).

c42

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 2) terms).

c43

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 3) terms).

c44

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 4) terms).

c45

Numerical factor before the sum over sites in the spin Hamiltonian ((4, 5) terms).

multiple_counting

Whether the all elements of the equivalent sets of interaction parameters are included in the Hamiltonian's sums.

name

A label for the convention.

spin_normalized

Whether spin vectors/operators are "normalized" to 1.