Skip to content

Commit

Permalink
Merge pull request #177 from martimunicoy/alchemical_fixes
Browse files Browse the repository at this point in the history
Alchemical fixes
  • Loading branch information
martimunicoy committed May 8, 2023
2 parents cc41953 + 17f963f commit c0ae464
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 89 deletions.
21 changes: 21 additions & 0 deletions docs/releasehistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 <https:/
* ``micro`` increments represent bugfix releases or improvements in documentation


1.4.4 - Corrections for alchemistry and new charge calculator
-------------------------------------------------------------

This is a micro release of peleffy that contains corrections for alchemistry module. A new charge calculator
called Mulliken is also available.

New features
""""""""""""
- `PR #174 <https://github.com/martimunicoy/peleffy/pull/174>`_: minor fix in the logger to prevent conflicts with external loggers
- `PR #176 <https://github.com/martimunicoy/peleffy/pull/176>`_: new charge calculator called Mulliken
- `PR #177 <https://github.com/martimunicoy/peleffy/pull/177>`_: new method to save alchemical mapping as a PNG file

Bugfixes
""""""""
- `PR #177 <https://github.com/martimunicoy/peleffy/pull/177>`_: bug fixes for alchemical solvent templates and affected tests

Tests added
"""""""""""
- `PR #176 <https://github.com/martimunicoy/peleffy/pull/176>`_: new tests to validate the new charge calculator


1.4.3 - Minor improvements for CLI arguments and ffld_server
------------------------------------------------------------

Expand Down
76 changes: 43 additions & 33 deletions examples/alchemistry/ethylene_to_chlorofom.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions peleffy/data/tests/alchemical_ligandParams_0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,47 +85,47 @@
"scale": 0.85
},
"_C6_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_C7_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_C8_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_C9_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"C10_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"C11_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"H12_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H13_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H14_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H15_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H16_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
}
}
Expand Down
48 changes: 24 additions & 24 deletions peleffy/data/tests/alchemical_ligandParams_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
"scale": 0.755
},
"_C3_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_C4_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_C5_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_O1_": {
"radius": 0.75,
"radius": 1.5,
"scale": 0.425
},
"_O2_": {
"radius": 0.75,
"radius": 1.5,
"scale": 0.425
},
"_H1_": {
Expand All @@ -49,83 +49,83 @@
"scale": 0.85
},
"_H3_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_H4_": {
"radius": 1.25,
"scale": 0.85
},
"_H5_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_H6_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_H7_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_H8_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_H9_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H10_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H11_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"_C6_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_C7_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_C8_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"_C9_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"C10_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"C11_": {
"radius": 0.85,
"radius": 1.7,
"scale": 0.36
},
"H12_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H13_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H14_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H15_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
},
"H16_": {
"radius": 0.6,
"radius": 1.2,
"scale": 0.425
}
}
Expand Down
26 changes: 13 additions & 13 deletions peleffy/data/tests/alchemical_ligandParams_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
"scale": 0.79
},
"_C3_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_C4_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_C5_": {
"radius": 0.0,
"radius": 1.7,
"scale": 0.0
},
"_O1_": {
"radius": 0.0,
"radius": 1.5,
"scale": 0.0
},
"_O2_": {
"radius": 0.0,
"radius": 1.5,
"scale": 0.0
},
"_H1_": {
Expand All @@ -49,39 +49,39 @@
"scale": 0.85
},
"_H3_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_H4_": {
"radius": 1.3,
"scale": 0.85
},
"_H5_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_H6_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_H7_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_H8_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_H9_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H10_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"H11_": {
"radius": 0.0,
"radius": 1.2,
"scale": 0.0
},
"_C6_": {
Expand Down
8 changes: 8 additions & 0 deletions peleffy/forcefield/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ class GasteigerCalculator(_PartialChargeCalculator):

_name = 'gasteiger'

class MullikenCalculator(_PartialChargeCalculator):
"""
Implementation of the Mulliken partial charge calculator (using
RDKit).
"""

_name = 'mulliken'


class OPLSChargeCalculator(_PartialChargeCalculator):
"""
Expand Down
6 changes: 4 additions & 2 deletions peleffy/forcefield/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ class ChargeCalculatorSelector(object):
from peleffy.forcefield.calculators import (OPLSChargeCalculator,
Am1bccCalculator,
GasteigerCalculator,
DummyChargeCalculator)
DummyChargeCalculator,
MullikenCalculator)

_AVAILABLE_TYPES = {'opls2005': OPLSChargeCalculator,
'am1bcc': Am1bccCalculator,
'gasteiger': GasteigerCalculator,
'dummy': DummyChargeCalculator
'dummy': DummyChargeCalculator,
'mulliken': MullikenCalculator
}

def get_by_name(self, charge_method, molecule):
Expand Down
8 changes: 7 additions & 1 deletion peleffy/tests/test_forcefields.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_charge_calculator_selector(self):
peleffy.forcefield.calculators.GasteigerCalculator), \
'Invalid custom selection 1 for the charge calculator'

# Check custom selection 1
# Check custom selection 2
openff = OpenForceField(self.FORCE_FIELD_NAME)
calculator = openff._get_charge_calculator('opls2005', dummy_mol)

Expand All @@ -67,6 +67,12 @@ def test_charge_calculator_selector(self):
peleffy.forcefield.calculators.OPLSChargeCalculator), \
'Invalid custom selection 2 for the charge calculator'

# Check custom selection 3
openff = OpenForceField(self.FORCE_FIELD_NAME)
calculator = openff._get_charge_calculator('mulliken', dummy_mol)
assert isinstance(calculator, peleffy.forcefield.calculators.MullikenCalculator), \
"Invalid custom selection 3 for the charge calculator"

def test_parameterizer(self):
"""It checks the parameterized method."""

Expand Down
14 changes: 14 additions & 0 deletions peleffy/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,20 @@ def test_gasteiger_method(self):
# Check charges
check_CHO_charges(parameters)

def test_mulliken_method(self):
"""It tests the mulliken method"""
ligand_path = get_data_file_path(self.LIGAND_PATH)

# Load molecule
molecule = Molecule(ligand_path)

# Parameterize
ff = OpenForceField(FORCEFIELD_NAME)
parameters = ff.parameterize(molecule, charge_method='mulliken')

# Check charges
check_CHO_charges(parameters)

def test_OPLS_method(self):
"""It tests the OPLS method"""

Expand Down
Loading

0 comments on commit c0ae464

Please sign in to comment.