kartograf icon indicating copy to clipboard operation
kartograf copied to clipboard

Expanding for multistates

Open RiesBen opened this issue 1 year ago • 8 comments

This pull request is all about Multistate Free Energy Methods.

Features:

  • [ ] implementation of multistate mapping
  • [ ] Visualization of multistate mapping

Motivation:

The goal is to enable methods like (RE-)EDS, LadyBugs or other multistate methods to get quick access to hybrid topology approach atom-mappings.

Theory:

The algorithm concept:

  • generate all NxN mappings
  • filter the mappings
  • merge down the mappings to a global mapping, that contains linked atom mappings for all states.
    • get the largest connected set of the global mapping.

Usage

Here example result, all ligands have a mapped core-region, such that all 14 ligands can be used in one hybrid topology simulation.

Code:

# Get input Data
from openfe_benchmarks import benzenes
components = benzenes.get_system().ligand_components

# Exclude cycle breakers! as not feasible for Hybrid topology approaches.
not_lig = ["lig_4", "lig_7",  "lig_10"] #"lig_3", "lig_2",
components = [c for c in components if(c.name not in not_lig)][:15]

#for visualization
#Chem.Draw.MolsToGridImage([c.to_rdkit() for c in components])

#mapp:
from kartograf import KartografAtomMapper

atomMapper = KartografAtomMapper()
multi_state_mapping = atomMapper.suggest_multistate_mapping(components, greedy=True, map_hydrogens=False)

multi_state_mapping

Result Visualization:

  • 3D- Representation
from kartograf.utils.multistate_visualization_3D import visualize_multistate_mappings_3D
visualize_multistate_mappings_3D(components, multi_state_mapping)

image

  • 2D- Representation
from kartograf.utils.multistate_visualization import visualize_multistate_mappings_2D
visualize_multistate_mappings_2D(components, multi_state_mapping)

image

returned value: [{'lig_1': 4, 'lig_10': 6, 'lig_11': 3, 'lig_12': 3, 'lig_13': 3, 'lig_14': 4, 'lig_15': 4, 'lig_16': 4, 'lig_2': 10, 'lig_3': 10, 'lig_5': 6, 'lig_6': 4, 'lig_8': 8, 'lig_9': 8}, {'lig_1': 6, 'lig_10': 3, 'lig_11': 6, 'lig_12': 6, 'lig_13': 5, 'lig_14': 6, 'lig_15': 6, 'lig_16': 6, 'lig_2': 4, 'lig_3': 4, 'lig_5': 3, 'lig_6': 6, 'lig_8': 10, 'lig_9': 5}, {'lig_1': 8, 'lig_10': 15, 'lig_11': 11, ... }]

RiesBen avatar Jul 19 '23 13:07 RiesBen