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

how to get molecular weight #35

Closed
srio opened this issue Jun 21, 2016 · 11 comments
Closed

how to get molecular weight #35

srio opened this issue Jun 21, 2016 · 11 comments

Comments

@srio
Copy link

srio commented Jun 21, 2016

Hello Tom,

I came to a problem: using the compound parser I cannot get the molecular weight of the compound. The compound information should have either the final molecular weight or the number of different elements (to be able to compute it). For example, with H2O:

In [106]: xraylib.CompoundParser("H2O")
Out[106]:
{'Elements': [1, 8],
'massFractions': [0.1120976692563818, 0.8879023307436182],
'nAtomsAll': 3.0,
'nElements': 2}

How I can get the molecular weight = 2_xraylib.AtomicWeight(1) + 1_xraylib.AtomicWeight(8) ?

If it is not possible, please consider it for a future version!!

Thanks a lot,

Manolo

@tschoonj
Copy link
Owner

Hi Manolo,

This is currently not calculated by the compound parser.

I will look into it. Shouldn't be hard to implement.

Best,

Tom

@srio
Copy link
Author

srio commented Jun 21, 2016

Thanks. I think is important to store the number of atoms of each
element, so in water [2,1] for Z=[1,8]. With this and AtomicWeight() we
can survive. Many thanks for your quick answer!!
M

On 06/21/2016 04:15 PM, Tom Schoonjans wrote:

Hi Manolo,

This is currently not calculated by the compound parser.

I will look into it. Shouldn't be hard to implement.

Best,

Tom


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqKxav1CEkpzeTKUWVm-C_jyCn3Kshks5qN_H1gaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

@tschoonj
Copy link
Owner

tschoonj commented Jul 6, 2016

Hi Manolo,

I am currently working on this and work should be finished soon.

Just to be clear (I had to use wikipedia for this...): you are referring to molar mass right (in g/mol)? Molecular mass is the mass of a particular molecule and varies according to isotopes present in it and (currently) cannot be provided by xraylib.

Best,

Tom

@srio
Copy link
Author

srio commented Jul 6, 2016

Thanks Tom. Yes you are right is the molar mass (or molecular mass for
"averaged" isotopes). I never paid attention to the names...

Best regards,

Manolo

On 07/06/2016 03:03 PM, Tom Schoonjans wrote:

Hi Manolo,

I am currently working on this and work should be finished soon.

