Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_charmm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
openmm-version: ["8.2.0dev1"]
openmm-version: ["8.3.1"]

steps:
- uses: actions/checkout@v4
Expand Down
30 changes: 10 additions & 20 deletions openmmforcefields/generators/system_generators.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
"""
System generators that build an OpenMM System object from a Topology object.

"""

from openmmforcefields.utils import classproperty

################################################################################
# LOGGER
################################################################################

import logging

_logger = logging.getLogger("openmmforcefields.system_generators")
_logger = logging.getLogger("openmmforcefields.generators.system_generators")

################################################################################
# System generator base class
################################################################################


class classproperty(property):
def __get__(self, obj, objtype=None):
return super().__get__(objtype)

def __set__(self, obj, value):
super().__set__(type(obj), value)

def __delete__(self, obj):
super().__delete__(type(obj))


class SystemGenerator:
"""
Common interface for generating OpenMM Systems from OpenMM Topology objects
Expand Down Expand Up @@ -97,7 +87,7 @@ def __init__(
----------
forcefields : list of str, optional, default=None
List of the names of ffxml files that will be used in System creation for the biopolymer.
small_molecule_forcefield : str, optional, default='openff-1.0.0'
small_molecule_forcefield : str, optional, default='openff-2.2.0'
Small molecule force field to use.
Must be supported by one of the registered template generators:
[GAFFTemplateGenerator, SMIRNOFFTemplateGenerator]
Expand All @@ -113,7 +103,7 @@ def __init__(
periodic_forcefield_kwargs : NonbondedMethod, optional, default={'nonbondedMethod' : PME}
Keyword arguments added to forcefield_kwargs when the Topology is periodic.
template_generator_kwargs : dict, optional, default=None
Keyword arguments to be passed to subclasses of
The value of an extra keyword argument called `template_generator_kwargs` to be passed to subclasses of
``openmmforcefields.generators.template_generators.SmallMoleculeTemplateGenerator``.
Currently only used for ``openmmforcefields.generators.template_generators.EspalomaTemplateGenerator``.
barostat : openmm.MonteCarloBarostat, optional, default=None
Expand Down Expand Up @@ -202,7 +192,6 @@ def __init__(
>>> system_generator.particle_epsilons = False # will zero out Lennard-Jones particle-particle interactions
>>> system_generator.particle_exceptions = False # will zero out all 1-4 Lennard-Jones interactions
>>> system_generator.torsions = False # will zero out all torsion terms

""" # noqa

# Initialize
Expand Down Expand Up @@ -301,8 +290,8 @@ def add_molecules(self, molecules):
Can also be a list of Molecule objects or objects that can be used to construct a Molecule.
If specified, these molecules will be recognized and parameterized as needed.
The parameters will be cached in case they are encountered again the future.

"""

if self.template_generator is None:
raise ValueError(
"You must have a small molecule residue template generator registered to add small molecules"
Expand All @@ -314,6 +303,7 @@ def _modify_forces(self, system):
"""
Add barostat and modify forces if requested.
"""

# Add barostat if requested and the system uses periodic boundary conditions
if (self.barostat is not None) and system.usesPeriodicBoundaryConditions():
import numpy as np
Expand Down Expand Up @@ -368,21 +358,21 @@ def create_system(self, topology, molecules=None):

Parameters
----------
topology : openmmtools.topology.Topology object
topology : openmm.app.Topology object
The topology describing the system to be created
molecules : openff.toolkit.topology.Molecule or list of Molecules, optional, default=None
Can alternatively be an object (such as an OpenEye OEMol or RDKit Mol or SMILES string) that can be used
to construct a Molecule.
Can also be a list of Molecule objects or objects that can be used to construct a Molecule.
If specified, these molecules will be recognized and parameterized with antechamber as needed.
If specified, these molecules will be recognized and parameterized as needed.
The parameters will be cached in case they are encountered again the future.

Returns
-------
system : openmm.System
A system object generated from the topology

"""

# Inform the template generator about any specified molecules
if (self.template_generator is not None) and (molecules is not None):
self.template_generator.add_molecules(molecules)
Expand Down
Loading
Loading