changed reading hint
[gromacs/adressmacs.git] / src / mdlib / calcmu.c
blob2531621e1177d5bf700008b1a71ed34d9ccce8a2
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * GRowing Old MAkes el Chrono Sweat
29 static char *SRCID_calcmu_c = "$Id$";
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include "typedefs.h"
34 #include "network.h"
35 #include "vec.h"
36 #include "fatal.h"
37 #include "physics.h"
38 #include "nsb.h"
39 #include "main.h"
41 void calc_mu(t_nsborder *nsb,rvec x[],real q[],rvec mu)
43 int i,start,end,m;
45 start = START(nsb);
46 end = start + HOMENR(nsb);
48 clear_rvec(mu);
49 for(i=start; (i<end); i++) {
50 for(m=0; (m<DIM); m++) {
51 mu[m] += q[i]*x[i][m];
54 for(m=0; (m<DIM); m++)
55 mu[m] *= ENM2DEBYE;
58 bool read_mu(FILE *fp,rvec mu,real *vol)
60 /* For backward compatibility */
61 real mmm[4];
63 if (fread(mmm,(size_t)(4*sizeof(mmm)),1,fp) != 1)
64 return FALSE;
66 copy_rvec(mmm,mu);
67 *vol = mmm[3];
69 return TRUE;