Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

DrawMolecule Class Reference

Subclass of BaseMolecule and Displayable for drawing a molecule. More...

#include <DrawMolecule.h>

Inheritance diagram for DrawMolecule:

BaseMolecule Displayable Pickable Molecule List of all members.

Public Methods

 DrawMolecule (VMDApp *, Displayable *)
 constructor ... pass in a VMDApp * and a parent displayable. More...

virtual ~DrawMolecule ()
wkf_threadpool_t * cpu_threadpool (void)
wkf_threadpool_t * cuda_devpool (void)
 Query CUDA device pool pointer. More...

int atom_displayed (int)
 return whether the Nth atom is displayed. This is true if ANY representation is displaying the given atom. More...

int components (void)
 total number of components. More...

DrawMolItem * component (int)
 return Nth component ... change to proper return type. More...

DrawMolItem * component_from_pickable (const Pickable *)
 return the component that matches the given Pickable, or NULL if no match. More...

int get_component_by_name (const char *)
 retrieve the index of the component with the given name. Returns -1 on failure. More...

const char * get_component_name (int)
 Get the name of the given component. Names are initially "repN", where N starts at 0 and increases each time a rep is created. Return NULL if the index is invalid. More...

int del_rep (int)
 delete the Nth representation ... return success. More...

void add_rep (AtomColor *, AtomRep *, AtomSel *, const Material *)
 Add a new representation (component). This always succeeds, since all parameters must have already been verified as valid. The rep takes over ownership of the parameter objects (except Material). More...

int change_rep (int, AtomColor *, AtomRep *, const char *sel)
 change the Nth representation ... return success. if any object is NULL, that characteristic is not changed. More...

int show_rep (int repid, int onoff)
 turn the Nth representation on or off. Return success. More...

void force_recalc (int)
 force a recalc of all representations For MOL_REGEN, this also invalidates the value of cov and scale_factor,. More...

void change_pbc ()
 Tell reps that the periodic image parameters have been changed. More...

void change_ts ()
 Tell reps that the currently displayed timestep has changed. More...

int highlighted_rep () const
 Return the highlighted rep for this molecule. Returns -1 if there is no such rep. More...

int numframes () const
 number of frames in the files associatd with the molecule. More...

int frame () const
 index of current frame. More...

void override_current_frame (int frame)
 change current frame without firing callbacks. More...

Timestep * current ()
 get the current frame. More...

Timestep * get_frame (int n)
 get the specifed frame. More...

Timestep * get_last_frame ()
 get the last frame. More...

void delete_frame (int n)
 delete the nth frame. More...

void append_frame (Timestep *)
 append the given frame. More...

void duplicate_frame (const Timestep *)
 duplicate the given frame passing NULL adds a 'null' frame (i.e. all zeros). More...

float scale_factor ()
 scaling factor required to make the molecule fit within (-1 ... 1). More...

int cov (float &, float &, float &)
 center of volume of this molecule. Return success. Fails if there aren't any coordinates, graphics, or volumetric data sets to compute the cov from. More...

int recalc_bonds (void)
 recalculate bonds via distance bond search based on current timestep. More...

int need_secondary_structure (int)
 request ss calculation. Return success. More...

void invalidate_ss ()
 invalidate current secondary structure when structure is changed. More...

int recalc_ss ()
 recalculate the secondary structure using current coordinates Return success. More...

MoleculeGraphics * moleculeGraphics () const
virtual void prepare ()
 specific preparations, called by draw_prepare, supplied by derived class. More...

void register_monitor (DrawMoleculeMonitor *)
 register monitors. More...

void unregister_monitor (DrawMoleculeMonitor *)
 unregister monitors. More...

void notify ()

Public Attributes

int active
 is this molecule active? Used by MoleculeList. More...

VMDApp * app
 Needed by DrawMolItem, so that reps get can access to GPU global memory management routines, shared QuickSurf objects, and other such routines. More...

ResizeArray< DrawMolItem * > repList
 all representations in this molecule. More...


Detailed Description

Subclass of BaseMolecule and Displayable for drawing a molecule.

