Add `custom_per_atom_properties` and `custom_per_config_properties` options to `write_extxyz`
Closes #1464
Possibly related to #1432
As I mentioned in #1464, I believe the ideal solution for printing custom properties via write_extxyz
should be to have custom_per_atom_properties
and custom_per_config_properties
options. The present MR is for that.
For this, I am afraid but would like to suggest partly reverting !3257 (merged), particularly removing save_calc_results
. The alternative usage I would suggest in this MR is:
atoms = Atoms('Cu', cell=[2] * 3, pbc=[True] * 3)
atoms.calc = EMT()
atoms.get_potential_energy()
atoms.calc.results['REF_energy'] = atoms.calc.results.pop('energy')
atoms.calc.results['REF_forces'] = atoms.calc.results.pop('forces')
atoms.write(
'tmp.xyz',
custom_per_atom_properties=['REF_forces'],
custom_per_config_properties=['REF_energy'],
)
which looks for me more understandable and easy-to-use.
In !3257 (merged), I also noticed that the issue about the 3x3 stress tensor (reported in the following issues / MRs) has been solved (silently?). So I also took over the solutions. This closes #783, #1247, !3261 (closed) (by hand) (I am so sorry @ktns and @noambern for stealing your contributions...) and is related to #782, !3257 (merged).
@noambern, @jameskermode, @askhl: I would be so happy if I could hear how you feel.
Checklist
-
I am familiar with ASE's contribution guidelines. -
Doc strings in code changed in this MR are up to date. -
Unit tests have been added for new or changed code. -
Issue is resolved via "closes #XXXX" if applicable.