Skip to content

WIP: Alternative AtomsData class to replace Atoms.arrays

Eric Hermes requested to merge ehermes/ase:AtomsData2 into master

An alternative approach to consolidating per-atom data into a single object. !1626 is the original merge request I made in this vein.

In this MR, Atoms.arrays looks almost unchanged from the outside, but under the hood it is completely different. I tried to modify ase/atoms.py only minimally, but it should be possible to move some of the array getting/setting/deleting logic into AtomsData itself.

This has both benefits and drawbacks compared to the way Atoms.arrays currently works. The primary benefit is that per-atom data like positions, momenta, etc. are guaranteed to be close in memory. This may make it quicker to access multiple per-atom properties in quick succession. The primary drawback is that adding new arrays requires allocation of a brand new array for all array data. I don't know whether this will result in a net gain or loss in efficiency/speed. I think large-scale MD simulations should tell us one way or another.

@jameskermode what do you think about this approach?

Edited by Eric Hermes

Merge request reports