MDANSE icon indicating copy to clipboard operation
MDANSE copied to clipboard

Behaviour of MDANSE when atom databases in the trajectory file and on the local storage have the same key or does not exist on the local storage

Open ChiCheng45 opened this issue 11 months ago • 2 comments

Description of the error What should MDANSE do when the atom databases in the trajectory file and on the local storage have the same key.

For example, what if there was a custom atom called "Atom1" on the local storage and in the atom database on the trajectory file, but they had different values of b_inc. My feeling is that the values in the trajectory file should take priority. We need to check what happens in MDANSE exactly, as I'm not sure it is consistent.

Also, when there isn't an entry in the local storage, the 3D view and jobs do not work. This occurs as MDANSE appears to always look up the atom properties in the local atom database.

ChiCheng45 avatar Apr 16 '25 16:04 ChiCheng45

Normally, the local (in-trajectory) definition should take priority. Also, the intention was always to have the Trajectory class try to get the atom properties from the in-trajectory database, BUT it should also default to the central database if the local database is missing the entry. So, if it fails at the moment on a missing in-trajectory definition, then it is a bug and not the intended behaviour.

Also, in the case of centre-of-mass trajectories, each molecule is replaced with a particle and new atom types are created for each molecule type. In this case, the atom types are guaranteed NOT to be in the central database, and the in-trajectory database is the only option. A question here: should we store the elemental composition of the molecule particles to allow MDANSE to re-generate the artificial atoms from the central database?

I would suggest the following:

  1. If the trajectory definition is different from the central "atoms.json", use the trajectory definition, BUT issue a warning.
  2. Make sure that MDANSE gets the definitions from atoms.json if the relevant definition in the trajectory is missing. Again, a warning could be issued here, as normally the trajectory should hold the parameters of all the particle types it contains.

MBartkowiakSTFC avatar Apr 22 '25 07:04 MBartkowiakSTFC

Also, when there isn't an entry in the local storage, the 3D view and jobs do not work. This occurs as MDANSE appears to always look up the atom properties in the local atom database.

When looking at tutorial 4, I noticed that the TrajectoryEditor run created a trajectory file which did NOT contain the atom database at all. So, maybe it is just a problem with TrajectoryEditor, and we need to add:

    self._output_trajectory.write_standard_atom_database()

in the TrajectoryEditor.finalize() method.

MBartkowiakSTFC avatar Apr 22 '25 12:04 MBartkowiakSTFC