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

Hydrogens are not copied when using copyMoleculeByAtoms #57

Open
lpatiny opened this issue Jan 26, 2020 · 0 comments
Open

Hydrogens are not copied when using copyMoleculeByAtoms #57

lpatiny opened this issue Jan 26, 2020 · 0 comments

Comments

@lpatiny
Copy link

lpatiny commented Jan 26, 2020

@thsa

Using copyMoleculeByAtoms and not copying all the atoms the target molecule is a fragment and apparently the hydrogens are therefore not copied even if the atomMap pretends it is copied.

I would hope we always keep those explicit hydrogens especially that they coordinates may be important.

const molecule = OCL.Molecule.fromSmiles('C');
molecule.addImplicitHydrogens();

console.log(molecule.getAllAtoms()); // returns 5

const copy = new OCL.Molecule(0, 0);
copy.setFragment(false);
const atomMap = [];
molecule.copyMoleculeByAtoms(
  copy,
  [true, true, true, false, false],
  true,
  atomMap,
);

console.log(copy.getAllAtoms()); // returns 1

console.log(atomMap); // returns [ 0, 1, 2, -1, -1 ]

console.log(copy.getAtomicNo(1)); // returns -1
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

1 participant