Re: [gmx-users] Reading XTC files from fortran90

2007-10-01 Thread Tsjerk Wassenaar
Hi Jones,

 I can already do that for .xtc files. Seems that, unfortunatelly, the least
 odd way is to find a way to get the last pieces of information needed
 (atomic charges and masses) from the .tpr files. Other ways would include
 lots of file translations, or adaptions in the codes themselves which would
 lead to non-generality of it.


I'd say the easiest is to get into gmx_editconf and look at the option
-grasp or -mead which put the atomic charge and vdw radius in the
b-factor and occupancy field of a .pdb file when given a .tpr file.
It's trivial to make it write charges and masses instead. Would also
be a good first exercise for C/Gromacs :p

 Sorry for not noticing the box shape in the .xtc file. I passed over that
 integer in the reading, dismissing it as only some kind of old feature
 useless now. Really sorry for that point.


I'm not sure what you mean with shape and that integer. There's
nothing much redundant in the .xtc file and there are no integers
having to do with box shape. In fact, there is no shape...

Cheers,

Tsjerk

-- 
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-10-01 Thread Mark Abraham

Jones de Andrade wrote:

Hi Mark.

Wait a second, you mean that editconf would allow me to have both 
charges and masses on a .pdb file directly from command line (having 
other matters asking for my presence absolutelly now, so please forgive 
me if this message becomes somehow strange)


No, nobody said that. Please read free advice carefully, since there's 
no better way to annoy the giver than to not be understood when they've 
expressed an idea clearly.


So, I would have atom names, 


Yes

number of molecules types, 


No

number of molecules of each type, 


No

 number of atoms of each molecule type,

No

coordinates, 


Yes

charges

Yes, if you use the right editconf option

and masses on a .pdb file, correct?

No.

But, still, where could I then easilly get the box type and sizes, as 
well as simulation times?


The .xtc file, the .edr file...


Thanks a lot for all the help, and sorry for this punctual hurry here.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-10-01 Thread Mark Abraham

Jones de Andrade wrote:

Hi all.

First: ok, lets stop the C X Fortran issue here: this kind of subject 
always look like a ready to become flamme war one.  ;) Sorry for 
rising the subject a bit in the previous email.


The point is: when this project started, almost 4 years ago, I already 
knew very well frotran90, and gromacs was not still in the sight for us, 
but fortran codes like mdynamix still were. So, at that point it was 
pointless to learn C.


Three years later, at the end of the project, gromacs becomes all-day 
tool, and thousands of lines of code already written and optimized for 
fortran90 also are standard here.  ;)  That's the reason why it would be 
crazzyness to try to translate everything to C. So, the aim here is to 
just change the reading procedures, to read the information needed from 
gromacs. One way would be to rewrite everything on fortran, and that 
will be painfull. The other is to link to the objects and libraries in 
the proper way.


If everything goes smoothly here, the next project I get in will include 
two years of implementing a few extra features inside gromacs code. 
Then, of course, learning C will be a must, and the first thing to be 
done.  :)


Fine :-) That's the sort of reason that you'd want to have to keep 
Fortran for the present problem.


I can already do that for .xtc files. Seems that, unfortunatelly, the 
least odd way is to find a way to get the last pieces of information 
needed (atomic charges and masses) from the .tpr files. Other ways would 
include lots of file translations, or adaptions in the codes themselves 
which would lead to non-generality of it.


Like I said, the masses are easy to infer from the atom names. You don't 
need to read them... you know anything starting with N has mass 14.011 
(or whatever it is). Or you can read share/gromacs/top/atommass.dat to 
do the lookups.


Sorry for not noticing the box shape in the .xtc file. I passed over 
that integer in the reading, dismissing it as only some kind of old 
feature useless now. Really sorry for that point.


Which files should I look for in order to get the proper way of reading 
masses and atomic charges from a .tpr file? And which objects will need 
to be included in the linking stage? Is there any outsider program 
(fortran would be perfect, but I don't think it will be too common too) 
that works directly with the .tpr files?


tpxio.c will have relevant functions. Or, follow the execution of mdrun 
until it reads the .tpr file and see how it handles these things.


If you use the editconf suggestion to get charges, you don't need to 
read a .tpr file.


Thanks a lot everybody for all the help, and sorry for taking so much of 
your time,


Help is fine, but repeating myself is tiresome :-)

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-10-01 Thread Jones de Andrade
Hi all.

First of all, I would really want want to apologize if I somehow
missunderstood any previous message from anyone, and made myself a bit
annoying because of this fact.

Second, I would like to say thanks again to eferybody for all help in these
matters.

On 10/1/07, Tsjerk Wassenaar [EMAIL PROTECTED] wrote:

 I'd say the easiest is to get into gmx_editconf and look at the option
 -grasp or -mead which put the atomic charge and vdw radius in the
 b-factor and occupancy field of a .pdb file when given a .tpr file.
 It's trivial to make it write charges and masses instead. Would also
 be a good first exercise for C/Gromacs :p


