lilyminium / polymetrizer

MIT License
3 stars 0 forks source link

Not finding some torsions #9

Open lilyminium opened 3 years ago

lilyminium commented 3 years ago

I would like for this example to work:

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

met = Polymetrizer(monomers=dict(Ser=SER, Ala=ALA, Cys=CYS, Ace=ACE, Nme=NME),
                   caps=[ACE, NME],
                   r_linkages = {1: {2, 6}, 3: {4, 5}, 7: {2}, 8: {3}})
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,
                         # 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",
                        )

offmol = met.oligomers[-1].to_openff()
new_ff.create_openmm_system(offmol.to_topology())

However, it's not finding some torsions. 😩

UnassignedProperTorsionParameterException: ProperTorsionHandler was not able to find parameters for the following valence terms:

- Topology indices (20, 16, 18, 33): names and elements ( N), ( C), ( C), ( H), 
- Topology indices (13, 16, 18, 33): names and elements ( C), ( C), ( C), ( H), 
- Topology indices (17, 16, 18, 33): names and elements ( H), ( C), ( C), ( H), 

It's probably something to do with finding central nodes/indices vs caps.

lilyminium commented 3 years ago

prune_isomorphs=False fixes this -- I'd guess it's from the ACE/NME being both caps and residues.