Definition at line 62 of file DrawMolecule.h.


Constructor & Destructor Documentation

DrawMolecule::DrawMolecule (  VMDApp *   ,
Displayable *   
) 
 

constructor ... pass in a VMDApp * and a parent displayable.

Definition at line 48 of file DrawMolecule.C.

References active, PickList::add_pickable, BaseMolecule::need_find_bonds, and VMDApp::pickList.

DrawMolecule::~DrawMolecule (    )  [virtual]
 

Definition at line 67 of file DrawMolecule.C.

References app, component, components, ResizeArray< Timestep * >::num, VMDApp::pickList, ResizeArray< Timestep * >::remove, and PickList::remove_pickable.


Member Function Documentation

void DrawMolecule::add_rep (  AtomColor *   ,
AtomRep *   ,
AtomSel *   ,
const Material *   
) 
 

Add a new representation (component). This always succeeds, since all parameters must have already been verified as valid. The rep takes over ownership of the parameter objects (except Material).

Definition at line 142 of file DrawMolecule.C.

References PickList::add_pickable, app, ResizeArray< DrawMolItem * >::append, Displayable::change_material, VMDApp::pickList, and repList.

Referenced by MoleculeList::add_rep.

void DrawMolecule::append_frame (  Timestep *    ) 
 

append the given frame.

Definition at line 282 of file DrawMolecule.C.

References app, ResizeArray< Timestep * >::append, change_ts, VMDApp::commandQueue, BaseMolecule::need_find_bonds, NULL, ResizeArray< Timestep * >::num, override_current_frame, CommandQueue::runcommand, VMDApp::scene_resetview_newmoldata, and vmd_bond_search.

Referenced by IMDMgr::check_event, cmd_rawtimestep, duplicate_frame, VMDApp::molecule_from_selection_list, and CoorPluginData::next.

int DrawMolecule::atom_displayed (  int    ) 
 

return whether the Nth atom is displayed. This is true if ANY representation is displaying the given atom.

Definition at line 117 of file DrawMolecule.C.

References components, Displayable::displayed, n, BaseMolecule::nAtoms, and repList.

Referenced by GeometryMol::transformed_atom_coord.

void DrawMolecule::change_pbc (    ) 
 

Tell reps that the periodic image parameters have been changed.

Definition at line 201 of file DrawMolecule.C.

References DrawMolItem::change_pbc, component, components, and notify.

int DrawMolecule::change_rep (  int   ,
AtomColor *   ,
AtomRep *   ,
const char *    sel
) 
 

change the Nth representation ... return success. if any object is NULL, that characteristic is not changed.

Definition at line 167 of file DrawMolecule.C.

References DrawMolItem::change_color, DrawMolItem::change_rep, DrawMolItem::change_sel, component, and n.

Referenced by MoleculeList::change_rep, MoleculeList::change_repcolor, MoleculeList::change_repmethod, and MoleculeList::change_repsel.

void DrawMolecule::change_ts (    ) 
 

Tell reps that the currently displayed timestep has changed.

Definition at line 213 of file DrawMolecule.C.

References app, DrawMolItem::change_ts, VMDApp::commandQueue, component, components, BaseMolecule::id, notify, DrawForce::prepare, MoleculeGraphics::prepare, and CommandQueue::runcommand.

Referenced by append_frame, delete_frame, Animation::goto_frame, molinfo_set, and py_set_frame.

DrawMolItem * DrawMolecule::component (  int    ) 
 

return Nth component ... change to proper return type.

Definition at line 90 of file DrawMolecule.C.

References components, n, NULL, and repList.

