Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating subsets of GMSO topology #866

Open
CalCraven opened this issue Jan 23, 2025 · 0 comments
Open

Creating subsets of GMSO topology #866

CalCraven opened this issue Jan 23, 2025 · 0 comments

Comments

@CalCraven
Copy link
Contributor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant