Пример #1
0
tpr_t * guamps_init_tpr(const int natoms) {
  tpr_t *tpr = (tpr_t *)calloc(1, sizeof(tpr_t));
  tpr->natoms = natoms;
  init_inputrec (&tpr->inputrec);
  init_state    (&tpr->state, -1,-1,-1,-1);
  tpr->f      = (rvec *)calloc(natoms, sizeof(rvec));
  init_mtop     (&tpr->mtop);
  return tpr;
}
Пример #2
0
void init_parallel(FILE *log,char *tpxfile,t_commrec *cr,
		   t_inputrec *inputrec,gmx_mtop_t *mtop,
		   t_state *state,
		   int list)
{
  int  step;
  real t;
  char buf[256];
  
  if (MASTER(cr)) {
    init_inputrec(inputrec);
    read_tpx_state(tpxfile,&step,&t,inputrec,state,NULL,mtop);
    /* When we will be doing domain decomposition with separate PME nodes
     * the rng entries will be too large, we correct for this later.
     */
    set_state_entries(state,inputrec,cr->nnodes);
  }
  bcast_ir_mtop(cr,inputrec,mtop);

  if (inputrec->eI == eiBD || EI_SD(inputrec->eI)) {
    /* Make sure the random seeds are different on each node */
    inputrec->ld_seed += cr->nodeid;
  }
  
  /* Printing */
  if (list!=0 && log!=NULL) 
  {
	  if (list&LIST_INPUTREC)
		  pr_inputrec(log,0,"parameters of the run",inputrec,FALSE);
	  if (list&LIST_X)
		  pr_rvecs(log,0,"box",state->box,DIM);
	  if (list&LIST_X)
		  pr_rvecs(log,0,"box_rel",state->box_rel,DIM);
	  if (list&LIST_V)
		  pr_rvecs(log,0,"boxv",state->boxv,DIM);
	  if (list&LIST_X)
		  pr_rvecs(log,0,int_title("x",0,buf,255),state->x,state->natoms);
	  if (list&LIST_V)
		  pr_rvecs(log,0,int_title("v",0,buf,255),state->v,state->natoms);
	  if (list&LIST_TOP)
		  pr_mtop(log,0,int_title("topology",cr->nodeid,buf,255),mtop,TRUE);
	  fflush(log);
  }
}
Пример #3
0
Файл: test.c Проект: badi/guamps
void test3() {

  const char *fn = "../state0.cpt";
  FILE *fplog = stderr;
  t_commrec cr;
  gmx_bool bPartDecomp = FALSE;
  ivec dd_nc;
  t_inputrec ir;
  t_state state;
  gmx_bool
    bReadRNG = TRUE,
    bReadEkin = TRUE,
    bAppend = TRUE,
    bForceAppend = FALSE;

  init_state(&state, -1,-1,-1,-1);
  init_inputrec(&ir);


  int simulation_part;
  gmx_large_int_t step;
  double t;


  read_checkpoint_state(fn, &simulation_part,
			&step, &t, &state);

  /* load_checkpoint(fn, &fplog, */
  /* 		  &cr, bPartDecomp, dd_nc, */
  /* 		  &ir, &state, */
  /* 		  &bReadRNG, &bReadEkin, */
  /* 		  bAppend, bForceAppend); */

  printf("%u\n", *state.ld_rng);

}
Пример #4
0
Файл: test.c Проект: badi/guamps
// works
void test1() {
  const char 
    *intopol  = "../topol.tpr",
    *incpt    = "../state0.cpt",
    *outtopol = "../new.tpr";
  const unsigned int seed = 42;

  // read the header
  t_tpxheader header;
  int version, generation;
  read_tpxheader(intopol, &header, FALSE, &version, &generation);

  // decide if forces can be read from tpr
  rvec *forces;

  if (header.bF) {
    snew(forces, 1);
  } else {
    forces = NULL;
  }

  // read the topology file
  t_inputrec ir;
  t_state topol_state;
  gmx_mtop_t mtop;

  init_inputrec(&ir);
  init_state(&topol_state, -1, -1, -1, -1);
  init_mtop(&mtop);

  read_tpx_state(intopol,
		 &ir, &topol_state, forces,
		 &mtop);

  // read the checkpoint
  int sim_part;
  gmx_large_int_t step;
  double time;
  t_state cpt_state;
  t_commrec comm;

  init_state(&cpt_state, -1, -1, -1, -1);

  printf("Opening %s for reading\n", incpt);
  read_checkpoint_state(incpt, &sim_part, &step, &time, &cpt_state);


  printf("ld_rng  = %d\n", (int) cpt_state.ld_rng);
  printf("ld_rngi = %d\n"  , (int) cpt_state.ld_rngi);


  // update the state to be written
  /* gmx_rng_t rng = gmx_rng_init(seed); */
  /* unsigned int rng_state, rng_index; */
  /* gmx_rng_get_state(rng, &rng_state, &rng_index); */

  ir.ld_seed = 42;
  ir.init_t = time;
  ir.init_step = step;
  ir.init_lambda = cpt_state.lambda;
  

  /* // write the new tpr */
  /* write_tpx_state(outtopol, */
  /* 		  &ir, &cpt_state, &mtop); */

}