spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
118 stars 52 forks source link

Core: geometry->positions wrong if `lattice_constant != 1` #459

Closed MSallermann closed 5 years ago

MSallermann commented 5 years ago

This only occurs if the number of basis atoms is > 1. The problem seems to be that Vectormath::Build_Spins(...) assumes that cell_atoms is not scaled by the lattice constant. But it is.

A simple fix would be to not scale cell_atoms in the geometry constructor. I.e. changing https://github.com/spirit-code/spirit/blob/develop/core/src/data/Geometry.cpp#L34 to cell_atoms[iatom] = build_array;

GPMueller commented 5 years ago

Should be fixed with 255bd302734f4f2050d4bc5f80c029194e0da5ea. The generation of positions has been refactored into the Geometry class and the basis cell and translations are now both scaled by the lattice constant (maybe lattice_scale would be more fitting, with lattice_constant only applying to translations?) and the lattice_constant scaling is therefore removed from the DDI calculations.