4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Glycine aRginine prOline Methionine Alanine Cystine Serine
36 static char *SRCID_xmdrun_c = "$Id$";
81 static t_commrec *cr_msim;
83 t_commrec *init_msim(t_commrec *cr,int nfile,t_filenm fnm[])
93 cr_new->left = cr->left;
94 cr_new->right = cr->right;
96 /* Patch file names (except log which has been done already) */
97 for(i=0; (i<nfile); i++) {
98 /* Because of possible multiple extensions per type we must look
99 * at the actual file name
101 ftp = fn2ftp(fnm[i].fn);
104 fprintf(stderr,"Old file name: %s",fnm[i].fn);
106 buf = par_fn(fnm[i].fn,ftp,cr);
108 fnm[i].fn = strdup(buf);
110 fprintf(stderr,", new: %s\n",fnm[i].fn);
118 real mol_dipole(int k0,int k1,atom_id ma[],rvec x[],real q[])
124 for(k=k0; (k<k1); k++) {
126 for(m=0; (m<DIM); m++)
127 mu[m] += q[kk]*x[kk][m];
129 return norm(mu); /* Dipole moment of this molecule in e nm */
132 real calc_mu_aver(t_commrec *cr,t_nsborder *nsb,rvec x[],real q[],rvec mu,
133 t_topology *top,t_mdatoms *md,int gnx,atom_id grpindex[])
141 end = start + HOMENR(nsb);
143 atom = top->atoms.atom;
144 mols = &(top->blocks[ebMOLS]);
147 for(i=start; (i<end); i++)
148 for(m=0; (m<DIM); m++)
149 mu[m] += q[i]*x[i][m];
154 /* I guess we have to parallelise this one! */
158 for(i=0; (i<gnx); i++) {
159 int gi = grpindex[i];
160 mu_ave += mol_dipole(mols->index[gi],mols->index[gi+1],mols->a,x,q);
170 #include "../mdlib/md.c"
171 #include "../kernel/mdrun.c"