4e972895043ebfe6f2358da8e00de35dbc7ecafe
[alexxy/gromacs.git] / include / pppm.h
1 /*
2  * 
3  *                This source code is part of
4  * 
5  *                 G   R   O   M   A   C   S
6  * 
7  *          GROningen MAchine for Chemical Simulations
8  * 
9  *                        VERSION 3.2.0
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.
14
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.
19  * 
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.
26  * 
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.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * Gromacs Runs On Most of All Computer Systems
34  */
35
36 #ifndef _pppm_h
37 #define _pppm_h
38
39 #include <stdio.h>
40 #include "typedefs.h"
41 #include "gmxcomplex.h"
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 int gmx_pppm_init(FILE *log,      t_commrec *cr,
48                          const output_env_t oenv, bool bVerbose,
49                          bool bOld,      matrix box,
50                          char *ghatfn,   t_inputrec *ir,
51                          bool bReproducible);
52 /* Setup stuff for PPPM. 
53  * Either reads a ghat function from file (when the file exists)
54  * or generate a ghat function from scratch.
55  */
56
57 int gmx_pppm_do(FILE *log,       gmx_pme_t pme,
58                        bool bVerbose,
59                        rvec x[],        rvec f[],
60                        real charge[],   rvec box,
61                        real phi[],      t_commrec *cr,
62                        int start,       int nt,
63                        t_nrnb *nrnb,
64                        int pme_order,   real *energy);
65 /* Do a PPPM calculation for the long range electrostatics. */
66
67 /******************************************************************
68  *
69  *   ROUTINES FOR GHAT MANIPULATION
70  *
71  ******************************************************************/
72  
73 real gk(real k,real rc,real r1);
74 /* Compute the Ghat function for a single k-value */
75
76 real gknew(real k,real rc,real r1);
77 /* Compute the (new!) Ghat function for a single k-value */
78
79 void pr_scalar_gk(const char *fn,const output_env_t oenv,
80                          int nx,int ny,int nz, rvec box,real ***ghat);
81
82 void mk_ghat(FILE *fp,int nx,int ny,int nz,
83                     real ***ghat, rvec box,real r1,real rc,bool bSym,bool bOld);
84 /* Generate a Ghat function from scratch. The ghat grid should
85  * be allocated using the mk_rgrid function. When bSym, only
86  * the first octant of the function is generated by direct calculation
87  * and the above mentioned function is called for computing the rest.
88  * When !bOld a new experimental function form will be used.
89  */
90
91 real ***rd_ghat(FILE *log,const output_env_t oenv,char *fn,ivec igrid,
92                        rvec gridspacing, rvec beta,int *porder,
93                        real *rshort,real *rlong);
94 /* Read a Ghat function from a file as generated by the program
95  * mk_ghat. The grid size (number of grid points) is returned in
96  * igrid, the space between grid points in gridspacing,
97  * beta is a constant that determines the contribution of first
98  * and second neighbours in the grid to the force
99  * (See Luty et al. JCP 103 (1995) 3014)
100  * porder determines whether 8 (when porder = 1) or 27 (when
101  * porder = 2) neighbouring grid points are used for spreading
102  * the charge.
103  * rshort and rlong are the lengths used for generating the Ghat
104  * function.
105  */
106                   
107 void wr_ghat(const char *fn,const output_env_t oenv, 
108                     int n1max,int n2max, int n3max,real h1,
109                     real h2,real h3,real ***ghat,int nalias,
110                     int porder,int niter,bool bSym,rvec beta,
111                     real r1,real rc,real pval,real zval,real eref,real qopt);
112 /* Write a ghat file. (see above) */
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif