Skip to content

Resolve "Implement unified vector products"

Closes #43 (closed)

Cleanup, remove legacy code, and implement unified vector products in math.py:

AnyVector = TypeVar("AnyVector", MeshVector, FlattenedMeshVector, FlattenedLocalMeshVector, FlattenedAFMMeshVector, FlattenedLocalAFMMeshVector)
LabVector = TypeVar("LabVector", MeshVector, FlattenedMeshVector)

def inner_product(vec1: AnyVector, vec2: AnyVector) -> MeshScalar:
    ...

def cross_product(vec1: LabVector, vec2: LabVector) -> LabVector:
    ...

def tensor_product(vec1: AnyVector, vec2: AnyVector) -> scipy.sparse.csr.csr_matrix:
    ...

With that, the following functions where removed:

  • flattened_mesh_vec_scalar_product
  • flattened_mesh_vec_cross_product
  • flattened_AFMmesh_vec_scalar_product
  • flattened_mesh_vec_tensor_product
  • flattened_mesh_vec_scalar_product2d
  • spherical_angles_to_mesh_vector (was not used anymore)

This allowed to remove the redundant FerromagneticSelfInteraction and AntiferromagneticSelfInteraction which where children of AbstracSelfInteraction and implemented the energy density with the respective adapted scalar product (which is now unified as inner_product). Now all interactions directly inherit from AbstracSelfInteraction. This name is no longer adequate since it also includes the ZeemannInteraction. Therefore, AbstracSelfInteraction has been renamed to Interaction.

Importantly flattened_AFMmesh_vec_scalar_product_separate still exist and is necessary to calculate the equilibrium field projection h0 for antiferromagnetic. However, I did not want to resolve this now, since it is part of the greater issue #40.

Edited by Koerber, Lukas (FWIN-C) - 108045

Merge request reports

Loading