Referenced by GraphicsFltkMenu::act_on_command, Tool::assign_rep, change_pbc, change_rep, MoleculeList::change_repmat, change_ts, MoleculeList::check_pickable, del_rep, force_recalc, get_component_name, molinfo_get, VMDApp::molrep_get_clipplane, VMDApp::molrep_get_color, VMDApp::molrep_get_colorupdate, VMDApp::molrep_get_drawframes, VMDApp::molrep_get_instances, VMDApp::molrep_get_material, VMDApp::molrep_get_pbc, VMDApp::molrep_get_pbc_images, VMDApp::molrep_get_scaleminmax, VMDApp::molrep_get_selection, VMDApp::molrep_get_selupdate, VMDApp::molrep_get_smoothing, VMDApp::molrep_get_style, VMDApp::molrep_is_shown, VMDApp::molrep_numselected, VMDApp::molrep_reset_scaleminmax, VMDApp::molrep_set_clipcenter, VMDApp::molrep_set_clipcolor, VMDApp::molrep_set_clipnormal, VMDApp::molrep_set_clipstatus, VMDApp::molrep_set_colorupdate, VMDApp::molrep_set_drawframes, VMDApp::molrep_set_instances, VMDApp::molrep_set_pbc, VMDApp::molrep_set_pbc_images, VMDApp::molrep_set_scaleminmax, VMDApp::molrep_set_selupdate, VMDApp::molrep_set_smoothing, recalc_ss, DrawMolItem::representation_index, PickModeMoveRep::rotate, show_rep, Tool::target, PickModeMoveRep::translate, Tool::tug, GraphicsFltkMenu::update_pbc, GraphicsFltkMenu::update_rep, GraphicsFltkMenu::update_repbrowser, and ~DrawMolecule.

DrawMolItem * DrawMolecule::component_from_pickable (  const Pickable *    ) 
 

return the component that matches the given Pickable, or NULL if no match.

Definition at line 99 of file DrawMolecule.C.

References components, NULL, and repList.

int DrawMolecule::components (  void    )  [inline]
 

total number of components.

Definition at line 143 of file DrawMolecule.h.

References ResizeArray::num.

Referenced by atom_displayed, change_pbc, change_ts, MoleculeList::check_pickable, component, component_from_pickable, force_recalc, VMDApp::molecule_load, molinfo_get, VMDApp::num_molreps, recalc_ss, DrawMolItem::representation_index, PickModeMoveRep::rotate, PickModeMoveRep::translate, GraphicsFltkMenu::update_repbrowser, GraphicsFltkMenu::update_repindex, and ~DrawMolecule.

int DrawMolecule::cov (  float &   ,
float &   ,
float &   
) 
 

center of volume of this molecule. Return success. Fails if there aren't any coordinates, graphics, or volumetric data sets to compute the cov from.

Definition at line 395 of file DrawMolecule.C.

References MoleculeGraphics::cov, data, ResizeArray< VolumetricData * >::num, MoleculeGraphics::num_elements, VolumetricData::origin, BaseMolecule::volumeList, VolumetricData::xaxis, VolumetricData::yaxis, z, and VolumetricData::zaxis.

Referenced by MoleculeList::center_from_top_molecule_reps, and AtomColor::find.

wkf_threadpool_t * DrawMolecule::cpu_threadpool (  void    ) 
 

Definition at line 106 of file DrawMolecule.C.

References app, and VMDApp::thrpool.

Referenced by Orbital::calculate_mo.

wkf_threadpool_t * DrawMolecule::cuda_devpool (  void    ) 
 

Query CUDA device pool pointer.

Definition at line 111 of file DrawMolecule.C.

References app, VMDApp::cuda, CUDAAccel::get_cuda_devpool, and NULL.

Referenced by Orbital::calculate_mo.

Timestep* DrawMolecule::current (    )  [inline]
 

get the current frame.

Definition at line 205 of file DrawMolecule.h.

References NULL, and ResizeArray::num.

Referenced by GeometryMol::atom_formatted_name, AtomColor::find, Molecule::get_new_frames, VMDApp::molecule_dupframe, need_secondary_structure, normal_atom_coord, GeometryMol::normal_atom_coord, parse_timestep, PickModeCenter::pick_molecule_end, PickModeMove::pick_molecule_move, PickModeForceFragment::pick_molecule_move, PickModeForceResidue::pick_molecule_move, PickModeForceAtom::pick_molecule_move, print_atom_info, recalc_bonds, PickModeMoveRep::rotate, PickModeMoveMolecule::rotate, PickModeMoveFragment::rotate, PickModeMoveResidue::rotate, selframe, Tool::target, AtomSel::timestep, PickModeMoveRep::translate, PickModeMoveMolecule::translate, PickModeMoveFragment::translate, PickModeMoveResidue::translate, PickModeMoveAtom::translate, vmd_volmap_ils, and write_ss_input_pdb.

