Francois,

Take a look at the OBElementTable class. There is a global static
instantiation of it (named 'etab') available through the mol.h header,
see the example code on
http://openbabel.org/api/2.3/classOpenBabel_1_1OBElementTable.shtml.

The simple program:

#include <iostream>
#include <openbabel/mol.h>

int main(int, char **)
{
  std::cout << "The mass of carbon is "
            << OpenBabel::etab.GetMass(6)
            << " amu." << std::endl;
  return 0;
}

Compiled with

g++ -lopenbabel -I/usr/include/openbabel-2.0/ test.cpp

produces

$ ./a.out
The mass of carbon is 12.0107 amu.

HTH,

Dave

On Mon, Jul 1, 2013 at 9:11 PM, Francois Berenger <beren...@riken.jp> wrote:
> On 06/29/2013 02:33 AM, Geoffrey Hutchison wrote:
>>> Where can I find in the open babel source
>>> code the conversion table from atom type to mass?
>>
>> Well you don’t really care much about the atom type -- you care about the 
>> element. I mean, an aromatic nitrogen is still a nitrogen.
>>
>> So I'm a bit confused what you want. Do you want example code on how to get 
>> the mass of an atom?
>
> Yes, example code would help.
>
> Francois.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> OpenBabel-Devel mailing list
> OpenBabel-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to