00001 /***************************************************************************
00002 *cr
00003 *cr (C) Copyright 2008-2009 The Board of Trustees of the
00004 *cr University of Illinois
00005 *cr All Rights Reserved
00006 *cr
00007 ***************************************************************************/
00008
00009 /***************************************************************************
00010 * RCS INFORMATION:
00011 *
00012 * $RCSfile: msmpot.h,v $
00013 * $Author: johns $ $Locker: $ $State: Exp $
00014 * $Revision: 1.3 $ $Date: 2010/06/03 20:07:09 $
00015 *
00016 ***************************************************************************/
00017
00024 #ifndef MSMPOT_H
00025 #define MSMPOT_H
00026
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030
00031 /* struct Msmpot_t; */
00033 typedef struct Msmpot_t Msmpot;
00034
00036 Msmpot *Msmpot_create(void);
00037
00039 void Msmpot_destroy(Msmpot *);
00040
00041
00099 int Msmpot_compute(Msmpot *pm,
00100 float *epotmap, /* electrostatic potential map */
00101 int mx, int my, int mz, /* map lattice dimensions */
00102 float lx, float ly, float lz, /* map lattice lengths */
00103 float x0, float y0, float z0, /* map origin (lower-left corner) */
00104 float vx, float vy, float vz, /* periodic cell lengths along x, y, z;
00105 set to 0 for non-periodic direction */
00106 const float *atom, /* atoms stored x/y/z/q (length 4*natoms) */
00107 int natoms /* number of atoms */
00108 );
00109
00110
00156 int Msmpot_compute_exact(Msmpot *pm,
00157 float *epotmap, /* electrostatic potential map */
00158 int mx, int my, int mz, /* map lattice dimensions */
00159 float lx, float ly, float lz, /* map lattice lengths */
00160 float x0, float y0, float z0, /* map origin (lower-left corner) */
00161 float vx, float vy, float vz, /* periodic cell lengths along x, y, z;
00162 set to 0 for non-periodic direction */
00163 const float *atom, /* atoms stored x/y/z/q (length 4*natoms) */
00164 int natoms /* number of atoms */
00165 );
00166
00167
00168 /*
00169 * Use CUDA GPU acceleration for Msmpot_compute().
00170 * devlist - available devices, listed in decreasing order of preference
00171 * listlen - length of devlist array
00172 * cuda_optional - 1 indicates fall back on CPU if device or CUDA kernel
00173 * can't be used to compute desired result, 0 indicates hard failure
00174 * No checking is done for actual device existence until Msmpot_compute().
00175 * However, an error is returned if the MSMPOT build lacks CUDA support
00176 * or if devlist and listlen do not together indicate at least one device.
00177 */
00178 int Msmpot_use_cuda(Msmpot *, const int *devlist, int listlen,
00179 int cuda_optional);
00180
00181
00182 #if 0
00183 /*
00184 * Establish a callback indicating progress of Msmpot_compute().
00185 * Function "progress" is provided by user to accept four ints:
00186 * numphases - number of phases
00187 * phasecnt - which phase
00188 * numunits - number of work units for this phase
00189 * unitcnt - which work unit
00190 * A nonzero return value from progress() will result in early
00191 * termination of the Msmpot_compute() call.
00192 */
00193 int Msmpot_callback_status(Msmpot *,
00194 int (*progress)(int numphases, int phasecnt, int numunits, int unitcnt));
00195 #endif
00196
00197
00198 /*@brief Return the error message string for a particular return code. */
00199 const char *Msmpot_error_string(int retcode);
00200
00201 /*
00202 * Configure the MSM parameters to improve accuracy or performance.
00203 *
00204 * interp - choose interpolant (MSMPOT_INTERP_*);
00205 * set less than 0 for default
00206 * split - choose splitting (MSMPOT_SPLIT_*);
00207 * set less than 0 for optimal choice based on interp
00208 * nlevels - maximum number of levels for lattice hierarchy;
00209 * set less than or equal to 0 to use maximum possible levels
00210 * cutoff - length of short-range cutoff for atomic interactions;
00211 * set less than or equal to 0 for default
00212 * hmin - minimum spacing for MSM h-level lattice, hmax = (3/2)*hmin;
00213 * for periodic boundaries, we can choose h, hmin <= h <= hmax;
00214 * for non-periodic boundaries, h = hmin;
00215 * set less than or equal to 0 for optimal choice based on cutoff
00216 * binszmin - minimum bin size for geometric hashing;
00217 * for periodic, binsize = L / floor(L / binszmin);
00218 * for non-periodic boundaries, binsize = binszmin;
00219 * set less than or equal to 0 for default
00220 *
00221 * Set any option less than 0 to
00222 */
00223 int Msmpot_configure(Msmpot *,
00224 int interp, /* which interpolant */
00225 int split, /* which splitting */
00226 float cutoff, /* cutoff distance (in Angstroms) */
00227 float hmin, /* minimum spacing MSM h-level lattice */
00228 int nlevels, /* maximum number of levels */
00229 float density, /* expected density of system */
00230 float binfill, /* ratio for bin fill, between 0 and 1 */
00231 float errtol, /* error tolerance for convergence of periodic
00232 #Msmpot_compute_exact() calculation */
00233 int usecuda /* Use CUDA GPU acceleration? */
00234 );
00235
00236 /*
00237 * MSM interpolation methods. (Default is CUBIC.)
00238 */
00239 enum {
00240 MSMPOT_INTERP_CUBIC = 0, /* C1 cubic (numerical Hermite) */
00241 MSMPOT_INTERP_QUINTIC, /* C1 quintic (linear blend of quartics) */
00242 MSMPOT_INTERP_QUINTIC2, /* C2 quintic */
00243 MSMPOT_INTERP_SEPTIC, /* C1 septic (linear blend of sextics) */
00244 MSMPOT_INTERP_SEPTIC3, /* C3 septic */
00245 MSMPOT_INTERP_NONIC, /* C1 nonic (linear blend of octics) */
00246 MSMPOT_INTERP_NONIC4, /* C4 nonic */
00247 MSMPOT_INTERPMAX /* (for internal use) */
00248 };
00249
00250 /*
00251 * MSM potential splitting methods. (Default is TAYLOR2.)
00252 */
00253 enum {
00254 MSMPOT_SPLIT_TAYLOR2 = 0, /* C2 Taylor splitting of s^(1/2), s = r^2 */
00255 MSMPOT_SPLIT_TAYLOR3, /* C3 Taylor splitting of s^(1/2), s = r^2 */
00256 MSMPOT_SPLIT_TAYLOR4, /* C4 Taylor splitting of s^(1/2), s = r^2 */
00257 MSMPOT_SPLIT_TAYLOR5, /* C5 Taylor splitting of s^(1/2), s = r^2 */
00258 MSMPOT_SPLIT_TAYLOR6, /* C6 Taylor splitting of s^(1/2), s = r^2 */
00259 MSMPOT_SPLIT_TAYLOR7, /* C7 Taylor splitting of s^(1/2), s = r^2 */
00260 MSMPOT_SPLIT_TAYLOR8, /* C8 Taylor splitting of s^(1/2), s = r^2 */
00261 MSMPOT_SPLITMAX /* (for internal use) */
00262 };
00263
00269 typedef enum MsmpotRetcode_t {
00270 MSMPOT_SUCCESS = 0,
00271 MSMPOT_ERROR_ASSERT,
00272 MSMPOT_ERROR_MALLOC,
00273 MSMPOT_ERROR_PARAM,
00274 MSMPOT_ERROR_SUPPORT,
00275 MSMPOT_ERROR_CUDA_DEVREQ,
00276 MSMPOT_ERROR_CUDA_MALLOC,
00277 MSMPOT_ERROR_CUDA_MEMCPY,
00279 MSMPOT_ERROR_CUDA_KERNEL,
00280 MSMPOT_ERROR_CUDA_SUPPORT,
00281 MSMPOT_ERROR_UNKNOWN
00282 } MsmpotRetcode;
00283
00284
00285 #ifdef __cplusplus
00286 }
00287 #endif
00288
00289 #endif /* MSMPOT_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002