3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
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 * Gromacs Runs On Most of All Computer Systems
45 #include "gmxcomplex.h"
52 extern int gmx_pppm_init(FILE *log
, t_commrec
*cr
,
53 const output_env_t oenv
, bool bVerbose
,
54 bool bOld
, matrix box
,
55 char *ghatfn
, t_inputrec
*ir
,
57 /* Setup stuff for PPPM.
58 * Either reads a ghat function from file (when the file exists)
59 * or generate a ghat function from scratch.
62 extern int gmx_pppm_do(FILE *log
, gmx_pme_t pme
,
65 real charge
[], rvec box
,
66 real phi
[], t_commrec
*cr
,
69 int pme_order
, real
*energy
);
70 /* Do a PPPM calculation for the long range electrostatics. */
72 /******************************************************************
74 * ROUTINES FOR GHAT MANIPULATION
76 ******************************************************************/
78 extern real
gk(real k
,real rc
,real r1
);
79 /* Compute the Ghat function for a single k-value */
81 extern real
gknew(real k
,real rc
,real r1
);
82 /* Compute the (new!) Ghat function for a single k-value */
84 extern void pr_scalar_gk(const char *fn
,const output_env_t oenv
,
85 int nx
,int ny
,int nz
, rvec box
,real
***ghat
);
87 extern void mk_ghat(FILE *fp
,int nx
,int ny
,int nz
,
88 real
***ghat
, rvec box
,real r1
,real rc
,bool bSym
,bool bOld
);
89 /* Generate a Ghat function from scratch. The ghat grid should
90 * be allocated using the mk_rgrid function. When bSym, only
91 * the first octant of the function is generated by direct calculation
92 * and the above mentioned function is called for computing the rest.
93 * When !bOld a new experimental function form will be used.
96 extern real
***rd_ghat(FILE *log
,const output_env_t oenv
,char *fn
,ivec igrid
,
97 rvec gridspacing
, rvec beta
,int *porder
,
98 real
*rshort
,real
*rlong
);
99 /* Read a Ghat function from a file as generated by the program
100 * mk_ghat. The grid size (number of grid points) is returned in
101 * igrid, the space between grid points in gridspacing,
102 * beta is a constant that determines the contribution of first
103 * and second neighbours in the grid to the force
104 * (See Luty et al. JCP 103 (1995) 3014)
105 * porder determines whether 8 (when porder = 1) or 27 (when
106 * porder = 2) neighbouring grid points are used for spreading
108 * rshort and rlong are the lengths used for generating the Ghat
112 extern void wr_ghat(const char *fn
,const output_env_t oenv
,
113 int n1max
,int n2max
, int n3max
,real h1
,
114 real h2
,real h3
,real
***ghat
,int nalias
,
115 int porder
,int niter
,bool bSym
,rvec beta
,
116 real r1
,real rc
,real pval
,real zval
,real eref
,real qopt
);
117 /* Write a ghat file. (see above) */