00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DRAWMOLECULE_H
00024 #define DRAWMOLECULE_H
00025
00026 #include "BaseMolecule.h"
00027 #include "Displayable.h"
00028 #include "DrawMolItem.h"
00029 #include "ResizeArray.h"
00030 #include "WKFThreads.h"
00031 #include "QuickSurf.h"
00032
00033 class AtomColor;
00034 class AtomRep;
00035 class AtomSel;
00036 class VMDApp;
00037 class MoleculeGraphics;
00038 class DrawForce;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #define VMDENABLEORBITALGRIDBACKDOOR 1
00049
00052 class DrawMoleculeMonitor {
00053 public:
00054
00055 virtual void notify(int) = 0;
00056 DrawMoleculeMonitor() {}
00057 virtual ~DrawMoleculeMonitor() {}
00058 };
00059
00060
00062 class DrawMolecule : public BaseMolecule, public Displayable {
00063 public:
00064 int active;
00065
00066 VMDApp *app;
00067
00068
00069
00070
00071 private:
00072 int repcounter;
00073
00076 MoleculeGraphics *molgraphics;
00077
00079 DrawForce *drawForce;
00080
00081 #if defined(VMDENABLEORBITALGRIDBACKDOOR)
00084 public:
00085 #endif
00086
00087 ResizeArray<DrawMolItem *> repList;
00088
00089 #if defined(VMDENABLEORBITALGRIDBACKDOOR)
00092 private:
00093 #endif
00094
00095 ResizeArray<Timestep *> timesteps;
00096
00098 int curframe;
00099
00102 int did_secondary_structure;
00103
00105 ResizeArray<DrawMoleculeMonitor *> monitorlist;
00106
00108 void addremove_ts();
00109
00110 float center[3];
00111 float scalefactor;
00112
00115 void update_cov_scale();
00116
00118 void invalidate_cov_scale();
00119
00120 public:
00122 DrawMolecule(VMDApp *, Displayable *);
00123 virtual ~DrawMolecule();
00124
00125
00126
00127
00128
00129 wkf_threadpool_t * cpu_threadpool(void);
00130
00132 wkf_threadpool_t * cuda_devpool(void);
00133
00136 int atom_displayed(int);
00137
00138
00139
00140
00141
00143 int components(void) { return int(repList.num()); }
00144
00146 DrawMolItem *component(int);
00147
00149 DrawMolItem *component_from_pickable(const Pickable *);
00150
00153 int get_component_by_name(const char *);
00154
00158 const char *get_component_name(int);
00159
00160
00162 int del_rep(int);
00163
00167 void add_rep(AtomColor *, AtomRep *, AtomSel *, const Material *);
00168
00171 int change_rep(int, AtomColor *, AtomRep *, const char *sel);
00172
00174 int show_rep(int repid, int onoff);
00175
00178
00179 void force_recalc(int);
00180
00182 void change_pbc();
00183
00185 void change_ts();
00186
00189 int highlighted_rep() const;
00190
00191
00192
00193
00194
00196 int numframes() const { return int(timesteps.num()); }
00197
00199 int frame() const { return curframe; }
00200
00202 void override_current_frame(int frame);
00203
00205 Timestep *current() {
00206 if (curframe >= 0 && curframe < timesteps.num())
00207 return timesteps[curframe];
00208 return NULL;
00209 }
00210
00212 Timestep *get_frame(int n) {
00213 if ( n>= 0 && n<timesteps.num() ) {
00214 return timesteps[n];
00215 }
00216 return NULL;
00217 }
00218
00220 Timestep *get_last_frame() {
00221 return get_frame(int(timesteps.num())-1);
00222 }
00223
00225 void delete_frame(int n);
00226
00228 void append_frame(Timestep *);
00229
00232 void duplicate_frame(const Timestep *);
00233
00235 float scale_factor();
00236
00240 int cov(float &, float &, float &);
00241
00243 int recalc_bonds(void);
00244
00246 int need_secondary_structure(int);
00247
00249 void invalidate_ss();
00250
00253 int recalc_ss();
00254
00255
00256
00257 MoleculeGraphics *moleculeGraphics() const { return molgraphics; }
00258
00259
00260 virtual void prepare();
00261
00263 void register_monitor(DrawMoleculeMonitor *);
00264
00266 void unregister_monitor(DrawMoleculeMonitor *);
00267
00268 void notify();
00269 };
00270
00271 #endif
00272