A lightweight Python 3.7+ package for reading and writing VASP ML_AB files.
Clone the repository and install using
pip install .
Pymlff depends on numpy and click.
Pymlff includes a basic command line utility for merging ML_AB.
mlff merge ML_AB1 ML_AB2 ML_AB_NEW
More than 2 ML_AB files can be combined at once, e.g.
mlff merge ML_AB1 ML_AB2 ML_AB3 ML_AB4 ML_AB_NEW
More functionality is available through the Python API.
from pymlff import MLAB
# load an ML_AB file
ab = MLAB.from_file("ML_AB")
# write an ML_AB file
ab.write_file("ML_AB_NEW")
Configurations can be filtered based on a filter function. The function should accept two arguments, the index of the configuration in the configurations list and a configuration itself. If the filter function returns True, the configuration will be kept, if False, the configuration will be removed. For example, to filter configurations with less than 256 atoms:
new_ab = ab.filter_configurations(lambda i, config: config.num_atoms >= 256)
See the Configuration object for the available attributes to use for filtering.
MLAB objects can be combined using the Python +
operator. For example,
from pymlff import MLAB
# load two ML_AB files
ab1 = MLAB.from_file("ML_AB1")
ab2 = MLAB.from_file("ML_AB2")
new_ab = ab1 + ab2