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*/
73 adress->refs[i]=strtod(ptr1[i],NULL);
74 for( ;(i<DIM); i++) /*remaining undefined components of the vector set to zero*/
78 void do_adress_index(t_adress *adress, gmx_groups_t *groups,char **gnames,t_grpopts *opts,warninp_t wi){
81 int nadress_cg_grp_names, nadress_tf_grp_names;
83 /* AdResS coarse grained groups input */
85 nr = groups->grps[egcENER].nr;
86 snew(adress->group_explicit, nr);
87 for (i=0; i <nr; i++){
88 adress->group_explicit[i] = TRUE;
90 adress->n_energy_grps = nr;
92 nadress_cg_grp_names = str_nelem(adress_cg_grp_names,MAXPTR,ptr1);
94 if (nadress_cg_grp_names > 0){
95 for (i=0; i <nadress_cg_grp_names; i++){
96 /* search for the group name mathching the tf group name */
99 gmx_strcasecmp(ptr1[i],(char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
101 if (k==nr) gmx_fatal(FARGS,"Adress cg energy group %s not found\n",ptr1[i]);
102 adress->group_explicit[k] = FALSE;
103 printf ("AdResS: Energy group %s is treated as coarse-grained \n",
104 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
106 /* set energy group exclusions between all coarse-grained and explicit groups */
107 for (j = 0; j < nr; j++) {
108 for (k = 0; k < nr; k++) {
109 if (!(adress->group_explicit[k] == adress->group_explicit[j])){
110 opts->egp_flags[nr * j + k] |= EGP_EXCL;
111 if (debug) fprintf(debug,"AdResS excl %s %s \n",
112 (char*)(gnames[groups->grps[egcENER].nm_ind[j]]),
113 (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
118 warning(wi,"For an AdResS simulation at least one coarse-grained energy group has to be specified in adress_cg_grp_names");
122 /* AdResS multiple tf tables input */
123 nadress_tf_grp_names = str_nelem(adress_tf_grp_names,MAXPTR,ptr1);
124 adress->n_tf_grps = nadress_tf_grp_names;
125 snew(adress->tf_table_index, nadress_tf_grp_names);
127 nr = groups->grps[egcENER].nr;
129 if (nadress_tf_grp_names > 0){
130 for (i=0; i <nadress_tf_grp_names; i++){
131 /* search for the group name mathching the tf group name */
134 gmx_strcasecmp(ptr1[i],(char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
136 if (k==nr) gmx_fatal(FARGS,"Adress tf energy group %s not found\n",ptr1[i]);
138 adress->tf_table_index[i] = k;
139 if (debug) fprintf(debug,"found tf group %s id %d \n",ptr1[i], k);
140 if (adress->group_explicit[k]){
141 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]);
146 /* end AdResS multiple tf tables input */