{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a system mixing SMIRNOFF and non-SMIRNOFF-formatted force fields\n", "\n", "This example shows how to create a receptor-ligand `System` where the ligand (toluene) is parametrized with a SMIRNOFF force field and the protein (T4 Lysozyme) solvated in water is assigned AMBER and TIP3P-FB parameters through the ParmEd library.\n", "\n", "We'll need two PDB files. One for the ligand in vacuum, and one for the solvated protein without ligand. The coordinates of the protein-ligand complex will be determined by these PDB files, so their positions needs to be consistent with the ligand being positioned in the binding pocket if this is the desired initial configuration of your simulation." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Parametrize a molecule with the Parsley force field\n", "\n", "First, we parametrize the ligand (toluene) with the SMIRNOFF-format Parsley force field through the usual route to create an OpenMM `System`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from simtk.openmm.app import PDBFile\n", "\n", "from openff.toolkit.utils import get_data_file_path\n", "from openff.toolkit.topology import Molecule, Topology\n", "from openff.toolkit.typing.engines.smirnoff import ForceField" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Create an OpenFF Topology of toluene from a pdb file.\n", "toluene_pdb_file_path = get_data_file_path('molecules/toluene.pdb')\n", "toluene_pdbfile = PDBFile(toluene_pdb_file_path)\n", "toluene = Molecule.from_smiles('Cc1ccccc1')\n", "off_topology = Topology.from_openmm(openmm_topology=toluene_pdbfile.topology,\n", " unique_molecules=[toluene])\n", "\n", "# Load the Parsley force field from disk.\n", "force_field = ForceField('openff_unconstrained-1.0.0.offxml')\n", "\n", "# Parametrize the toluene molecule.\n", "toluene_system = force_field.create_openmm_system(off_topology)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and we convert the OpenMM `System` to a ParmEd `Structure` that we'll be able to mix with the protein.\n", "\n", "