Skip to content

ENH: Refactoring for espresso_io

TomD requested to merge tomdemeyere/ase:espresso_io into master

Checklist

  1. Migration towards a more complete espresso IO module i.e. working with most espresso binaries. Users can write and read various files by using the newly created 'write_fortran_namelist' and the old 'read_fortran_namelist'. New keys for other binaries than pw.x are put in a newly created ase.io.espresso_namelist.keys module. These io functions are for fairly simple binaries. For more complex binaries such as cp.x additional functions might be needed.
  2. Refactoring of the Namelist class which is now in a newly created ase.io.espresso_namelist.namelist module. All functions that were previously defined in ase.io.espresso to deal with Namelist are now part of this class. Namely 'namelist_to_string' is now 'to_string', 'construct_namelist' is now to_nested(). Some of these functions were simplified to reflect the new changes.

Quality of life improvements:

  • Namelists can now be pretty-printed by using .to_string(), allowing the user to see what the input file will look like, as well as quickly copy-pasting.
  • Namelists now allow more complex dict operations such as pop, |, etc...
  • Namelists can now be automatically constructed to whatever available binary by calling to_nested(binary = 'pw), default keys are 'pw'.
  • Namelist are now correctly ordered even when the user is using different methods to pass input keywords (kwargs, nested, and flat form).
  • Important clean_up of ase.io.espresso by creating two submodules in ase.io.espresso_namelist

All tests pass and I've added some.

Merge request reports