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

utilities.h File Reference

Go to the source code of this file.

Compounds

struct  msgtimer

Defines

#define FALSE   0
#define TRUE   1
#define NULL   0
#define ABS(A)   ((A)>0?(A):-(A))
#define VMD_PI   3.14159265358979323846
#define VMD_TWOPI   (2.0 * VMD_PI)
#define VMD_1_PI   0.31830988618379067154
#define DEGTORAD(a)   (a*VMD_PI/180.0)
#define RADTODEG(a)   (a*180.0/VMD_PI)
#define VMD_RAND_MAX   2147483647L

Typedefs

typedef void * vmd_timerhandle
 a timer handle. More...


Functions

char * combine_arguments (int, const char **, int)
 given an argc, argv pair, take all the arguments from the Nth one on and combine them into a single string with spaces separating words. This allocates space for the string, which must be freed by the user. More...

char * stringdup (const char *)
 make a copy of a string using c++ new routine for memory alloc. More...

char * stringtoupper (char *)
 convert the given string to upper case. More...

void stripslashes (char *str)
 strip trailing '/' characters from a string. More...

int strupcmp (const char *, const char *)
 do case-insensitive string comparisons. More...

int strupncmp (const char *, const char *, int)
 do case-insensitive string comparisons. More...

void breakup_filename (const char *, char **, char **)
 break a file name up into path + name, returning both in the specified character pointers. This creates storage for the new strings by allocating space for them. More...

char * str_tokenize (const char *, int *, char **)
 tokenize a given string; return char ptr if ok, NULL if error. More...

