[gmx-developers] maybe a bug in g_dipoles

David van der Spoel spoel at xray.bmc.uu.se
Fri Dec 12 09:23:05 CET 2003


On Fri, 12 Dec 2003, Li Daobing wrote:

>Hello,
>
>`make_ndx' produce a index file, the numbers in the file is `atom
>index'.
>
>when i use 'g_dipoles' with `-n' optiions, it treat the index number
>in the index file as residue index, so we got an mistake result or
>cause the program `Segmention fault' error.
>
this is correct, the index should refer to molecules, so if you would do a 
single protein or helix in an environement you need to specify an index 
file with a single number. Also note that if your molecule is not neutral, 
then the results is origin dependent.


>detail:
>in function do_dip:
>
>      for(i=0; (i<gnx); i++) {
>	int gi = grpindex ? grpindex[i] : i;
>	mol_dip(mols->index[gi],mols->index[gi+1],mols->a,x,atom,dipole[i]);
>
>the `gi' is already atom index(from ndx file), you use
>`mols->index[gi]' may cause overflow or get an undefined number cause
>mol_dip function raise overflow error in `kk = ma[k]' or `atom[kk]` line
>
>in function mol_dip:
>void mol_dip(int k0,int k1,atom_id ma[],rvec x[],t_atom atom[],rvec mu)
>{
>  int  k,kk,m;
>  real q;
>  
>  clear_rvec(mu);
>  for(k=k0; (k<k1); k++) {
>    kk = ma[k];
>    q  = e2d(atom[kk].q);
>    for(m=0; (m<DIM); m++) 
>      mu[m] += q*x[kk][m];
>  }
>}
>
>
>
>
>
>

-- 
David.
________________________________________________________________________
David van der Spoel, PhD, Assist. Prof., Molecular Biophysics group,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,  	75124 Uppsala, Sweden
phone:	46 18 471 4205		fax: 46 18 511 755
spoel at xray.bmc.uu.se	spoel at gromacs.org   http://xray.bmc.uu.se/~spoel
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




More information about the gromacs.org_gmx-developers mailing list