Good idea! Even I don't choose to sitck with many file type conversions for
the sake of the disk space, that specific program now seems to be a good
start to learn explicitly how all the topology data is passed from one place
to the other. And that would help me to learn how to read the topology files
(since it seems to be only a matter now of reading atomic charges and
masses).

I'm not sure what you mean with shape and that integer. There's
 nothing much redundant in the .xtc file and there are no integers
 having to do with box shape. In fact, there is no shape...


Well, by shape I meant cubic and truncated octahedral, for example.
But the integer was my mistake (old dlpoly adaptions that just came to my
mind, together with the first integer in the header of all xdrf files and
that I could not find a proper meaning at time), thought for a moment that
the first integer in the .xtc header mean the shape of the box. Just
played a bit later with the manual and recorded that it's only the 9 box
parameters that are important to define that within gromacs. Sorry for that
mistake.

  So, I would have atom names,

 Yes


From .gro or .pdb file in the standard way.

 number of molecules types,
 No
  number of molecules of each type,
 No
  number of atoms of each molecule type,
 No


I think those three can become yes in a really easy way: some kind of state
machine would easily do the trick and count them properly.

 coordinates,
 Yes


From .xtc or .pdb file.

charges
 Yes, if you use the right editconf option
 and masses on a .pdb file, correct?
 No.


Only modifying editconf to print those in a adapted .pdb file, throw a file
conversion and much disk space wasted. Or I can learn exactly from
editconf how to read it from .tpr or .top (I guess it takes from these files
the atomic charges when needed) and adapt into my codes.

 But, still, where could I then easilly get the box type and sizes, as
  well as simulation times?
 The .xtc file, the .edr file...


So .xtc, since its already under control.  ;)

Fine :-) That's the sort of reason that you'd want to have to keep
 Fortran for the present problem.


So we agree here. Three ways so: converting the trajectories to another
format (ugly for my taste, and too much disk space needed), linking to a
library (like done in reading .xtc files) or linking to an object. ;)

Like I said, the masses are easy to infer from the atom names. You don't
 need to read them... you know anything starting with N has mass 14.011
 (or whatever it is). Or you can read share/gromacs/top/atommass.dat to
 do the lookups.


That is the kind of stuff I really don't like. For instance, all codes I
written for all this time long aimed at being abolutelly general. So, if
anything starting by N means nitrogen, how to deal when someone using the
same program (even in the group) chooses to say that Nb is a different type
of nitrogen while another says it is niobium? The program must be able to
deal with such problems that arise (and believe, I've already got locked at
this one once, and that's why I don't go such a way anymore), and the only
way I see it doing so is directly reading the topologies, instead of
knowing it in advance.  ;)

 Sorry for not noticing the box shape in the .xtc file. I passed over
  that integer in the reading, dismissing it as only some kind of old
  feature useless now. Really sorry for that point.
 
  Which files should I look for in order to get the proper way of reading
  masses and atomic charges from a .tpr file? And which objects will need
  to be included in the linking stage? Is there any outsider program
  (fortran would be perfect, but I don't think it will be too common too)
  that works directly with the .tpr files?

 tpxio.c will have relevant functions. Or, follow the execution of mdrun
 until it reads the .tpr file and see how it handles these things.


Thanks a lot! That final information will be really usefull for me to sort
out how to properly link those routines in my codes.  :)

If you use the editconf suggestion to get charges, you don't need to
 read a .tpr file.


But then or I get locked into the problem of generality of having too much
disk usage. But that idea will be also usefull to learn how to read the
masses and charges from .tpr files.

 Thanks a lot everybody for all the help, and sorry for taking so much 

Re: [gmx-users] Reading XTC files from fortran90

2007-10-01 Thread Mark Abraham

Jones de Andrade wrote:



 From .gro or .pdb file in the standard way.

  number of molecules types,
No
  number of molecules of each type,
No
  number of atoms of each molecule type,
No


I think those three can become yes in a really easy way: some kind of 
state machine would easily do the trick and count them properly.


Yes, but now you have to infer molecule changes from residue name 
changes, which is doable, but messy.



  coordinates,
Yes


 From .xtc or .pdb file.

charges
Yes, if you use the right editconf option
and masses on a .pdb file, correct?
No.


Only modifying editconf to print those in a adapted .pdb file, throw a 
file conversion and much disk space wasted. Or I can learn exactly 
from editconf how to read it from .tpr or .top (I guess it takes from 
these files the atomic charges when needed) and adapt into my codes.


The point of editconf is to feed your system *one* pdb structure with 
atom names, charges and/or whatever - it would be easy to modify 
editconf to write masses in one column and charges in another. You rely 
on the user to then supply a .xtc file that corresponds to that .pdb, in 
the same way that most of the GROMACS analysis tools accept an .xtc and 
various subsets of the possible structure files. You don't convert your 
.xtc to a .pdb trajectory, because that would be immensely wasteful, and 
the static information of the names, masses and charges doesn't vary 
with time under the MD approximation.



