Write atomic masses also for the elements not in `Atoms`
This MR fixes one issue in !2891 (merged); I fix the number of Masses
data lines to be consistent with X
in X atom types
in LAMMPS data files written by ASE.
When we specify specorder
in write_lammps_data
, the number of atom types written in the LAMMPS data file is equal to the length of specorder
.
In contrast, the number of data lines in the Masses
section was equal to the number of distinct elements in atoms.symbols
.
They can be inconsistent when, e.g., specorder = ["Al", "Cu"]
while the Atoms object contains only "Cu"
.
In such cases, LAMMPS raises an error (as shown in attached files).
To fix this, when specorder
is given and masses=True
, the atomic masses for all the elements in specorder
should be written, regardless if the elements are in the Atoms object or not. This is done in the present MR.
In this MR I do not add tests specifically for this issue; better assertion tests will be added rather in !2907 (merged).