Just to be clear (I had to use wikipedia
https://en.wikipedia.org/wiki/Molar_mass for this...): you are
referring to /molar mass/ right (in g/mol)? /Molecular mass/ is the
mass of a particular molecule and varies according to isotopes present
in it and (currently) cannot be provided by xraylib.

Best,

Tom


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqKz1lvMb28aDr_SeZpW74FY-kKk3Nks5qS6eugaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

@tschoonj
Copy link
Owner

tschoonj commented Jul 7, 2016

Hi Manolo,

I have changed the compoundData struct according to your requirements. It now contains nAtoms, an array of double's with the number of atoms per element, and molarMass, the molar mass of the compound, in g/mol.

As I have no immediate plans to make a new release, I recommend you clone the repo if you want the new compoundData struct.

Best,

Tom

@tschoonj tschoonj closed this as completed Jul 7, 2016
@srio
Copy link
Author

srio commented Jul 7, 2016

Thanks a lot Tom.

I'm trying to reinstall xraylib. One question (I already got your answer
but do not remember). How I create the "configure" script that is not
present in github? (I usually download xraylib from
http://lvserver.ugent.be/xraylib/xraylib-3.1.0.tar.gz )

Thanks a lot!!

Manolo

On 07/06/2016 03:03 PM, Tom Schoonjans wrote:

Hi Manolo,

I am currently working on this and work should be finished soon.

Just to be clear (I had to use wikipedia
https://en.wikipedia.org/wiki/Molar_mass for this...): you are
referring to /molar mass/ right (in g/mol)? /Molecular mass/ is the
mass of a particular molecule and varies according to isotopes present
in it and (currently) cannot be provided by xraylib.

Best,

Tom


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqKz1lvMb28aDr_SeZpW74FY-kKk3Nks5qS6eugaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

@tschoonj
Copy link
Owner

tschoonj commented Jul 7, 2016

autoreconf -i

@srio
Copy link
Author

srio commented Jul 7, 2016

Thanks Tom. I get some errors, any hint? :

First error (ubuntu 14.04):

chac:~/Oasys/OASYS_VE/xraylib % autoreconf -i
configure.ac:45: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

I do it again:

chac:~/Oasys/OASYS_VE/xraylib % autoreconf -i
configure.ac:39: installing 'build-aux/ar-lib'
configure.ac:33: installing 'build-aux/compile'
configure.ac:19: installing 'build-aux/config.guess'
configure.ac:19: installing 'build-aux/config.sub'
configure.ac:18: installing 'build-aux/install-sh'
configure.ac:18: installing 'build-aux/missing'
example/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
fortran/Makefile.am:17: error: Libtool library used but 'LIBTOOL' is
undefined
fortran/Makefile.am:17: The usual way to define 'LIBTOOL' is to add
'LT_INIT'
fortran/Makefile.am:17: to 'configure.ac' and run 'aclocal' and
'autoconf' again.
fortran/Makefile.am:17: If 'LT_INIT' is in 'configure.ac', make sure
fortran/Makefile.am:17: its definition is in aclocal's search path.
idl/Makefile.am:25: error: Libtool library used but 'LIBTOOL' is undefined
idl/Makefile.am:25: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
idl/Makefile.am:25: to 'configure.ac' and run 'aclocal' and 'autoconf'
again.
idl/Makefile.am:25: If 'LT_INIT' is in 'configure.ac', make sure
idl/Makefile.am:25: its definition is in aclocal's search path.
lua/Makefile.am:15: error: Libtool library used but 'LIBTOOL' is undefined
lua/Makefile.am:15: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
lua/Makefile.am:15: to 'configure.ac' and run 'aclocal' and 'autoconf'
again.
lua/Makefile.am:15: If 'LT_INIT' is in 'configure.ac', make sure
lua/Makefile.am:15: its definition is in aclocal's search path.
perl/Makefile.am:16: error: Libtool library used but 'LIBTOOL' is undefined
perl/Makefile.am:16: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
perl/Makefile.am:16: to 'configure.ac' and run 'aclocal' and
'autoconf' again.
perl/Makefile.am:16: If 'LT_INIT' is in 'configure.ac', make sure
perl/Makefile.am:16: its definition is in aclocal's search path.
php/Makefile.am:15: error: Libtool library used but 'LIBTOOL' is undefined
php/Makefile.am:15: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
php/Makefile.am:15: to 'configure.ac' and run 'aclocal' and 'autoconf'
again.
php/Makefile.am:15: If 'LT_INIT' is in 'configure.ac', make sure
php/Makefile.am:15: its definition is in aclocal's search path.
python/Makefile.am:17: error: Libtool library used but 'LIBTOOL' is
undefined
python/Makefile.am:17: The usual way to define 'LIBTOOL' is to add
'LT_INIT'
python/Makefile.am:17: to 'configure.ac' and run 'aclocal' and
'autoconf' again.
python/Makefile.am:17: If 'LT_INIT' is in 'configure.ac', make sure
python/Makefile.am:17: its definition is in aclocal's search path.
python/Makefile.am:27: installing 'build-aux/py-compile'
ruby/Makefile.am:15: error: Libtool library used but 'LIBTOOL' is undefined
ruby/Makefile.am:15: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
ruby/Makefile.am:15: to 'configure.ac' and run 'aclocal' and
'autoconf' again.
ruby/Makefile.am:15: If 'LT_INIT' is in 'configure.ac', make sure
ruby/Makefile.am:15: its definition is in aclocal's search path.
src/Makefile.am:20: error: Libtool library used but 'LIBTOOL' is undefined
src/Makefile.am:20: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
src/Makefile.am:20: to 'configure.ac' and run 'aclocal' and 'autoconf'
again.
src/Makefile.am:20: If 'LT_INIT' is in 'configure.ac', make sure
src/Makefile.am:20: its definition is in aclocal's search path.
autoreconf: automake failed with exit status: 1

Now trying configure:

chac:~/Oasys/OASYS_VE/xraylib % ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define EXTENSIONS... yes
checking for strndup... yes
checking for strdup... yes
checking for ar... ar
checking the archiver (ar) interface... ar
./configure: line 5085: syntax error near unexpected token 2.0.0' ./configure: line 5085:LT_PREREQ(2.0.0)'

On 07/07/2016 04:32 PM, Tom Schoonjans wrote:

|autoreconf -i|


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqK1oa4Nml0lAxoM0dPe_cOa8IlkvUks5qTQ4ZgaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

@tschoonj
Copy link
Owner

tschoonj commented Jul 7, 2016

You have to install libtool first with apt-get

@srio
Copy link
Author

srio commented Jul 7, 2016

Got it. I need to install (ubuntu 14.04):

On 07/07/2016 04:32 PM, Tom Schoonjans wrote:

|autoreconf -i|


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqK1oa4Nml0lAxoM0dPe_cOa8IlkvUks5qTQ4ZgaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

@srio
Copy link
Author

srio commented Jul 7, 2016

It works! Beautiful, thanks a lot.

On 07/07/2016 04:51 PM, Tom Schoonjans wrote:

You have to install |libtool| first with |apt-get|


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#35 (comment), or
mute the thread
https://github.com/notifications/unsubscribe/AAeqK-9-ytTNE3y2-vB3EECmhZazux0Mks5qTRJXgaJpZM4I6xww.

Manuel Sanchez del Rio
European Synchrotron Radiation Facility
BP 220, 38043 Grenoble-Cedex 9 (France)
email: srio@esrf.eu
Tel +33-476 882513 Fax +33-476 882542 http://www.esrf.eu

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