Esempio n. 1
0
void add_param(t_params *ps, int ai, int aj, const real *c, char *s)
{
    int i;

    if ((ai < 0) || (aj < 0))
    {
        gmx_fatal(FARGS, "Trying to add impossible atoms: ai=%d, aj=%d", ai, aj);
    }
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    clear_atom_list(2, ps->param[ps->nr].a);
    if (c == nullptr)
    {
        clear_force_param(0, ps->param[ps->nr].c);
    }
    else
    {
        for (i = 0; (i < MAXFORCEPARAM); i++)
        {
            ps->param[ps->nr].c[i] = c[i];
        }
    }
    set_p_string(&(ps->param[ps->nr]), s);
    ps->nr++;
}
Esempio n. 2
0
static void cppar(t_param p[], int np, t_params plist[], int ftype)
{
    int       i, j, nral, nrfp;
    t_params *ps;

    ps   = &plist[ftype];
    nral = NRAL(ftype);
    nrfp = NRFP(ftype);

    /* Keep old stuff */
    pr_alloc(np, ps);
    for (i = 0; (i < np); i++)
    {
        for (j = 0; (j < nral); j++)
        {
            ps->param[ps->nr].a[j] = p[i].a[j];
        }
        for (j = 0; (j < nrfp); j++)
        {
            ps->param[ps->nr].c[j] = p[i].c[j];
        }
        for (j = 0; (j < MAXSLEN); j++)
        {
            ps->param[ps->nr].s[j] = p[i].s[j];
        }
        ps->nr++;
    }
}
Esempio n. 3
0
void add_vsite2_atoms(t_params *ps, int ai, int aj, int ak)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    ps->param[ps->nr].ak() = ak;
    clear_atom_list  (3, ps->param[ps->nr].a);
    clear_force_param(0, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), "");
    ps->nr++;
}
Esempio n. 4
0
void add_vsite2_param(t_params *ps, int ai, int aj, int ak, real c0)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].AI = ai;
    ps->param[ps->nr].AJ = aj;
    ps->param[ps->nr].AK = ak;
    clear_atom_list  (3, ps->param[ps->nr].a);
    ps->param[ps->nr].C0 = c0;
    clear_force_param(1, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), "");
    ps->nr++;
}
Esempio n. 5
0
void add_cmap_param(t_params *ps, int ai, int aj, int ak, int al, int am, char *s)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    ps->param[ps->nr].ak() = ak;
    ps->param[ps->nr].al() = al;
    ps->param[ps->nr].am() = am;
    clear_atom_list(5, ps->param[ps->nr].a);
    clear_force_param(0, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), s);
    ps->nr++;
}
Esempio n. 6
0
void add_vsite4_atoms(t_params *ps, int ai, int aj, int ak, int al, int am)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].AI = ai;
    ps->param[ps->nr].AJ = aj;
    ps->param[ps->nr].AK = ak;
    ps->param[ps->nr].AL = al;
    ps->param[ps->nr].AM = am;
    clear_atom_list  (5, ps->param[ps->nr].a);
    clear_force_param(0, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), "");
    ps->nr++;
}
Esempio n. 7
0
void add_vsite3_atoms(t_params *ps,int ai,int aj,int ak,int al, gmx_bool bSwapParity)
{
  pr_alloc(1,ps);
  ps->param[ps->nr].AI=ai;
  ps->param[ps->nr].AJ=aj;
  ps->param[ps->nr].AK=ak;
  ps->param[ps->nr].AL=al;
  clear_atom_list  (4, ps->param[ps->nr].a);
  clear_force_param(0, ps->param[ps->nr].c);
  if (bSwapParity)
    ps->param[ps->nr].C1=-1;
  set_p_string(&(ps->param[ps->nr]),"");
  ps->nr++;
}
Esempio n. 8
0
void add_vsite3_param(t_params *ps, int ai, int aj, int ak, int al,
                      real c0, real c1)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    ps->param[ps->nr].ak() = ak;
    ps->param[ps->nr].al() = al;
    clear_atom_list  (4, ps->param[ps->nr].a);
    ps->param[ps->nr].c0() = c0;
    ps->param[ps->nr].c1() = c1;
    clear_force_param(2, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), "");
    ps->nr++;
}
Esempio n. 9
0
void add_imp_param(t_params *ps, int ai, int aj, int ak, int al, real c0, real c1,
                   char *s)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].AI = ai;
    ps->param[ps->nr].AJ = aj;
    ps->param[ps->nr].AK = ak;
    ps->param[ps->nr].AL = al;
    clear_atom_list  (4, ps->param[ps->nr].a);
    ps->param[ps->nr].C0 = c0;
    ps->param[ps->nr].C1 = c1;
    clear_force_param(2, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), s);
    ps->nr++;
}
Esempio n. 10
0
void add_vsite3_atoms(t_params *ps, int ai, int aj, int ak, int al, bool bSwapParity)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    ps->param[ps->nr].ak() = ak;
    ps->param[ps->nr].al() = al;
    clear_atom_list  (4, ps->param[ps->nr].a);
    clear_force_param(0, ps->param[ps->nr].c);
    if (bSwapParity)
    {
        ps->param[ps->nr].c1() = -1;
    }
    set_p_string(&(ps->param[ps->nr]), "");
    ps->nr++;
}
Esempio n. 11
0
void add_dih_param(t_params *ps, int ai, int aj, int ak, int al, real c0, real c1,
                   real c2, char *s)
{
    pr_alloc(1, ps);
    ps->param[ps->nr].ai() = ai;
    ps->param[ps->nr].aj() = aj;
    ps->param[ps->nr].ak() = ak;
    ps->param[ps->nr].al() = al;
    clear_atom_list  (4, ps->param[ps->nr].a);
    ps->param[ps->nr].c0() = c0;
    ps->param[ps->nr].c1() = c1;
    ps->param[ps->nr].c2() = c2;
    clear_force_param(3, ps->param[ps->nr].c);
    set_p_string(&(ps->param[ps->nr]), s);
    ps->nr++;
}
Esempio n. 12
0
void add_param_to_list(t_params *list, t_param *b)
{
  int j;
  
  /* allocate one position extra */
  pr_alloc (1,list);

  /* fill the arrays */
  for (j=0; (j < MAXFORCEPARAM); j++) 
    list->param[list->nr].c[j]   = b->c[j];
  for (j=0; (j < MAXATOMLIST); j++) 
    list->param[list->nr].a[j]   = b->a[j];
  memset(list->param[list->nr].s,0,sizeof(list->param[list->nr].s));
  
  list->nr++;
}
Esempio n. 13
0
void add_param(t_params *ps,int ai,int aj, real *c, char *s)
{
  int i;
  
  if ((ai < 0) || (aj < 0)) 
    gmx_fatal(FARGS,"Trying to add impossible atoms: ai=%d, aj=%d",ai,aj);
  pr_alloc(1,ps);
  ps->param[ps->nr].AI=ai;
  ps->param[ps->nr].AJ=aj;
  clear_atom_list(2, ps->param[ps->nr].a);
  if (c==NULL) 
    clear_force_param(0, ps->param[ps->nr].c);
  else
    for(i=0; (i < MAXFORCEPARAM); i++)
      ps->param[ps->nr].c[i]=c[i];
  set_p_string(&(ps->param[ps->nr]),s);
  ps->nr++;
}
Esempio n. 14
0
void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype)
{
    int       n2m;
    t_2morse *t2m;

    int       i, j, k, last, ni, nj;
    int       nrharm, nrmorse, bb;
    real      edis, kb, b0, beta;
    gmx_bool *bRemoveHarm;

    /* First get the data */
    t2m = read_dissociation_energies(&n2m);
    if (debug)
    {
        fprintf(debug, "MORSE: read %d dissoc energies\n", n2m);
    }
    if (n2m <= 0)
    {
        fprintf(stderr, "No dissocation energies read\n");
        return;
    }

    /* For all the molecule types */
    for (i = 0; (i < nrmols); i++)
    {
        /* Check how many morse and harmonic BONDSs there are, increase size of
         * morse with the number of harmonics
         */
        nrmorse = mols[i].plist[F_MORSE].nr;

        for (bb = 0; (bb < F_NRE); bb++)
        {
            if ((interaction_function[bb].flags & IF_BTYPE) && (bb != F_MORSE))
            {
                nrharm  = mols[i].plist[bb].nr;
                pr_alloc(nrharm, &(mols[i].plist[F_MORSE]));
                snew(bRemoveHarm, nrharm);

                /* Now loop over the harmonics, trying to convert them */
                for (j = 0; (j < nrharm); j++)
                {
                    ni   = mols[i].plist[bb].param[j].AI;
                    nj   = mols[i].plist[bb].param[j].AJ;
                    edis =
                        search_e_diss(n2m, t2m,
                                      get_atomtype_name(mols[i].atoms.atom[ni].type, atype),
                                      get_atomtype_name(mols[i].atoms.atom[nj].type, atype));
                    if (edis != 0)
                    {
                        bRemoveHarm[j] = TRUE;
                        b0             = mols[i].plist[bb].param[j].c[0];
                        kb             = mols[i].plist[bb].param[j].c[1];
                        beta           = sqrt(kb/(2*edis));
                        mols[i].plist[F_MORSE].param[nrmorse].a[0] = ni;
                        mols[i].plist[F_MORSE].param[nrmorse].a[1] = nj;
                        mols[i].plist[F_MORSE].param[nrmorse].c[0] = b0;
                        mols[i].plist[F_MORSE].param[nrmorse].c[1] = edis;
                        mols[i].plist[F_MORSE].param[nrmorse].c[2] = beta;
                        nrmorse++;
                    }
                }
                mols[i].plist[F_MORSE].nr = nrmorse;

                /* Now remove the harmonics */
                for (j = last = 0; (j < nrharm); j++)
                {
                    if (!bRemoveHarm[j])
                    {
                        /* Copy it to the last position */
                        for (k = 0; (k < MAXATOMLIST); k++)
                        {
                            mols[i].plist[bb].param[last].a[k] =
                                mols[i].plist[bb].param[j].a[k];
                        }
                        for (k = 0; (k < MAXFORCEPARAM); k++)
                        {
                            mols[i].plist[bb].param[last].c[k] =
                                mols[i].plist[bb].param[j].c[k];
                        }
                        last++;
                    }
                }
                sfree(bRemoveHarm);
                fprintf(stderr, "Converted %d out of %d %s to morse bonds for mol %d\n",
                        nrharm-last, nrharm, interaction_function[bb].name, i);
                mols[i].plist[bb].nr = last;
            }
        }
    }
    sfree(t2m);
}