Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lilyminium/polymetrizer


https://github.com/lilyminium/polymetrizer

Last synced: 20 days ago
JSON representation

Awesome Lists containing this project

README

        

polymetrizer
==============================
[//]: # (Badges)
[![GitHub Actions Build Status](https://github.com/lilyminium/polymetrizer/workflows/CI/badge.svg)](https://github.com/lilyminium/polymetrizer/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/lilyminium/polymetrizer/branch/master/graph/badge.svg)](https://codecov.io/gh/lilyminium/polymetrizer/branch/master)

Generate force fields for polymer-like molecules

```python
from polymetrizer import Polymetrizer
from polymetrizer.tests.smiles import ALA, SER, CYS, ACE, NME
from openff.toolkit.typing.engines.smirnoff import ForceField

# ALA = "[H][N]([C@]([H])([C](=[O])[*:2])[C]([H])([H])[H])[*:1]"
# SER = "[H][O][C]([H])([H])[C@@]([H])([C](=[O])[*:2])[N]([H])[*:1]"
# CYS = "[H][S][C]([H])([H])[C@@]([H])([C](=[O])[*:2])[N]([H])[*:1]"
# ACE = "CC(=O)-[*:6]"
# NME = "[*:7]NC"

# The linkage points go HN-R1, O=C-R2
# so we need to bond R1-R2 to get a peptide bond
# ACE is O=C-R6
# NME is CN-R7

met = Polymetrizer(monomers=dict(Ser=SER, Ala=ALA, Cys=CYS, Ace=ACE, Nme=NME),
caps=[ACE, NME],
r_linkages = {1: {2, 6}, 7: {2}})
original_ff = ForceField("openff_unconstrained-1.3.0.offxml")
new_ff = met.polymetrize(original_ff,
n_neighbor_monomers=1, # builds tripeptides
n_overlapping_atoms=3,
prune_isomorphs=False,
# minimize before doing AM1BCC charges with MMFF
minimize_geometry=True,
# optimization too expensive, but if so....
optimize_geometry=False,
optimize_method="m06-2x/def2-TZVP",
)
offsmi = met.oligomers[-1].to_smiles()
offmol = Molecule.from_smiles(offsmi, allow_undefined_stereo=True)
# or offmol = met.oligomers[-1].to_openff()
new_ff.create_openmm_system(offmol.to_topology())
```

You can inspect the force field by ID:

```python
>>> new_ff.get_parameter_handler("LibraryCharges").parameters[:3]
[,
,
]

>>> [x for x in new_ff.get_parameter_handler("ProperTorsions").parameters
... if "CysNme" in x.id]
[,
,
,
,
,
,
,
,
,
]
```

### Copyright

Copyright (c) 2021, Lily Wang

#### Acknowledgements

Project based on the
[Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.5.