int DrawMolecule::del_rep (  int    ) 
 

delete the Nth representation ... return success.

Definition at line 129 of file DrawMolecule.C.

References app, component, n, NULL, VMDApp::pickList, ResizeArray< DrawMolItem * >::remove, PickList::remove_pickable, and repList.

Referenced by MoleculeList::del_rep.

void DrawMolecule::delete_frame (  int    n ) 
 

delete the nth frame.

Definition at line 336 of file DrawMolecule.C.

References app, change_ts, VMDApp::commandQueue, n, ResizeArray< Timestep * >::num, ResizeArray< Timestep * >::remove, and CommandQueue::runcommand.

Referenced by VMDApp::molecule_deleteframes.

void DrawMolecule::duplicate_frame (  const Timestep *    ) 
 

duplicate the given frame passing NULL adds a 'null' frame (i.e. all zeros).

Definition at line 323 of file DrawMolecule.C.

References append_frame, BaseMolecule::nAtoms, NULL, and Timestep::zero_values.

Referenced by VMDApp::molecule_dupframe, and vmd_volmap_ils.

void DrawMolecule::force_recalc (  int    ) 
 

force a recalc of all representations For MOL_REGEN, this also invalidates the value of cov and scale_factor,.

Definition at line 183 of file DrawMolecule.C.

References app, VMDApp::commandQueue, component, components, DrawMolItem::force_recalc, DrawMolItem::MOL_REGEN, Displayable::need_matrix_recalc, CommandQueue::runcommand, and DrawMolItem::SEL_REGEN.

Referenced by access_tcl_atomsel, atomsel_set, atomselect_move, atomselect_moveby, IMDMgr::check_event, cmd_rawtimestep, density_binmask, density_clamp, density_crop, density_downsample, density_mdff_potential, density_move, density_moveto, density_range, density_sadd, density_sigma, density_smooth, density_smult, density_supersample, density_trim, fit, fpbc_join, fpbc_recenter, fpbc_unwrap, fpbc_wrap, VMDApp::molecule_load, VMDApp::molecule_reanalyze, PickModeAddBond::pick_molecule_end, PickModeMove::pick_molecule_move, py_move, py_moveby, MolFilePlugin::read_optional_structure, setbonds, and text_cmd_mol.

int DrawMolecule::frame (    )  const [inline]
 

index of current frame.

Definition at line 199 of file DrawMolecule.h.

Referenced by GeometryMol::atom_formatted_name, GeometryMol::calculate_all, cmd_rawtimestep, AtomColor::find, Animation::frame, measure_energy, measure_geom, measure_pbc2onc, measure_pbc_neighbors, VMDApp::molecule_frame, molinfo_get, py_write, and colvarproxy_vmd::setup.

int DrawMolecule::get_component_by_name (  const char *    ) 
 

retrieve the index of the component with the given name. Returns -1 on failure.

Definition at line 237 of file DrawMolecule.C.

References ResizeArray< DrawMolItem * >::num, and repList.

Referenced by VMDApp::molrep_get_by_name.

const char * DrawMolecule::get_component_name (  int    ) 
 

Get the name of the given component. Names are initially "repN", where N starts at 0 and increases each time a rep is created. Return NULL if the index is invalid.

Definition at line 249 of file DrawMolecule.C.

References component, and DrawMolItem::name.

Referenced by VMDApp::molrep_get_name.

Timestep* DrawMolecule::get_frame (  int    n )  [inline]
 

get the specifed frame.

Definition at line 212 of file DrawMolecule.h.

References n, NULL, and ResizeArray::num.

