Repository navigation
fix: restrict the MI charge-separated bond pass to Group 1/2 metals - #306
Conversation
The pass added in 7837660 disconnected every single or coordinative metal-ligand bond whose atoms carry opposite formal charges. On metals outside Groups 1 and 2 such charges usually depict oxidation states on a covalent complex, so the pass split complexes that the neutral drawing keeps connected: H2PtCl6 drawn as Pt(4+) with four Cl(-) (PubChem SID 71150) lost four of six equivalent ligands, AlH4(-) drawn as Al(3+) with four H(-) fell apart into ions, and charged ZnCl2, FeCl3, SnCl4 and CuCl gave a different InChI from their neutral drawings. Apply the pass to Group 1 and Group 2 metals only and leave all other metal-ligand bonds to the decision tree. The chelate-ring check in the pass and the ring perception it needed are removed: the ring count is always zero for Group 1/2 metals, so the check could no longer fire. Adds unit tests for H2PtCl6, AlH4(-) and ZnCl2 drawn with charges. Refs #304
…arated pass change Restricting the charge-separated bond pass to Group 1/2 metals produces 26 intended diffs in inchi.sdf, all metal or metalloid structures whose charged metal-ligand bonds now stay connected: Sb ylides from the technical-manual tables, Cu, Co, Ru and Fe complexes, and repeated components (cobalamin, ferrocenyl phosphonium) that now come out identical. mcule.sdf is unchanged. Refs #304
Unit Test Coverage ReportCoverage Regression Summary
Find details on the base coverage at https://iupac-inchi.github.io/InChI/coverage/index.html Find details on this PR's coverage by downloading coverage-reports-42350061202 and opening html/index.html |
nnuk
left a comment
There was a problem hiding this comment.
@fbaensch-beilstein this means that currently the criteria for a metal atom in a ring system with at least C, N and O atoms will not be disconnected? I am asking this because we have this decision in the decision tree and most importantly in the MI paper. So, should we change that also?
|
No, the chelate criterion is unchanged. The decision tree still keeps all metal bonds when the metal's ring system contains at least three C, N or O atoms, so the paper's rule stands. The PR only removes the duplicate of that check from the charge-separated pass: the pass now runs for Group 1/2 metals only, and |
|
As discussed this morning, you find some more examples from the 3 bug lists in the attached excel sheet. They incude a depiction of the structure, the mofie, and the inChIs of 1.07.5, mol. inorganics, and the InChI of 1.07.5 with the recmet parameter. The issue is caused in case the "ligand atom" (atom of the ligand that is directly linked to the metal atom) is negatively charged. In most of the cases the InChIs of 1.07.5 /recmet are as expected. |
@gblanke02 The MI InChIs are not what the latest dev head will generate as their prefix is 1B/ not 1BB/ |
|
@gblanke02 Thanks for the sheet. I ran all 13 molfiles through current Your diagnosis holds: dev cuts a metal–ligand bond whenever the ligand atom is negative and the metal positive. This PR restricts that rule to Group 1/2 metals. Summary:
Related: #309 (stacked on this PR, fixes #305) decides metal-bond disconnection per fragment. It gives the same InChI as this PR for all 13 examples. |
|
@gblanke02 A review of this PR found a side effect where I need your decision before I push a follow-up. Situation. With this PR the charge-separated pass only cuts bonds of Group 1/2 metals. For every other metal a charged bond goes to the decision tree. The tree checks whether the metal has a "normal" valence for its drawn charge, and Ag(+) with one bond does not, so the bond is kept. As a result, a charged and a neutral drawing of the same simple salt now differ:
The same happens for CuF, HgF and TlF. For CuCl it is the other way round: the bond table keeps Cu–Cl, so on this PR charged and neutral CuCl now agree (both connected), while on dev the charged one was cut. Proposed follow-up (implemented locally, not pushed). Group 1/2 metals are still always cut. For other metals, the charged pass cuts the bond only when the MI bond table cuts that element pair, as it would for the neutral drawing:
One limit: for a pair the table cuts, the charged drawing is decided by the table alone, while the neutral drawing also goes through the rest of the decision tree (valence, chelate ring, link to another metal). For example, a charged Ag(+)–F(−) inside a chelate would be cut, while the neutral one would be kept. Question. Should charged metal–ligand bonds on metals outside Group 1/2 be cut when the bond table cuts that pair (the proposal), or stay connected as in the current PR? |
|
This implementation is a good way for the current release. A few more comments about the examples described in the PDF: |
A metal outside Group 1/2 drawn with opposite charges across a bond whose element pair the bond table cuts (Ag(+)-F(-), likewise Cu/Hg/Tl-F) can be neither kept (the neutral drawing is cut) nor cut (the drawing would then disagree with the covalent reading). MI now rejects such a structure with "Error 99 (Charge-separated bond to a non-Group 1/2 metal)" and no InChI; the CLI continues with the next structure. Pairs the table keeps (Pt-Cl, Al-H, Zn-Cl, Fe-Cl, Sn-Cl, Cu-Cl) are unchanged and still left to the decision tree; the neutral Ag-F drawing is still cut. Refs #304
Just to be sure which output you want for a bonded Ag(+)-F(-) (the same applies to Cu/Hg/Tl-F, i.e. pairs the bond table cuts):
Pairs the bond table keeps (Pt-Cl, Al-H, Zn-Cl, Cu-Cl, ...) are not affected by any of these. |
|
According to the disconnection table it would be correct to disconnect Ag and F to create a ionic bond Ag+ F-. Because the uncutted version is false a full error message without InChI string is preferred.
Von: fbaensch-beilstein ***@***.***>
Gesendet: Donnerstag, 5. November 2026 16:15
An: IUPAC-InChI/InChI ***@***.***>
Cc: ***@***.***; Mention ***@***.***>
Betreff: Re: [IUPAC-InChI/InChI] fix: restrict the MI charge-separated bond pass to Group 1/2 metals (PR #306)
[https://avatars.githubusercontent.com/u/168176402?s=20&v=4]fbaensch-beilstein left a comment (IUPAC-InChI/InChI#306)<#306 (comment)>
Outside group 1 and 2 structures like Ag+-F- are handled but let InChI return an error message.
Error message means no InChI. Or do you want a warning and an uncutted InChI?
—
Reply to this email directly, view it on GitHub<#306?email_source=notifications&email_token=AT3EDCLUZB2MF72ZFZ6FORT5XSKNZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRWGE2TSNRZGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6661596921>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AT3EDCNXDQR472BL7FBTJLD5XSKNZAVCNFSNUABFKJSXA33TNF2G64TZHM3TGOBWGUZTKMZQHNEXG43VMU5TMMJYGI4TSMRUGE4KC5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AT3EDCMUMYQOR4QIUX4YVRD5XSKNZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRWGE2TSNRZGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y> and Android<https://github.com/notifications/mobile/android/AT3EDCNYBCFTNZXCRSIPWSD5XSKNZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRWGE2TSNRZGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>. Download it today!
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Restricts the MolecularInorganics charge-separated bond pass (7837660, #219) to Group 1/2 metals. On other metals opposite formal charges usually depict oxidation states on a covalent complex, so the pass split H₂PtCl₆ (SID 71150), AlH₄⁻ drawn as Al³⁺/4 H⁻, and charged ZnCl₂/FeCl₃/SnCl₄/CuCl, which now match their neutral drawings. Na/Ca salts and the #219 unit tests are unchanged.
Where the bond table cuts the element pair (Ag(+)-F(-), likewise Cu/Hg/Tl-F), neither keeping nor cutting the charged bond is right, so MI now rejects the structure with
Error 99 (Charge-separated bond to a non-Group 1/2 metal)and no InChI (agreed with @gblanke02 in the review). The neutral Ag-F drawing is still cut;-LegacyMetalHandlingis unchanged.Intended output change: 26 structures in
inchi.sdf(Sb ylides from the technical-manual tables; Cu, Co, Ru, Fe complexes that stay connected; repeated cobalamin and ferrocenyl components that now come out identical); the reference is regenerated in the second commit, mcule is unchanged. Related but separate: #305.Closes #304