If you use the editconf suggestion to get charges, you don't need to
read a .tpr file.


But then or I get locked into the problem of generality of having too 
much disk usage. But that idea will be also usefull to learn how to read 
the masses and charges from .tpr files.


Easier is to hack editconf as described above.

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Tsjerk Wassenaar
Hi Jones,

You probably only need to read the atoms and such from a .pdb or .gro
file, unless you really want to have topology information (bondedness,
molecule definitions, etc). Then you do have to read the topology file
or a .tpr file directly. Don't recall having seen the fortran
implementations for these... But maybe Bert knows better.

Just one note... There's no shape in PBC. The lattice vectors are all
there is, and these are stored in the .xtc file (as you already know).

Cheers,

Tsjerk

On 9/30/07, Jones de Andrade [EMAIL PROTECTED] wrote:
 Hi Bert.

 Thanks a lot for the help. I've found the mistakes, one programming minor
 issue and a compiler configuration a bit of hidden in the config files.
 Old time mistakes just choose to arise at its worst moments. :)

 At the moment, I already can read the coordinates, number of atoms, box
 coordinates, step number, simulation time and precision. I guess this is all
 what is stored in the .xtc files themselves, am I right?

  I have so one extra question: I guess that extra information as atom names,
 number of molecules of type X, number of molecular types, box and pbc
 shape and atomic charges and masses are *not* stored in the .xtc files, am
 I right? Ok, the integer stuff (number of molecules of type X, number of
 molecular types, box and pbc) could be written in a special .ndx file, but
 that would, by all means, looks at least diselegant.

 If so, the only two possible ways of getting them is reading or the .top and
 .itp files correctly, or to read the .tpr file, correct? Now, is there any
 guideline available on how to deal with those files?

 Thanks a lot everybody for all the help.


 Sincerally yours,

 Jones

 On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:
  On Sat, 29 Sep 2007, Jones de Andrade wrote:
 
   Hi Bert.
  
   Thank you for the prompt answer.
  
   Just did as instructed, but got the following:
  
   CruNumMac src/own/B/9/xtc 286% ifort xtciof.f90 test_xtc.f90
   -L/home/johannes/src/own/B/9/xtc/xtc/ -lxrdf -lg2c
   IPO link: can not find -lxrdf
 
 
  well, apparently the path you specify with -L does not contain a
  libxdrf.a
 
  the way you called it the compiler expects it to be located here:
  /home/johannes/src/own/B/9/xtc/xtc/libxdrf.a
 
  also, IIRC, the xtcio stuff is already linked into the libxdrf.a, so no
  need to include it again.
 
 
   ifort: error: problem during multi-file optimization compilation (code
 1)
  
   Looks better, in the sense that the number of error messages was
 reduced.
   But still doesn't accept to link to the xrdf library.
  
   Tried that with and without re-make of the library (strange fact that
 the
   SGI arch is to be used in linux) and also tried to say -llibxrdf instead
 of
   -lxrdf. Nothing worked.
  
   Have you or someone come across such an error before? Any clue of what
 can
   possibly be going wrong?
  
   Thanks a lot in advance...
  
   Sincerally yours,
  
   Jones
  
   On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:
   
Hi,
   
try:
   
download
http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz
   
(and optionally issue a 'make' in the xtc directory after unpacking)
   
in the linking stage, use something like
   
ifort -blabla -lxdrf -L/wherever/xtc -lg2c
   
your smalll test code looks OK apart from the fact that I don't know
 what
happens if you readwrite from the same file.
   
Bert
   
  
 
 
  Bert
 
 
 
  
  Bert de Groot, PhD
 
  Max Planck Institute for Biophysical Chemistry
  Computational biomolecular dynamics group
  Am Fassberg 11
  37077 Goettingen, Germany
 
  tel: +49-551-2012308, fax: +49-551-2012302
 
  http://www.mpibpc.gwdg.de/groups/de_groot
  ___
  gmx-users mailing list gmx-users@gromacs.org
  http://www.gromacs.org/mailman/listinfo/gmx-users
  Please search the archive at http://www.gromacs.org/search before posting!
  Please don't post (un)subscribe requests to the list. Use the
  www interface or send it to [EMAIL PROTECTED] .
  Can't post? Read
 http://www.gromacs.org/mailing_lists/users.php
 


 ___
 gmx-users mailing listgmx-users@gromacs.org
 http://www.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to [EMAIL PROTECTED]
 Can't post? Read
 http://www.gromacs.org/mailing_lists/users.php



-- 
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't 

Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Jones de Andrade
Hi Tsjerk.

Thanks for the prompt answer.

Good idea, I can take the atom names from a .gro file, nad, probably some
strange algorithm can also get the number of atoms per molecule and number
of molecules from there, am I right? That would help a lot.

