Skip to content

Commit

Permalink
Merge pull request #3 from kevinshen56714/kshen-v1.0.0
Browse files Browse the repository at this point in the history
Add args for `setup` and bump to v1.0.0
  • Loading branch information
kevinshen56714 authored Jun 5, 2022
2 parents 24edbd6 + 1c12c32 commit 877752b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)]
10 changes: 6 additions & 4 deletions pyemc/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand All @@ -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])
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 877752b

Please sign in to comment.