Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lilyminium/polymetrizer
https://github.com/lilyminium/polymetrizer
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lilyminium/polymetrizer
- Owner: lilyminium
- License: mit
- Created: 2021-05-21T23:48:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-27T17:57:59.000Z (about 3 years ago)
- Last Synced: 2024-11-01T04:12:27.586Z (2 months ago)
- Language: Python
- Size: 221 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
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-R7met = 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.