Skip to content

SmallBearC/pymlff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pymlff

A lightweight Python 3.7+ package for reading and writing VASP ML_AB files.

Installation

Clone the repository and install using

pip install .

Pymlff depends on numpy and click.

Examples

Command line utility

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

Python API

More functionality is available through the Python API.

Reading and writing ML_AB files

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")

Filtering configurations

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.

Combining ML_AB files

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

About

A lightweight python package for reading and writing VASP ML_AB files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%