How to calculate the number of bonds between heavy atoms?

User fca09bdbff

05-02-2014 17:50:43


I would like a use a Chemical Term to calculate the total number of bonds in a molecule excluding those that are connected to hydrogen atoms, i.e. only bonds between heavy atoms. 'BondCount' is available in JChem for Excel, but this includes bonds to hydrogen.

Is this possible?

Thanks and regards,

Tim Ritchie.

ChemAxon d76e6e95eb

05-02-2014 20:42:24

Hi Tim,

If you have no protons in your molecules, just substract the number of hydrogens, and you will probably get what you want.


User fca09bdbff

06-02-2014 11:33:54

Hi Gyuri,

Thanks for your response. Could you provide me with an example expression to do this please?



ChemAxon d76e6e95eb

06-02-2014 18:11:22

There are more solutions for this problem, but this should work in most cases

bondCount() - hcount()

User fca09bdbff

07-02-2014 08:02:56

Hello Gyuri,

I am trying this in JChem for Excel.

For this structure, CC(C(O)=O)c1cccc(c1)C(=O)c1ccccc1, if I use

=JCChemicalTerms(A2,"bondCount()") I get the correct number of total bonds (34)

if I use =JCChemicalTerms(A2,"hcount()"), I get the answer 3, which is obviously not correct.

Am I doing something wrong?

Thanks and regards,


ChemAxon d76e6e95eb

07-02-2014 08:09:15

My fault, sorry, hcount returns the number of Hydrogen connections of an atom indeed. Please use this instead:

bondCount() - atomcount(1)

where 1 is the type of the atom, so its Hydrogen. I hope this gives you what you are looking for.

User fca09bdbff

07-02-2014 11:41:06

Thanks Gyuri,

I had to use


i.e. single quotes around the 1 for it to work correctly.

Regards, Tim.

ChemAxon d76e6e95eb

09-02-2014 18:33:42

You are right, the quotes are needed.