But: I'll still be unable to get atomic masses and point charges. No to
mention the box shape. :( And I'll need a way to read these parameters too,
unless I begin to write all them in a really awfull and strange index file.

From what I can understand on the file logistics of gromacs, these
information are only stored in the whole .top .itp .atp .rtp structure of
files or, in a condensed form, in the .tpr file. Is that right?

Thanks a lot for all the information and help!

Sincerally yours,

Jones

On 9/30/07, Tsjerk Wassenaar [EMAIL PROTECTED] wrote:

 Hi Jones,

 You probably only need to read the atoms and such from a .pdb or .gro
 file, unless you really want to have topology information (bondedness,
 molecule definitions, etc). Then you do have to read the topology file
 or a .tpr file directly. Don't recall having seen the fortran
 implementations for these... But maybe Bert knows better.

 Just one note... There's no shape in PBC. The lattice vectors are all
 there is, and these are stored in the .xtc file (as you already know).

 Cheers,

 Tsjerk

 On 9/30/07, Jones de Andrade [EMAIL PROTECTED] wrote:
  Hi Bert.
 
  Thanks a lot for the help. I've found the mistakes, one programming
 minor
  issue and a compiler configuration a bit of hidden in the config
 files.
  Old time mistakes just choose to arise at its worst moments. :)
 
  At the moment, I already can read the coordinates, number of atoms, box
  coordinates, step number, simulation time and precision. I guess this is
 all
  what is stored in the .xtc files themselves, am I right?
 
   I have so one extra question: I guess that extra information as atom
 names,
  number of molecules of type X, number of molecular types, box and pbc
  shape and atomic charges and masses are *not* stored in the .xtc
 files, am
  I right? Ok, the integer stuff (number of molecules of type X, number
 of
  molecular types, box and pbc) could be written in a special .ndx file,
 but
  that would, by all means, looks at least diselegant.
 
  If so, the only two possible ways of getting them is reading or the .top
 and
  .itp files correctly, or to read the .tpr file, correct? Now, is there
 any
  guideline available on how to deal with those files?
 
  Thanks a lot everybody for all the help.
 
 
  Sincerally yours,
 
  Jones
 
  On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:
   On Sat, 29 Sep 2007, Jones de Andrade wrote:
  
Hi Bert.
   
Thank you for the prompt answer.
   
Just did as instructed, but got the following:
   
CruNumMac src/own/B/9/xtc 286% ifort xtciof.f90 test_xtc.f90
-L/home/johannes/src/own/B/9/xtc/xtc/ -lxrdf -lg2c
IPO link: can not find -lxrdf
  
  
   well, apparently the path you specify with -L does not contain a
   libxdrf.a
  
   the way you called it the compiler expects it to be located here:
   /home/johannes/src/own/B/9/xtc/xtc/libxdrf.a
  
   also, IIRC, the xtcio stuff is already linked into the libxdrf.a, so
 no
   need to include it again.
  
  
ifort: error: problem during multi-file optimization compilation
 (code
  1)
   
Looks better, in the sense that the number of error messages was
  reduced.
But still doesn't accept to link to the xrdf library.
   
Tried that with and without re-make of the library (strange fact
 that
  the
SGI arch is to be used in linux) and also tried to say -llibxrdf
 instead
  of
-lxrdf. Nothing worked.
   
Have you or someone come across such an error before? Any clue of
 what
  can
possibly be going wrong?
   
Thanks a lot in advance...
   
Sincerally yours,
   
Jones
   
On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:

 Hi,

 try:

 download
 http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz

 (and optionally issue a 'make' in the xtc directory after
 unpacking)

 in the linking stage, use something like

 ifort -blabla -lxdrf -L/wherever/xtc -lg2c

 your smalll test code looks OK apart from the fact that I don't
 know
  what
 happens if you readwrite from the same file.

 Bert

   
  
  
   Bert
  
  
  
   
   Bert de Groot, PhD
  
   Max Planck Institute for Biophysical Chemistry
   Computational biomolecular dynamics group
   Am Fassberg 11
   37077 Goettingen, Germany
  
   tel: +49-551-2012308, fax: +49-551-2012302
  
   http://www.mpibpc.gwdg.de/groups/de_groot
   ___
   gmx-users mailing list gmx-users@gromacs.org
   http://www.gromacs.org/mailman/listinfo/gmx-users
   Please search the archive at http://www.gromacs.org/search before
 posting!
   Please don't post (un)subscribe requests to 

Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread David van der Spoel

Mark Abraham wrote:

Jones de Andrade wrote:

Hi Tsjerk.

Thanks for the prompt answer.

Good idea, I can take the atom names from a .gro file, nad, probably 
some strange algorithm can also get the number of atoms per molecule 
and number of molecules from there, am I right? That would help a lot.


Simplest is to write a parser for a gmxdump of a .tpr file. This is what 
Perl was made for. If you're constrained to use Fortran for your 
analysis program, then developing an intermediate file format for it to 
parse might be worthwhile.


