Skip to content

Incar writing refactoring

Michael Wolloch requested to merge vasp_incar_refactor into master

Checklist

Summary

  • Refactoring the write_incar method of ase.calculators.vasp.create_input.GenerateVaspInput.
  • Based on the INCAR writer from @martin-schlipf (see !2588) which handles most of the formatting and actual file writing.
  • Pulled out a couple of functions (check_ichain, set_magmom, set_ldau, test_nelect_charge_compitability) which should make it much easier to transfer this to new calculators.
  • Removed support for the net_charge keyword argument which was deprecated.
  • Added some tests.

Issues to be solved

  1. @stly's tests in ase.test.caclulator.vasp.test_vasp_incar.py now fail. They did work before 455ed83b. The reason they fail is that the Mock objects checked if ase.calculators.vasp.create_input.open is called exactly once. It is not called anymore, instead ase.io.vasp_parsers.incar_writer.write_incar is called. I tried to fix this, but I do not understand Mock enough to do so in reasonable time. I would appreciate if @stly can look at this.
  2. There might be the need for more tests. The only thing I spotted was an issue with ichain, and I added a test for that.

For some more context and the overall goal of this MR please see #1340!

Edited by Michael Wolloch

Merge request reports