diff --git a/README.md b/README.md index 6daea53..938807f 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,56 @@ -### Title of your forcefield +# Create your custom force field -Installation: +The goal of this repositiory is to provide the templates and examples necessary for you to quickly +set up a custom forcefield of your own for atomtyping, and to quickly validate your results as +well. + + +### Hierarchy +* `tutorial/` - example custom forcefield and validation script +* `forcefield_template.xml` - empty `.xml` file to add a custom forcefield +___ + +### Installation Requirements +The following packages and their dependencies are necessary for a usable `foyer` environment. +Continuum's [`Anaconda`](https://www.continuum.io/downloads) python package manager is +recommended. + +#### Installation (using `Anaconda`): ```bash conda install -c omnia -c mosdef parmed foyer pytest ``` +___ + +### Staying up to date with our template `XML` file +As we continue to increase our support for many `SMARTS` features within +`Foyer`, we will be updating our testing suite to also reflect these changes. +To keep you up to date with these changes, we have included `FEATURE`. + +To stay up to date with these changes, simply run in your `master` branch: +```bash + ./FEATURE update_xml_template +``` + +--- -1. Fork this repo +### Implement own forcefield +1. Fork this repository + * More information about forking through GitHub can be found [here.](https://guides.github.com/activities/forking) -2. Create your force field `.xml` file based on the [OpenMM](http://openmm.org/) [`.xml` format](http://docs.openmm.org/7.0.0/userguide/application.html#creating-force-fields) -and add [foyer](https://github.com/mosdef-hub/foyer) style SMARTS strings to define your atom types +2. Follow [this](tutorial/README.md) tutorial for developing own force field and `XML` +format for `Foyer`. -3. Optionally, add example molecules with correct atomtypes defined as test cases. Execute the testing script using `py.test -v --tb=line` +___ -4. Generate your own DOI via Zenodo +### Giving back to the community +Once you have successfully generated a custom forcefield for your system of interest, making this +information easily testable and citable by others is highly recommended. An optimal way to make this +forcefield readily citable is through a custom DOI. Zenodo provides a simple way to develop +a DOI for your forked repository. + +1. Generate your own DOI via Zenodo * https://guides.github.com/activities/citable-code/ -5. Update the link to the Zenodo DOI badge +2. Update the link to the Zenodo DOI badge * [![DOI](https://zenodo.org/badge/XXX/USER_NAME/YOUR_FORCEFIELD_REPO.svg)](https://zenodo.org/badge/latestdoi/XXX/USER_NAME/YOUR_FORCEFIELD_REPO) + diff --git a/forcefield_template.xml b/forcefield_template.xml index f95092b..6b4f01f 100644 --- a/forcefield_template.xml +++ b/forcefield_template.xml @@ -1,16 +1,16 @@ - - - - + + + + - + - - + + + diff --git a/tutorial/test_atomtyping.py b/tutorial/test_atomtyping.py new file mode 100644 index 0000000..375faa5 --- /dev/null +++ b/tutorial/test_atomtyping.py @@ -0,0 +1,19 @@ +from glob import glob + +import parmed as pmd +import pytest + +from foyer import Forcefield +from foyer.tests.utils import atomtype + +MOL2_FILES = glob('test_molecules/*.mol2') +FORCEFIELD_FILES = glob('*.xml') + +FORCEFIELD = Forcefield(forcefield_files=FORCEFIELD_FILES) + +@pytest.mark.parametrize('mol2_file', MOL2_FILES) +def test_atomtyping(mol2_file): + structure = pmd.load_file(mol2_file, structure=True) + atomtype(structure, FORCEFIELD) + + diff --git a/tutorial/test_molecules/README.md b/tutorial/test_molecules/README.md new file mode 100644 index 0000000..85556b6 --- /dev/null +++ b/tutorial/test_molecules/README.md @@ -0,0 +1,4 @@ +All `.mol2` files in this directory will be run using the testing script +provided in the source directory. The MOL2 `atom_type` field +[(column 6)](http://chemyang.ccnu.edu.cn/ccb/server/AIMMS/mol2.pdf) +is assumed to specify the atomtype. diff --git a/tutorial/test_molecules/benzene.mol2 b/tutorial/test_molecules/benzene.mol2 new file mode 100644 index 0000000..c14de19 --- /dev/null +++ b/tutorial/test_molecules/benzene.mol2 @@ -0,0 +1,32 @@ +@MOLECULE +***** + 12 12 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 4.4184 0.3892 -0.0538 opls_145 1 LIG1 -0.0618 + 2 C 5.6788 -0.2166 -0.0953 opls_145 1 LIG1 -0.0618 + 3 C 5.7871 -1.6105 -0.0420 opls_145 1 LIG1 -0.0618 + 4 C 4.6350 -2.3985 0.0528 opls_145 1 LIG1 -0.0618 + 5 C 3.3746 -1.7927 0.0943 opls_145 1 LIG1 -0.0618 + 6 C 3.2663 -0.3989 0.0410 opls_145 1 LIG1 -0.0618 + 7 H 6.5701 0.3930 -0.1686 opls_146 1 LIG1 0.0618 + 8 H 4.3346 1.4675 -0.0951 opls_146 1 LIG1 0.0618 + 9 H 2.2912 0.0698 0.0731 opls_146 1 LIG1 0.0618 + 10 H 2.4833 -2.4024 0.1677 opls_146 1 LIG1 0.0618 + 11 H 4.7188 -3.4768 0.0941 opls_146 1 LIG1 0.0618 + 12 H 6.7622 -2.0791 -0.0740 opls_146 1 LIG1 0.0618 +@BOND + 1 1 2 ar + 2 2 3 ar + 3 3 4 ar + 4 4 5 ar + 5 5 6 ar + 6 6 1 ar + 7 2 7 1 + 8 1 8 1 + 9 6 9 1 + 10 5 10 1 + 11 4 11 1 + 12 3 12 1 diff --git a/tutorial/test_molecules/cyclohexane.mol2 b/tutorial/test_molecules/cyclohexane.mol2 new file mode 100644 index 0000000..5f48b57 --- /dev/null +++ b/tutorial/test_molecules/cyclohexane.mol2 @@ -0,0 +1,44 @@ +@MOLECULE + + 18 18 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 0.8395 0.4663 0.2319 opls_136 1 LIG1 -0.0531 + 2 C 0.0944 1.7154 -0.2627 opls_136 1 LIG1 -0.0531 + 3 C -1.3531 1.7160 0.2501 opls_136 1 LIG1 -0.0531 + 4 H 0.0920 1.7269 -1.3749 opls_140 1 LIG1 0.0265 + 5 H 0.6181 2.6287 0.0933 opls_140 1 LIG1 0.0265 + 6 C -2.0812 0.4403 -0.1986 opls_136 1 LIG1 -0.0531 + 7 H -1.8878 2.6090 -0.1394 opls_140 1 LIG1 0.0265 + 8 H -1.3528 1.7681 1.3613 opls_140 1 LIG1 0.0265 + 9 C -1.3356 -0.8032 0.3073 opls_136 1 LIG1 -0.0531 + 10 H -2.1328 0.4132 -1.3097 opls_140 1 LIG1 0.0265 + 11 H -3.1190 0.4424 0.1974 opls_140 1 LIG1 0.0265 + 12 C 0.1069 -0.8064 -0.2176 opls_136 1 LIG1 -0.0531 + 13 H -1.8613 -1.7202 -0.0348 opls_140 1 LIG1 0.0265 + 14 H -1.3259 -0.8029 1.4200 opls_140 1 LIG1 0.0265 + 15 H 0.0959 -0.8561 -1.3290 opls_140 1 LIG1 0.0265 + 16 H 0.6432 -1.7015 0.1645 opls_140 1 LIG1 0.0265 + 17 H 0.8975 0.4850 1.3425 opls_140 1 LIG1 0.0265 + 18 H 1.8751 0.4647 -0.1704 opls_140 1 LIG1 0.0265 +@BOND + 1 1 2 1 + 2 2 3 1 + 3 2 4 1 + 4 2 5 1 + 5 3 6 1 + 6 3 7 1 + 7 3 8 1 + 8 6 9 1 + 9 6 10 1 + 10 6 11 1 + 11 9 12 1 + 12 9 13 1 + 13 9 14 1 + 14 12 1 1 + 15 12 15 1 + 16 12 16 1 + 17 1 17 1 + 18 1 18 1 diff --git a/tutorial/test_molecules/ethane.mol2 b/tutorial/test_molecules/ethane.mol2 new file mode 100644 index 0000000..16d6cae --- /dev/null +++ b/tutorial/test_molecules/ethane.mol2 @@ -0,0 +1,23 @@ +@MOLECULE +***** + 8 7 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C -1.9232 3.3803 0.0000 opls_135 1 LIG1 -0.0681 + 2 C -1.9232 2.1386 0.0000 opls_135 1 LIG1 -0.0681 + 3 H -0.9691 3.7370 0.3279 opls_140 1 LIG1 0.0227 + 4 H -2.6842 3.7370 0.6623 opls_140 1 LIG1 0.0227 + 5 H -2.1162 3.7370 -0.9902 opls_140 1 LIG1 0.0227 + 6 H -1.7301 1.7819 0.9902 opls_140 1 LIG1 0.0227 + 7 H -1.1622 1.7819 -0.6623 opls_140 1 LIG1 0.0227 + 8 H -2.8772 1.7819 -0.3279 opls_140 1 LIG1 0.0227 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 + 5 2 6 1 + 6 2 7 1 + 7 2 8 1 diff --git a/tutorial/test_molecules/isobutane.mol2 b/tutorial/test_molecules/isobutane.mol2 new file mode 100644 index 0000000..c1b32d9 --- /dev/null +++ b/tutorial/test_molecules/isobutane.mol2 @@ -0,0 +1,35 @@ +@MOLECULE +***** + 14 13 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 2.6671 0.6332 0.0607 opls_135 1 LIG1 -0.0629 + 2 C 3.2286 -0.5869 -0.6775 opls_137 1 LIG1 -0.0496 + 3 H 3.0335 1.5696 -0.4116 opls_140 1 LIG1 0.0232 + 4 H 2.9784 0.6254 1.1276 opls_140 1 LIG1 0.0232 + 5 H 1.5571 0.6326 0.0123 opls_140 1 LIG1 0.0232 + 6 C 2.6998 -1.8813 -0.0498 opls_135 1 LIG1 -0.0629 + 7 H 3.0120 -1.9588 1.0142 opls_140 1 LIG1 0.0232 + 8 H 3.0901 -2.7629 -0.6017 opls_140 1 LIG1 0.0232 + 9 H 1.5902 -1.9054 -0.0992 opls_140 1 LIG1 0.0232 + 10 C 4.7611 -0.5681 -0.6553 opls_135 1 LIG1 -0.0629 + 11 H 2.8922 -0.5446 -1.7369 opls_140 1 LIG1 0.0293 + 12 H 5.1410 -0.6101 0.3883 opls_140 1 LIG1 0.0232 + 13 H 5.1395 0.3588 -1.1369 opls_140 1 LIG1 0.0232 + 14 H 5.1626 -1.4381 -1.2176 opls_140 1 LIG1 0.0232 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 + 5 2 6 1 + 6 6 7 1 + 7 6 8 1 + 8 6 9 1 + 9 2 10 1 + 10 2 11 1 + 11 10 12 1 + 12 10 13 1 + 13 10 14 1 diff --git a/tutorial/test_molecules/methane.mol2 b/tutorial/test_molecules/methane.mol2 new file mode 100644 index 0000000..428bd07 --- /dev/null +++ b/tutorial/test_molecules/methane.mol2 @@ -0,0 +1,17 @@ +@MOLECULE +***** + 5 4 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 2.7245 1.0118 0.0000 opls_138 1 LIG1 -0.0776 + 2 H 3.7945 1.0118 0.0000 opls_140 1 LIG1 0.0194 + 3 H 2.3678 0.8629 -0.9978 opls_140 1 LIG1 0.0194 + 4 H 2.3678 1.9503 0.3700 opls_140 1 LIG1 0.0194 + 5 H 2.3678 0.2221 0.6278 opls_140 1 LIG1 0.0194 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 diff --git a/tutorial/test_molecules/neopentane.mol2 b/tutorial/test_molecules/neopentane.mol2 new file mode 100644 index 0000000..aea227a --- /dev/null +++ b/tutorial/test_molecules/neopentane.mol2 @@ -0,0 +1,41 @@ +@MOLECULE +***** + 17 16 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 2.7006 0.6280 0.1626 opls_135 1 LIG1 -0.0603 + 2 C 3.2533 -0.5900 -0.6008 opls_139 1 LIG1 -0.0405 + 3 H 3.0643 1.5745 -0.2927 opls_140 1 LIG1 0.0235 + 4 H 3.0258 0.6056 1.2253 opls_140 1 LIG1 0.0235 + 5 H 1.5893 0.6348 0.1387 opls_140 1 LIG1 0.0235 + 6 C 2.7332 -1.8843 0.0521 opls_135 1 LIG1 -0.0603 + 7 H 3.0589 -1.9468 1.1130 opls_140 1 LIG1 0.0235 + 8 H 3.1208 -2.7774 -0.4843 opls_140 1 LIG1 0.0235 + 9 H 1.6225 -1.9177 0.0263 opls_140 1 LIG1 0.0235 + 10 C 4.7925 -0.5722 -0.5504 opls_135 1 LIG1 -0.0603 + 11 C 2.7869 -0.5315 -2.0674 opls_135 1 LIG1 -0.0603 + 12 H 5.1511 -0.6139 0.5008 opls_140 1 LIG1 0.0235 + 13 H 5.1896 0.3551 -1.0172 opls_140 1 LIG1 0.0235 + 14 H 5.2129 -1.4444 -1.0965 opls_140 1 LIG1 0.0235 + 15 H 1.6771 -0.5433 -2.1268 opls_140 1 LIG1 0.0235 + 16 H 3.1754 -1.4030 -2.6376 opls_140 1 LIG1 0.0235 + 17 H 3.1520 0.3965 -2.5584 opls_140 1 LIG1 0.0235 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 + 5 2 6 1 + 6 6 7 1 + 7 6 8 1 + 8 6 9 1 + 9 2 10 1 + 10 2 11 1 + 11 10 12 1 + 12 10 13 1 + 13 10 14 1 + 14 11 15 1 + 15 11 16 1 + 16 11 17 1 diff --git a/tutorial/test_molecules/propane.mol2 b/tutorial/test_molecules/propane.mol2 new file mode 100644 index 0000000..04cc048 --- /dev/null +++ b/tutorial/test_molecules/propane.mol2 @@ -0,0 +1,29 @@ +@MOLECULE +***** + 11 10 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 2.5782 0.6297 0.1568 opls_135 1 LIG1 -0.0655 + 2 C 3.3489 -0.5997 -0.3152 opls_136 1 LIG1 -0.0588 + 3 H 3.1280 1.5486 -0.1365 opls_140 1 LIG1 0.0230 + 4 H 2.4698 0.6172 1.2623 opls_140 1 LIG1 0.0230 + 5 H 1.5698 0.6547 -0.3088 opls_140 1 LIG1 0.0230 + 6 C 2.6304 -1.8877 0.0746 opls_135 1 LIG1 -0.0655 + 7 H 4.3620 -0.5945 0.1416 opls_140 1 LIG1 0.0260 + 8 H 3.4566 -0.5602 -1.4206 opls_140 1 LIG1 0.0260 + 9 H 2.5345 -1.9568 1.1792 opls_140 1 LIG1 0.0230 + 10 H 3.2119 -2.7620 -0.2869 opls_140 1 LIG1 0.0230 + 11 H 1.6184 -1.9198 -0.3826 opls_140 1 LIG1 0.0230 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 + 5 2 6 1 + 6 2 7 1 + 7 2 8 1 + 8 6 9 1 + 9 6 10 1 + 10 6 11 1 diff --git a/tutorial/test_molecules/propene.mol2 b/tutorial/test_molecules/propene.mol2 new file mode 100644 index 0000000..48e5938 --- /dev/null +++ b/tutorial/test_molecules/propene.mol2 @@ -0,0 +1,25 @@ +@MOLECULE +propene + 9 8 0 0 0 +SMALL +GASTEIGER + +@ATOM + 1 C 0.6922 1.6400 -0.0021 opls_135 1 LIG1 -0.0471 + 2 C -0.1008 0.3726 0.0817 opls_142 1 LIG1 -0.0942 + 3 H 0.0205 2.5116 0.1441 opls_140 1 LIG1 0.0272 + 4 H 1.1746 1.7215 -0.9991 opls_140 1 LIG1 0.0272 + 5 H 1.4734 1.6524 0.7871 opls_140 1 LIG1 0.0272 + 6 C 0.4895 -0.8175 -0.0529 opls_143 1 LIG1 -0.1029 + 7 H -1.1715 0.4227 0.2553 opls_144 1 LIG1 0.0564 + 8 H 1.5592 -0.8909 -0.2252 opls_144 1 LIG1 0.0532 + 9 H -0.1007 -1.7259 0.0112 opls_144 1 LIG1 0.0532 +@BOND + 1 1 2 1 + 2 1 3 1 + 3 1 4 1 + 4 1 5 1 + 5 2 6 2 + 6 2 7 1 + 7 6 8 1 + 8 6 9 1