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

pascal.baillod at epfl.ch pascal.baillod at epfl.ch
Tue Jan 17 18:56:10 CET 2006


Hello,

Thank you very much for theses indications, David! The compilation of mdrun with
my new sum_epotPROT routine (copy below) works fine, but when I try to run it (2
cpus, 2 PT replicas, runs fine with normal code), I get the following error message:


Reading file md1.tpr, VERSION 3.3 (single precision)
-------------------------------------------------------
Program mdrun_mpi, VERSION 3.3
Source code file: smalloc.c, line: 113
 
Fatal error:
calloc for ir->opts.nrdf (nelem=-1079115263, elsize=4, file tpxio.c, line 487)

tpxio.c line 487 looks like: 
snew(ir->opts.nrdf,   ir->opts.ngtc);

Here below, I send a copy of the 3 changes I put in the code, 2 of which are
supposed to settle memory allocation problems:

1) idef.h -----------------------------------------

typedef atom_id t_iatom;

/* this MUST correspond to the 
   t_interaction_function[F_NRE] in gmxlib/ifunc.c */
enum {
  F_BONDS,
  F_G96BONDS,
  /* a number of other contributions */
  F_EPOTprot,     /* the index of my new prot ener term	*/
  F_NRE           /* This number is for the total number of energies	*/
};



2) md.c ---------------------------------------------

  /* Initiate everything (snew sets to zero!) */
  snew(ener,F_NRE+1);

... with the idea that F_NRE+1 should account for memory allocation for my new
prot energy term.


3) tgroup.c ----------------------------------------------


void sum_epotPROT(t_grpopts *opts,t_groups *grps,real epot[])
{
  int i;

  /* Accumulate energies */
  epot[F_COUL_SR]  = grps->estat.ee[egCOULSR][0] +
0.5*(grps->estat.ee[egCOULSR][1] + grps->estat.ee[egCOULSR][2]);
  epot[F_LJ]       = grps->estat.ee[egLJSR][0] + 0.5*(grps->estat.ee[egLJSR][1]
+ grps->estat.ee[egLJSR][2]);
  epot[F_LJ14]     = grps->estat.ee[egLJ14][0] + 0.5*(grps->estat.ee[egLJ14][1]
+ grps->estat.ee[egLJ14][2]);
  epot[F_COUL14]   = grps->estat.ee[egCOUL14][0] +
0.5*(grps->estat.ee[egCOUL14][1] + grps->estat.ee[egCOUL14][2]);  
  epot[F_COUL_LR]  = grps->estat.ee[egCOULLR][0] +
0.5*(grps->estat.ee[egCOULLR][1] + grps->estat.ee[egCOULLR][2]);
  epot[F_LJ_LR]    = grps->estat.ee[egLJLR][0] + 0.5*(grps->estat.ee[egLJLR][1]
+ grps->estat.ee[egLJLR][2]);
/* lattice part of LR doesnt belong to any group
 * and has been added earlier
 */
  epot[F_BHAM]     = grps->estat.ee[egBHAMSR][0] +
0.5*(grps->estat.ee[egBHAMSR][1] + grps->estat.ee[egBHAMSR][2]);
  epot[F_BHAM_LR]     = grps->estat.ee[egBHAMLR][0] +
0.5*(grps->estat.ee[egBHAMLR][1] + grps->estat.ee[egBHAMLR][2]);

  epot[F_EPOTprot] = 0;
  for(i=0; (i<F_EPOTprot); i++)
    if (i != F_DISRESVIOL && i != F_ORIRESDEV && i !=
F_DIHRESVIOL)
      epot[F_EPOTprot] += epot[i];
}

I thank you very much for your help!!

Pascal


*******************************************************************************
Pascal Baillod (PhD student) 
*******************************************************************************
Swiss Federal Institute of Technology EPFL	        Tel: +41-(0)21-693-0322
Institute of Chemical Sciences and Engineering ,	Fax: +41-(0)21-693-0320
Laboratory of Computational Chemistry and Biochemistry	pascal.baillod at epfl.ch
Room BCH 4121, Avenue Forel,	                        http://lcbcpc21.epfl.ch
CH-1015 Lausanne	
*******************************************************************************



More information about the gromacs.org_gmx-developers mailing list