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

cml conversion to smiles - extra implicit hydrogens added to files with explicit hydrogens #2655

Open
kmlefran opened this issue Dec 11, 2023 · 1 comment

Comments

@kmlefran
Copy link

Environment Information

Open Babel version: 3.1.1
Operating system and version: MacOS Ventura 13.6

Expected Behavior

As per obabel -Hcml
"In the absence of hydrogenCount and any explicit hydrogen on
an atom, implicit hydrogen is assumed to be present appropriate
to the radical or spinMultiplicity attributes on the atom or
its normal valency if they are not present."

If atoms in a cml file have explicit hydrogens, further implicit hydrogens should not be added. So, for the following, as a cml file
ch2.txt

obabel ch2.cml -ocan should produce [CH2]

Actual Behavior

Extra implicit hydrogens are added, obabel ch2.cml -ocan results in C - that is, methane.

Steps to Reproduce

Using attached ch2.txt (cml file with txt file type to be uploaded)
ch2.txt
obabel -icml ch2.txt -ocan

@nbehrnd
Copy link
Contributor

nbehrnd commented Dec 12, 2023

Agreed, [CH2] stays CH2 e.g., in CDK Depict and is not methane represented as C; with one explicit hydrogen [H]C, or C[H], nor depicted with two explicit hydrogens, [H]C[H]. This equally is reflected in openbabel reports:

$ obabel -:"[CH2]" -oreport
FILENAME: 
FORMULA: CH2
MASS: 14.0266
EXACT MASS: 14.0156501
INTERATOMIC DISTANCES

              C   1
              -----------
   C   1    0.0000 



ATOMIC CHARGES
   C   1    0.0000000000


BOND ANGLES


TORSION ANGLES


1 molecule converted

vs, for instance

$ obabel -:"C[H]" -oreport
FILENAME: 
FORMULA: CH4
MASS: 16.0425
EXACT MASS: 16.0313001
TOTAL SPIN: 2
INTERATOMIC DISTANCES

              C   1      H   2
              ----------------------
   C   1    0.0000 
   H   2    0.0000     0.0000 



ATOMIC CHARGES
   C   1   -0.0309297904
   H   2    0.0309297904


BOND ANGLES


TORSION ANGLES


1 molecule converted

But then, the equally observed

$ obabel -:"[CH2]" -oxyz -xh
1

C          0.00000        0.00000        0.00000
1 molecule converted

isn't consistent, either:

$ obabel -:"[CH2]" -oxyz -h
3

C          0.00000        0.00000        0.00000
H          0.00000        0.00000        0.00000
H          0.00000        0.00000        0.00000
1 molecule converted

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