But: I'll still be unable to get atomic masses and point charges. No 
to mention the box shape. :( And I'll need a way to read these 
parameters too, unless I begin to write all them in a really awfull 
and strange index file.


 From what I can understand on the file logistics of gromacs, these 
information are only stored in the whole .top .itp .atp .rtp 
structure of files or, in a condensed form, in the .tpr file. Is 
that right?


Yeah. Writing something to do the lookups in the .*tp files which grompp 
does to form the .tpr is asking for trouble. Do the lookup in the .tpr 
file. The .edr file has box dimensions, of course.


All this makes it sound like you should be dropping Fortran and writing 
in C or Perl!


the box is in the xtc file, if you need the atom names a corresponding 
pdb or gro file should do the trick. don't try to read tpr files or 
gmxdumps of it, that's a complete waste of time. you can e.g. use 
editconf to dump a pdb file with charges in the b-factor fields.


And indeed, using fortran will make your life quite miserable for these 
kind of things.


--
David van der Spoel, Ph.D.
Molec. Biophys. group, Dept. of Cell  Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205. Fax: +4618511755.
[EMAIL PROTECTED]   [EMAIL PROTECTED]   http://folding.bmc.uu.se
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Mark Abraham

David van der Spoel wrote:

the box is in the xtc file, if you need the atom names a corresponding 
pdb or gro file should do the trick. don't try to read tpr files or 
gmxdumps of it, that's a complete waste of time. you can e.g. use 
editconf to dump a pdb file with charges in the b-factor fields.


Yes, I now see that editconf has that ability, and Jones can fill in the 
masses himself, so he doesn't need to parse the .tpr at all.


And indeed, using fortran will make your life quite miserable for these 
kind of things.


:-)

Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Jones de Andrade
Hi all.

Firstly, thanks a lot for all the help!  ;)

First, about reading the atom-names from a .gro file, I don't think it would
so painfull. It would look like a bit to having a well programmed state
machine in the code.

About the language, yes, I admit that bor reads and writes, fortran is
miserable. But for calculations (like the inner codes of a certain program?
;)  only joking...  :D  ) if one chooses not to go by assembly, fortran is
still the way, specially if you consider the extra simplicity of fortran90.
Anyway, I would not even consider re-writing the reads in fortran, but would
love to consider to link to a library (like in reading .xtc files) or
gromacs compiled object just to read it correctly.  ;)

About the box, is it on the .xtc file? Could not get the proper variable of
it, could someone give me some infor which is that?

Finally: yes, I considered changing everything to a .pdb file, despite the
file size and the fact that I completelly forgot it could have the charges
on it. But even so I would still have problems with the atomic masses, am I
right? Or can I put that on a standard pdb file with gromacs programs?

Again, tahnks a lot for all help in advance!

Sincerally yours,

Jones

On 9/30/07, David van der Spoel [EMAIL PROTECTED] wrote:

 Mark Abraham wrote:
  Jones de Andrade wrote:
  Hi Tsjerk.
 
  Thanks for the prompt answer.
 
  Good idea, I can take the atom names from a .gro file, nad, probably
  some strange algorithm can also get the number of atoms per molecule
  and number of molecules from there, am I right? That would help a lot.
 
  Simplest is to write a parser for a gmxdump of a .tpr file. This is what
  Perl was made for. If you're constrained to use Fortran for your
  analysis program, then developing an intermediate file format for it to
  parse might be worthwhile.
 
  But: I'll still be unable to get atomic masses and point charges. No
  to mention the box shape. :( And I'll need a way to read these
  parameters too, unless I begin to write all them in a really awfull
  and strange index file.
 
   From what I can understand on the file logistics of gromacs, these
  information are only stored in the whole .top .itp .atp .rtp
  structure of files or, in a condensed form, in the .tpr file. Is
  that right?
 
  Yeah. Writing something to do the lookups in the .*tp files which grompp
  does to form the .tpr is asking for trouble. Do the lookup in the .tpr
  file. The .edr file has box dimensions, of course.
 
  All this makes it sound like you should be dropping Fortran and writing
  in C or Perl!
 
 the box is in the xtc file, if you need the atom names a corresponding
 pdb or gro file should do the trick. don't try to read tpr files or
 gmxdumps of it, that's a complete waste of time. you can e.g. use
 editconf to dump a pdb file with charges in the b-factor fields.

 And indeed, using fortran will make your life quite miserable for these
 kind of things.

 --
 David van der Spoel, Ph.D.
 Molec. Biophys. group, Dept. of Cell  Molec. Biol., Uppsala University.
 Box 596, 75124 Uppsala, Sweden. Phone:  +46184714205. Fax: +4618511755.
 [EMAIL PROTECTED][EMAIL PROTECTED]   http://folding.bmc.uu.se
 ___
 gmx-users mailing listgmx-users@gromacs.org
 http://www.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to [EMAIL PROTECTED]
 Can't post? Read http://www.gromacs.org/mailing_lists/users.php

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Mark Abraham

Jones de Andrade wrote:

Hi all.

Firstly, thanks a lot for all the help!  ;)

