Open jngrad opened 1 week ago
I think this needs to be fixed in the getter in the script interface. There, currently we just return the iage box. Instead, fold_positoin should be used to calculate the updated image box from position and image box on the particle. Cf. the pos_folded getter.
Our hdf5 interface is also affected by the bug.
Applying @RudolfWeeber's suggestion in both ScriptInterface::Particles::ParticleHandle::ParticleHandle()
and
Writer::H5md::File::write()
seems to fix the bug, with and without Lees-Edwards boundary conditions.
When Verlet lists are used, and the Verlet skin is too large, particles are no longer resorted and their image box is miscounted.
MWE:
Three skin values can be used in this MWE:
skin=0.4
: no particle resort happens besides the first time step (local resort)skin=0.04
: particle resort (local resort) happens in one cellskin=0.004
: particle resort (local resort) happens in multiple cellsDepending on the choice of initial conditions, e.g. with
x0=[9.50, 0.0, 0.0]
andskin=0.4
, the image box is updated, but with a random time lag, i.e. it gets incremented when the position is anywhere betweenbox_l
andbox_l + skin
. The only particle folding test we have doesn't use Verlet lists.This bug is reproducible on the Python branch, and the 4.2.2 and 4.1.4 releases. Other releases were not checked.
Many thanks to Xin Yuan for reporting this issue with a MWE on the mailing list thread Position folding issue.