Skip to content

Creating subsets of GMSO topology #866

@CalCraven

Description

@CalCraven

A summary of the question or discussion topic.
It is a common use case to want to modify OPLSAA.xml, but you're only interested in using a small subset of the forcefield.

While that is a great use case, and we do support it, we don't necessarily have great documentation for how to go about that. So I'm going to put a little block of code showing this behavior, so future users can potentially see for themselves how to do this using GMSO commands.

import gmso
from gmso.parameterization import apply
import mbuild as mb
ff = gmso.ForceField("oplsaa") # loads full 1000 atomtype forcefield
molecule = mb.load("CC, smiles=True) # example ethane molecule, can be whatever you want
topology = molecule.to_gmso()
parameterized_topology = apply(topology, ff, identify_connections=True) # gets angles and dihedrals too
parameterized_topology.write_forcefield("ethane.xml") # this file will be saved locally and contain on the parameters from opls that were used in ethane.xml. 
# Please note that this will be in the GMSO format, not the Foyer format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions