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_LOWDEG1,
00201 MGRID_LOWDEG2,
00202 MGRID_LOWDEG3,
00203 MGRID_LOWDEG4,
00204 MGRID_LOWDEG5,
00205 MGRID_LOWDEG6,
00206 MGRID_LOWDEG7,
00207 MGRID_LOWDEG8,
00208 MGRID_LOWALT5_1,
00209 MGRID_LOWALT6_1,
00210 MGRID_LOWALT7_1,
00211 MGRID_LOWALT8_1,
00212 MGRID_LOWALT8_2,
00213 MGRID_EXSFPC2,
00216 MGRID_EXSFPQ2,
00219 MGRID_EXSFRC2,
00222 MGRID_EXSFRQ2,
00225 MGRID_EXACT3,
00226 MGRID_EXACT2,
00227 MGRID_EXACT1,
00228 MGRID_EXACT0,
00229 MGRID_SPLIT_END
00230 };
00231
00232
00258 typedef struct MgridParam_tag {
00259 MD_Dvec center;
00260 double length;
00261 double cutoff;
00262 double spacing;
00263 int32 nspacings;
00265 int32 nlevels;
00266 int32 boundary;
00267 int32 natoms;
00268 int32 approx;
00269 int32 split;
00270 } MgridParam;
00271
00272
00273
00307 typedef struct MgridSystem_tag {
00308
00309
00310 double u_elec;
00312 double u_short;
00314 double u_long;
00316 MD_Dvec *f_elec;
00318 MD_Dvec *f_short;
00321 MD_Dvec *f_long;
00325
00326 MD_Dvec *pos;
00328 double *charge;
00332
00333 int32 **excl_list;
00337 int32 **scaled14_list;
00341 double scaling14;
00345 } MgridSystem;
00346
00347
00348
00353 typedef struct Mgrid_tag {
00354 MgridParam param;
00355
00356
00359 int (*short_force)(struct Mgrid_tag *, MgridSystem *);
00360
00361
00362 void (*short_done)(struct Mgrid_tag *);
00363
00364
00365 MD_Dvec lo;
00366 double inv_cellsize;
00367 double inv_cutoff;
00368
00369 int32 *next;
00370
00371
00372 MgridCell *cell;
00373 int32 ncells;
00374 int32 ndimcells;
00375
00376
00377 int32 is_split_even_powers;
00378
00379
00380 int (*cell_interactions)(struct Mgrid_tag *, MgridSystem *);
00381
00382
00383
00384
00385
00386 int (*long_force)(struct Mgrid_tag *, MgridSystem *);
00387
00388
00389 void (*long_done)(struct Mgrid_tag *);
00390
00391
00392 MD_Dvec origin;
00393 double inv_spacing;
00394 double u_self;
00395 double g_zero;
00396
00397 MgridLattice *qgrid;
00398
00399 MgridLattice *egrid;
00400
00401
00402 double *scaling;
00403
00404 MgridLattice gdsum;
00405 int32 gdsum_radius;
00406
00407 MgridLattice glast;
00408 int32 glast_radius;
00409
00410
00411 MgridLattice *gdsum_list;
00412 int32 *gdsum_radius_list;
00413
00414
00415 MgridLattice *opres_list;
00416 MgridLattice *oppro_list;
00417
00418
00419 MgridLattice *is_zero;
00420
00421 } Mgrid;
00422
00423
00424
00425
00460 int mgrid_param_config(MgridParam *p);
00461
00462
00463
00464
00472 int mgrid_string_to_boundary(const char *);
00473
00481 const char *mgrid_boundary_to_string(int);
00482
00491 int mgrid_string_to_approx(const char *);
00492
00500 const char *mgrid_approx_to_string(int);
00501
00510 int mgrid_string_to_split(const char *);
00511
00519 const char *mgrid_split_to_string(int);
00520
00521
00522
00523
00531 int mgrid_init(Mgrid *);
00532
00550 int mgrid_setup(Mgrid *, const MgridSystem *s, const MgridParam *p);
00551
00565 int mgrid_force(Mgrid *, MgridSystem *s);
00566
00572 void mgrid_done(Mgrid *);
00573
00574
00575
00576
00589 int mgrid_system_validate(const Mgrid *, const MgridSystem *s);
00590
00591
00592
00593
00602 int mgrid_exact_smooth(Mgrid *, MgridSystem *s);
00603
00604
00605
00606 int mgrid_short_setup(Mgrid *);
00607 int mgrid_ncubic_setup(Mgrid *, const MgridSystem *);
00608 int mgrid_pcubic_setup(Mgrid *, const MgridSystem *);
00609 int mgrid_nbspline_setup(Mgrid *, const MgridSystem *);
00610 int mgrid_pbspline_setup(Mgrid *, const MgridSystem *);
00611 int mgrid_nquintic1_setup(Mgrid *, const MgridSystem *);
00612 int mgrid_pquintic1_setup(Mgrid *, const MgridSystem *);
00613 int mgrid_nquintic2_setup(Mgrid *, const MgridSystem *);
00614 int mgrid_pquintic2_setup(Mgrid *, const MgridSystem *);
00615 int mgrid_nheptic1_setup(Mgrid *, const MgridSystem *);
00616 int mgrid_pheptic1_setup(Mgrid *, const MgridSystem *);
00617 int mgrid_nheptic3_setup(Mgrid *, const MgridSystem *);
00618 int mgrid_pheptic3_setup(Mgrid *, const MgridSystem *);
00619 int mgrid_nnonic1_setup(Mgrid *, const MgridSystem *);
00620 int mgrid_pnonic1_setup(Mgrid *, const MgridSystem *);
00621 int mgrid_nnonic4_setup(Mgrid *, const MgridSystem *);
00622 int mgrid_pnonic4_setup(Mgrid *, const MgridSystem *);
00623 int mgrid_nhermite_setup(Mgrid *, const MgridSystem *);
00624 int mgrid_phermite_setup(Mgrid *, const MgridSystem *);
00625 int mgrid_setup_longrange(Mgrid *, const MgridSystem *);
00626
00627 #ifdef __cplusplus
00628 }
00629 #endif
00630
00631 #endif