Incar writing refactoring
Checklist
-
I have read the contribution guidelines. -
Unit tests have been added for any new or changed code, and the test suite passes. Note: Your request will likely not be merged without the appropriate tests. -
"closes #XXXX" is in the body of the MR description to link the related issue, if applicable.
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
-
@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 ifase.calculators.vasp.create_input.open
is called exactly once. It is not called anymore, insteadase.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. - 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