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 char const *weight_string;
00110 int weight_mutable;
00111 int compute_init();
00112 int compute_frame(int frame, float *voldata);
00113 float radius_scale;
00114
00115 public:
00116 VolMapCreateDensity(VMDApp *app, AtomSel *sel, float res, float *the_weight, char const *the_weight_string, int the_weight_mutable, float the_radscale) : VolMapCreate(app, sel, res) {
00117 weight = the_weight;
00118 weight_string = the_weight_string;
00119 weight_mutable = the_weight_mutable;
00120
00121 radius_scale = the_radscale;
00122 }
00123 };
00124
00125
00126 class VolMapCreateInterp : public VolMapCreate {
00127 protected:
00128 float *weight;
00129 char const *weight_string;
00130 int weight_mutable;
00131 int compute_init();
00132 int compute_frame(int frame, float *voldata);
00133
00134 public:
00135 VolMapCreateInterp(VMDApp *app, AtomSel *sel, float res, float *the_weight, char const *the_weight_string, int the_weight_mutable) : VolMapCreate(app, sel, res) {
00136 weight = the_weight;
00137 weight_string = the_weight_string;
00138 weight_mutable = the_weight_mutable;
00139 }
00140 };
00141
00142
00143 class VolMapCreateOccupancy : public VolMapCreate {
00144 private:
00145 bool use_points;
00146 protected:
00147 int compute_init();
00148 int compute_frame(int frame, float *voldata);
00149 public:
00150 VolMapCreateOccupancy(VMDApp *app, AtomSel *sel, float res, bool use_point_particles) : VolMapCreate(app, sel, res) {
00151 use_points = use_point_particles;
00152 }
00153 };
00154
00155
00156 class VolMapCreateDistance : public VolMapCreate {
00157 protected:
00158 float max_dist;
00159 int compute_init();
00160 int compute_frame(int frame, float *voldata);
00161 public:
00162 VolMapCreateDistance(VMDApp *app, AtomSel *sel, float res, float the_max_dist) : VolMapCreate(app, sel, res) {
00163 max_dist = the_max_dist;
00164 }
00165 };
00166
00167
00168 class VolMapCreateCoulombPotential : public VolMapCreate {
00169 protected:
00170 int compute_init();
00171 int compute_frame(int frame, float *voldata);
00172
00173 public:
00174 VolMapCreateCoulombPotential(VMDApp *app, AtomSel *sel, float res) : VolMapCreate(app, sel, res) {
00175 }
00176 };
00177
00178
00179 #if defined(VMDUSEMSMPOT)
00180 class VolMapCreateCoulombPotentialMSM : public VolMapCreate {
00181 protected:
00182 int compute_init();
00183 int compute_frame(int frame, float *voldata);
00184
00185 public:
00186 VolMapCreateCoulombPotentialMSM(VMDApp *app, AtomSel *sel, float res) : VolMapCreate(app, sel, res) {
00187 }
00188 };
00189 #endif
00190
00191
00195 class VolMapCreateILS {
00196 private:
00197 VMDApp *app;
00198 int molid;
00199
00200 int num_atoms;
00201
00202 VolumetricData *volmap;
00203 VolumetricData *volmask;
00204
00205 float delta;
00206 int nsubsamp;
00207
00208
00209
00210 int nsampx, nsampy, nsampz;
00211
00212 float minmax[6];
00213 float gridorigin[3];
00214
00215 float cutoff;
00216 float extcutoff;
00217 float excl_dist;
00218
00219 bool compute_elec;
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 int conformer_freq;
00239
00240 int num_conformers;
00241
00242 float *conformers;
00243
00244
00245
00246 int num_orientations;
00247 int num_rotations;
00248
00249
00250
00251 float *vdwparams;
00252 int *atomtypes;
00253
00254 int num_unique_types;
00255
00256 float temperature;
00257
00258 int num_probe_atoms;
00259 float probe_effsize;
00260 float *probe_coords;
00261
00262
00263 float probe_symmaxis1[3];
00264 float probe_symmaxis2[3];
00265 int probe_axisorder1, probe_axisorder2;
00266 int probe_tetrahedralsymm;
00267
00268
00269
00270
00271
00272 float *probe_vdw;
00273 float *probe_charge;
00274
00275 int first, last;
00276 int computed_frames;
00277
00278 float max_energy;
00279
00280 float min_occup;
00281
00282
00283 bool pbc;
00284
00285 bool pbcbox;
00286
00287 float pbccenter[3];
00288
00289 AtomSel *alignsel;
00290 const float *alignrefpos;
00291
00292 Matrix4 transform;
00293
00294
00295 int maskonly;
00296
00297
00298
00299
00300
00301
00302
00303 int box_inside_pbccell(int frame, float *minmax);
00304
00305
00306
00307
00308 int grid_inside_pbccell(int frame, float *voldata,
00309 const Matrix4 &alignment);
00310
00311
00312
00313 int set_grid();
00314
00315
00316 int initialize();
00317
00318
00319 int compute_frame(int frame, float *voldata);
00320
00321
00322 void align_frame(Molecule *mol, int frame, float *coords,
00323 Matrix4 &alignment);
00324
00325
00326
00327 int get_atom_coordinates(int frame, Matrix4 &alignment,
00328 int *(&vdwtypes),
00329 float *(&coords));
00330
00331
00332
00333 int is_probe_linear(float *axis);
00334
00335
00336 void check_probe_symmetry();
00337
00338
00339
00340 void initialize_probe();
00341 void get_eff_proberadius();
00342
00343
00344
00345 int gen_conf_tetrahedral(float *(&conform), int freq,
00346 int &numorient, int &numrot);
00347
00348
00349 int gen_conf(float *(&conform), int freq,
00350 int &numorient, int &numrot);
00351
00352 float dimple_depth(float phi);
00353
00354
00355
00356 int create_unique_paramlist();
00357
00358
00359 public:
00360 VolMapCreateILS(VMDApp *_app, int molid, int firstframe,
00361 int lastframe, float T, float res,
00362 int subr, float cut, int maskonly);
00363 ~VolMapCreateILS();
00364
00365 VolumetricData* get_volmap() { return volmap; };
00366
00367
00368 int compute();
00369
00371 int add_map_to_molecule();
00372
00375 int write_map(const char *filename);
00376
00377
00378 void set_probe(int num_probe_atoms, int num_conf,
00379 const float *probe_coords,
00380 const float *vdwrmin, const float *vdweps,
00381 const float *charge);
00382
00383
00384
00385
00386 void set_probe_symmetry(int order1, const float *axis1,
00387 int order2, const float *axis2,
00388 int tetrahedral);
00389
00390
00391 void set_minmax (float minx, float miny, float minz, float maxx, float maxy, float maxz);
00392
00393
00394 void set_pbc(float center[3], int bbox);
00395
00396
00397 void set_maxenergy(float maxenergy);
00398
00399
00400 void set_alignsel(AtomSel *asel);
00401
00402
00403
00404 void set_transform(const Matrix4 *mat);
00405
00406 int get_conformers(float *&conform) const {
00407 conform = conformers;
00408 return num_conformers;
00409 }
00410
00411 void get_statistics(int &numconf, int &numorient,
00412 int &numrot) {
00413 numconf = num_conformers;
00414 numorient = num_orientations;
00415 numrot = num_rotations;
00416 }
00417 };
00418
00419
00420
00421 int volmap_write_dx_file (VolumetricData *volmap, const char *filename);