First, about reading the atom-names from a .gro file, I don't think it 
would so painfull. It would look like a bit to having a well 
programmed state machine in the code.


About the language, yes, I admit that bor reads and writes, fortran is 
miserable. But for calculations (like the inner codes of a certain 
program?  ;)  only joking...  :D  ) if one chooses not to go by 
assembly, fortran is still the way, specially if you consider the extra 
simplicity of fortran90. Anyway, I would not even consider re-writing 
the reads in fortran, but would love to consider to link to a library 
(like in reading .xtc files) or gromacs compiled object just to read it 
correctly.  ;)


So now you have to weigh up the amount of time your computer will be 
doing calculations (and then how much Fortran gains against the 
alternatives) vs the amount of your time you'll spend writing and 
debugging the I/O routines :-) Short of doing calculations whose cost is 
on the order of more MD simulations, I'd be amazed if Fortran comes out 
ahead.


About the box, is it on the .xtc file? Could not get the proper variable 
of it, could someone give me some infor which is that?


Check out the C I/O routines?

Finally: yes, I considered changing everything to a .pdb file, despite 
the file size and the fact that I completelly forgot it could have the 
charges on it. But even so I would still have problems with the atomic 
masses, am I right? Or can I put that on a standard pdb file with 
gromacs programs?


You've got atom names in the pdb, so look the masses up in your own 
code. Or post-process the pdb file to put masses in whichever of 
occupancy and B-factor doesn't have charges.


Mark
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]

Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-09-30 Thread Jones de Andrade
Hi Mark.

Wait a second, you mean that editconf would allow me to have both charges
and masses on a .pdb file directly from command line (having other matters
asking for my presence absolutelly now, so please forgive me if this message
becomes somehow strange)

So, I would have atom names, number of molecules types, number of molecules
of each type, number of atoms of each molecule type, coordinates, charges
and masses on a .pdb file, correct?

But, still, where could I then easilly get the box type and sizes, as well
as simulation times?

Thanks a lot for all the help, and sorry for this punctual hurry here.

Sincerally yours,

Jones

On 9/30/07, Mark Abraham [EMAIL PROTECTED] wrote:

 David van der Spoel wrote:

  the box is in the xtc file, if you need the atom names a corresponding
  pdb or gro file should do the trick. don't try to read tpr files or
  gmxdumps of it, that's a complete waste of time. you can e.g. use
  editconf to dump a pdb file with charges in the b-factor fields.

 Yes, I now see that editconf has that ability, and Jones can fill in the
 masses himself, so he doesn't need to parse the .tpr at all.

  And indeed, using fortran will make your life quite miserable for these
  kind of things.

 :-)

 Mark
 ___
 gmx-users mailing listgmx-users@gromacs.org
 http://www.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to [EMAIL PROTECTED]
 Can't post? Read http://www.gromacs.org/mailing_lists/users.php

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] Reading XTC files from fortran90

2007-09-29 Thread Jones de Andrade
Hi Bert.

Thank you for the prompt answer.

Just did as instructed, but got the following:

CruNumMac src/own/B/9/xtc 286% ifort xtciof.f90 test_xtc.f90
-L/home/johannes/src/own/B/9/xtc/xtc/ -lxrdf -lg2c
IPO link: can not find -lxrdf
ifort: error: problem during multi-file optimization compilation (code 1)

Looks better, in the sense that the number of error messages was reduced.
But still doesn't accept to link to the xrdf library.

Tried that with and without re-make of the library (strange fact that the
SGI arch is to be used in linux) and also tried to say -llibxrdf instead of
-lxrdf. Nothing worked.

Have you or someone come across such an error before? Any clue of what can
possibly be going wrong?

Thanks a lot in advance...

Sincerally yours,

Jones

On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:

 Hi,

 try:

 download
 http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz

 (and optionally issue a 'make' in the xtc directory after unpacking)

 in the linking stage, use something like

 ifort -blabla -lxdrf -L/wherever/xtc -lg2c

 your smalll test code looks OK apart from the fact that I don't know what
 happens if you readwrite from the same file.

 Bert

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] Reading XTC files from fortran90

2007-09-29 Thread Bert de Groot
On Sat, 29 Sep 2007, Jones de Andrade wrote:

 Hi Bert.

 Thank you for the prompt answer.

 Just did as instructed, but got the following:

 CruNumMac src/own/B/9/xtc 286% ifort xtciof.f90 test_xtc.f90
 -L/home/johannes/src/own/B/9/xtc/xtc/ -lxrdf -lg2c
 IPO link: can not find -lxrdf


well, apparently the path you specify with -L does not contain a
libxdrf.a

the way you called it the compiler expects it to be located here:
/home/johannes/src/own/B/9/xtc/xtc/libxdrf.a

