00001
00002
00003
00004
00040 #ifndef MGRID_H
00041 #define MGRID_H
00042
00043 #include "mdapi/mdtypes.h"
00044 #include "mgrid/lattice.h"
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00050
00051
00052
00053
00056 typedef struct MgridCell_tag {
00057
00058 int32 head;
00059 int32 cnt;
00060 int32 nnbrs;
00061 int32 nbr[14];
00062 MD_Dvec offset[14];
00063 } MgridCell;
00064
00065
00066
00067
00068
00069
00070
00071 enum {
00072 MGRID_FAIL = -1
00073 };
00074
00075
00076
00081 enum MgridBoundary_tag {
00082 MGRID_BOUNDARY_BEGIN = 0,
00083 MGRID_PERIODIC,
00084 MGRID_NONPERIODIC,
00085 MGRID_BOUNDARY_END
00086 };
00087
00088
00089
00095 enum MgridApprox_tag {
00096 MGRID_APPROX_BEGIN = 0,
00097 MGRID_CUBIC,
00099 MGRID_BSPLINE,
00101 MGRID_QUINTIC1,
00103 MGRID_QUINTIC2,
00105 MGRID_HEPTIC1,
00108 MGRID_HEPTIC3,
00111 MGRID_NONIC1,
00114 MGRID_NONIC4,
00117 MGRID_HERMITE,
00119 MGRID_APPROX_END
00120 };
00121
00122
00123
00129 enum MgridSplit_tag {
00130 MGRID_SPLIT_BEGIN = 0,
00131 MGRID_TAYLOR1,
00134 MGRID_TAYLOR2,
00137 MGRID_TAYLOR3,
00140 MGRID_TAYLOR4,
00143 MGRID_TAYLOR5,
00146 MGRID_TAYLOR6,
00149 MGRID_TAYLOR7,
00152 MGRID_TAYLOR8,
00155 MGRID_ERRMIN3,
00159 MGRID_EXSELF1,
00163 MGRID_EXSELF2,
00167 MGRID_EXSELF3,
00171 MGRID_EXSELF7,
00176 MGRID_ODDPR1,
00179 MGRID_ODDPR2,
00182 MGRID_ODDPR3,
00185 MGRID_ODDPR4,
00188 MGRID_ODDPR5,
00191 MGRID_ODDPR6,
00194 MGRID_ODDPR7,
00197 MGRID_ODDPR8,
00200 MGRID_SPLIT_END
00201 };
00202
00203
00229 typedef struct MgridParam_tag {
00230 MD_Dvec center;
00231 double length;
00232 double cutoff;
00233 double spacing;
00234 int32 nspacings;
00236 int32 nlevels;
00237 int32 boundary;
00238 int32 natoms;
00239 int32 approx;
00240 int32 split;
00241 } MgridParam;
00242
00243
00244
00278 typedef struct MgridSystem_tag {
00279
00280
00281 double u_elec;
00283 double u_short;
00285 double u_long;
00287 MD_Dvec *f_elec;
00289 MD_Dvec *f_short;
00292 MD_Dvec *f_long;
00296
00297 MD_Dvec *pos;
00299 double *charge;
00303
00304 int32 **excl_list;
00308 int32 **scaled14_list;
00312 double scaling14;
00316 } MgridSystem;
00317
00318
00319
00324 typedef struct Mgrid_tag {
00325 MgridParam param;
00326
00327
00330 int (*short_force)(struct Mgrid_tag *, MgridSystem *);
00331
00332
00333 void (*short_done)(struct Mgrid_tag *);
00334
00335
00336 MD_Dvec lo;
00337 double inv_cellsize;
00338 double inv_cutoff;
00339
00340 int32 *next;
00341
00342
00343 MgridCell *cell;
00344 int32 ncells;
00345 int32 ndimcells;
00346
00347
00348 int32 is_split_even_powers;
00349
00350
00351 int (*cell_interactions)(struct Mgrid_tag *, MgridSystem *);
00352
00353
00354
00355
00356
00357 int (*long_force)(struct Mgrid_tag *, MgridSystem *);
00358
00359
00360 void (*long_done)(struct Mgrid_tag *);
00361
00362
00363 MD_Dvec origin;
00364 double inv_spacing;
00365 double u_self;
00366 double g_zero;
00367
00368 MgridLattice *qgrid;
00369
00370 MgridLattice *egrid;
00371
00372
00373 double *scaling;
00374
00375 MgridLattice gdsum;
00376 int32 gdsum_radius;
00377
00378 MgridLattice glast;
00379 int32 glast_radius;
00380
00381
00382 MgridLattice *gdsum_list;
00383 int32 *gdsum_radius_list;
00384
00385 } Mgrid;
00386
00387
00388
00389
00424 int mgrid_param_config(MgridParam *p);
00425
00426
00427
00428
00436 int mgrid_string_to_boundary(const char *);
00437
00445 const char *mgrid_boundary_to_string(int);
00446
00455 int mgrid_string_to_approx(const char *);
00456
00464 const char *mgrid_approx_to_string(int);
00465
00474 int mgrid_string_to_split(const char *);
00475
00483 const char *mgrid_split_to_string(int);
00484
00485
00486
00487
00495 int mgrid_init(Mgrid *);
00496
00514 int mgrid_setup(Mgrid *, const MgridSystem *s, const MgridParam *p);
00515
00529 int mgrid_force(Mgrid *, MgridSystem *s);
00530
00536 void mgrid_done(Mgrid *);
00537
00538
00539
00540
00553 int mgrid_system_validate(const Mgrid *, const MgridSystem *s);
00554
00555
00556
00557
00566 int mgrid_exact_smooth(Mgrid *, MgridSystem *s);
00567
00568
00569
00570 int mgrid_short_setup(Mgrid *);
00571 int mgrid_ncubic_setup(Mgrid *, const MgridSystem *);
00572 int mgrid_pcubic_setup(Mgrid *, const MgridSystem *);
00573 int mgrid_nbspline_setup(Mgrid *, const MgridSystem *);
00574 int mgrid_pbspline_setup(Mgrid *, const MgridSystem *);
00575 int mgrid_nquintic1_setup(Mgrid *, const MgridSystem *);
00576 int mgrid_pquintic1_setup(Mgrid *, const MgridSystem *);
00577 int mgrid_nquintic2_setup(Mgrid *, const MgridSystem *);
00578 int mgrid_pquintic2_setup(Mgrid *, const MgridSystem *);
00579 int mgrid_nheptic1_setup(Mgrid *, const MgridSystem *);
00580 int mgrid_pheptic1_setup(Mgrid *, const MgridSystem *);
00581 int mgrid_nheptic3_setup(Mgrid *, const MgridSystem *);
00582 int mgrid_pheptic3_setup(Mgrid *, const MgridSystem *);
00583 int mgrid_nnonic1_setup(Mgrid *, const MgridSystem *);
00584 int mgrid_pnonic1_setup(Mgrid *, const MgridSystem *);
00585 int mgrid_nnonic4_setup(Mgrid *, const MgridSystem *);
00586 int mgrid_pnonic4_setup(Mgrid *, const MgridSystem *);
00587 int mgrid_nhermite_setup(Mgrid *, const MgridSystem *);
00588 int mgrid_phermite_setup(Mgrid *, const MgridSystem *);
00589 int mgrid_setup_longrange(Mgrid *, const MgridSystem *);
00590
00591 #ifdef __cplusplus
00592 }
00593 #endif
00594
00595 #endif