This doesn't work for C[N+], where 3 hydrogens should be added to the nitrogen.
-Andreas Daniel Fontaine wrote: > Shouldn't the formula be the following since the polarity of the charge > is irrelevant, it only implies an unfilled valency? > > missingHydrogen = (int) (defaultAtom.getBondOrderSum() - bondOrderSum - > singleElectronSum - abs(atom.getFormalCharge())); > > this formula would work in both cases. > > On Wed, 2007-05-23 at 13:54 +0200, Andreas Schüller wrote: >> Hello, >> >> I would agree that the first molecule should have hydrogens added like this: >> > 1: 2 >> > 2: 0 >> > 3: 1 >> > 4: 2 >> >> A [C+] has three valence electrons to possibly form three single bonds. >> Molecular Operating Environment (MOE) 2006.08 adds hydrogens in >> compliance to the above scheme. >> >> Applying the modified formula >> > missingHydrogen = (int) (defaultAtom.getBondOrderSum() - >> > bondOrderSum - singleElectronSum - >> > atom.getFormalCharge()); >> to C3 of the first molecule suggests to add 4-2-0-(+1)=1 hydrogens, >> which seems correct. >> >> On the otherhand: >> >> Let's see for [O-] in e.g. C[O-]: >> 2-1-0-(-1)=2 (!!) >> This is definately wrong. Here, the original formula applies: 2-1-0+(-1)=0 >> >> For [N+] in C[N+]: >> 3-1-0+(+1)=3 >> Again, the original formula applies. >> >> I think that carbocations, [C+], are an exception, since they seek an >> electron sextet in their outer valence shell rather than an octet. They >> should probably be treated differently. >> If one assumed defaultAtom.getBondOrderSum() = 2 for a carbocation the >> original formula would apply: >> 2-2-0+(+1)=1 >> >> Best wishes, >> Andreas >> >> >> >> Daniel Fontaine wrote: >> > Stefan, >> > >> > As I said, I am not a chemist. However, I made the change you suggested >> > and recompiled CDK and all my test cases now run as expected. I believe >> > your suggestion of changing +charge to -charge is correct. >> > >> > I appreciate all of your help. >> > Dan >> > >> > On Tue, 2007-05-22 at 17:17 +0200, Stefan Kuhn wrote: >> >> Looking at the situation I think indeed that atom 3 should have 1 >> hydrogen, >> >> since it is positivly charged. >> >> Could one of the chemists comment on this? >> >> If it is indeed 1, the code in SaturationChecker is wrong, which >> seems hard to >> >> believe. Right now the code is: >> >> missingHydrogen = (int) (defaultAtom.getBondOrderSum() - >> >> bondOrderSum - singleElectronSum + >> >> atom.getFormalCharge()); >> >> I think indeed it should be -charge, since, if the charge is >> negative, we need >> >> extra electrons. >> >> Again, the chemists please. >> >> >> >> >> >> On Tuesday 22 May 2007 16:32, Daniel Fontaine wrote: >> >>> I admit I am not much of a chemist, I am a programmer, but the program >> >>> that generated the fragment, Mass Frontier, has the first molecule with >> >>> 5 hydrogens rather than 7. I was told this is correct due to the >> >>> positive charge on the carbon? Does CDK not handle this sort of thing? >> >>> Or am I missing something? >> >>> >> >>> thanks for all of your help >> >>> Dan >> >>> >> >>> On Tue, 2007-05-22 at 15:48 +0200, Stefan Kuhn wrote: >> >>>> On Tuesday 22 May 2007 15:23, Daniel Fontaine wrote: >> >>>>> Thanks, but if this reader is working properly, why is the hydrogen >> >>>>> adder not taking charges into consideration? I am getting two >> >>>>> hydrogens too many added to that first fragment I posted. >> >>>> Hm, I get for the first molecule the following implicit Hs after >> >>>> addImplicitHydrogensToSatisfyValency: >> >>>> 1: 2 >> >>>> 2: 0 >> >>>> 3: 3 >> >>>> 4:2 >> >>>> For the second one: >> >>>> 1: 1 >> >>>> 2: 0 >> >>>> 3: 1 >> >>>> 4: 2 >> >>>> That looks ok, I would say, doesn't it? >> >>>> Stefan >> >>>> >> >>>>> thanks, >> >>>>> Dan >> >>>>> >> >>>>> On Tue, 2007-05-22 at 10:29 +0200, Stefan Kuhn wrote: >> >>>>>> Ok, the problem is you are using the wrong property. You should use >> >>>>>> getFormatCharge, which works and is supposed to give that sort of, >> >>>>>> well, >> >>>>>> formal charge. The getCharge is used by classes assigning partial >> >>>>>> charges and >> >>>>>> will always give 0 if you do not explicitly run one of them. >> >>>>>> Stefan >> >>>>>> >> >>>>>> On Monday 21 May 2007 20:28, Daniel Fontaine wrote: >> >>>>>>> Hello, I am new to CDK and the mailing list. >> >>>>>>> >> >>>>>>> I am reading in a list of compounds from an sdf file that include >> >>>>>>> charges. These charges don't appear on the atoms of the >> >>>>>> corresponding >> >>>>>> >> >>>>>>> Molecules, however, when loading with MDLV2000Reader. All atoms >> >>>>>> show a >> >>>>>> >> >>>>>>> charge of 0.0. >> >>>>>>> >> >>>>>>> This is a problem because I am trying to add implicit hydrogens >> >>>>>>> with HydrogenAdder. I frequently end up with too many hydrogens and >> >>>>>>> the >> >>>>>> wrong >> >>>>>> >> >>>>>>> mass. >> >>>>>>> >> >>>>>>> any help would be appreciated, >> >>>>>>> Dan >> >>>>>> >> --------------------------------------------------------------------- >> >>>>>> ---- >> >>>>>> >> >>>>>>> This SF.net email is sponsored by DB2 Express >> >>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >> >>>>>>> control of your XML. No limits. Just data. Click to get it now. >> >>>>>>> http://sourceforge.net/powerbar/db2/ >> >>>>>>> _______________________________________________ >> >>>>>>> Cdk-user mailing list >> >>>>>>> [email protected] >> >>>>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >> >>>>>> -- >> >>>>>> Stefan Kuhn BSc MA >> >>>>>> IPB Halle >> >>>>>> AG Bioinformatik & Massenspektrometrie >> >>>>>> Weinberg 3 >> >>>>>> 06120 Halle >> >>>>>> http://www.ipb-halle.de http://msbi.bic-gh.de >> >>>>>> [EMAIL PROTECTED] Tel. +49 (0) 345 5582 1474 Fax.+49 (0) 345 5582 >> >>>>>> 1409 >> >>>>>> >> >>>>>> >> --------------------------------------------------------------------- >> >>>>>> ---- This SF.net email is sponsored by DB2 Express >> >>>>>> Download DB2 Express C - the FREE version of DB2 express and take >> >>>>>> control of your XML. No limits. Just data. Click to get it now. >> >>>>>> http://sourceforge.net/powerbar/db2/ >> >>>>>> _______________________________________________ >> >>>>>> Cdk-user mailing list >> >>>>>> [email protected] >> >>>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >> >>>>> >> ----------------------------------------------------------------------- >> >>>>> -- This SF.net email is sponsored by DB2 Express >> >>>>> Download DB2 Express C - the FREE version of DB2 express and take >> >>>>> control of your XML. No limits. Just data. Click to get it now. >> >>>>> http://sourceforge.net/powerbar/db2/ >> >>>>> _______________________________________________ >> >>>>> Cdk-user mailing list >> >>>>> [email protected] >> >>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >> >>> >> ------------------------------------------------------------------------- >> >>> This SF.net email is sponsored by DB2 Express >> >>> Download DB2 Express C - the FREE version of DB2 express and take >> >>> control of your XML. No limits. Just data. Click to get it now. >> >>> http://sourceforge.net/powerbar/db2/ >> >>> _______________________________________________ >> >>> Cdk-user mailing list >> >>> [email protected] >> >>> https://lists.sourceforge.net/lists/listinfo/cdk-user >> > >> > >> > ------------------------------------------------------------------------- >> > This SF.net email is sponsored by DB2 Express >> > Download DB2 Express C - the FREE version of DB2 express and take >> > control of your XML. No limits. Just data. Click to get it now. >> > http://sourceforge.net/powerbar/db2/ >> > _______________________________________________ >> > Cdk-user mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/cdk-user >> > >> >> -- >> Andreas Schüller >> PhD student in the research group of Prof. Dr. Gisbert Schneider >> >> Johann Wolfgang Goethe University >> Beilstein-endowed Chair for Chemoinformatics >> Building B - 3rd floor >> Siesmayerstr. 70 >> 60323 Frankfurt am Main >> Germany >> >> Tel.: +49 69 798 24879 >> Fax: +49 69 798 24880 >> http://www.modlab.de/ >> >> >> Daniel Fontaine wrote: >>> Stefan, >>> >>> As I said, I am not a chemist. However, I made the change you suggested >>> and recompiled CDK and all my test cases now run as expected. I believe >>> your suggestion of changing +charge to -charge is correct. >>> >>> I appreciate all of your help. >>> Dan >>> >>> On Tue, 2007-05-22 at 17:17 +0200, Stefan Kuhn wrote: >>>> Looking at the situation I think indeed that atom 3 should have 1 >>>> hydrogen, >>>> since it is positivly charged. >>>> Could one of the chemists comment on this? >>>> If it is indeed 1, the code in SaturationChecker is wrong, which seems >>>> hard to >>>> believe. Right now the code is: >>>> missingHydrogen = (int) (defaultAtom.getBondOrderSum() - >>>> bondOrderSum - singleElectronSum + >>>> atom.getFormalCharge()); >>>> I think indeed it should be -charge, since, if the charge is negative, we >>>> need >>>> extra electrons. >>>> Again, the chemists please. >>>> >>>> >>>> On Tuesday 22 May 2007 16:32, Daniel Fontaine wrote: >>>>> I admit I am not much of a chemist, I am a programmer, but the program >>>>> that generated the fragment, Mass Frontier, has the first molecule with >>>>> 5 hydrogens rather than 7. I was told this is correct due to the >>>>> positive charge on the carbon? Does CDK not handle this sort of thing? >>>>> Or am I missing something? >>>>> >>>>> thanks for all of your help >>>>> Dan >>>>> >>>>> On Tue, 2007-05-22 at 15:48 +0200, Stefan Kuhn wrote: >>>>>> On Tuesday 22 May 2007 15:23, Daniel Fontaine wrote: >>>>>>> Thanks, but if this reader is working properly, why is the hydrogen >>>>>>> adder not taking charges into consideration? I am getting two >>>>>>> hydrogens too many added to that first fragment I posted. >>>>>> Hm, I get for the first molecule the following implicit Hs after >>>>>> addImplicitHydrogensToSatisfyValency: >>>>>> 1: 2 >>>>>> 2: 0 >>>>>> 3: 3 >>>>>> 4:2 >>>>>> For the second one: >>>>>> 1: 1 >>>>>> 2: 0 >>>>>> 3: 1 >>>>>> 4: 2 >>>>>> That looks ok, I would say, doesn't it? >>>>>> Stefan >>>>>> >>>>>>> thanks, >>>>>>> Dan >>>>>>> >>>>>>> On Tue, 2007-05-22 at 10:29 +0200, Stefan Kuhn wrote: >>>>>>>> Ok, the problem is you are using the wrong property. You should use >>>>>>>> getFormatCharge, which works and is supposed to give that sort of, >>>>>>>> well, >>>>>>>> formal charge. The getCharge is used by classes assigning partial >>>>>>>> charges and >>>>>>>> will always give 0 if you do not explicitly run one of them. >>>>>>>> Stefan >>>>>>>> >>>>>>>> On Monday 21 May 2007 20:28, Daniel Fontaine wrote: >>>>>>>>> Hello, I am new to CDK and the mailing list. >>>>>>>>> >>>>>>>>> I am reading in a list of compounds from an sdf file that include >>>>>>>>> charges. These charges don't appear on the atoms of the >>>>>>>> corresponding >>>>>>>> >>>>>>>>> Molecules, however, when loading with MDLV2000Reader. All atoms >>>>>>>> show a >>>>>>>> >>>>>>>>> charge of 0.0. >>>>>>>>> >>>>>>>>> This is a problem because I am trying to add implicit hydrogens >>>>>>>>> with HydrogenAdder. I frequently end up with too many hydrogens and >>>>>>>>> the >>>>>>>> wrong >>>>>>>> >>>>>>>>> mass. >>>>>>>>> >>>>>>>>> any help would be appreciated, >>>>>>>>> Dan >>>>>>>> --------------------------------------------------------------------- >>>>>>>> ---- >>>>>>>> >>>>>>>>> This SF.net email is sponsored by DB2 Express >>>>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>>>> _______________________________________________ >>>>>>>>> Cdk-user mailing list >>>>>>>>> [email protected] >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >>>>>>>> -- >>>>>>>> Stefan Kuhn BSc MA >>>>>>>> IPB Halle >>>>>>>> AG Bioinformatik & Massenspektrometrie >>>>>>>> Weinberg 3 >>>>>>>> 06120 Halle >>>>>>>> http://www.ipb-halle.de http://msbi.bic-gh.de >>>>>>>> [EMAIL PROTECTED] Tel. +49 (0) 345 5582 1474 Fax.+49 (0) 345 5582 >>>>>>>> 1409 >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> ---- This SF.net email is sponsored by DB2 Express >>>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>>> _______________________________________________ >>>>>>>> Cdk-user mailing list >>>>>>>> [email protected] >>>>>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >>>>>>> ----------------------------------------------------------------------- >>>>>>> -- This SF.net email is sponsored by DB2 Express >>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>> _______________________________________________ >>>>>>> Cdk-user mailing list >>>>>>> [email protected] >>>>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >>>>> ------------------------------------------------------------------------- >>>>> This SF.net email is sponsored by DB2 Express >>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>> control of your XML. No limits. Just data. Click to get it now. >>>>> http://sourceforge.net/powerbar/db2/ >>>>> _______________________________________________ >>>>> Cdk-user mailing list >>>>> [email protected] >>>>> https://lists.sourceforge.net/lists/listinfo/cdk-user >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by DB2 Express >>> Download DB2 Express C - the FREE version of DB2 express and take >>> control of your XML. No limits. Just data. Click to get it now. >>> http://sourceforge.net/powerbar/db2/ >>> _______________________________________________ >>> Cdk-user mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/cdk-user >>> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

