1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by Christoph Junghans, Brad Lambeth, and possibly others.
12 * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
13 * All rights reserved.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * GROningen Mixture of Alchemy and Childrens' Stories
39 #include "gmx_fatal.h"
43 static char adress_refs[STRLEN], adress_tf_grp_names[STRLEN], adress_cg_grp_names[STRLEN];
45 void read_adressparams(int *ninp_p, t_inpfile **inp_p, t_adress *adress, warninp_t wi)
58 EETYPE("adress_type", adress->type, eAdresstype_names);
59 RTYPE ("adress_const_wf", adress->const_wf, 1);
60 RTYPE ("adress_ex_width", adress->ex_width, 0);
61 RTYPE ("adress_hy_width", adress->hy_width, 0);
62 RTYPE ("adress_ex_forcecap", adress->ex_forcecap, 0);
63 EETYPE("adress_interface_correction", adress->icor, eAdressICtype_names);
64 EETYPE("adress_site", adress->site, eAdressSITEtype_names);
65 STYPE ("adress_reference_coords", adress_refs, NULL);
66 STYPE ("adress_tf_grp_names", adress_tf_grp_names, NULL);
67 STYPE ("adress_cg_grp_names", adress_cg_grp_names, NULL);
68 EETYPE("adress_do_hybridpairs", adress->do_hybridpairs, yesno_names);
70 nadress_refs = str_nelem(adress_refs, MAXPTR, ptr1);
72 for (i = 0; (i < nadress_refs); i++) /*read vector components*/
74 adress->refs[i] = strtod(ptr1[i], NULL);
76 for (; (i < DIM); i++) /*remaining undefined components of the vector set to zero*/
85 void do_adress_index(t_adress *adress, gmx_groups_t *groups, char **gnames, t_grpopts *opts, warninp_t wi)
89 int nadress_cg_grp_names, nadress_tf_grp_names;
91 /* AdResS coarse grained groups input */
93 nr = groups->grps[egcENER].nr;
94 snew(adress->group_explicit, nr);
95 for (i = 0; i < nr; i++)
97 adress->group_explicit[i] = TRUE;
99 adress->n_energy_grps = nr;
101 nadress_cg_grp_names = str_nelem(adress_cg_grp_names, MAXPTR, ptr1);
103 if (nadress_cg_grp_names > 0)
105 for (i = 0; i < nadress_cg_grp_names; i++)
107 /* search for the group name mathching the tf group name */
110 gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
116 gmx_fatal(FARGS, "Adress cg energy group %s not found\n", ptr1[i]);
118 adress->group_explicit[k] = FALSE;
119 printf ("AdResS: Energy group %s is treated as coarse-grained \n",
120 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
122 /* set energy group exclusions between all coarse-grained and explicit groups */
123 for (j = 0; j < nr; j++)
125 for (k = 0; k < nr; k++)
127 if (!(adress->group_explicit[k] == adress->group_explicit[j]))
129 opts->egp_flags[nr * j + k] |= EGP_EXCL;
132 fprintf(debug, "AdResS excl %s %s \n",
133 (char*)(gnames[groups->grps[egcENER].nm_ind[j]]),
134 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
142 warning(wi, "For an AdResS simulation at least one coarse-grained energy group has to be specified in adress_cg_grp_names");
146 /* AdResS multiple tf tables input */
147 nadress_tf_grp_names = str_nelem(adress_tf_grp_names, MAXPTR, ptr1);
148 adress->n_tf_grps = nadress_tf_grp_names;
149 snew(adress->tf_table_index, nadress_tf_grp_names);
151 nr = groups->grps[egcENER].nr;
153 if (nadress_tf_grp_names > 0)
155 for (i = 0; i < nadress_tf_grp_names; i++)
157 /* search for the group name mathching the tf group name */
160 gmx_strcasecmp(ptr1[i], (char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
166 gmx_fatal(FARGS, "Adress tf energy group %s not found\n", ptr1[i]);
169 adress->tf_table_index[i] = k;
172 fprintf(debug, "found tf group %s id %d \n", ptr1[i], k);
174 if (adress->group_explicit[k])
176 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]);
181 /* end AdResS multiple tf tables input */