00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "Matrix4.h"
00019
00020
00021 #define VMDUSEMSMPOT 1
00022
00023 class VMDApp;
00024 class VolumetricData;
00025 class AtomSel;
00026 class Molecule;
00027
00033
00034 class VolMapCreate {
00035 public:
00036 typedef enum {COMBINE_AVG, COMBINE_MIN, COMBINE_MAX, COMBINE_STDEV, COMBINE_PMF} CombineType;
00037
00038 protected:
00039 VMDApp *app;
00040 AtomSel *sel;
00041 float delta;
00042 int computed_frames;
00043 int checkpoint_freq;
00044 char *checkpoint_name;
00045 bool user_minmax;
00046 float min_coord[3], max_coord[3];
00047
00048 protected:
00049 virtual int compute_frame(int frame, float *voldata) = 0;
00050 int compute_init(float padding);
00051
00053 virtual int compute_init() {return compute_init(0.);}
00054
00056 int calculate_minmax (float *min_coord, float *max_coord);
00057
00059 int calculate_max_radius (float &radius);
00060
00062 void combo_begin(CombineType method, void **customptr, void *params);
00063 void combo_addframe(CombineType method, float *voldata, void *customptr, float *framedata);
00064 void combo_export(CombineType method, float *voldata, void *customptr);
00065 void combo_end(CombineType method, void *customptr);
00066
00067
00068 public:
00069 VolumetricData *volmap;
00070
00071 VolMapCreate(VMDApp *app, AtomSel *sel, float resolution);
00072 virtual ~VolMapCreate();
00073
00074 void set_minmax (float minx, float miny, float minz, float maxx, float maxy, float maxz);
00075
00076 void set_checkpoint (int checkpointfreq, char *checkpointname);
00077
00078 int compute_all(bool allframes, CombineType method, void *params);
00079
00084 virtual void write_map(const char *filename);
00085
00086
00087 int write_dx_file (const char *filename);
00088
00089 };
00090
00091
00092 class VolMapCreateMask: public VolMapCreate {
00093 protected:
00094 int compute_init();
00095 int compute_frame(int frame, float *voldata);
00096 private:
00097 float atomradius;
00098
00099 public:
00100 VolMapCreateMask(VMDApp *app, AtomSel *sel, float res, float the_atomradius) : VolMapCreate(app, sel, res) {
00101 atomradius = the_atomradius;
00102 }
00103 };
00104
00105
00106 class VolMapCreateDensity : public VolMapCreate {
00107 protected:
00108 float *weight;
00109 int compute_init();
00110 int compute_frame(int frame, float *voldata);
00111 float radius_scale;
00112
00113 public:
00114 VolMapCreateDensity(VMDApp *app, AtomSel *sel, float res, float *the_weight, float the_radscale) : VolMapCreate(app, sel, res) {
00115 weight = the_weight;
00116
00117 radius_scale = the_radscale;
00118 }
00119 };
00120
00121
00122 class VolMapCreateInterp : public VolMapCreate {
00123 protected:
00124 float *weight;
00125 int compute_init();
00126 int compute_frame(int frame, float *voldata);
00127
00128 public:
00129 VolMapCreateInterp(VMDApp *app, AtomSel *sel, float res, float *the_weight) : VolMapCreate(app, sel, res) {
00130 weight = the_weight;
00131 }
00132 };
00133
00134
00135 class VolMapCreateOccupancy : public VolMapCreate {
00136 private:
00137 bool use_points;
00138 protected:
00139 int compute_init();
00140 int compute_frame(int frame, float *voldata);
00141 public:
00142 VolMapCreateOccupancy(VMDApp *app, AtomSel *sel, float res, bool use_point_particles) : VolMapCreate(app, sel, res) {
00143 use_points = use_point_particles;
00144 }
00145 };
00146
00147
00148 class VolMapCreateDistance : public VolMapCreate {
00149 protected:
00150 float max_dist;
00151 int compute_init();
00152 int compute_frame(int frame, float *voldata);
00153 public:
00154 VolMapCreateDistance(VMDApp *app, AtomSel *sel, float res, float the_max_dist) : VolMapCreate(app, sel, res) {
00155 max_dist = the_max_dist;
00156 }
00157 };
00158
00159
00160 class VolMapCreateCoulombPotential : public VolMapCreate {
00161 protected:
00162 int compute_init();
00163 int compute_frame(int frame, float *voldata);
00164
00165 public:
00166 VolMapCreateCoulombPotential(VMDApp *app, AtomSel *sel, float res) : VolMapCreate(app, sel, res) {
00167 }
00168 };
00169
00170
00171 #if defined(VMDUSEMSMPOT)
00172 class VolMapCreateCoulombPotentialMSM : public VolMapCreate {
00173 protected:
00174 int compute_init();
00175 int compute_frame(int frame, float *voldata);
00176
00177 public:
00178 VolMapCreateCoulombPotentialMSM(VMDApp *app, AtomSel *sel, float res) : VolMapCreate(app, sel, res) {
00179 }
00180 };
00181 #endif
00182
00183
00187 class VolMapCreateILS {
00188 private:
00189 VMDApp *app;
00190 int molid;
00191
00192 int num_atoms;
00193
00194 VolumetricData *volmap;
00195 VolumetricData *volmask;
00196
00197 float delta;
00198 int nsubsamp;
00199
00200
00201
00202 int nsampx, nsampy, nsampz;
00203
00204 float minmax[6];
00205 float gridorigin[3];
00206
00207 float cutoff;
00208 float extcutoff;
00209 float excl_dist;
00210
00211 bool compute_elec;
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 int conformer_freq;
00231
00232 int num_conformers;
00233
00234 float *conformers;
00235
00236
00237
00238 int num_orientations;
00239 int num_rotations;
00240
00241
00242
00243 float *vdwparams;
00244 int *atomtypes;
00245
00246 int num_unique_types;
00247
00248 float temperature;
00249
00250 int num_probe_atoms;
00251 float probe_effsize;
00252 float *probe_coords;
00253
00254
00255 float probe_symmaxis1[3];
00256 float probe_symmaxis2[3];
00257 int probe_axisorder1, probe_axisorder2;
00258 int probe_tetrahedralsymm;
00259
00260
00261
00262
00263
00264 float *probe_vdw;
00265 float *probe_charge;
00266
00267 int first, last;
00268 int computed_frames;
00269
00270 float max_energy;
00271
00272 float min_occup;
00273
00274
00275 bool pbc;
00276
00277 bool pbcbox;
00278
00279 float pbccenter[3];
00280
00281 AtomSel *alignsel;
00282 const float *alignrefpos;
00283
00284 Matrix4 transform;
00285
00286
00287 int maskonly;
00288
00289
00290
00291
00292
00293
00294
00295 int box_inside_pbccell(int frame, float *minmax);
00296
00297
00298
00299
00300 int grid_inside_pbccell(int frame, float *voldata,
00301 const Matrix4 &alignment);
00302
00303
00304
00305 int set_grid();
00306
00307
00308 int initialize();
00309
00310
00311 int compute_frame(int frame, float *voldata);
00312
00313
00314 void align_frame(Molecule *mol, int frame, float *coords,
00315 Matrix4 &alignment);
00316
00317
00318
00319 int get_atom_coordinates(int frame, Matrix4 &alignment,
00320 int *(&vdwtypes),
00321 float *(&coords));
00322
00323
00324
00325 int is_probe_linear(float *axis);
00326
00327
00328 void check_probe_symmetry();
00329
00330
00331
00332 void initialize_probe();
00333 void get_eff_proberadius();
00334
00335
00336
00337 int gen_conf_tetrahedral(float *(&conform), int freq,
00338 int &numorient, int &numrot);
00339
00340
00341 int gen_conf(float *(&conform), int freq,
00342 int &numorient, int &numrot);
00343
00344 float dimple_depth(float phi);
00345
00346
00347
00348 int create_unique_paramlist();
00349
00350
00351 public:
00352 VolMapCreateILS(VMDApp *_app, int molid, int firstframe,
00353 int lastframe, float T, float res,
00354 int subr, float cut, int maskonly);
00355 ~VolMapCreateILS();
00356
00357 VolumetricData* get_volmap() { return volmap; };
00358
00359
00360 int compute();
00361
00363 int add_map_to_molecule();
00364
00367 int write_map(const char *filename);
00368
00369
00370 void set_probe(int num_probe_atoms, int num_conf,
00371 const float *probe_coords,
00372 const float *vdwrmin, const float *vdweps,
00373 const float *charge);
00374
00375
00376
00377
00378 void set_probe_symmetry(int order1, const float *axis1,
00379 int order2, const float *axis2,
00380 int tetrahedral);
00381
00382
00383 void set_minmax (float minx, float miny, float minz, float maxx, float maxy, float maxz);
00384
00385
00386 void set_pbc(float center[3], int bbox);
00387
00388
00389 void set_maxenergy(float maxenergy);
00390
00391
00392 void set_alignsel(AtomSel *asel);
00393
00394
00395
00396 void set_transform(const Matrix4 *mat);
00397
00398 int get_conformers(float *&conform) const {
00399 conform = conformers;
00400 return num_conformers;
00401 }
00402
00403 void get_statistics(int &numconf, int &numorient,
00404 int &numrot) {
00405 numconf = num_conformers;
00406 numorient = num_orientations;
00407 numrot = num_rotations;
00408 }
00409 };
00410
00411
00412
00413 int volmap_write_dx_file (VolumetricData *volmap, const char *filename);