Python Interface to EMC


EMC has been one of my favorite libraries for creating structures for LAMMPS simulations. To make it easier to install and to integrate into automatic pipelines, I made a Python pacakge - emc-pypi


$ pip install emc-pypi

You can then start using EMC in Python without pre-installation of EMC or any configuration.

Example code snippet

import pyemc

# Run emc_setup and generate the build.emc file for the build command

# Or you can pass in arguments like this
pyemc.setup('your-setup-file.esh', '-ntotal=1000', '-field=opls-aa')

# Finally, run the emc executable to create simulation input files'build.emc')

I hope this is helpful for the EMC community and promotes EMC.


Hi Kevin,

Thank you for taking the trouble to create a python wrapper for EMC. Might I inquire in what context you are using your python solution?


Hi - as of Aug 1, 2022 - I think there’s a version validity error that pops up if you try to use this wrapper in your other PMD code.

Error: main:
Validity has run out; please download a fresh version.
Program aborted.

I saw you tried to lock the version of emc-pypi to 1.0.0 but I don’t think it’s a fix for the EMC version issue. I was wondering if you were able to get this running?

Sorry if this is not the place for this question.


The versions of EMC available online are only valid for one year. You will need to update your version of EMC by the newest version available online, if you get the above error.