Debian Codegraph @

contrib/iapbs/src/apbs_driver.h

raw
1 /**
2 *
3 * @file apbs_driver.h
4 * @author Robert Konecny
5 * @brief Header file for the main iAPBS driver
6 *
7 *
8 */
9
10
11 /*! \def NATOMS
12 \brief Maximum number of atoms.
13 */
14 #define NATOMS 150000
15
16 /**
17 * @brief Wrapper iAPBS function
18 * @author Robert Konecny
19 *
20 * @param nat Number of atoms
21 * @param x Atomic coordinate (x)
22 * @param y Atomic coordinate (y)
23 * @param z Atomic coordinate (z)
24 * @param radius Atomic radii
25 * @param charge Atomic charges
26 * @param r_param Input APBS parameters (real values)
27 * 0: pdie
28 * 1: nsdie
29 * 2: srad
30 * 3: swin
31 * 4: temp
32 * 5: sdens
33 * 6: gamma
34 * 7: smpbe_vol
35 * 8: smpbe_size
36 * @param i_param Input APBS parameters (integer values)
37 * 0: sim_type - 0=mg-manual, 1=mg-auto, 2=mg-parallel
38 * 1: nlev - required if sim_type=mg-manual
39 * 2: grid_centering_mode - 0=use center[0-2] values, 1=center on mol1
40 * 3: coarse_centering_mode - 0=use ccenter[0-2] values, 1=center on mol 1
41 * 4: fine_centering_mode - 0=use fcenter[0-2] values, 1= center on mol 1
42 * 5: chgm - 0=sp10, 1=sp12, 2=sp14
43 * 6: pbe_mode - 0=lpbe, 1=npbe, 2=lrpbe, 3=nrpbe, 4=smpbe
44 * 7: bcfl - 0=zero, 1=sdh, 2=mdh, 4=focus
45 * 8: srfm - 0=mol, 1=smol, 2=sp12, 3=sp14
46 * 9: calcforce - 0=no, 1=yes
47 * 10: calcenergy - 0=no, 1=yes
48 * 11: write_pot - 0=no, 1=yes
49 * 12: write_charge - 0=no, 1=yes
50 * 13: write_smol - 0=no, 1=yes
51 * 14: write_kappa - 0=no, 1=yes
52 * 15: write_diel - 0=no, 1=yes
53 * 16: write_atompot - 0=no, 1=yes
54 * 17: use_pot - 0=no, 1=yes
55 * 18: NOT USED
56 * 19: apol_calcforce - 0=no, 1=yes
57 * 20: apol_calcenergy - 0=no, 1=yes
58 * 21: nIons - number of ions
59 * 22: use_charge - 0=no, 1=yes
60 * 23: use_kappa - 0=no, 1=yes
61 * 24: use_diel - 0=no, 1=yes
62 * @param grid Grid spacing
63 * @param dime Grid dimensions
64 * @param pdime Grid of processors to be used in calculation
65 * @param glen Grid side lengths
66 * @param center Grid center
67 * @param cglen Coarse grid side lengths
68 * @param fglen Fine grid side lengths
69 * @param ccenter Coarse grid center
70 * @param fcenter Fine grid center
71 * @param ofrac Overlap fraction between procs
72 * @param dbg Debug verbosity flag
73 * @param ionq Mobile ion charge
74 * @param ionc Mobile ion concentration
75 * @param ionr Mobile ion radius
76 * @param (out) esEnergy Electrostatic energy
77 * This must be allocated for the number of simulations by the caller
78 * @param (out) npEnergy Non-polar energy
79 * This must be allocated for the number of simulations by the caller
80 * @param (out) apbsdx Total electrostatic force per atom (x coordinate)
81 * @param (out) apbsdy Total electrostatic force per atom (y coordinate)
82 * @param (out) apbsdz Total electrostatic force per atom (z coordinate)
83 * @param (out) apbsqfx Fixed charge force (x)
84 * @param (out) apbsqfy Fixed charge force (y)
85 * @param (out) apbsqfz Fixed charge force (z)
86 * @param (out) apbsibx Ionic boundary force (x)
87 * @param (out) apbsiby Ionic boundary force (y)
88 * @param (out) apbsibz Ionic boundary force (z)
89 * @param (out) apbsnpx Non-polar force (x)
90 * @param (out) apbsnpy Non-polar force (y)
91 * @param (out) apbsnpz Non-polar force (z)
92 * @param (out) apbsdbx Dielectric boundary force (x)
93 * @param (out) apbsdby Dielectric boundary force (y)
94 * @param (out) apbsdbz Dielectric boundary force (z)
95 * The above apbsXXX[] must be allocated for at least the number of actual atoms and less than NATOMS
96 * if calcforce > 0. Otherwise this can be null.
97 * @param apbsgrid_meta grid meta data
98 * 0: ndata (input)
99 * 0 <= ndata <= number of grid-dimensioned data sets to be returned in apbsgrid**.
100 * If 0, "write" statements results will go to files.
101 * 1: nx (out) actual x-dimension
102 * 2: ny (out) actual y-dimension
103 * 3: nz (out) actual z-dimension
104 * 4: hx (out) actual x-grid resolution
105 * 5: hy (out) actual y-grid resolution
106 * 6: hz (out) actual z-grid resolution
107 * 7: centx (out) actual x center coord
108 * 8: centy (out) actual y center coord
109 * 9: centz (out) actual z center coord
110 * 10: minx (out) actual x min coord
111 * 11: miny (out) actual y min coord
112 * 12: minz (out) actual z min coord
113 * @param (out) apbsgrid List of grid data sets
114 * The memory must be allocated by the user when apbsgrid_meta[0]>0,
115 * or the program shall terminate.
116 *
117 * apbsgrid[0][0] points to an array of data corresponding to
118 * the first TRE value in i_param[11:16].
119 * e.g. If &i_param+11 = {0,1,0,1,0,0}, indicating "write_charge" and "write_kappa" = 1,
120 * apbsgrid should be allocated by the user to 2*x*ny*nz * sizeof(double).
121 *
122 * The grid data is arranged in z, y, x in the order of increment frequency.
123 * e.g. apbsgrid[0][0] =: charge of grid location (0,0,0).
124 * abpsgrid[0][1] =: (0,0,1), apbsgrid[0][2] =: (0,0,2), ...,
125 * apbsgrid[0][nz+1] = (0,1,0), apbsgrid[0][nz+2] =: (0,1,1), ...
126 *
127 * // This will print out the grid data in the same order as WRITE statement
128 * // would write to file.
129 * //
130 * int i, j, k, line=0;
131 * double * data = apbsgrid[0];
132 * for (i=0; i<nx; i++) {
133 * for (j=0; j<ny; j++) {
134 * for (k=0; k<nz; k++) {
135 * u = k*(nx)*(ny)+j*(nx)+i;
136 * printf("%12.6e ", data[u]);
137 * icol++;
138 * if (icol == 3) {
139 * icol = 0;
140 * lines++;
141 * printf("\n");
142 * }
143 * }
144 * }
145 * }
146 * @return 1 if successful, 0 otherwise
147 *
148 * All output data structures must be allocated memory by the caller if they are r
149 */
150
151 VEXTERNC int apbsdrv_(int *nat,
152 double x[NATOMS],
153 double y[NATOMS],
154 double z[NATOMS],
155 double radius[NATOMS],
156 double charge[NATOMS],
157 double r_param[9],
158 int i_param[25],
159 double grid[3],
160 int dime[3],
161 int pdime[3],
162 double glen[3],
163 double center[3],
164 double cglen[3],
165 double fglen[3],
166 double ccenter[3],
167 double fcenter[3],
168 double *ofrac,
169 int *dbg,
170 double ionq[MAXION],
171 double ionc[MAXION],
172 double ionr[MAXION],
173 double esEnergy[NOSH_MAXCALC],
174 double npEnergy[NOSH_MAXCALC],
175 double apbsdx[NATOMS],
176 double apbsdy[NATOMS],
177 double apbsdz[NATOMS],
178 double apbsqfx[NATOMS],
179 double apbsqfy[NATOMS],
180 double apbsqfz[NATOMS],
181 double apbsibx[NATOMS],
182 double apbsiby[NATOMS],
183 double apbsibz[NATOMS],
184 double apbsnpx[NATOMS],
185 double apbsnpy[NATOMS],
186 double apbsnpz[NATOMS],
187 double apbsdbx[NATOMS],
188 double apbsdby[NATOMS],
189 double apbsdbz[NATOMS],
190 double apbsgrid_meta[13],
191 double * apbsgrid[]);
192
193 /**
194 * @brief Calculate forces from MG solution
195 * @author Robert Konecny (based on forceMG)
196 *
197 * @param mem Memory management object
198 * @param nosh Parameters from input file
199 * @param pbeparm Generic PBE parameters
200 * @param mgparm MG-specific parmaeters
201 * @param pmg MG object
202 * @param nforce 0 => no forces, 1 => net forces, >1 => number of
203 * forces (1 per atom)
204 * @param atomForce Pointer to array of force objects
205 * @param alist List of atom lists
206 * @param debug verbosity flag
207 * @return 1 if successful, 0 otherwise */
208 VEXTERNC int iforceMG(Vmem *mem,
209 NOsh *nosh,
210 PBEparm *pbeparm,
211 MGparm *mgparm,
212 Vpmg *pmg,
213 int *nforce,
214 AtomForce **atomForce,
215 Valist *alist[NOSH_MAXMOL],
216 int debug);
217
218 /**
219 * @brief Combine and pretty-print energy data
220 * @ingroup Frontend
221 * @author David Gohara
222 * @return 1 if successful, 0 otherwise */
223 //VEXTERNC double getElecEnergy(
224
225 double getElecEnergy(
226 Vcom *com, /** Communications object */
227 NOsh *nosh, /** Parameters from input file */
228 double totEnergy[NOSH_MAXCALC], /** Array of energies
229 from different calculations */
230 int iprint /** Index of energy statement to print */
231 );
232
233
234 /**
235 * @brief Creates APBS input string
236 * @author Robert Konecny
237 * @param r_param Input APBS parameters (real values)
238 * @param i_param Input APBS parameters (integer values)
239 * @param grid Grid spacing
240 * @param dime Grid dimensions
241 * @param ionq Mobile ion charge
242 * @param ionc Mobile ion concentration
243 * @param ionr Mobile ion radius
244 * @param glen Grid side lengths
245 * @param center Grid center
246 * @param cglen Coarse grid side lengths
247 * @param fglen Fine grid side lengths
248 * @param ccenter Coarse grid center
249 * @param fcenter Fine grid center
250 * @param ofrac Overlap fraction between procs
251 * @param pdime Grid of processors to be used in calculation
252 * @param debug Debug verbosity level.
253 * @return the input string */
254 char *setupString(double r_param[9], int i_param[25], double grid[3],
255 int dime[3], double ionq[MAXION], double ionc[MAXION],
256 double ionr[MAXION], double glen[3], double center[3],
257 double cglen[3], double fglen[3],
258 double ccenter[3], double fcenter[3], double *ofrac,
259 int pdime[3], int debug);