示例#1
0
static void pr_pull(FILE *fp,int indent,t_pull *pull)
{
  int g;

  PS("pull-geometry",EPULLGEOM(pull->eGeom));
  pr_ivec(fp,indent,"pull-dim",pull->dim,DIM,TRUE);
  PR("pull-r1",pull->cyl_r1);
  PR("pull-r0",pull->cyl_r0);
  PR("pull-constr-tol",pull->constr_tol);
  PI("pull-nstxout",pull->nstxout);
  PI("pull-nstfout",pull->nstfout);
  PI("pull-ngrp",pull->ngrp);
  for(g=0; g<pull->ngrp+1; g++)
    pr_pullgrp(fp,indent,g,&pull->grp[g]);
}
示例#2
0
void pr_qm_opts(FILE *fp,int indent,const char *title,t_grpopts *opts)
{
  int i,m,j;

  fprintf(fp,"%s:\n",title);
  
  pr_int(fp,indent,"ngQM",opts->ngQM);
  if (opts->ngQM > 0) {
    pr_ivec(fp,indent,"QMmethod",opts->QMmethod,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"QMbasis",opts->QMbasis,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"QMcharge",opts->QMcharge,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"QMmult",opts->QMmult,opts->ngQM,FALSE);
    pr_bvec(fp,indent,"bSH",opts->bSH,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"CASorbitals",opts->CASorbitals,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"CASelectrons",opts->CASelectrons,opts->ngQM,FALSE);
    pr_rvec(fp,indent,"SAon",opts->SAon,opts->ngQM,FALSE);
    pr_rvec(fp,indent,"SAon",opts->SAon,opts->ngQM,FALSE);
    pr_ivec(fp,indent,"SAsteps",opts->SAsteps,opts->ngQM,FALSE);
    pr_bvec(fp,indent,"bOPT",opts->bOPT,opts->ngQM,FALSE);
    pr_bvec(fp,indent,"bTS",opts->bTS,opts->ngQM,FALSE);
  }
}
示例#3
0
文件: pppm.c 项目: Chadi-akel/cere
void init_pppm(FILE *log,t_commrec *cr,t_nsborder *nsb,
	       bool bVerbose,bool bOld,rvec box,char *ghatfn,t_inputrec *ir)
{
  int   nx,ny,nz,m,porder;
  ivec  grids;
  real  r1,rc;
  const real tol = 1e-5;
  rvec  spacing;

#ifdef WITHOUT_FFTW
  fatal_error(0,"PPPM used, but GROMACS was compiled without FFTW support!\n");
#endif

  if (cr != NULL) {
    if (cr->nnodes > 1)
	fprintf(log,"Initializing parallel PPPM.\n");
  }
  fprintf(log,"Will use the PPPM algorithm for long-range electrostatics\n");
 
  if (!fexist(ghatfn)) {    
    beta[XX]=beta[YY]=beta[ZZ]= 1.85;
    nx     = ir->nkx;
    ny     = ir->nky;
    nz     = ir->nkz;
    
    fprintf(log,"Generating Ghat function\n");
    fprintf(log,"Grid size is %d x %d x %d\n",nx,ny,nz);

    if ((nx < 4) || (ny < 4) || (nz < 4)) 
      fatal_error(0,"Grid must be at least 4 points in all directions");
      
    ghat   = mk_rgrid(nx,ny,nz);
    mk_ghat(NULL,nx,ny,nz,ghat,box,ir->rcoulomb_switch,ir->rcoulomb,TRUE,bOld);
    
    if (bVerbose)
      pr_scalar_gk("generghat.xvg",nx,ny,nz,box,ghat);
  }
  else {
    fprintf(stderr,"Reading Ghat function from %s\n",ghatfn);
    ghat = rd_ghat(log,ghatfn,grids,spacing,beta,&porder,&r1,&rc);
    
    /* Check whether cut-offs correspond */
    if ((fabs(r1-ir->rcoulomb_switch)>tol) || (fabs(rc-ir->rcoulomb)>tol)) {
      fprintf(log,"rcoulomb_switch = %10.3e  rcoulomb = %10.3e"
	          "  r1 = %10.3e  rc = %10.3e\n",
	      ir->rcoulomb_switch,ir->rcoulomb,r1,rc);
      fflush(log);
      fatal_error(0,"Cut-off lengths in tpb file and Ghat file %s "
		  "do not match\nCheck your log file!",ghatfn);
    }
      
    /* Check whether boxes correspond */
    for(m=0; (m<DIM); m++)
      if (fabs(box[m]-grids[m]*spacing[m]) > tol) {
	pr_rvec(log,0,"box",box,DIM);
	pr_rvec(log,0,"grid-spacing",spacing,DIM);
	pr_ivec(log,0,"grid size",grids,DIM);
	fflush(log);
	fatal_error(0,"Box sizes in tpb file and Ghat file %s do not match\n"
		    "Check your log file!",ghatfn);
      }

    if (porder != 2)
      fatal_error(0,"porder = %d, should be 2 in %s",porder,ghatfn);
      
    nx = grids[XX];
    ny = grids[YY];
    nz = grids[ZZ];
    
    if (bVerbose)
      pr_scalar_gk("optimghat.xvg",nx,ny,nz,box,ghat);
  }
  /* Now setup the FFT things */
  grid = mk_fftgrid(log,PAR(cr),nx,ny,nz,ir->bOptFFT);
}
示例#4
0
void renum_atype(t_params plist[], gmx_mtop_t *mtop,
                 int *wall_atomtype,
                 gpp_atomtype_t ga, gmx_bool bVerbose)
{
    int         i, j, k, l, molt, mi, mj, nat, nrfp, ftype, ntype;
    t_atoms    *atoms;
    t_param    *nbsnew;
    int        *typelist;
    real       *new_radius;
    real       *new_vol;
    real       *new_surftens;
    real       *new_gb_radius;
    real       *new_S_hct;
    int        *new_atomnumber;
    char     ***new_atomname;

    ntype = get_atomtype_ntypes(ga);
    snew(typelist, ntype);

    if (bVerbose)
    {
        fprintf(stderr, "renumbering atomtypes...\n");
    }

    /* Since the bonded interactions have been assigned now,
     * we want to reduce the number of atom types by merging
     * ones with identical nonbonded interactions, in addition
     * to removing unused ones.
     *
     * With Generalized-Born electrostatics, or implicit solvent
     * we also check that the atomtype radius, effective_volume
     * and surface tension match.
     *
     * With QM/MM we also check that the atom numbers match
     */

    /* Get nonbonded interaction type */
    if (plist[F_LJ].nr > 0)
    {
        ftype = F_LJ;
    }
    else
    {
        ftype = F_BHAM;
    }

    /* Renumber atomtypes by first making a list of which ones are actually used.
     * We provide the list of nonbonded parameters so search_atomtypes
     * can determine if two types should be merged.
     */
    nat = 0;
    for (molt = 0; molt < mtop->nmoltype; molt++)
    {
        atoms = &mtop->moltype[molt].atoms;
        for (i = 0; (i < atoms->nr); i++)
        {
            atoms->atom[i].type =
                search_atomtypes(ga, &nat, typelist, atoms->atom[i].type,
                                 plist[ftype].param, ftype);
            atoms->atom[i].typeB =
                search_atomtypes(ga, &nat, typelist, atoms->atom[i].typeB,
                                 plist[ftype].param, ftype);
        }
    }

    for (i = 0; i < 2; i++)
    {
        if (wall_atomtype[i] >= 0)
        {
            wall_atomtype[i] = search_atomtypes(ga, &nat, typelist, wall_atomtype[i],
                                                plist[ftype].param, ftype);
        }
    }

    snew(new_radius, nat);
    snew(new_vol, nat);
    snew(new_surftens, nat);
    snew(new_atomnumber, nat);
    snew(new_gb_radius, nat);
    snew(new_S_hct, nat);
    snew(new_atomname, nat);

    /* We now have a list of unique atomtypes in typelist */

    if (debug)
    {
        pr_ivec(debug, 0, "typelist", typelist, nat, TRUE);
    }

    /* Renumber nlist */
    nbsnew = NULL;
    snew(nbsnew, plist[ftype].nr);

    nrfp  = NRFP(ftype);

    for (i = k = 0; (i < nat); i++)
    {
        mi = typelist[i];
        for (j = 0; (j < nat); j++, k++)
        {
            mj = typelist[j];
            for (l = 0; (l < nrfp); l++)
            {
                nbsnew[k].c[l] = plist[ftype].param[ntype*mi+mj].c[l];
            }
        }
        new_radius[i]     = get_atomtype_radius(mi, ga);
        new_vol[i]        = get_atomtype_vol(mi, ga);
        new_surftens[i]   = get_atomtype_surftens(mi, ga);
        new_atomnumber[i] = get_atomtype_atomnumber(mi, ga);
        new_gb_radius[i]  = get_atomtype_gb_radius(mi, ga);
        new_S_hct[i]      = get_atomtype_S_hct(mi, ga);
        new_atomname[i]   = ga->atomname[mi];
    }

    for (i = 0; (i < nat*nat); i++)
    {
        for (l = 0; (l < nrfp); l++)
        {
            plist[ftype].param[i].c[l] = nbsnew[i].c[l];
        }
    }
    plist[ftype].nr     = i;
    mtop->ffparams.atnr = nat;

    sfree(ga->radius);
    sfree(ga->vol);
    sfree(ga->surftens);
    sfree(ga->atomnumber);
    sfree(ga->gb_radius);
    sfree(ga->S_hct);
    /* Dangling atomname pointers ? */
    sfree(ga->atomname);

    ga->radius     = new_radius;
    ga->vol        = new_vol;
    ga->surftens   = new_surftens;
    ga->atomnumber = new_atomnumber;
    ga->gb_radius  = new_gb_radius;
    ga->S_hct      = new_S_hct;
    ga->atomname   = new_atomname;

    ga->nr = nat;

    sfree(nbsnew);
    sfree(typelist);
}
示例#5
0
int gmx_pppm_init(FILE *log,      t_commrec *cr,
                  const output_env_t oenv, gmx_bool bVerbose,
                  gmx_bool bOld,      matrix box,
                  char *ghatfn,   t_inputrec *ir,
                  gmx_bool bReproducible)
{
  int   nx,ny,nz,m,porder;
  ivec  grids;
  real  r1,rc;
  const real tol = 1e-5;
  rvec  box_diag,spacing;

#ifdef DISABLE_PPPM
    gmx_fatal(FARGS,"PPPM is not functional in the current version, we plan to implement PPPM through a small modification of the PME code.");
    return -1;
#else
    
#ifdef GMX_WITHOUT_FFTW
  gmx_fatal(FARGS,"PPPM used, but GROMACS was compiled without FFTW support!\n");
#endif

  if (log) {
    if (cr != NULL) {
      if (cr->nnodes > 1)
	fprintf(log,"Initializing parallel PPPM.\n");
    }
    fprintf(log,
	    "Will use the PPPM algorithm for long-range electrostatics\n");
  }
 
  for(m=0; m<DIM; m++)
    box_diag[m] = box[m][m];

  if (!gmx_fexist(ghatfn)) {    
    beta[XX]=beta[YY]=beta[ZZ]= 1.85;
    nx     = ir->nkx;
    ny     = ir->nky;
    nz     = ir->nkz;
   
    if (log) {
      fprintf(log,"Generating Ghat function\n");
      fprintf(log,"Grid size is %d x %d x %d\n",nx,ny,nz);
    }

    if ((nx < 4) || (ny < 4) || (nz < 4)) 
      gmx_fatal(FARGS,"Grid must be at least 4 points in all directions");
      
    ghat   = mk_rgrid(nx,ny,nz);
    mk_ghat(NULL,nx,ny,nz,ghat,box_diag,
	    ir->rcoulomb_switch,ir->rcoulomb,TRUE,bOld);
    
    if (bVerbose)
      pr_scalar_gk("generghat.xvg",oenv,nx,ny,nz,box_diag,ghat);
  }
  else {
    fprintf(stderr,"Reading Ghat function from %s\n",ghatfn);
    ghat = rd_ghat(log,oenv,ghatfn,grids,spacing,beta,&porder,&r1,&rc);
    
    /* Check whether cut-offs correspond */
    if ((fabs(r1-ir->rcoulomb_switch)>tol) || (fabs(rc-ir->rcoulomb)>tol)) {
      if (log) {
	fprintf(log,"rcoulomb_switch = %10.3e  rcoulomb = %10.3e"
		"  r1 = %10.3e  rc = %10.3e\n",
		ir->rcoulomb_switch,ir->rcoulomb,r1,rc);
	fflush(log);
      }
      gmx_fatal(FARGS,"Cut-off lengths in tpb file and Ghat file %s "
		  "do not match\nCheck your log file!",ghatfn);
    }
      
    /* Check whether boxes correspond */
    for(m=0; (m<DIM); m++)
      if (fabs(box_diag[m]-grids[m]*spacing[m]) > tol) {
	if (log) {
	  pr_rvec(log,0,"box",box_diag,DIM,TRUE);
	  pr_rvec(log,0,"grid-spacing",spacing,DIM,TRUE);
	  pr_ivec(log,0,"grid size",grids,DIM,TRUE);
	  fflush(log);
	}
	gmx_fatal(FARGS,"Box sizes in tpb file and Ghat file %s do not match\n"
		    "Check your log file!",ghatfn);
      }

    if (porder != 2)
      gmx_fatal(FARGS,"porder = %d, should be 2 in %s",porder,ghatfn);
      
    nx = grids[XX];
    ny = grids[YY];
    nz = grids[ZZ];
    
    if (bVerbose)
      pr_scalar_gk("optimghat.xvg",oenv,nx,ny,nz,box_diag,ghat);
  }
  /* Now setup the FFT things */
#ifdef GMX_MPI
  cr->mpi_comm_mygroup=cr->mpi_comm_mysim;
#endif
  grid = mk_fftgrid(nx,ny,nz,NULL,NULL,cr,bReproducible);
  
  return 0;
#endif
}