Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in copyMoleculeByAtoms when H are mapped #97

Open
lpatiny opened this issue Jul 31, 2023 · 1 comment
Open

Bug in copyMoleculeByAtoms when H are mapped #97

lpatiny opened this issue Jul 31, 2023 · 1 comment

Comments

@lpatiny
Copy link

lpatiny commented Jul 31, 2023

Sorry for the javascript example ...

It seems there is a bug in copyMoleculeByAtoms when we have recognizeDelocalizedBonds:true and one of the mapped atom in an hydrogen.
The atomMap is correct but the hydrogen is not copied.

import OCL from 'openchemlib'
const { Molecule } = OCL


const molecule = Molecule.fromSmiles('C')
molecule.addImplicitHydrogens()
const atomMap = []
const atomMask = [true, true, false, false, false]

let fragment = new Molecule(0, 0)
molecule.copyMoleculeByAtoms(fragment, atomMask, false, atomMap);
console.log(fragment.getAllAtoms(), atomMap) // 2 [ 0, 1, -1, -1, -1 ]

fragment = new Molecule(0, 0)
molecule.copyMoleculeByAtoms(fragment, atomMask, true, atomMap);
// if recognizeDelocalizedBonds is true we have the atomMap but the fragment do not contain the H it points to incorrect atom. We have a mapping to 0 and 1 but only atom 0 exists.
console.log(fragment.getAllAtoms(), atomMap) // 1 [ 0, 1, -1, -1, -1 ]
@thsa
Copy link
Contributor

thsa commented Aug 8, 2023 via email

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

No branches or pull requests

2 participants