Skip to content

Complicated metal complexes as ligand#273

Open
rwxayheee wants to merge 6 commits intoforlilab:developfrom
rwxayheee:metal_charge_method
Open

Complicated metal complexes as ligand#273
rwxayheee wants to merge 6 commits intoforlilab:developfrom
rwxayheee:metal_charge_method

Conversation

@rwxayheee
Copy link
Contributor

@rwxayheee rwxayheee commented Dec 9, 2024

This small edit on the charge method allows potentially complicated metal complexes (with datives, double, triple or quadruple bonds) to become ligand, where metal gets a partial charge as the sum of the metal's formal charge (from input) and the Gasteiger charges of non-real Hs that were added to compensate breaking M-L bonds.

It should also support charge assignment in bridged structures like M-L-M. Here, the coordinate atom L will have multiple added Hs, and the charge will be distribute to both metal atoms based on the bond order.

Dative bonds, are a special case. Breaking a dative bonds do not result in addition of non-real Hs.

This process looks complicated. I put some more in-line comments, but in future we could rewrite it.

double, and more bond types; M-L-M structure
@rwxayheee rwxayheee changed the title implement support for metal complexes as ligand Metal complexes as ligand Dec 9, 2024
for idx in neigh_idx_to_nr_h:
n = neigh_idx_to_nr_h[idx]
newidx = idx - sum([i < idx for i in idx_to_rm])
mol.GetAtomWithIdx(newidx).SetNumExplicitHs(n + 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetNumExplicitHs without Resetting it (since the added hydrogens are non-real) might be causing some problems when functions like RemoveHs are called later on the ligand mol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of resetting it, not modifying atoms in input mol is better

@rwxayheee rwxayheee requested a review from diogomart December 10, 2024 05:39
@rwxayheee rwxayheee marked this pull request as ready for review December 10, 2024 05:39
@rwxayheee
Copy link
Contributor Author

rwxayheee commented Dec 10, 2024

This PR allows preparation of metal complexes with dative bonds as ligands. An example is heme (with Fe(II):
Chemical structure:
heme_mine_structure

Input SDF:
heme_mine.sdf.txt

Output PDBQT:
heme_mine.pdbqt.txt

@rwxayheee
Copy link
Contributor Author

Merged develop into this branch.

Added a test (example showed in this PR):

  • added a script file metal_test.py
  • added a folder metal_complex_data for test files

@rwxayheee rwxayheee changed the base branch from develop to release January 16, 2025 21:55
@rwxayheee rwxayheee changed the base branch from release to develop January 16, 2025 21:56
rm_to_neigh[atom.GetIdx()].add(neigh.GetIdx())
if not idx_to_rm:
return Chem.Mol(mol), idx_to_rm, rm_to_neigh
return input_mol, idx_to_rm, rm_to_neigh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to either return a copy of input_mol, or make a copy before changing Se to S for computing Gasteiger charges in the function that calls remove_elements()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why and what's the difference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to prevent a side effect (a modification) on a molecule that a user passes to an instance of MoleculePreparation. This could be a padded_mol in a Polymer. The modification is changing Selenium to Sulfur here: https://github.com/rwxayheee/Meeko/blob/cb7b4e7db4334f161b35124135214ca69099c3f1/meeko/molsetup.py#L1768-L1771
That's why the original code returns a copy of the input molecule, instead of returning the input molecule itself. Then the copy is modified, and the original input mol is safe from side effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks, I understand now

changes outside of the function in the subsequent steps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RuntimeError: expected only 1 added H per heavy atom, maybe deleted element had double bond to this heavy atom

2 participants