#include <stdlib.h>Go to the source code of this file.
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 | VMD_ANGS_TO_BOHR 1.88972612478289694072 |
| #define | DEGTORAD(a) (a*VMD_PI/180.0) |
| #define | RADTODEG(a) (a*180.0/VMD_PI) |
| #define | VMD_RAND_MAX 2147483647L |
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... | |
| 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... | |
|
|
Definition at line 37 of file utilities.h. |
|
|
Definition at line 49 of file utilities.h. Referenced by collinear, compute_angle_energy, compute_dihed_energy, compute_imprp_energy, dodecahedron, Timestep::get_transform_vectors, measure_surface_int, obj_transabout, Matrix4::rot, Quat::rotate, Symmetry::Symmetry, and vmd_volmap_ils. |
|
|
Definition at line 28 of file utilities.h. |
|
|
|
Definition at line 50 of file utilities.h. Referenced by dodecahedron, myfit3, Matrix4::rotate_axis, transvec, Matrix4::transvec, transvecinv, and Matrix4::transvecinv. |
|
|
Definition at line 29 of file utilities.h. |
|
|
Definition at line 43 of file utilities.h. Referenced by RenderManDisplayDevice::write_header, LibGelatoDisplayDevice::write_header, and GelatoDisplayDevice::write_header. |
|
|
Definition at line 46 of file utilities.h. |
|
|
|
Definition at line 431 of file utilities.h. Referenced by measure_sasa, and vmd_random_gaussian. |
|
|
Definition at line 42 of file utilities.h. Referenced by FileRenderer::cone, FileRenderer::cylinder, fullcirclearc, HSItoRGB, DispCmdCylinder::putdata, Symmetry::score_axis, and Symmetry::score_rotary_reflection. |
|
||||||||||||
|
compute the angle between two vectors a & b (0 to 180 deg).
Definition at line 395 of file utilities.C. Referenced by GeometryAngle::calculate, calculate_angle, dodecahedron, signed_angle, and vmd_measure_hbonds. |
|
||||||||||||||||
|
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 159 of file utilities.C. Referenced by Molecule::Molecule. |
|
|
Definition at line 194 of file utilities.h. Referenced by cremer_pople_ring_color, hotcold_gradient, hotcold_gradient_lerp, and scale_color. |
|
||||||||||||||||
|
clamp an integer value to the range min->max.
Definition at line 95 of file utilities.h. Referenced by VolumetricData::compute_volume_gradient. |
|
||||||||||||||||
|
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 63 of file utilities.C. Referenced by text_cmd_mol, and text_cmd_render. |
|
|
define a cubic spline with a B-Spline basis.
Definition at line 252 of file utilities.h. |
|
||||||||||||
|
define a cubic spline with a Catmull-Rom basis.
Definition at line 272 of file utilities.h. Referenced by DrawMolItem::DrawMolItem. |
|
||||||||||||||||
|
compute the cross product, assumes that x1 memory is _different_ than both x2 and x3, and returns the pointer to x1.
Definition at line 317 of file utilities.C. Referenced by align_plane_with_axis, angle, IsoSurface::compute, Vrml2DisplayDevice::cone, FileRenderer::cone, Vrml2DisplayDevice::cylinder, FileRenderer::cylinder, dihedral, dodecahedron, hill_reilly_ring_pucker, DispCmdCylinder::putdata, DispCmdSquare::putdata, DispCmdTriangle::putdata, ring_axes, signed_angle, and POV3DisplayDevice::tricolor. |
|
||||||||||||||||||||
|
Compute the dihedral angle for the given atoms, returning a value between -180 and 180.
Definition at line 407 of file utilities.C. Referenced by GeometryDihedral::calculate, and calculate_dihed. |
|
||||||||||||
|
compute the distance between two points a & b.
Definition at line 426 of file utilities.C. Referenced by VrmlDisplayDevice::cone, Vrml2DisplayDevice::cone, convert_endpoints_to_matrix, VrmlDisplayDevice::cylinder, Vrml2DisplayDevice::cylinder, RotateTool::do_event, and trans_overlap. |
|
||||||||||||
|
compute the squared distance between two points a & b.
Definition at line 385 of file utilities.h. Referenced by distance, measure_rgyr, measure_rmsd, measure_rmsf, trans_overlap, vmd_gridsearch1, vmd_gridsearch2, and vmd_gridsearch3. |
|
||||||||||||
|
||||||||||||
|
compute the inner dot product.
Definition at line 104 of file utilities.h. |
|
||||||||||||||||
|
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 364 of file utilities.h. |
|
||||||||||||||||
|
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 297 of file utilities.h. |
|
||||||||||||||||||||||||||||
|
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 321 of file utilities.h. |
|
||||||||||||||||
|
compute the midpoint a between two vectors b & c (a = (b + c)/2).
Definition at line 214 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. |
|
|
find and return the norm of a 3-vector.
Definition at line 343 of file utilities.C. Referenced by GeometrySpring::calculate, GeometryBond::calculate, calculate_bond, AtomColor::find, icosahedron_geodesic, Symmetry::impose, VRPNFeedback::sendforce, VMDDisplayList::set_clip_normal, triangulate, and vmd_volmap_compare. |
|
||||||||||||||||
|
tokenize a given string; return char ptr if ok, NULL if error.
Referenced by VMDGetOptions. |
|
|
|
convert the given string to upper case.
Definition at line 104 of file utilities.C. Referenced by strupcmp. |
|
|
strip trailing '/' characters from a string.
Definition at line 116 of file utilities.C. Referenced by vmd_tempfile, and VMDreadStartup. |
|
||||||||||||
|
do case-insensitive string comparisons.
Definition at line 123 of file utilities.C. Referenced by VMDApp::axes_set_location, UIText::change_interp, SpaceballTracker::do_start, DisplayDevice::set_cue_mode, DisplayDevice::set_projection, VMDApp::stage_set_location, text_cmd_material, text_cmd_rotate, text_cmd_scale, text_cmd_translate, VMDApp::vmd_choose_file, vmd_measure_angle, vmd_measure_bond, vmd_measure_dihed, vmd_measure_energy, vmd_measure_pbc2onc_transform, vmd_measure_pbc_neighbors, vmd_measure_symmetry, and VMDGetOptions. |
|
||||||||||||||||
|
do case-insensitive string comparisons.
Definition at line 140 of file utilities.C. Referenced by checkfileextension, VMDApp::colorscale_method_index, IdList::find, obj_measure, obj_volmap, 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_plugin, text_cmd_render, text_cmd_rock, text_cmd_rotate, text_cmd_spaceball, text_cmd_stage, text_cmd_tool, text_cmd_user, text_cmd_vmdbench, vmd_measure_angle, vmd_measure_avpos, vmd_measure_bond, vmd_measure_dihed, vmd_measure_energy, vmd_measure_inertia, vmd_measure_pbc2onc_transform, vmd_measure_pbc_neighbors, vmd_measure_rmsf, vmd_measure_symmetry, vmd_measure_trans_overlap, and xinput_enable. |
|
|
get the time of day from the system clock, and return it (in seconds) (This is supposedly accurate to within about 1 millisecond.
Definition at line 232 of file utilities.C. |
|
||||||||||||||||
|
determine if a triangle is degenerate or not.
Definition at line 349 of file utilities.C. Referenced by Surf::compute. |
|
||||||||||||||||
|
||||||||||||
|
||||||||||||
|
increment 1st vector by 2nd vector.
Definition at line 139 of file utilities.h. Referenced by ring_axes. |
|
||||||||||||||||||||
|
perform linear interpolation between two vectors a = b + frac*(c-b).
Definition at line 181 of file utilities.h. References vec_add, vec_scale, and vec_sub. Referenced by lerp_color_range, and VolumetricData::voxel_gradient_interpolate. |
|
||||||||||||
|
a = -b.
Definition at line 160 of file utilities.h. Referenced by FileRenderer::cone, FileRenderer::cylinder, GrabTool::do_event, dodecahedron, get_transform_to_orthonormal_cell, hexahedron, icosahedron_geodesic, measure_pbc_neighbors, octahedron, TachyonDisplayDevice::start_clipgroup, POV3DisplayDevice::start_clipgroup, and LibTachyonDisplayDevice::start_clipgroup. |
|
|
normalizes the 3-vector to length one and returns the pointer note that this changes the vector.
Definition at line 327 of file utilities.C. Referenced by MoleculeGraphics::add_tricolor, MoleculeGraphics::add_trinorm, align_plane_with_axis, Vrml2DisplayDevice::cone, FileRenderer::cone, Vrml2DisplayDevice::cylinder, FileRenderer::cylinder, cylinder_full, OpenGLRenderer::do_define_light, RotateTool::do_event, dodecahedron, hill_reilly_ring_pucker, icosahedron_geodesic, Symmetry::impose, FileRenderer::line, measure_fit, IsoSurface::normalize, orthonormal_basis, prepare_texture_coordinates, DispCmdCylinder::putdata, DispCmdSquare::putdata, DispCmdTriangle::putdata, PSDisplayDevice::render, ring_axes, VolMapCreateILS::set_probe_symmetry, signed_angle, FileRenderer::sphere, triangulate, and OpenGLRenderer::update_shader_uniforms. |
|
||||||||||||||||
|
||||||||||||||||
|
a = b*c.
Definition at line 146 of file utilities.h. |
|
||||||||||||||||
|
a += c*d.
Definition at line 167 of file utilities.h. Referenced by compute_pbcminmax, get_transform_to_orthonormal_cell, icosahedron_geodesic, measure_pbc_neighbors, ribbon_spline, and triangulate. |
|
||||||||||||||||
|
subtract 3rd vector from 2nd and put into 1st in other words, a = b - c.
Definition at line 125 of file utilities.h. Referenced by GeometrySpring::calculate, GeometryBond::calculate, GeometryAngle::calculate, calculate_angle, calculate_bond, Vrml2DisplayDevice::cone, convert_endpoints_to_matrix, Vrml2DisplayDevice::cylinder, dihedral, SpringTool::do_event, TugTool::do_event, RotateTool::do_event, PinchTool::do_event, Tool::dograb, draw_outsides, AtomColor::find, hill_reilly_ring_pucker, icosahedron_geodesic, FileRenderer::line, measure_pbc_neighbors, PickModeMove::pick_molecule_move, DispCmdCylinder::putdata, PickModeMoveRep::rotate, PickModeMoveMolecule::rotate, PickModeMoveFragment::rotate, PickModeMoveResidue::rotate, VRPNFeedback::sendforce, VolMapCreateILS::set_probe, triangulate, POV3DisplayDevice::tricolor, vec_lerp, vmd_gridsearch1, vmd_gridsearch2, vmd_gridsearch3, vmd_gridsearch_bonds, and vmd_measure_hbonds. |
|
||||||||||||||||||||
|
a = b + c*d (name taken from STREAM benchmark routine).
Definition at line 174 of file utilities.h. Referenced by orthonormal_basis. |
|
|
Definition at line 188 of file utilities.h. Referenced by cremer_pople_ring_color, dodecahedron, Timestep::get_transform_vectors, hotcold_gradient, hotcold_gradient_lerp, measure_minmax, and VolMapCreateILS::set_probe. |
|
|
check for input on stdin.
Definition at line 250 of file utilities.C. |
|
|
VMD file deletion function (portable).
Definition at line 474 of file utilities.C. Referenced by Surf::compute, ss_from_stride, and VMDTempFile::~VMDTempFile. |
|
|
return the number of MB of physical memory "free" (no VM/swap counted...).
Definition at line 609 of file utilities.C. |
|
|
return the percentage of physical memory available.
Definition at line 681 of file utilities.C. |
|
|
return the number of MB of physical memory installed in the system.
Definition at line 554 of file utilities.C. |
|
|
return the uid of the currently logged-on user.
Definition at line 306 of file utilities.C. |
|
|
Definition at line 493 of file utilities.C. Referenced by VMDCollab::act_on_command, FreeVRScene::draw, CaveScene::draw, VMDTitle::prepare, IMDSimThread::reader, and VMDApp::VMDupdate. |
|
|
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.
Definition at line 512 of file utilities.C. |
|
|
Slow but accurate standard distribution random number generator (variance = 1).
Definition at line 530 of file utilities.C. |
|
|
VMD process sleep functions (portable).
Definition at line 485 of file utilities.C. Referenced by MSMSInterface::compute_from_socket, VMDCollab::connect, text_cmd_sleep, VMDApp::VMDexit, and VMDinitialize. |
|
|
portable random number generation, NOT thread-safe however.
Definition at line 520 of file utilities.C. Referenced by measure_sasa. |
|
|
a buffer function to system() call to be replaced by a different implementation in console-free Win32 applications.
Definition at line 504 of file utilities.C. Referenced by Surf::compute, MSMSInterface::compute_from_file, PlainTextInterp::evalString, FileRenderList::render, and ss_from_stride. |
|
|
VMD temp file (portable) given a string, return a new one with the temp dir name prepended. The returned string must be deleted.
Definition at line 430 of file utilities.C. Referenced by Surf::compute, MSMSInterface::compute_from_file, and text_cmd_mol. |
|
|
return the username of the currently logged-on user.
Definition at line 286 of file utilities.C. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002