also, IIRC, the xtcio stuff is already linked into the libxdrf.a, so no
need to include it again.


 ifort: error: problem during multi-file optimization compilation (code 1)

 Looks better, in the sense that the number of error messages was reduced.
 But still doesn't accept to link to the xrdf library.

 Tried that with and without re-make of the library (strange fact that the
 SGI arch is to be used in linux) and also tried to say -llibxrdf instead of
 -lxrdf. Nothing worked.

 Have you or someone come across such an error before? Any clue of what can
 possibly be going wrong?

 Thanks a lot in advance...

 Sincerally yours,

 Jones

 On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:
 
  Hi,
 
  try:
 
  download
  http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz
 
  (and optionally issue a 'make' in the xtc directory after unpacking)
 
  in the linking stage, use something like
 
  ifort -blabla -lxdrf -L/wherever/xtc -lg2c
 
  your smalll test code looks OK apart from the fact that I don't know what
  happens if you readwrite from the same file.
 
  Bert
 



Bert




Bert de Groot, PhD

Max Planck Institute for Biophysical Chemistry
Computational biomolecular dynamics group
Am Fassberg 11
37077 Goettingen, Germany

tel: +49-551-2012308, fax: +49-551-2012302

http://www.mpibpc.gwdg.de/groups/de_groot
___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php


Re: [gmx-users] Reading XTC files from fortran90

2007-09-29 Thread Jones de Andrade
Hi Bert.

Thanks a lot for the help. I've found the mistakes, one programming minor
issue and a compiler configuration a bit of hidden in the config files.
Old time mistakes just choose to arise at its worst moments. :)

At the moment, I already can read the coordinates, number of atoms, box
coordinates, step number, simulation time and precision. I guess this is all
what is stored in the .xtc files themselves, am I right?

I have so one extra question: I guess that extra information as atom names,
number of molecules of type X, number of molecular types, box and pbc
shape and atomic charges and masses are *not* stored in the .xtc files, am
I right? Ok, the integer stuff (number of molecules of type X, number of
molecular types, box and pbc) could be written in a special .ndx file, but
that would, by all means, looks at least diselegant.

If so, the only two possible ways of getting them is reading or the .top and
.itp files correctly, or to read the .tpr file, correct? Now, is there any
guideline available on how to deal with those files?

Thanks a lot everybody for all the help.

Sincerally yours,

Jones

On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:

 On Sat, 29 Sep 2007, Jones de Andrade wrote:

  Hi Bert.
 
  Thank you for the prompt answer.
 
  Just did as instructed, but got the following:
 
  CruNumMac src/own/B/9/xtc 286% ifort xtciof.f90 test_xtc.f90
  -L/home/johannes/src/own/B/9/xtc/xtc/ -lxrdf -lg2c
  IPO link: can not find -lxrdf


 well, apparently the path you specify with -L does not contain a
 libxdrf.a

 the way you called it the compiler expects it to be located here:
 /home/johannes/src/own/B/9/xtc/xtc/libxdrf.a

 also, IIRC, the xtcio stuff is already linked into the libxdrf.a, so no
 need to include it again.


  ifort: error: problem during multi-file optimization compilation (code
 1)
 
  Looks better, in the sense that the number of error messages was
 reduced.
  But still doesn't accept to link to the xrdf library.
 
  Tried that with and without re-make of the library (strange fact that
 the
  SGI arch is to be used in linux) and also tried to say -llibxrdf instead
 of
  -lxrdf. Nothing worked.
 
  Have you or someone come across such an error before? Any clue of what
 can
  possibly be going wrong?
 
  Thanks a lot in advance...
 
  Sincerally yours,
 
  Jones
 
  On 9/29/07, Bert de Groot [EMAIL PROTECTED] wrote:
  
   Hi,
  
   try:
  
   download
   http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz
  
   (and optionally issue a 'make' in the xtc directory after unpacking)
  
   in the linking stage, use something like
  
   ifort -blabla -lxdrf -L/wherever/xtc -lg2c
  
   your smalll test code looks OK apart from the fact that I don't know
 what
   happens if you readwrite from the same file.
  
   Bert
  
 


 Bert



 
 Bert de Groot, PhD

 Max Planck Institute for Biophysical Chemistry
 Computational biomolecular dynamics group
 Am Fassberg 11
 37077 Goettingen, Germany

 tel: +49-551-2012308, fax: +49-551-2012302

 http://www.mpibpc.gwdg.de/groups/de_groot
 ___
 gmx-users mailing listgmx-users@gromacs.org
 http://www.gromacs.org/mailman/listinfo/gmx-users
 Please search the archive at http://www.gromacs.org/search before posting!
 Please don't post (un)subscribe requests to the list. Use the
 www interface or send it to [EMAIL PROTECTED]
 Can't post? Read http://www.gromacs.org/mailing_lists/users.php

___
gmx-users mailing listgmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please search the archive at http://www.gromacs.org/search before posting!
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Re: [gmx-users] Reading XTC files from fortran90

2007-09-28 Thread Bert de Groot
Hi,

try:

download
http://www.mpibpc.gwdg.de/groups/de_groot/xtc.tar.gz

(and optionally issue a 'make' in the xtc directory after unpacking)