Referenced by check_timesteps, cmd_gettimestep, cmd_rawtimestep, compute_pbcminmax, find_cluster_thr, fpbc_exec_join, fpbc_exec_join_cpu, fpbc_exec_recenter, fpbc_exec_unwrap, fpbc_exec_unwrap_cpu, fpbc_exec_wrapatomic, fpbc_exec_wrapatomic_cpu, fpbc_exec_wrapcompound, fpbc_exec_wrapcompound_cpu, get_last_frame, colvarproxy_vmd::load_atoms, colvarproxy_vmd::load_coords, mdff_cc, measure_avpos, measure_gofr, measure_pbc2onc, measure_pbc_neighbors, measure_rdf, measure_rmsdmat_qcp, measure_rmsdmat_qcp_ooc, measure_rmsf, measure_rmsf_perresidue, VMDApp::molecule_dupframe, VMDApp::molecule_orblocalize, molinfo_get, molinfo_set, MolFilePlugin::next, CoorPluginData::next, parse_timestep, GraphicsFltkRepOrbital::regen_orbitallist, selframe, colvarproxy_vmd::set_frame, AtomSel::timestep, colvarproxy_vmd::update_input, and vmd_volmap_ils.

Timestep* DrawMolecule::get_last_frame (    )  [inline]
 

get the last frame.

Definition at line 220 of file DrawMolecule.h.

References get_frame, and ResizeArray::num.

Referenced by IMDMgr::check_event, parse_timestep, selframe, and AtomSel::timestep.

int DrawMolecule::highlighted_rep (    )  const
 

Return the highlighted rep for this molecule. Returns -1 if there is no such rep.

Definition at line 229 of file DrawMolecule.C.

References app, VMDApp::highlighted_molid, VMDApp::highlighted_rep, and BaseMolecule::id.

Referenced by PickModeMoveRep::rotate, and PickModeMoveRep::translate.

void DrawMolecule::invalidate_ss (    ) 
 

invalidate current secondary structure when structure is changed.

Definition at line 469 of file DrawMolecule.C.

Referenced by VMDApp::molecule_reanalyze, and MolFilePlugin::read_optional_structure.

MoleculeGraphics* DrawMolecule::moleculeGraphics (    )  const [inline]
 

Definition at line 257 of file DrawMolecule.h.

Referenced by MoleculeList::check_pickable, mol_from_id, MolFilePlugin::read_rawgraphics, and tcl_graphics.

int DrawMolecule::need_secondary_structure (  int    ) 
 

request ss calculation. Return success.

Definition at line 437 of file DrawMolecule.C.

References app, current, NULL, VMDApp::show_stride_message, ss_from_dssp, and ss_from_stride.

Referenced by AtomColor::find, and recalc_ss.

void DrawMolecule::notify (    ) 
 

Definition at line 273 of file DrawMolecule.C.

References BaseMolecule::id, and ResizeArray< DrawMoleculeMonitor * >::num.

Referenced by change_pbc, DrawMolItem::change_sel, change_ts, prepare, DrawMolItem::set_instances, DrawMolItem::set_pbc, and DrawMolItem::set_pbc_images.

int DrawMolecule::numframes (    )  const [inline]
 

number of frames in the files associatd with the molecule.

Definition at line 196 of file DrawMolecule.h.

References ResizeArray::num.

Referenced by GeometryMol::calculate_all, IMDMgr::check_event, check_timesteps, cmd_gettimestep, cmd_rawtimestep, CoorPluginData::CoorPluginData, AtomColor::find, fpbc_join, fpbc_recenter, fpbc_unwrap, fpbc_wrap, Animation::goto_frame, mdff_cc, measure_avpos, measure_cluster, measure_energy, measure_geom, measure_gofr, measure_pbc2onc, measure_pbc_neighbors, measure_rdf, measure_rmsdmat_qcp, measure_rmsdmat_qcp_ooc, measure_rmsf, measure_rmsf_perresidue, VMDApp::molecule_deleteframes, VMDApp::molecule_dupframe, VMDApp::molecule_numframes, VMDApp::molecule_orblocalize, VMDApp::molecule_savetrajectory, molinfo_get, MolFilePlugin::next, CoorPluginData::next, Animation::num, py_mol_write, py_set_frame, py_write, setframe, and MolBrowser::update.

void DrawMolecule::override_current_frame (  int    frame ) 
 

