Fixed parsing of the charge_mode keyword in nep.in
The syntax of the charge_mode keyword in nep.in has been updated to charge_mode <mode> [<flip_charge>].
As a result read_nepfile() crashed with ValueError: invalid literal for int() with base 10: '1 1' on the extended nep.in syntax.
This MR fixes this behavior. It also cleans up the handling of lists of floats and ints, respectively.
Changes
- Fold
charge_modeinto the existing list-value handling, alongsidecutoff/n_max/l_max/basis_size/type_weight, instead of treating it as a scalar.charge_modeis now returned as a list ([mode]or[mode, flip_charge]). - Split that list-value branch by type:
n_max/l_max/basis_size/charge_modeas ints,cutoff/type_weightas floats. Previously everything was cast tofloat, so round-tripping throughwrite_nepfile()turnedn_max 8 6inton_max 8.0 6.0. - Update
read_structures()'scharge_modelookup for the new list shape. - Add tests for the extended
charge_modesyntax and for int-vs-float formatting on a read/write roundtrip.