in the linking stage, use something like

ifort -blabla -lxdrf -L/wherever/xtc -lg2c

your smalll test code looks OK apart from the fact that I don't know what
happens if you readwrite from the same file.

Bert



On Sat, 29 Sep 2007, Jones de Andrade wrote:

 Hi all.

 I'm writing this beucase I'm having terrible problems in trying to deal with
 gromacs trajectory files with my own programs, originally written on
 fortran90.

 The codes themselves are enoughly big to make it out of question to try to
 translate them. What leads to some sort of mixed language compilation.

 My first guess was to try to use the guidelines from
 http://xray.bmc.uu.se/~spoel/md/online/xtc.html, but it absolutelly didn't
 worked. Could not find a compatible library. Tried to recompile gromacs in
 order to do so, but instead of a libsdrf.a library file, it created just
 common .lo and .o object files.

 Looked inside concoord program, as there are some mentions in the list to
 look at the code. Was a really good aprentize, could understand better the
 logics involved when dealing with .xtc files, BUT I could not use the
 library files that came with that. Somehow, it wasn't recognized as a valid
 file.

 My last try up to now was to try to link my test-read-program with the
 libxdrf object file. It yelded the following error:

 CruNumMac src/own/B/9/xtc 238% ifort libxdrf.lo xtciof.f90 test_xtc.f90
 IPO: WARNING: no IR in object file libxdrf.lo; was the source file compiled
 with -ipo?
 IPO Error: unresolved : xdrfint_
 Referenced in /tmp/ipo_ifortZNvZHh.o
 IPO Error: unresolved : xdrfclose_
 Referenced in /tmp/ipo_ifortZNvZHh.o
 IPO Error: unresolved : xdrfopen_
 Referenced in /tmp/ipo_ifortZNvZHh.o
 IPO Error: unresolved : xdrffloat_
 Referenced in /tmp/ipo_ifortZNvZHh.o
 IPO Error: unresolved : xdrf3dfcoord_
 Referenced in /tmp/ipo_ifortZNvZHh.o
 IPO: performing multi-file optimizations
 IPO: generating object file /tmp/ipo_ifortZNvZHh.o
 test_xtc.f90(17) : (col. 3) remark: LOOP WAS VECTORIZED.
 test_xtc.f90(25) : (col. 8) remark: LOOP WAS VECTORIZED.
 xtciof.f90(112) : (col. 3) remark: LOOP WAS VECTORIZED.
 libxdrf.lo: file not recognized: File format not recognized

 If I try to link to the .o objetc:

 CruNumMac src/own/B/9/xtc 240% ifort libxdrf.o xtciof.f90 test_xtc.f90
 IPO: WARNING: no IR in object file libxdrf.o; was the source file compiled
 with -ipo?
 IPO Error: unresolved : xdrfint_
 Referenced in /tmp/ipo_ifort2f5KMw.o
 IPO Error: unresolved : xdrfclose_
 Referenced in /tmp/ipo_ifort2f5KMw.o
 IPO Error: unresolved : xdrfopen_
 Referenced in /tmp/ipo_ifort2f5KMw.o
 IPO Error: unresolved : xdrffloat_
 Referenced in /tmp/ipo_ifort2f5KMw.o
 IPO Error: unresolved : xdrf3dfcoord_
 Referenced in /tmp/ipo_ifort2f5KMw.o
 IPO Error: unresolved : ffclose
 Referenced in libxdrf.o
 IPO: performing multi-file optimizations
 IPO: generating object file /tmp/ipo_ifort2f5KMw.o
 test_xtc.f90(17) : (col. 3) remark: LOOP WAS VECTORIZED.
 test_xtc.f90(25) : (col. 8) remark: LOOP WAS VECTORIZED.
 xtciof.f90(112) : (col. 3) remark: LOOP WAS VECTORIZED.
 /tmp/ipo_ifort2f5KMw.o(.text+0x1e1): In function `MAIN__':
 /tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x4ea):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrfclose_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x517):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrfopen_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x92b): In function `xtciof_mp_xtcheader_':
 /tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfint_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x941):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrfint_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x95e):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrfint_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x97b):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrffloat_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xb8e): In function `xtciof_mp_xtcio_':
 /tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrffloat_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xbde):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrffloat_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xc2e):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrffloat_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xc7e):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrffloat_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xcce):/tmp/ipo_ifort2f5KMw.f: more undefined
 references to `xdrffloat_' follow
 /tmp/ipo_ifort2f5KMw.o(.text+0xe6b): In function `xtciof_mp_xtcio_':
 /tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrf3dfcoord_'
 /tmp/ipo_ifort2f5KMw.o(.text+0xfc6): In function `xtciof_mp_xtcopen_':
 /tmp/ipo_ifort2f5KMw.f: undefined reference to `xdrfopen_'
 /tmp/ipo_ifort2f5KMw.o(.text+0x1292):/tmp/ipo_ifort2f5KMw.f: undefined
 reference to `xdrfclose_'