choderalab / openmoltools

An open set of tools for automating tasks relating to small molecules
MIT License
63 stars 30 forks source link

Protein-ligand OpenMM example - generating chemical .xml files #309

Open gcorso opened 1 year ago

gcorso commented 1 year ago

Hi, I'm trying to run OpenMM on protein-ligand complexes. I have the pdb file of the protein and the mol2 file of the ligand with their respective positions. I came across the solution in the examples/test_protein_ligand file. However, I am not sure how is the chemical .xml file generated in the example below?

https://github.com/choderalab/openmoltools/blob/affdcc2ccf4832305502cf670e7bddfad09e5d9f/examples/test_protein_ligand.py#L9

This issue on openmm is originally where I found the script and may contain some useful information.

Thanks for the help, Gabriele


Edit. In case more context is useful, this is the code I'm using:

    #pdb is a PDBFile object and rd_mol is an RDKit molecule coming from a mol2 file
    molpdb_file = io.StringIO(Chem.MolToPDBBlock(rd_mol))
    molpdb = openmm_app.PDBFile(molpdb_file)
    model = openmm_app.modeller.Modeller(pdb.topology, pdb.positions)
    model.add(molpdb.topology, molpdb.positions)

    force_field = openmm_app.ForceField("amber10.xml", ..., "tip3p.xml")  # this is where the .xml I'm missing should go  
    system = force_field.createSystem(model.topology, nonbondedMethod=openmm_app.PME, nonbondedCutoff=1.0 * unit.nanometers,  constraints=openmm_app.HAngles)