double time_of_day (void)
 get the time of day from the system clock, and return it (in seconds) (This is supposedly accurate to within about 1 millisecond. More...

vmd_timerhandle vmd_timer_create (void)
 create a timer (clears timer). More...

void vmd_timer_destroy (vmd_timerhandle)
 create a timer (clears timer). More...

void vmd_timer_start (vmd_timerhandle)
 start a timer (clears timer). More...

void vmd_timer_stop (vmd_timerhandle)
 stop a timer. More...

double vmd_timer_time (vmd_timerhandle)
 report elapsed time in seconds. More...

double vmd_timer_timenow (vmd_timerhandle)
 report elapsed time in seconds. More...

msgtimermsg_timer_create (double updatetime)
 initialize periodic status message timer. More...

int msg_timer_timeout (msgtimer *time)
 return true if it's time to print a status update message. More...

void msg_timer_destroy (msgtimer *mt)
 destroy message timer. More...

int vmd_check_stdin (void)
 check for input on stdin. More...

char * vmd_username (void)
 return the username of the currently logged-on user. More...

int vmd_getuid (void)
 return the uid of the currently logged-on user. More...

int clamp_int (int val, int min, int max)
 clamp an integer value to the range min->max. More...

float * cross_prod (float *x1, const float *x2, const float *x3)
 compute the cross product, assumes that x1 memory is _different_ than both x2 and x3, and returns the pointer to x1. More...

float dot_prod (const float *v1, const float *v2)
 compute the inner dot product. More...

double dot_prod (const double *v1, const double *v2)
void vec_copy (float *v1, const float *v2)
 copy the first 3 elements from v2 to v1. More...

float * vec_normalize (float *)
 normalizes the 3-vector to length one and returns the pointer note that this changes the vector. More...

void vec_sub (float *a, const float *b, const float *c)
 subtract 3rd vector from 2nd and put into 1st in other words, a = b - c. More...

void vec_add (float *a, const float *b, const float *c)
 add 2nd and 3rd elements, put into 1st. More...

void vec_incr (float *a, const float *b)
 increment 1st vector by 2nd vector. More...

void vec_scale (float *a, float b, const float *c)
 a = b*c. More...

void vec_scale (float *a, float b, const double *c)
 a = b*c. More...

void vec_negate (float *a, const float *b)
 a = -b. More...

void vec_scaled_add (float *a, float b, const float *c)
 a += c*d. More...

void vec_triad (float *a, const float *b, float c, const float *d)
 a = b + c*d (name taken from STREAM benchmark routine). More...

void vec_lerp (float *a, const float *b, const float *c, float frac)
 perform linear interpolation between two vectors a = b + frac*(c-b). More...

void vec_zero (float *a)
void clamp_color (float *rgb)
void midpoint (float *a, const float *b, const float *c)
 compute the midpoint a between two vectors b & c (a = (b + c)/2). More...

void create_Bspline_basis (float array[4][4])
 define a cubic spline with a B-Spline basis. More...

void create_modified_CR_spline_basis (float array[4][4], float slope)
 define a cubic spline with a Catmull-Rom basis. More...

void make_spline_Q_matrix (float q[4][3], float basis[4][4], const float *pts)
 Builds the spline matrix "Q" from the basis matrix "M" and the geometry matrix "G". The geometry matrix in this case is the pts parameter, which contains the previous, current, and next two points defining the curve. For Catmull-Rom splines the tangent at the current point is the same as the direction from the previous point to the next point. More...

void make_spline_Q_matrix_noncontig (float q[4][3], float basis[4][4], const float *pts1, const float *pts2, const float *pts3, const float *pts4)
 Builds the spline matrix "Q" from the basis matrix "M" and the geometry matrix "G". The geometry matrix in this case is the pts parameter, which contains the previous, current, and next two points defining the curve. For Catmull-Rom splines the tangent at the current point is the same as the direction from the previous point to the next point. This one works with non-contiguous memory layouts. More...

void make_spline_interpolation (float out[3], float w, float q[4][3])
 Evaluate the spline to return a point on the curve specified by the w parameter, in the range 0 to 1. XXX an improved implementation might use forward differences to find the points on the curve rather than explicitly evaluating points one at a time. Forward differences should be much faster, since it can be done with 9 additions and no multiplies, whereas this code has to do 9 multiplies as well as 9 additions for each point. The forward difference method requires setup, and some extra storage for it's position/velocity/acceleration accumulators however, so it may be an even trade-off. More...

int tri_degenerate (const float *, const float *, const float *)
 determine if a triangle is degenerate or not. More...

float angle (const float *, const float *)
 compute the angle between two vectors a & b (0 to 180 deg). More...

float dihedral (const float *, const float *, const float *, const float *)
 Compute the dihedral angle for the given atoms, returning a value between -180 and 180. More...

float distance (const float *, const float *)
 compute the distance between two points a & b. More...

float distance2 (const float *a, const float *b)
 compute the squared distance between two points a & b. More...

float norm (const float *)
 find and return the norm of a 3-vector. More...

char * vmd_tempfile (const char *)
 VMD temp file (portable) given a string, return a new one with the temp dir name prepended. The returned string must be deleted. More...

int vmd_delete_file (const char *)
 VMD file deletion function (portable). More...

void vmd_sleep (int)
 VMD process sleep functions (portable). More...

void vmd_msleep (int)
int vmd_system (const char *cmd)
 a buffer function to system() call to be replaced by a different implementation in console-free Win32 applications. More...

void vmd_srandom (unsigned int)
 portable random number generation, NOT thread-safe however. More...

long vmd_random ()
 portable random number generation, NOT thread-safe however XXX we should replace these with our own thread-safe random number generator implementation at some point. More...

float vmd_random_gaussian ()
 Slow but accurate standard distribution random number generator (variance = 1). More...

long vmd_get_total_physmem_mb (void)
 return the number of MB of physical memory installed in the system. More...

long vmd_get_avail_physmem_mb (void)
 return the number of MB of physical memory "free" (no VM/swap counted...). More...

long vmd_get_avail_physmem_percent (void)
 return the percentage of physical memory available. More...


Define Documentation

#define ABS      ((A)>0?(A):-(A))
 

Definition at line 35 of file utilities.h.

#define DEGTORAD      (a*VMD_PI/180.0)
 

Definition at line 44 of file utilities.h.

Referenced by compute_angle_energy, compute_dihed_energy, compute_imprp_energy, Timestep::get_transform_vectors, measure_surface_int, obj_transabout, Matrix4::rot, Quat::rotate, and Symmetry::Symmetry.

#define FALSE   0
 

Definition at line 26 of file utilities.h.

#define NULL   0
 

Definition at line 31 of file utilities.h.

Referenced by access_tcl_atomsel, access_tcl_atomsel_obj, IMDMgr::act_on_command, GraphicsFltkMenu::act_on_command, ColorFltkMenu::act_on_command, activate, add, add_callback, SymbolTable::add_custom_singleword, add_link, MaterialList::add_material, addmenu, addrep, alos, anim_goto, VMDApp::animation_dir_name, VMDApp::animation_style_name, VMDDisplayList::append, DrawMolItem::atom_displayed, BaseMolecule::atom_fragment, BaseMolecule::atom_residue, AtomColor::AtomColor, atomparser_node::atomparser_node, AtomSel::AtomSel, atomsel_AsAtomSel, atomsel_get, Atomsel_Init, atomsel_iter, atomsel_new, atomsel_set, atomselect, atomselect_move, atomselect_moveby, atomselection_subscript, atomSelParser_init, BaseMolecule::BaseMolecule, bondsearchthread, breakup_filename, OpenGLRenderer::build3Dmipmaps, button_cb, VolMapCreate::calculate_minmax, call_callbacks, MolFilePlugin::can_read_bonds, MolFilePlugin::can_read_graphics, MolFilePlugin::can_read_metadata, MolFilePlugin::can_read_structure, MolFilePlugin::can_read_timesteps, MolFilePlugin::can_read_volumetric, MolFilePlugin::can_write_bonds, MolFilePlugin::can_write_structure, MolFilePlugin::can_write_timesteps, categories, CaveScene::CaveScene, center, change, AtomSel::change, DrawMolItem::change_rep, MoleculeList::change_repcolor, MoleculeList::change_repmethod, MoleculeList::change_repsel, Win32Joystick::check_event, VMDCollab::check_event, Spaceball::check_event, UIVR::check_event, GeometryMol::check_mol, MoleculeList::check_pickable, myFl_Chart::clear, Tool::clear_rep, VMDDisplayList::clipplane, SnapshotDisplayDevice::close_file, LibTachyonDisplayDevice::close_file, FileRenderer::close_file, cmd_animate_usage, cmd_gettimestep, cmd_mol_list, cmd_mol_usage, cmd_rawtimestep, cmd_vmdbench_usage, CmdMaterialAdd::CmdMaterialAdd, CmdRender::CmdRender, VMDApp::color_get_restype, VMDApp::colorscale_method_name, combine_arguments, VolMapCreate::combo_begin, compile_branch, compile_regex, DrawMolecule::component, DrawMolecule::component_from_pickable, Surf::compute, VolMapCreate::compute_all, VolMapCreateFastEnergy::compute_end, VolMapCreateSlowEnergy::compute_end, VolMapCreateCoulombPotential::compute_frame, VolMapCreateFastEnergy::compute_frame, VolMapCreateSlowEnergy::compute_frame, VolMapCreateDistance::compute_frame, VolMapCreateOccupancy::compute_frame, VolMapCreateInterp::compute_frame, VolMapCreateDensity::compute_frame, VolMapCreateMask::compute_frame, MSMSInterface::compute_from_socket, VolMapCreateFastEnergy::compute_init, VolMapCreateSlowEnergy::compute_init, VMDCollab::connect, contacts, symbol_data::convert, AtomSel::coordinates, CoorPluginData::CoorPluginData, create, CmdLabelDelete::create_text, ToolFltkMenu::create_tool, ctxt::ctxt, cudabusbw, cudabusbwthread, cudaenergythread, cudamaddgflops, cudamaddthread, DisplayDevice::cue_mode_name, DrawMolecule::current, MoleculeList::del_all_molecules, del_callback, MoleculeList::del_molecule, MoleculeList::del_rep, DrawMolecule::del_rep, OpenGLCache::deleteUnused, delframe, delmacro, delrep, detach, IMDMgr::detach, CUDAAccel::device_name, dict2geom, VMDCollab::disconnect, Displayable::Displayable, SpringTool::do_event, RotateTool::do_event, VMDTkinterMenu::do_off, VMDTkMenu::do_on, VMDTkinterMenu::do_on, SaveTrajectoryFltkMenu::do_save, SpaceballTracker::do_start, CaveTracker::do_start, CaveButtons::do_start, TclTextInterp::doEvent, Tool::dograb, TclTextInterp::doInit, Displayable::draw_prepare, DrawMolItem::DrawMolItem, dupframe, DrawMolecule::duplicate_frame, energythread, escape_fltk_menustring, TclTextInterp::evalFile, VMDApp::filerender_default_filename, VMDApp::filerender_default_option, VMDApp::filerender_option, VMDApp::filerender_valid, FileRenderer::FileRenderer, FileRenderList::FileRenderList, FileSpec::FileSpec, FileRenderList::find, IdList::find, AtomColor::find, find_atom_from_name, OpenGLExtensions::find_extensions, find_menu_from_string, find_minmax, find_molecule, find_name_string_from_menuname, OpenGLExtensions::find_renderer, find_within, find_within_routine, fix, FltkOpenGLDisplayDevice::FltkOpenGLDisplayDevice, force_cb, FileRenderList::format, forward, FreeVRScene::FreeVRScene, geom2dict, GeometryList::geom_list, GeometryMol::GeometryMol, GeometrySpring::GeometrySpring, get, Molecule::get_accession, get_accessions, get_autoupdate, Tool::get_buttons, get_center, get_color, get_colormap, get_colors, get_colorupdate, SymbolTable::get_custom_singleword, Molecule::get_database, get_databases, Tool::get_feedback, Molecule::get_file, Molecule::get_file_specs, get_filenames, get_filetypes, get_frame, DrawMolecule::get_frame, get_location, get_material, get_nearby_atom, get_periodic, get_physical_time, VMDApp::get_plugin, Symmetry::get_pointgroup, get_pte_idx, get_pte_idx_from_string, get_remarks, Molecule::get_remarks, get_repname, get_rotation, get_scale, get_scaleminmax, get_selection, get_smoothing, get_style, get_tachyon_run_string, Tool::get_targeted_atom, UIText::get_tcl_interp, get_top, Tool::get_tracker, get_trans, Molecule::get_type, get_visible, get_vmdapp, BaseMolecule::get_volume_data, BaseMolecule::getbondorder, getbonds, Tool::getdevices, getframe, SensorConfig::getnames, Tool::getoffset, DispCmdPickPointIndexArray::getpointers, UIVR::gettool, getvalues, grab_FreeVR_memory, TclTextInterp::graph_label_cb, graphics_color, graphics_cone, graphics_cylinder, graphics_delete, graphics_info, graphics_line, graphics_listall, graphics_material, graphics_materials, graphics_point, graphics_replace, graphics_sphere, graphics_text, graphics_triangle, graphics_trinorm, GraphicsFltkMenu::GraphicsFltkMenu, GraphLabelEvent::GraphLabelEvent, JString::gsub, Symmetry::guess, VMDApp::guess_filetype, MolBrowser::handle, myglwindow::handle, hash_delete, hash_destroy, hash_lookup, imdconnect, IMDMgr::IMDMgr, IMDSim::IMDSim, IMDSimBlocking::IMDSimBlocking, IMDSimThread::IMDSimThread, MoleculeGraphics::info_id, BaseMolecule::init_atoms, MolFilePlugin::init_read, MolFilePlugin::init_write, initvmd, inthash_delete, inthash_destroy, inthash_lookup, intstack_compact, intstack_create, intstack_destroy, intstack_push, inverse, is_active, is_fixed, is_shown, is_startline, iter_next, JRegex::JRegex, keep, kill, IMDMgr::kill, label_add, label_delete, label_getvalues, label_hide, label_show, label_textsize, LibGelatoDisplayDevice::LibGelatoDisplayDevice, LibTachyonDisplayDevice::LibTachyonDisplayDevice, Scene::light_color, Scene::light_color_default, Scene::light_pos, Scene::light_pos_default, listall, location, loop, macro, MainFltkMenu::MainFltkMenu, make_neighborlist, make_neighborlist_sym, make_tcl_atomsel, malloc_from_CAVE_memory, match, JRegex::match, matdelete, measure_fit, measure_gofr, measure_minmax, measure_sasa, measure_surface, minmax, modrep, mol_add_volumetric, mol_cancel, mol_delete, mol_exists, mol_from_id, mol_listall, mol_load, mol_name, mol_new, mol_num, mol_numatoms, mol_rename, mol_ssrecalc, MoleculeList::molecule, Molecule::Molecule, VMDApp::molecule_id, VMDApp::molecule_load, VMDApp::molecule_name, VMDApp::molecule_savetrajectory, molecule_tcl, VMDApp::molecule_valid_id, MoleculeList::MoleculeList, MolFilePlugin::MolFilePlugin, molinfo_get, molinfo_set, VMDApp::molrep_get_color, VMDApp::molrep_get_colorupdate, VMDApp::molrep_get_drawframes, VMDApp::molrep_get_material, VMDApp::molrep_get_name, VMDApp::molrep_get_selection, VMDApp::molrep_get_selupdate, VMDApp::molrep_get_style, molrep_num, VMDApp::molrep_numselected, VMDApp::molrep_set_colorupdate, VMDApp::molrep_set_selupdate, TclTextInterp::mouse_pos_cb, mouse_usage, mousemode, msg_timer_create, msmain, My_Fl_Positioner::My_Fl_Positioner, myCreateWindow, myFl_Chart::myFl_Chart, NameList< Material * >::name, FileRenderList::name, next, MolFilePlugin::next, CoorPluginData::next, GeometryMol::normal_atom_coord, numframes, obj_getdoublearray, obj_measure, obj_transabout, obj_transvec, obj_transvecinv, obj_vecadd, obj_vecmean, obj_vecscale, obj_vecstddev, obj_vecsub, obj_vecsum, obj_vectrans, obj_volmap, once, SnapshotDisplayDevice::open_file, FileRenderer::open_file, OpenGLDisplayDevice::open_window, OpenGLCache::OpenGLCache, OpenGLDisplayDevice::OpenGLDisplayDevice, OpenGLRenderer::OpenGLRenderer, OpenWin32Connection, JString::operator+=, JString::operator=, Tool::orientation, SymbolTable::parse, parse_frames, parse_timestep, parse_two_selections_return_weight, parse_weight, parseMaterialDefs, ParseTree::ParseTree, pause, DisplayDevice::pick, PickList::pick_check, PickList::pick_end, PickModeAddBond::pick_molecule_end, PickList::pick_start, PickList::PickList, PickSelectionEvent::PickSelectionEvent, Tool::position, position_cb, prev, print_arep_summary, print_mol_summary, DisplayDevice::projection_name, PSDisplayDevice::PSDisplayDevice, DispCmdPickPointIndexArray::putdata, DispCmdPickPointIndex::putdata, DispCmdPickPoint::putdata, DispCmdLineWidth::putdata, DispCmdLineType::putdata, DispCmdSphereType::putdata, DispCmdSphereRes::putdata, DispCmdVolumeTexture::putdata, DispCmdVolSlice::putdata, DispCmdTextSize::putdata, DispCmdComment::putdata, DispCmdText::putdata, DispCmdColorIndex::putdata, DispCmdCone::putdata, DispCmdCylinder::putdata, DispCmdWireMesh::putdata, DispCmdTriStrips::putdata, DispCmdTriMesh::putdata, DispCmdSquare::putdata, DispCmdPolyLineArray::putdata, DispCmdLineArray::putdata, DispCmdLine::putdata, DispCmdLitPointArray::putdata, DispCmdPointArray::putdata, DispCmdSphereArray::putdata, DispCmdSphereIndex::putdata, DispCmdSphere::putdata, DispCmdPoint::putdata, DispCmdDataBlock::putdata, py_align, py_fit, py_move, py_moveby, py_rmsd, py_update, py_vmdexit, py_write, OpenGLDisplayDevice::read_event, read_matrix, MolFilePlugin::read_metadata, MolFilePlugin::read_optional_structure, MolFilePlugin::read_rawgraphics, read_stride_record, MolFilePlugin::read_structure, MolFilePlugin::read_volumetric, MolData::readFile, readorwrite, OpenGLDisplayDevice::readpixels, FltkOpenGLDisplayDevice::readpixels, DisplayDevice::readpixels, registermenu, Tool::remove_device, rename, render, PSDisplayDevice::render, OpenGLRenderer::render, repindex, VMDDisplayList::reset_and_free, reset_scaleminmax, resetview, reverse, rock, rotate, same_int, sasa, scale, scale_max, scale_method, scale_methods, scale_midpoint, scale_min, JRegex::search, sel_from_py, SelectionBuilder::SelectionBuilder, selframe, SensorConfig::SensorConfig, set, DispCmdTriangle::set_array, set_autoupdate, UIVR::set_buttons, set_center, set_colormap, set_colors, set_colorupdate, set_default, UIVR::set_feedback, set_frame, set_location, set_periodic, set_physical_time, set_rotation, set_scale, set_scaleminmax, set_smoothing, set_top, UIVR::set_tracker, set_trans, set_visible, set_vmdapp, BaseMolecule::setbondorder, setbonds, VolumeTexture::setGridData, settings, OpenGLRenderer::setup_initial_opengl_state, SetupOpenGL, show, skip, Spaceball::Spaceball, OpenGLDisplayDevice::spaceball, TclTextInterp::spaceball_cb, spaceball_decode_event, spaceball_enable, VMDApp::spaceball_get_tracker_status, spaceball_usage, SpaceballTracker::SpaceballTracker, speed, FileRenderer::sphere, split_tcl_atomsel_info, ss_from_stride, stereomodes, VMDCollab::stopserver, AtomGrid::store, AtomList::storeFile, str_tokenize, stream_bench, stringdup, stringtoupper, style, symbol_data::symbol_data, SymbolTableElement::SymbolTableElement, Symmetry::Symmetry, Tool::target, tcl_append_matrix, tcl_colorinfo, tcl_colorinfo_rgb, tcl_colorinfo_scale, tcl_commands_get_sel, tcl_get_matrix, tcl_get_weights, tcl_graphics, tcl_graphics_color, tcl_graphics_cone, tcl_graphics_cylinder, tcl_graphics_info, tcl_graphics_line, tcl_graphics_sphere, tcl_graphics_text, TclTextInterp::TclTextInterp, text_cmd_animate, text_cmd_axes, text_cmd_collab, text_cmd_color, text_cmd_display, text_cmd_gopython, text_cmd_imd, text_cmd_label, text_cmd_light, text_cmd_material, text_cmd_menu, text_cmd_mol, text_cmd_mouse, text_cmd_play, text_cmd_plugin, text_cmd_render, text_cmd_rock, text_cmd_rotate, text_cmd_scale, text_cmd_spaceball, text_cmd_stage, text_cmd_tkrender, text_cmd_tool, text_cmd_translate, text_cmd_user, text_cmd_vmdbench, text_cmd_wait, textinputcb, Timestep::Timestep, timestep, AtomSel::timestep, Tool::Tool, Tool::tool_location_update, transfer, GeometryMol::transformed_atom_coord, translate, UIText::UIText, SpaceballTracker::update, SpaceballButtons::update, update, TachyonDisplayDevice::update_exec_cmd, update_off, update_on, GraphicsFltkMenu::update_rep, update_ui, Vec_Init, velocities, vmd_bond_search, vmd_bondsearch_thr, vmd_check_stdin, VMDApp::vmd_choose_file, vmd_closedir, vmd_cpu_affinitylist, vmd_cuda_bus_bw, vmd_cuda_madd_gflops, vmd_cuda_vol_cpotential, vmd_get_avail_physmem_mb, vmd_get_total_physmem_mb, vmd_get_visual, vmd_get_vmddir, vmd_gridsearch1, vmd_gridsearch2, vmd_gridsearch3, vmd_gridsearch_bonds, Vmd_Init, vmd_initialize_tcl, vmd_isatty, vmd_measure_angle, vmd_measure_avpos, vmd_measure_bond, vmd_measure_center, vmd_measure_contacts, vmd_measure_dihed, vmd_measure_dipole, vmd_measure_energy, vmd_measure_fit, vmd_measure_gofr, vmd_measure_hbonds, vmd_measure_inertia, vmd_measure_inverse, vmd_measure_minmax, vmd_measure_pbc2onc_transform, vmd_measure_pbc_neighbors, vmd_measure_rgyr, vmd_measure_rmsd, vmd_measure_rmsf, vmd_measure_sasa, vmd_measure_sumweights, vmd_measure_surface, vmd_measure_symmetry, vmd_measure_trans_overlap, vmd_msleep, vmd_mutex_init, vmd_opendir, vmd_readdir, vmd_resize_alloc, vmd_tempfile, vmd_thread_create, vmd_thread_join, vmd_thread_numprocessors, vmd_username, vmd_volmap_new_fromtype, vmd_writebmp, vmd_writeppm, vmd_writergb, vmd_writetga, VMDApp::VMDApp, VMDCollab::VMDCollab, VMDDisplayList::VMDDisplayList, VMDFltkMenu::VMDFltkMenu, VMDGetOptions, OpenGLExtensions::vmdGetProcAddress, vmdinfo_tcl, VMDApp::VMDinit, VMDinitialize, vmdpcre_compile, vmdpcre_exec, vmdpcre_info, OpenGLExtensions::vmdQueryExtension, OpenGLExtensions::vmdQueryGLVersion, VMDreadInit, VMDreadStartup, vmdsock_accept, vmdsock_connect, vmdsock_create, vmdsock_destroy, vmdsock_selread, vmdsock_selwrite, vmdsock_shutdown, VMDTkinterMenu::VMDTkinterMenu, VMDTkMenu::VMDTkMenu, VMDApp::VMDupdate, vmdWindowProc, vol_cpotential_cpu, VolMap::VolMap, VolMapCreate::VolMapCreate, VolMapCreateFastEnergy::VolMapCreateFastEnergy, VolumeTexture::VolumeTexture, VolumetricData::VolumetricData, Vrml2DisplayDevice::Vrml2DisplayDevice, VrmlDisplayDevice::VrmlDisplayDevice, VRPNButtons::VRPNButtons, VRPNFeedback::VRPNFeedback, VRPNTracker::VRPNTracker, VMDTkinterMenu::where, Win32Joystick::Win32Joystick, win32vmdstart, RayShadeDisplayDevice::write_header, MolFilePlugin::write_timestep, xinput_close, xinput_close_device, xinput_decode_event, xinput_enable, xinput_open_device, yyparse, AtomSel::~AtomSel, CoorPluginData::~CoorPluginData, OpenGLDisplayDevice::~OpenGLDisplayDevice, ParseTree::~ParseTree, Spaceball::~Spaceball, SpaceballTracker::~SpaceballTracker, TclTextInterp::~TclTextInterp, VMDApp::~VMDApp, and Win32Joystick::~Win32Joystick.

#define RADTODEG      (a*180.0/VMD_PI)
 

Definition at line 45 of file utilities.h.

Referenced by myfit3, Matrix4::rotate_axis, transvec, Matrix4::transvec, transvecinv, and Matrix4::transvecinv.

#define TRUE   1
 

Definition at line 27 of file utilities.h.

#define VMD_1_PI   0.31830988618379067154
 

Definition at line 41 of file utilities.h.

Referenced by RenderManDisplayDevice::write_header, LibGelatoDisplayDevice::write_header, and GelatoDisplayDevice::write_header.

#define VMD_PI   3.14159265358979323846
 

Definition at line 39 of file utilities.h.

Referenced by VolMapCreateDensity::compute_frame, VolMapCreateFastEnergy::compute_init, VolMapCreateSlowEnergy::compute_init, RenderManDisplayDevice::cone, convert_endpoints_to_matrix, cremer_pople_params, RenderManDisplayDevice::cylinder, OpenGLRenderer::cylinder, GelatoDisplayDevice::cylinder, draw_letter_D, hill_reilly_ring_color, measure_gofr, measure_sasa, obj_transabout, ring_axes, and spherical_cap.

#define VMD_RAND_MAX   2147483647L
 

Definition at line 448 of file utilities.h.

Referenced by VolMapCreateFastEnergy::compute_init, VolMapCreateSlowEnergy::compute_init, measure_sasa, and vmd_random_gaussian.

#define VMD_TWOPI   (2.0 * VMD_PI)
 

Definition at line 40 of file utilities.h.

Referenced by FileRenderer::cone, FileRenderer::cylinder, fullcirclearc, HSItoRGB, and DispCmdCylinder::putdata.


Typedef Documentation

typedef void* vmd_timerhandle
 

a timer handle.

Definition at line 81 of file utilities.h.

Referenced by VolMapCreate::compute_all, cudabusbw, cudaenergythread, cudamaddgflops, energythread, Symmetry::guess, stream_bench, stringdup, vmd_cuda_vol_cpotential, vmd_timer_create, vmd_timer_destroy, vmd_timer_start, vmd_timer_stop, vmd_timer_time, vmd_timer_timenow, vol_cpotential, and vol_cpotential_cpu.


Function Documentation

float angle const float *   ,
const float *   
 

compute the angle between two vectors a & b (0 to 180 deg).

Definition at line 493 of file utilities.C.

Referenced by GeometryAngle::calculate, calculate_angle, and vmd_measure_hbonds.

void breakup_filename const char *   ,
char **   ,
char **   
 

break a file name up into path + name, returning both in the specified character pointers. This creates storage for the new strings by allocating space for them.

Definition at line 156 of file utilities.C.

Referenced by Molecule::Molecule.

void clamp_color float *    rgb [inline]
 

Definition at line 211 of file utilities.h.

Referenced by cremer_pople_ring_color, and hill_reilly_ring_color.

int clamp_int int    val,
int    min,
int    max
[inline]
 

clamp an integer value to the range min->max.

Definition at line 112 of file utilities.h.

Referenced by VolumetricData::compute_volume_gradient.

char* combine_arguments int   ,
const char **   ,
int   
 

given an argc, argv pair, take all the arguments from the Nth one on and combine them into a single string with spaces separating words. This allocates space for the string, which must be freed by the user.

Definition at line 60 of file utilities.C.

Referenced by text_cmd_mol, and text_cmd_render.

void create_Bspline_basis float    array[4][4] [inline]
 

define a cubic spline with a B-Spline basis.

Definition at line 269 of file utilities.h.

void create_modified_CR_spline_basis float    array[4][4],
float    slope
[inline]
 

define a cubic spline with a Catmull-Rom basis.

Definition at line 289 of file utilities.h.

Referenced by DrawMolItem::DrawMolItem.

float* cross_prod float *    x1,
const float *    x2,
const float *    x3
 

compute the cross product, assumes that x1 memory is _different_ than both x2 and x3, and returns the pointer to x1.

Definition at line 415 of file utilities.C.

Referenced by align_plane_with_axis, angle, IsoSurface::compute, Vrml2DisplayDevice::cone, FileRenderer::cone, Vrml2DisplayDevice::cylinder, FileRenderer::cylinder, dihedral, hill_reilly_ring_color, DispCmdCylinder::putdata, DispCmdSquare::putdata, DispCmdTriangle::putdata, ring_axes, and POV3DisplayDevice::tricolor.

float dihedral const float *   ,
const float *   ,
const float *   ,
const float *   
 

Compute the dihedral angle for the given atoms, returning a value between -180 and 180.

Definition at line 505 of file utilities.C.

Referenced by GeometryDihedral::calculate, and calculate_dihed.

float distance const float *   ,
const float *   
 

compute the distance between two points a & b.

Definition at line 524 of file utilities.C.

Referenced by VrmlDisplayDevice::cone, Vrml2DisplayDevice::cone, convert_endpoints_to_matrix, VrmlDisplayDevice::cylinder, Vrml2DisplayDevice::cylinder, RotateTool::do_event, and trans_overlap.

float distance2 const float *    a,
const float *    b
[inline]
 

compute the squared distance between two points a & b.

Definition at line 402 of file utilities.h.

Referenced by distance, measure_rgyr, measure_rmsd, measure_rmsf, trans_overlap, vmd_gridsearch1, vmd_gridsearch2, and vmd_gridsearch3.

double dot_prod const double *    v1,
const double *    v2
[inline]
 

Definition at line 125 of file utilities.h.

Referenced by angle, basis_change, VolumetricData::cell_lengths, collinear, IsoSurface::compute, VolMapCreateFastEnergy::compute_frame, compute_pbcminmax, Vrml2DisplayDevice::cone, Vrml2DisplayDevice::cylinder, dihedral, PinchTool::do_event, hill_reilly_ring_color, measure_pbc_neighbors, orthogonal, orthonormal_basis, DispCmdCylinder::putdata, ring_axes, VRPNFeedback::sendforce, TachyonDisplayDevice::start_clipgroup, POV3DisplayDevice::start_clipgroup, LibTachyonDisplayDevice::start_clipgroup, and POV3DisplayDevice::tricolor.

float dot_prod const float *    v1,
const float *    v2
[inline]
 

compute the inner dot product.

Definition at line 121 of file utilities.h.

void make_spline_interpolation float    out[3],
float    w,
float    q[4][3]
[inline]
 

Evaluate the spline to return a point on the curve specified by the w parameter, in the range 0 to 1. XXX an improved implementation might use forward differences to find the points on the curve rather than explicitly evaluating points one at a time. Forward differences should be much faster, since it can be done with 9 additions and no multiplies, whereas this code has to do 9 multiplies as well as 9 additions for each point. The forward difference method requires setup, and some extra storage for it's position/velocity/acceleration accumulators however, so it may be an even trade-off.

Definition at line 381 of file utilities.h.

void make_spline_Q_matrix float    q[4][3],
float    basis[4][4],
const float *    pts
[inline]
 

Builds the spline matrix "Q" from the basis matrix "M" and the geometry matrix "G". The geometry matrix in this case is the pts parameter, which contains the previous, current, and next two points defining the curve. For Catmull-Rom splines the tangent at the current point is the same as the direction from the previous point to the next point.

Definition at line 314 of file utilities.h.

void make_spline_Q_matrix_noncontig float    q[4][3],
float    basis[4][4],
const float *    pts1,
const float *    pts2,
const float *    pts3,
const float *    pts4
[inline]
 

Builds the spline matrix "Q" from the basis matrix "M" and the geometry matrix "G". The geometry matrix in this case is the pts parameter, which contains the previous, current, and next two points defining the curve. For Catmull-Rom splines the tangent at the current point is the same as the direction from the previous point to the next point. This one works with non-contiguous memory layouts.

Definition at line 338 of file utilities.h.

void midpoint float *    a,
const float *    b,
const float *    c
[inline]
 

compute the midpoint a between two vectors b & c (a = (b + c)/2).

Definition at line 231 of file utilities.h.

Referenced by GeometrySpring::create_cmd_list, GeometryDihedral::create_cmd_list, GeometryBond::create_cmd_list, GeometryAngle::create_cmd_list, and set_scale.

msgtimer* msg_timer_create double    updatetime
 

initialize periodic status message timer.

Definition at line 317 of file utilities.C.

Referenced by bondsearchthread, cudaenergythread, energythread, measure_gofr, and vmd_gridsearch1.

void msg_timer_destroy msgtimer   mt
 

destroy message timer.

Definition at line 343 of file utilities.C.

Referenced by bondsearchthread, cudaenergythread, energythread, measure_gofr, and vmd_gridsearch1.

int msg_timer_timeout msgtimer   time
 

return true if it's time to print a status update message.

Definition at line 329 of file utilities.C.

Referenced by bondsearchthread, cudaenergythread, energythread, measure_gofr_orth, and vmd_gridsearch1.