Exemplo n.º 1
0
void read_adressparams(int *ninp_p,t_inpfile **inp_p,t_adress *adress, warninp_t wi)
{
  int     nadress_refs,i;
  const char *tmp;
  char    *ptr1[MAXPTR];


  int    ninp;
  t_inpfile *inp;

  ninp   = *ninp_p;
  inp    = *inp_p;

  EETYPE("adress_type",                adress->type,         eAdresstype_names);
  RTYPE ("adress_const_wf",            adress->const_wf,     1);
  RTYPE ("adress_ex_width",            adress->ex_width,     0);
  RTYPE ("adress_hy_width",            adress->hy_width,     0);
  RTYPE ("adress_ex_forcecap",         adress->ex_forcecap,     0);
  EETYPE("adress_interface_correction",adress->icor,         eAdressICtype_names);
  EETYPE("adress_site",                adress->site,         eAdressSITEtype_names);
  STYPE ("adress_reference_coords",    adress_refs,             NULL);
  STYPE ("adress_tf_grp_names",        adress_tf_grp_names,     NULL);
  STYPE ("adress_cg_grp_names",        adress_cg_grp_names,     NULL);
  EETYPE("adress_do_hybridpairs",      adress->do_hybridpairs, yesno_names);
  
  nadress_refs = str_nelem(adress_refs,MAXPTR,ptr1);

  for(i=0; (i<nadress_refs); i++) /*read vector components*/
    adress->refs[i]=strtod(ptr1[i],NULL);
  for( ;(i<DIM); i++) /*remaining undefined components of the vector set to zero*/
    adress->refs[i]=0;

  *ninp_p   = ninp;
  *inp_p    = inp;
}
Exemplo n.º 2
0
void do_adress_index(t_adress *adress, gmx_groups_t *groups, char **gnames, t_grpopts *opts, warninp_t wi)
{
    int      nr, i, j, k;
    char    *ptr1[MAXPTR];
    int      nadress_cg_grp_names, nadress_tf_grp_names;

    /* AdResS coarse grained groups input */

    nr = groups->grps[egcENER].nr;
    snew(adress->group_explicit, nr);
    for (i = 0; i < nr; i++)
    {
        adress->group_explicit[i] = TRUE;
    }
    adress->n_energy_grps = nr;

    nadress_cg_grp_names = str_nelem(adress_cg_grp_names, MAXPTR, ptr1);

    if (nadress_cg_grp_names > 0)
    {
        for (i = 0; i < nadress_cg_grp_names; i++)
        {
            /* search for the group name mathching the tf group name */
            k = 0;
            while ((k < nr) &&
                    gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
            {
                k++;
            }
            if (k == nr)
            {
                gmx_fatal(FARGS, "Adress cg energy group %s not found\n", ptr1[i]);
            }
            adress->group_explicit[k] = FALSE;
            printf ("AdResS: Energy group %s is treated as coarse-grained \n",
                    (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
        }
        /* set energy group exclusions between all coarse-grained and explicit groups */
        for (j = 0; j < nr; j++)
        {
            for (k = 0; k < nr; k++)
            {
                if (!(adress->group_explicit[k] == adress->group_explicit[j]))
                {
                    opts->egp_flags[nr * j + k] |= EGP_EXCL;
                    if (debug)
                    {
                        fprintf(debug, "AdResS excl %s %s \n",
                                (char*)(gnames[groups->grps[egcENER].nm_ind[j]]),
                                (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
                    }
                }
            }
        }
    }
    else
    {
        warning(wi, "For an AdResS simulation at least one coarse-grained energy group has to be specified in adress_cg_grp_names");
    }


    /* AdResS multiple tf tables input */
    nadress_tf_grp_names = str_nelem(adress_tf_grp_names, MAXPTR, ptr1);
    adress->n_tf_grps    = nadress_tf_grp_names;
    snew(adress->tf_table_index, nadress_tf_grp_names);

    nr = groups->grps[egcENER].nr;

    if (nadress_tf_grp_names > 0)
    {
        for (i = 0; i < nadress_tf_grp_names; i++)
        {
            /* search for the group name mathching the tf group name */
            k = 0;
            while ((k < nr) &&
                    gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
            {
                k++;
            }
            if (k == nr)
            {
                gmx_fatal(FARGS, "Adress tf energy group %s not found\n", ptr1[i]);
            }

            adress->tf_table_index[i] = k;
            if (debug)
            {
                fprintf(debug, "found tf group %s id %d \n", ptr1[i], k);
            }
            if (adress->group_explicit[k])
            {
                gmx_fatal(FARGS, "Thermodynamic force group %s is not a coarse-grained group in adress_cg_grp_names. The thermodynamic force has to act on the coarse-grained vsite of a molecule.\n", ptr1[i]);
            }

        }
    }
    /* end AdResS multiple tf tables input */


}
Exemplo n.º 3
0
int ReadInput	(char *fnMdp, gmx_bool *bPolar, gmx_bool *bAPolar, t_PolKey *PolKey, t_APolKey *APolKey)	{
	warninp_t wi;
	gmx_bool bAllowWarnings=FALSE;
	int maxwarning = 99;
	t_inpfile *inp;
	int ninp;
	const char *tmp;


	wi = init_warning(bAllowWarnings,maxwarning);
	inp = read_inpfile(fnMdp, &ninp, wi);

	char *ptr[MAXPTR];
	int n;

	//To check for polar solvation calculation
	STYPE ("polar",                 polar,                  NULL);
	n= str_nelem(polar,MAXPTR,ptr);
	if ( (n>1) || ((strcmp(ptr[0],"yes")!=0) && (strcmp(ptr[0],"no")!=0)) )
		gmx_fatal(FARGS, "Polar should be yes or no\n");
	if(strcmp(ptr[0],"yes")==0)
		*bPolar = TRUE;

	//To check for APolar calculation
	STYPE ("apolar",               apolar,           NULL);
	n= str_nelem(apolar,MAXPTR,ptr);
	if ( (n>1) || ((strcmp(ptr[0],"yes")!=0) && (strcmp(ptr[0],"no")!=0)) )
		gmx_fatal(FARGS, "Polar should be yes or no\n");
	if(strcmp(ptr[0],"yes")==0)
		*bAPolar = TRUE;


	if(*bPolar)
	{
		//Psize keywords
		RTYPE ("cfac", 			PolKey->cfac, 		2);
		RTYPE ("gridspace", 	PolKey->gridspace, 	0.5);
		RTYPE ("gmemceil", 		PolKey->gmemceil, 	400);
		RTYPE ("fadd",			PolKey->fadd, 		20);
		RTYPE ("ofrac",			PolKey->ofrac, 		0.1);

		//Polar Keywords
		EETYPE("mg-type",       PolKey->mg_type,    mg_words);
		RTYPE ("pcharge",       PolKey->pcharge,    	0);
		RTYPE ("ncharge",   	PolKey->ncharge,    	0);
		RTYPE ("prad", 	 	 	PolKey->prad,    	0);
		RTYPE ("nrad",   		PolKey->nrad,    	0);
		RTYPE ("pconc",   		PolKey->pconc,    	0);
		RTYPE ("nconc",   		PolKey->nconc,    	0);
		RTYPE ("pdie",   		PolKey->pdie,    	4);
		RTYPE ("sdie",   		PolKey->sdie,    	78.4);
		RTYPE ("vdie",   		PolKey->vdie,    	1);
		RTYPE ("srad",   		PolKey->srad,    	1.4);
		RTYPE ("swin",   		PolKey->swin,    	0.30);
		RTYPE ("sdens",   		PolKey->sdens,    	10);
		RTYPE ("temp",   		PolKey->temp,    	300);
		EETYPE("srfm",			PolKey->srfm, 		srfm_words);
		EETYPE("chgm",			PolKey->chgm,    	chgm_words);
		EETYPE("bcfl",			PolKey->bcfl,    	bcfl_words);
		EETYPE("PBsolver",		PolKey->pbsolver,   	PBsolver);
	}

	if (*bAPolar)
	{
		//APolar Keywords
		RTYPE ("gamma",         APolKey->gamma,           0.030096);
		RTYPE ("sasconst",     APolKey->sasaconst,           0.0);
		RTYPE ("sasrad",        APolKey->sasrad,          1.4);

		RTYPE ("press",         APolKey->press,           0.0);
		RTYPE ("savconst",      APolKey->savconst,        0.0);
		RTYPE ("savrad",        APolKey->savrad,          1.4);

		APolKey->bWCA = FALSE;
		STYPE("WCA",               wca,           NULL);
		n= str_nelem(wca,MAXPTR,ptr);
		if ( (n>1) || ((strcmp(ptr[0],"yes")!=0) && (strcmp(ptr[0],"no")!=0)) )
			gmx_fatal(FARGS, "Polar should be yes or no\n");
		if(strcmp(ptr[0],"yes")==0)
			APolKey->bWCA = TRUE;

		RTYPE ("wcarad",        APolKey->wcarad,          1.4);
		RTYPE ("bconc",         APolKey->bconc,          0.033428);
		RTYPE ("dpos",          APolKey->dpos,           0.05);
		RTYPE ("APsdens",       APolKey->sdens,          200);
		STYPE ("grid",          grid,                    NULL);
		EETYPE("APsrfm",        APolKey->srfm,          APsrfm_words);
		RTYPE ("APswin",        APolKey->swin,          0.2);
		RTYPE ("APtemp",        APolKey->temp,          300);

		n= str_nelem(grid,MAXPTR,ptr);
		if ((n<3) || (n>3))
			gmx_fatal(FARGS, "Number of grid point should be three\n");
		APolKey->grid[0] = strtod(ptr[0],NULL);
		APolKey->grid[1] = strtod(ptr[1],NULL);
		APolKey->grid[2] = strtod(ptr[2],NULL);
	}
	return 0;
}