2

The problem is the memory layout. An object can be viewed in memory like a C struct which contains data and pointers to functions. If you use the OOP, you would have in each object the 3D coordinates, the 3D magnetic moments, and pointers to functions to manipulate this data. For instance, if you want to compute the distance between all pairs of particles, ...


1

The easiest way to do this is to use the fractional coordinate. The algorithm looks like this: Transform coordinate from cartesian to fractional; Round fractional coordinates to [0, 1); Transform back rounded coordinates to cartesian. To transform from cartesian coordinates to fractional, you have to multiply the coordinate vector by the inverted cell ...


Only top voted, non community-wiki answers of a minimum length are eligible