Den 2019-11-26 kl. 10:12, skrev Noel O'Boyle:
An SDF file describes the number of hydrogens on each atom. Open Babel is neither adding nor removing them. AddHydrogens() is just making them explicit.
Unfortunately, no. The structure below has 7 hydrogens and one charge but obprop adds one H and 4 (!) charges.

% obprop 2-aminoguanidinium.sdf
name             2-aminoguanidinium.sdf 1
formula          CH8N4+++++





 OpenBabel11261907103D

 12 11  0  0  0  0  0  0  0  0999 V2000
   -1.5988   -0.6139    0.0135 N   0  0  0  0  0  0  0  0  0  0  0  0
   -0.4655    1.3957   -0.0077 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.7405   -0.6123    0.0118 N   0  0  0  0  0  0  0  0  0  0  0  0
    1.9392    0.1153    0.0724 N   0  0  0  0  0  0  0  0  0  0  0  0
   -0.4481    0.0607    0.0074 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6144   -1.6250    0.0385 H   0  0  0  0  0  0  0  0  0  0  0  0
   -2.4894   -0.1345    0.0041 H   0  0  0  0  0  0  0  0  0  0  0  0
   -1.3186    1.9349   -0.0175 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.4173    1.8753   -0.1389 H   0  0  0  0  0  0  0  0  0  0  0  0
    1.9696    0.6569    0.9451 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.7365   -0.5322    0.1048 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.8109   -1.6139   -0.1611 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  6  1  0  0  0  0
  2  8  1  0  0  0  0
  4  3  1  0  0  0  0
  4 11  1  0  0  0  0
  4 10  1  0  0  0  0
  5  1  1  0  0  0  0
  5  2  1  0  0  0  0
  5  3  1  0  0  0  0
  7  1  1  0  0  0  0
  9  2  1  0  0  0  0
 12  3  1  0  0  0  0
M  CHG  1   1   5
M  END


Regards,
- Noel

On Tue, 26 Nov 2019 at 06:50, David van der Spoel <sp...@xray.bmc.uu.se <mailto:sp...@xray.bmc.uu.se>> wrote:

    Hi,

    I was trying to use obprop on an SDF file, but found out that it adds
    one hydrogen to my compound that should not be there. I then went to
    look at the code and removed these two lines
            if (!mol.HasHydrogensAdded())
              mol.AddHydrogens();
    recompiled and installed.
    Lo and behold, the bug is still there! That is, upon reading an SDF
    file
    the library already adds a hydrogen that shouldn't be there.

    What to do about this?
    Replace
            conv.Read(&mol, &ifs);
    by a new call
            conv.ReadAndDoNotModifyMyCompound(&mol, &ifs);

    Other suggestions?

-- David van der Spoel, Ph.D., Professor of Biology
    Head of Department, Cell & Molecular Biology, Uppsala University.
    Box 596, SE-75124 Uppsala, Sweden. Phone: +46184714205.
    http://www.icm.uu.se


    _______________________________________________
    OpenBabel-Devel mailing list
    OpenBabel-Devel@lists.sourceforge.net
    <mailto:OpenBabel-Devel@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/openbabel-devel



--
David van der Spoel, Ph.D., Professor of Biology
Head of Department, Cell & Molecular Biology, Uppsala University.
Box 596, SE-75124 Uppsala, Sweden. Phone: +46184714205.
http://www.icm.uu.se


_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to