[gmx-developers] Computing prot pot ener in the gmx code

David van der Spoel spoel at xray.bmc.uu.se
Mon Jan 16 19:49:43 CET 2006


pascal.baillod at epfl.ch wrote:
> Dear David and Yang,
>
> Thank you very much for your indications. I am having some trouble to understand
> how the potential energy data structures are defined in the code.
>
> I have defined the routine sum_epotPROT (see copy here below) in tgroup.c and
> the index F_EPOTprot, used in this routine and defined in idef.h. Following
> David's proposal, I have been trying to get the protein-protein and
> protein-solvent energy terms with 
>
> sum_v(grps->estat.nn,grps->estat.ee[egCOULSR][x])
>
> with indexes x = 0, 1 and 2. 
>
> 1) There is the following compilation error message, shown for every line of the
> subroutine sum_epotPROT with "...->estat.ee[egCOULSR][x]":
>
> tgroup.c(317): error: argument of type "real={float}" is incompatible with
> parameter of type "real={float} *"
>
> 2) It would help understanding how the epot and estat.ee[egLJ14][x] data
> structures are organised. epot is a one dimensional array, what about estat?
>
> 3) Am I correct in invoking epot on the left of the "="? Or should I define a
> new array? How dose the indexing work?
>
> Thank you very much for any help!
>
> Pascal
>
>
>
>
> void sum_epotPROT(t_grpopts *opts,t_groups *grps,real epot[])
> {
>   int i;
>
>   /* Accumulate energies */
>   epot[F_COUL_SR]     = sum_v(grps->estat.nn,grps->estat.ee[egCOULSR][0]);
>   epot[F_COUL_SR]    += sum_v(grps->estat.nn,grps->estat.ee[egCOULSR][1]);
>   epot[F_COUL_SR]    += sum_v(grps->estat.nn,grps->estat.ee[egCOULSR][2]);
>   

You want instead:

epot[F_COUL_SR] = grps->estat.ee[egCOULSR][0] + 
0.5*(grps->estat.ee[egCOULSR][1] + grps->estat.ee[egCOULSR][2]);

And so on...

-- 
David.
________________________________________________________________________
David van der Spoel, PhD, Assoc. 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