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, c421: float = None, c422: float = None, c43: float = None, c44: float = None, name: str = 'custom')[source]#

Convention of the spin Hamiltonian.

For the detailed description of the convention problem see Convention problem.

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 (one spin & one site) term of the Hamiltonian.

c21float, optional

Numerical factor before the (two spins & one site) term of the Hamiltonian.

c22float, optional

Numerical factor before the (two spins & two sites) term of the Hamiltonian.

c31float, optional

Numerical factor before the (three spins & one site) term of the Hamiltonian.

c32float, optional

Numerical factor before the (three spins & two sites) term of the Hamiltonian.

c33float, optional

Numerical factor before the (three spins & three sites) term of the Hamiltonian.

c41float, optional

Numerical factor before the (four spins & one site) term of the Hamiltonian.

c421float, optional

Numerical factor before the (four spins & two sites & 1+3) term of the Hamiltonian.

c422float, optional

Numerical factor before the (four spins & two sites & 2+2) term of the Hamiltonian.

c43float, optional

Numerical factor before the (four spins & three sites) term of the Hamiltonian.

c44float, optional

Numerical factor before the (four spins & four sites) term of the Hamiltonian.

namestr, default "custom"

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

Examples

>>> import magnopy
>>> n1 = magnopy.Convention(True, True, c21=1, c22=-0.5, name="conv #1")
>>> n2 = magnopy.Convention(False, True, c21=1, c22=-0.5, name="conv #2")
>>> n3 = magnopy.Convention(False, True, c22=-0.5, name="conv #3")
>>> print(n1)
"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 c421 factor;
  * Undefined c422 factor;
  * Undefined c43 factor;
  * Undefined c44 factor.
>>> n1.multiple_counting
True
>>> n1 == n2
False
>>> n3.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 c421 factor;
  * Undefined c422 factor;
  * Undefined c43 factor;
  * Undefined c44 factor.
>>> n3.name
'conv #3'

Methods:

get_modified([multiple_counting, ...])

Returns the new instance of the Convention class based on the called one with changed given properties.

get_predefined(name)

Returns one of the pre-defined conventions.

summary([return_as_string])

Gives human-readable summary of the convention.

Properties:

c1

Numerical factor before the (one spin & one site) sum of the Hamiltonian.

c21

Numerical factor before the (two spins & one site) sum of the Hamiltonian.

c22

Numerical factor before the (two spins & two sites) sum of the Hamiltonian.

c31

Numerical factor before the (three spins & one site) sum of the Hamiltonian.

c32

Numerical factor before the (three spins & two sites) sum of the Hamiltonian.

c33

Numerical factor before the (three spins & three sites) sum of the Hamiltonian.

c41

Numerical factor before the (four spins & one site) sum of the Hamiltonian.

c421

Numerical factor before the (four spins & two sites (1+3)) sum of the Hamiltonian.

c422

Numerical factor before the (four spins & two sites (2+2)) sum of the Hamiltonian.

c43

Numerical factor before the (four spins & three sites) sum of the Hamiltonian.

c44

Numerical factor before the (four spins & four sites) sum of the Hamiltonian.

multiple_counting

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

name

A label for the convention.

spin_normalized

Whether spin vectors/operators are normalized to 1.