From 1c12c32d52bc974105c44cb02c8b66dd699aff04 Mon Sep 17 00:00:00 2001 From: kevinshen56714 Date: Sun, 5 Jun 2022 11:44:59 -0400 Subject: [PATCH] Add args for `setup` and bump to v1.0.0 --- README.md | 22 +++++++++++----------- pyemc/runner.py | 10 ++++++---- setup.py | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4e2b834..950c63b 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,18 @@ # Enhanced Monte Carlo (EMC) Python Interface + [![PyPI version shields.io](https://img.shields.io/pypi/v/emc-pypi.svg?style=for-the-badge&logo=PyPI&logoColor=blue)](https://pypi.python.org/pypi/emc-pypi/) [![PyPI download month](https://img.shields.io/pypi/dm/emc-pypi.svg?style=for-the-badge&logo=PyPI)](https://pypi.python.org/pypi/emc-pypi/) [![PyPI download day](https://img.shields.io/pypi/dd/emc-pypi.svg?style=for-the-badge&logo=PyPI)](https://pypi.python.org/pypi/emc-pypi/) -This module is a thin Python wrapper library of the [EMC](http://montecarlo.sourceforge.net/emc/Welcome.html) package that allows you to use all EMC functionalities with Python interface. +This module is a thin Python wrapper library of the [EMC](http://montecarlo.sourceforge.net/emc/Welcome.html) package that allows you to use all EMC functionalities with Python interface. + +EMC creates input structures from SMILES strings and LAMMPS input files for particle simulations with atomistic force fields - Born, COMPASS, PCFF, CHARMM, OPLS, TraPPE or coarse-grained force fields - DPD, Martini, SDK. - See the [example input files](https://github.com/kevinshen56714/emc-pypi/tree/main/pyemc/emc/examples/setup) on how to prepare EMC input (.esh) files. - See the [docs](https://github.com/kevinshen56714/emc-pypi/blob/main/pyemc/emc/docs/emc.pdf) to understand more about EMC. The package works out of the box without pre-installation of EMC or any configuration. Please open an issue if you find something missing or not working as expected. -## About EMC -EMC creates input structures from SMILES strings and LAMMPS input files for particle simulations. Supported force fields are -- Atomistic: Born, COMPASS, PCFF, CHARMM, OPLS, TraPPE -- Coarse-grained: DPD, Martini, SDK - -In any publication of scientific results based in part or completely on the use of EMC, please cite the original paper: -P.J. in 't Veld and G.C. Rutledge, Macromolecules 2003, 36, 7358 [[link](https://pubs.acs.org/doi/full/10.1021/ma0346658)] [[pdf](https://pubs.acs.org/doi/pdf/10.1021/ma0346658)] - ## Installation ```bash @@ -29,10 +24,15 @@ pip install emc-pypi ```python import pyemc -# Run the emc_setup.pl and prepare the build.emc file for the following build command +# Run the emc_setup.pl and generate the build.emc file for the build command pyemc.setup('your-setup-file.esh') -# Run the emc executable +# 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 pyemc.build('build.emc') ``` +In any publication of scientific results based in part or completely on the use of EMC, please cite the original paper: +P.J. in 't Veld and G.C. Rutledge, Macromolecules 2003, 36, 7358 [[link](https://pubs.acs.org/doi/full/10.1021/ma0346658)] [[pdf](https://pubs.acs.org/doi/pdf/10.1021/ma0346658)] diff --git a/pyemc/runner.py b/pyemc/runner.py index b3d5c9f..a8ad00d 100644 --- a/pyemc/runner.py +++ b/pyemc/runner.py @@ -38,7 +38,7 @@ def _get_path() -> str: return os.path.dirname(__file__) -def setup(esh_file: str): +def setup(esh_file: str, *args): '''Method to run emc_setup.pl of EMC Attributes: @@ -50,7 +50,10 @@ def setup(esh_file: str): emc_setup_file = os.path.join(_get_path(), 'emc', 'scripts', 'emc_setup.pl') - subprocess.run(['perl', str(emc_setup_file), esh_file]) + command = ['perl', str(emc_setup_file), esh_file] + for arg in args: + command.append(arg) + subprocess.run(command) def build(build_file: str): @@ -62,7 +65,6 @@ def build(build_file: str): Returns: None ''' - emc_exec = _get_exec() - emc_bin_file = os.path.join(_get_path(), 'emc', 'bin', emc_exec) + emc_bin_file = os.path.join(_get_path(), 'emc', 'bin', _get_exec()) subprocess.run([str(emc_bin_file), build_file]) diff --git a/setup.py b/setup.py index c3f9957..1a97ee6 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ def package_files(directory): setup( name='emc-pypi', - version='0.1.2', + version='1.0.0', long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', description='Python interface for the Enhanced Monte Carlo (EMC) package',