2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
5 * Copyright (c) 2012,2014, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
42 #include "gromacs/legacyheaders/names.h"
43 #include "gromacs/utility/cstringutil.h"
44 #include "gromacs/utility/fatalerror.h"
45 #include "gromacs/utility/smalloc.h"
49 static char adress_refs[STRLEN], adress_tf_grp_names[STRLEN], adress_cg_grp_names[STRLEN];
51 void read_adressparams(int *ninp_p, t_inpfile **inp_p, t_adress *adress, warninp_t wi)
64 EETYPE("adress_type", adress->type, eAdresstype_names);
65 RTYPE ("adress_const_wf", adress->const_wf, 1);
66 RTYPE ("adress_ex_width", adress->ex_width, 0);
67 RTYPE ("adress_hy_width", adress->hy_width, 0);
68 RTYPE ("adress_ex_forcecap", adress->ex_forcecap, 0);
69 EETYPE("adress_interface_correction", adress->icor, eAdressICtype_names);
70 EETYPE("adress_site", adress->site, eAdressSITEtype_names);
71 STYPE ("adress_reference_coords", adress_refs, NULL);
72 STYPE ("adress_tf_grp_names", adress_tf_grp_names, NULL);
73 STYPE ("adress_cg_grp_names", adress_cg_grp_names, NULL);
74 EETYPE("adress_do_hybridpairs", adress->do_hybridpairs, yesno_names);
76 nadress_refs = str_nelem(adress_refs, MAXPTR, ptr1);
78 for (i = 0; (i < nadress_refs); i++) /*read vector components*/
80 adress->refs[i] = strtod(ptr1[i], NULL);
82 for (; (i < DIM); i++) /*remaining undefined components of the vector set to zero*/
91 void do_adress_index(t_adress *adress, gmx_groups_t *groups, char **gnames, t_grpopts *opts, warninp_t wi)
95 int nadress_cg_grp_names, nadress_tf_grp_names;
97 /* AdResS coarse grained groups input */
99 nr = groups->grps[egcENER].nr;
100 snew(adress->group_explicit, nr);
101 for (i = 0; i < nr; i++)
103 adress->group_explicit[i] = TRUE;
105 adress->n_energy_grps = nr;
107 nadress_cg_grp_names = str_nelem(adress_cg_grp_names, MAXPTR, ptr1);
109 if (nadress_cg_grp_names > 0)
111 for (i = 0; i < nadress_cg_grp_names; i++)
113 /* search for the group name mathching the tf group name */
116 gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
122 gmx_fatal(FARGS, "Adress cg energy group %s not found\n", ptr1[i]);
124 adress->group_explicit[k] = FALSE;
125 printf ("AdResS: Energy group %s is treated as coarse-grained \n",
126 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
128 /* set energy group exclusions between all coarse-grained and explicit groups */
129 for (j = 0; j < nr; j++)
131 for (k = 0; k < nr; k++)
133 if (!(adress->group_explicit[k] == adress->group_explicit[j]))
135 opts->egp_flags[nr * j + k] |= EGP_EXCL;
138 fprintf(debug, "AdResS excl %s %s \n",
139 (char*)(gnames[groups->grps[egcENER].nm_ind[j]]),
140 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
148 warning(wi, "For an AdResS simulation at least one coarse-grained energy group has to be specified in adress_cg_grp_names");
152 /* AdResS multiple tf tables input */
153 nadress_tf_grp_names = str_nelem(adress_tf_grp_names, MAXPTR, ptr1);
154 adress->n_tf_grps = nadress_tf_grp_names;
155 snew(adress->tf_table_index, nadress_tf_grp_names);
157 nr = groups->grps[egcENER].nr;
159 if (nadress_tf_grp_names > 0)
161 for (i = 0; i < nadress_tf_grp_names; i++)
163 /* search for the group name mathching the tf group name */
166 gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
172 gmx_fatal(FARGS, "Adress tf energy group %s not found\n", ptr1[i]);
175 adress->tf_table_index[i] = k;
178 fprintf(debug, "found tf group %s id %d \n", ptr1[i], k);
180 if (adress->group_explicit[k])
182 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]);
187 /* end AdResS multiple tf tables input */