martimunicoy / peleffy

The peleffy (PELE Force Field Yielder) is a Python package that builds PELE-compatible force field templates.

Home Page:https://martimunicoy.github.io/peleffy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrate method for the OPLS OBC parameters

martimunicoy opened this issue · comments

Description

PELE has a script to obtain the OBC parameters given a small molecule. This script is quite old though and presents many compatibility problems. Maybe we can incorporate this script into the offpele package to automatize the parameterization workflow. We could also look at its compatibility issues to try to improve it.

Solution

This would be a new Solvent class, that given a Molecule representation, parameterized with OPLS2005 would use atom types to assign the OBC parameters. Then, it should write the template file in the corresponding format file expected by PELE.

Support

A new branch called OBC_for_OPLS has been created. It contains a new method called _add_GBSA_solvent_parameters() to be filled with the parameterization pipeline from the solventOBCParamsGenerator.py script.

The original script required atom degrees to perform the parameterization. Consequently, we need method to extract atom degrees from our molecule representation. This can be done with RDKit in a very straightforward way:

rdkit_molecule = molecule.rdkit_molecule

atom_degrees = list()

for atom in rdkit_molecule.GetAtoms():
    atom_degrees.append(atom.GetDegree())

Besides, in case the parent atom of any atom is needed (for instance, thinking on identifying the atom a hydrogen atom is bonded to), the Atom's attribute parent stores the reference of the its parent atom. This attribute is set when initializing the Molecule representation in peleffy.
Atom objects are accessible after parameterizing the Molecule:

molecule = Molecule(smiles='CCC')
molecule.parameterize('openff_unconstrained-1.2.1.offxml')

for atom in molecule.atoms:
    if atom.parent is None:
        continue
    print(atom.parent.index)

Note that there is always an Atom without a parent Atom (its parent is set to None). This is the absolute parent atom according to the built molecular graph. However, a terminal atom such as hydrogen should never be the absolute parent atom and, therefore, it will never have a None parent atom.

Implementation

The method _add_GBSA_solvent_parameters() has been filled with the parameterization pipeline from the solventOBCParamsGenerator.py script.

Different features from the solventOBCParamsGenerator.py script have been introduced:

  • When only one of the two parameters is found, the default parameters are returned. In the solventOBCParamsGenerator.py script, the parameter found was return and the non-found parameter was not defined.
  • The parameters lists are saved in a JSON file.

Tests

The function test_add_GBSA_solvent_parameters has been implemented and tests the new method for adding the GBSA solvent parameters for the following ligands: methane.pdb, melatone.pdb and ethylene.pdb.