openff/interchange/tests/integration_tests/test_interoperability_pathways.py
def openff_openmm_pmd_gmx(
    topology: Topology,
    forcefield: ForceField,
    box: ArrayQuantity,
    prefix: str,
) -> None:
    """Pipeline to write GROMACS files from and OpenMM interchange through ParmEd"""
    topology.box_vectors = box.to(unit.nanometer).magnitude * omm_unit.nanometer  # type: ignore
    omm_sys = forcefield.create_openmm_system(topology)

    struct = pmd.openmm.load_topology(
        system=omm_sys,
        topology=topology.to_openmm(),
        xyz=topology.topology_molecules[0].reference_molecule.conformers[0],
    )

    # Assign dummy residue names, GROMACS will not accept empty strings
    # TODO: Patch upstream?
    for res in struct.residues:
        res.name = "FOO"

    struct.save(prefix + ".gro")
    struct.save(prefix + ".top")
Pipeline to write GROMACS files from and OpenMM interchange through ParmEd
Pipeline to write GROMACS files from and OpenMM interchange through ParmEd
Pipeline to write GROMACS files from and OpenMM interchange through ParmEd
def openff_openmm_pmd_gmx(
    topology: Topology,
    forcefield: ForceField,
    box: ArrayQuantity,
    prefix: str,
) -> None:
    topology.box_vectors = box.to(unit.nanometer).magnitude * omm_unit.nanometer  
    omm_sys = forcefield.create_openmm_system(topology)
    struct = pmd.openmm.load_topology(
        system=omm_sys,
        topology=topology.to_openmm(),
        xyz=topology.topology_molecules[0].reference_molecule.conformers[0],
    )
    for res in struct.residues:
        res.name = "FOO"
    struct.save(prefix + ".gro")
    struct.save(prefix + ".top")
def openff_openmm_pmd_gmx ( topology : Topology , forcefield : ForceField , box : ArrayQuantity , prefix : str , ) -> None : topology . box_vectors = box . to ( unit . nanometer ) . magnitude * omm_unit . nanometer omm_sys = forcefield . create_openmm_system ( topology ) struct = pmd . openmm . load_topology ( system = omm_sys , topology = topology . to_openmm ( ) , xyz = topology . topology_molecules [ 0 ] . reference_molecule . conformers [ 0 ] , ) for res in struct . residues : res . name = "FOO" struct . save ( prefix + ".gro" ) struct . save ( prefix + ".top" )
Pipeline to write GROMACS files from and OpenMM interchange through ParmEd
Pipeline to write GROMACS files from and OpenMM interchange through ParmEd
"""Pipeline to write GROMACS files from and OpenMM interchange through ParmEd""" # type: ignore # Assign dummy residue names, GROMACS will not accept empty strings # TODO: Patch upstream?
topology
Topology
forcefield
ForceField
box
ArrayQuantity
prefix
str