change current frame without firing callbacks.

Definition at line 262 of file DrawMolecule.C.

References n, ResizeArray< Timestep * >::num, and num.

Referenced by append_frame, GeometryMol::calculate_all, Animation::goto_frame, measure_energy, measure_geom, molinfo_set, and py_set_frame.

void DrawMolecule::prepare (    )  [virtual]
 

specific preparations, called by draw_prepare, supplied by derived class.

Reimplemented from Displayable.

Reimplemented in Molecule.

Definition at line 256 of file DrawMolecule.C.

References Displayable::needUpdate, and notify.

Referenced by Molecule::prepare.

int DrawMolecule::recalc_bonds (  void    ) 
 

recalculate bonds via distance bond search based on current timestep.

Definition at line 423 of file DrawMolecule.C.

References BaseMolecule::clear_bonds, BaseMolecule::count_bonds, current, and vmd_bond_search.

Referenced by VMDApp::molecule_bondsrecalc.

int DrawMolecule::recalc_ss (    ) 
 

recalculate the secondary structure using current coordinates Return success.

Definition at line 473 of file DrawMolecule.C.

References DrawMolItem::change_ss, component, components, and need_secondary_structure.

Referenced by VMDApp::molecule_ssrecalc.

void DrawMolecule::register_monitor (  DrawMoleculeMonitor *    ) 
 

register monitors.

Definition at line 482 of file DrawMolecule.C.

References ResizeArray< DrawMoleculeMonitor * >::append.

Referenced by GeometryMol::GeometryMol.

float DrawMolecule::scale_factor (    ) 
 

scaling factor required to make the molecule fit within (-1 ... 1).

Definition at line 371 of file DrawMolecule.C.

References data, dnorm, ResizeArray< VolumetricData * >::num, MoleculeGraphics::num_elements, scale_factor, MoleculeGraphics::scale_factor, BaseMolecule::volumeList, VolumetricData::xaxis, VolumetricData::yaxis, z, and VolumetricData::zaxis.

Referenced by MoleculeList::center_from_top_molecule_reps, and scale_factor.

int DrawMolecule::show_rep (  int    repid,
int    onoff
) 
 

turn the Nth representation on or off. Return success.

Definition at line 154 of file DrawMolecule.C.

References component, Displayable::off, and Displayable::on.

Referenced by VMDApp::molrep_show.

void DrawMolecule::unregister_monitor (  DrawMoleculeMonitor *    ) 
 

unregister monitors.

Definition at line 485 of file DrawMolecule.C.

References ResizeArray< DrawMoleculeMonitor * >::find, and ResizeArray< DrawMoleculeMonitor * >::remove.

Referenced by GeometryMol::~GeometryMol.


Member Data Documentation

int DrawMolecule::active
 

is this molecule active? Used by MoleculeList.

Definition at line 64 of file DrawMolecule.h.

Referenced by MoleculeList::activate, MoleculeList::active, DrawMolecule, Animation::goto_frame, MoleculeList::inactivate, molinfo_get, PickModeCenter::pick_molecule_end, and py_is_active.

VMDApp* DrawMolecule::app
 

Needed by DrawMolItem, so that reps get can access to GPU global memory management routines, shared QuickSurf objects, and other such routines.

Definition at line 66 of file DrawMolecule.h.

Referenced by MoleculeList::add_rep, add_rep, append_frame, QuickSurf::calc_surf, Orbital::calculate_mo, change_ts, Molecule::close_coor_file, cpu_threadpool, cuda_devpool, del_rep, delete_frame, find_next_cluster, force_recalc, Molecule::get_new_frames, highlighted_rep, measure_hbonds, need_secondary_structure, ~DrawMolecule, and Molecule::~Molecule.

ResizeArray<DrawMolItem *> DrawMolecule::repList
 

all representations in this molecule.

Definition at line 87 of file DrawMolecule.h.

Referenced by add_rep, atom_displayed, component, component_from_pickable, del_rep, and get_component_by_name.


The documentation for this class was generated from the following files:
Generated on Fri Jan 23 01:52:47 2026 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002