Hi, massA and massB in mdatoms are only set when doing free-energy calculations. massT gives the mass of a particle. Unfortunately there is a serious lack of documentation in the data type include files (and in most other parts of the code).
Berk > Date: Tue, 31 Aug 2010 10:46:51 +0300 > From: inons...@tau.ac.il > To: gmx-users@gromacs.org > Subject: [gmx-users] mdatoms->massA pointer dereferencing > > Good morning! > > I'm having C trouble with something which should be simple enough: > GROMACS uses a struct called mdatoms which, amongst other things, houses > the atom masses during the simulation. I'm trying to access this data > (an array of the masses of all atoms). I've tried to consult internet > sources and my local tech support team, but it seems the problem is that > I'm misunderstanding the GROMACS programing. Any help would be greatly > appreciated. > As I understand it, there's mdatoms, which is comprised of various stuff > among which is the pointer massA. > > From mdatom.c: > > line 209: md->massA[i] = mA; > > Since md and mdatoms are of the same struct type, I believe > mdatoms->massA is the pointer to the array I'm looking for. > > I've tried all these various combinations in the attempt to access the > elements of this array, to no avail... > > In md.c: > > . > . > . > include <mdatoms.h> > . > . > . > t_mdatoms.h *mdatoms > . > . > . > line 447: ...mdatoms->massT... > . > . > . > if (bFirstStep){ > fprintf(trajectory,"%d\n",max_trajectory_atom); > for(trajectory_atom=0;trajectory_atom<max_trajectory_atom;trajectory_atom++){ > fprintf(stderr,"%d/n",trajectory_atom); > fprintf(stderr,"%g ",mdatoms->massA[trajectory_atom]); //segmentation > fault ON RUN-TIME > // fprintf(trajectory,"%g ",mdatoms->massA->trajectory_atom); //error: > request for member ‘trajectory_atom’ in something not a structure or > union ON COMPILATION > // fprintf(trajectory,"%g ",mdatoms->massA.trajectory_atom); //error: > request for member ‘trajectory_atom’ in something not a structure or > union ON COMPILATION > // real *atomsmasses = mdatoms->massA;fprintf(trajectory,"%g > ",atomsmasses[trajectory_atom]);//segfault on run-time > // fprintf(trajectory,"%g ",mdatoms->tmassA); works, on the other hand, > tmassA being a number rather than pointer or array > > The command I issue and the output is: > > ~$ mdrun_d -quiet -v -pd -nt 1 > > :-) G R O M A C S (-: > > GROup of MAchos and Cynical Suckers > > :-) VERSION 4.5-beta4 (-: > > > Written by David van der Spoel, Erik Lindahl, Berk Hess, and others. > Copyright (c) 1991-2000, University of Groningen, The Netherlands. > Copyright (c) 2001-2008, The GROMACS development team, > check out http://www.gromacs.org for more information. > > This program is free software; you can redistribute it and/or > modify it under the terms of the GNU General Public License > as published by the Free Software Foundation; either version 2 > of the License, or (at your option) any later version. > > :-) mdrun_d (double precision) (-: > > > Back Off! I just backed up md.log to ./#md.log.3# > Getting Loaded... > Reading file topol.tpr, VERSION 4.5-beta2 (double precision) > Note: tpx file_version 71, software version 73 > Loaded with Money > > > Back Off! I just backed up traj.trr to ./#traj.trr.3# > > Back Off! I just backed up ener.edr to ./#ener.edr.3# > starting mdrun 'Single Atom of Sulfur Between Two Gold Atoms' > 6 steps, 0.0 ps. > > > 0 > Segmentation fault > > > The last two lines mean that the loop is entered ( trajectory_atom gets > value zero ) and as soon as "md->massA[trajectory_atom]" is accessed, > the program crashes. This was the result I got before. I tried accessing > only elements 1 and above (by changing trajectory_atom to > trajectory_atom+1 ) but got the same result. > > Thanks! > > -- > Inon Sharony > ינון שרוני > 972-3-6407634 > Please consider your environmental responsibility before printing this e-mail. > > -- > gmx-users mailing list gmx-users@gromacs.org > http://lists.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 gmx-users-requ...@gromacs.org. > Can't post? Read http://www.gromacs.org/mailing_lists/users.php
-- gmx-users mailing list gmx-users@gromacs.org http://lists.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 gmx-users-requ...@gromacs.org. Can't post? Read http://www.gromacs.org/mailing_lists/users.php