#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 | find_first_selection_aligned (int n, const int *on, int *firstsel) |
| int | find_last_selection_aligned (int n, const int *on, int *lastsel) |
| int | analyze_selection_aligned (int n, const int *on, int *firstsel, int *lastsel, int *selected) |
| void | minmax_1fv_aligned (const float *f, int n, float *min, float *max) |
| find min/max values for an array of floats. More... | |
| void | minmax_3fv_aligned (const float *f, const int n3, float *fmin, float *fmax) |
| int | minmax_selected_3fv_aligned (const float *f, const int *on, const int n3, const int firstsel, const int lastsel, float *fmin, float *fmax) |
| 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 460 of file utilities.h. Referenced by measure_sasa, and vmd_random_gaussian. |
|
|
Definition at line 42 of file utilities.h. Referenced by FileRenderer::cone_trunc, FileRenderer::cylinder, fullcirclearc, HSItoRGB, DispCmdCylinder::putdata, Symmetry::score_axis, and Symmetry::score_rotary_reflection. |
|
||||||||||||||||||||||||
|
Definition at line 670 of file utilities.C. Referenced by AtomSel::change, and same_double. |
|
||||||||||||
|
compute the angle between two vectors a & b (0 to 180 deg).
Definition at line 1196 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 171 of file utilities.C. Referenced by Molecule::Molecule. |
|
|
Definition at line 223 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 124 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 76 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 281 of file utilities.h. |
|
||||||||||||
|
define a cubic spline with a Catmull-Rom basis.
Definition at line 301 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 1118 of file utilities.C. Referenced by align_plane_with_axis, angle, IsoSurface::compute, X3DDisplayDevice::cone, Vrml2DisplayDevice::cone, FileRenderer::cone_trunc, 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 1208 of file utilities.C. Referenced by GeometryDihedral::calculate, and calculate_dihed. |
|
||||||||||||
|
compute the distance between two points a & b.
Definition at line 1227 of file utilities.C. Referenced by X3DDisplayDevice::cone, VrmlDisplayDevice::cone, Vrml2DisplayDevice::cone, convert_endpoints_to_matrix, VrmlDisplayDevice::cylinder, RotateTool::do_event, and trans_overlap. |
|
||||||||||||
|
compute the squared distance between two points a & b.
Definition at line 414 of file utilities.h. Referenced by cluster_get_rgyrd, distance, measure_rgyr, measure_rmsd, measure_rmsf, overlap_S12_contracted, trans_overlap, vmd_gridsearch1, vmd_gridsearch2, and vmd_gridsearch3. |
|
||||||||||||
|
||||||||||||
|
compute the inner dot product.
Definition at line 133 of file utilities.h. |
|
||||||||||||||||
|
Definition at line 523 of file utilities.C. Referenced by analyze_selection_aligned, measure_minmax, and same_int. |
|
||||||||||||||||
|
Definition at line 591 of file utilities.C. Referenced by analyze_selection_aligned, measure_minmax, and same_int. |
|
||||||||||||||||
|
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 393 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 326 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 350 of file utilities.h. |
|
||||||||||||||||
|
compute the midpoint a between two vectors b & c (a = (b + c)/2).
Definition at line 243 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 min/max values for an array of floats.
Definition at line 729 of file utilities.C. Referenced by AtomColor::find, BaseMolecule::get_radii_minmax, and VolumetricData::VolumetricData. |
|
||||||||||||||||||||
|
Definition at line 874 of file utilities.C. Referenced by vmd_gridsearch_bonds. |
|
||||||||||||||||||||||||||||||||
|
Definition at line 974 of file utilities.C. Referenced by QuickSurf::calc_surf, and measure_minmax. |
|
|
find and return the norm of a 3-vector.
Definition at line 1144 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 117 of file utilities.C. Referenced by strupcmp. |
|
|
strip trailing '/' characters from a string.
Definition at line 128 of file utilities.C. Referenced by vmd_tempfile, and VMDreadStartup. |
|
||||||||||||
|
do case-insensitive string comparisons.
Definition at line 135 of file utilities.C. Referenced by VMDApp::axes_set_location, UIText::change_interp, SpaceballTracker::do_start, M_VRJapp::preFrame, 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, VMDGetOptions, and VMDinitialize. |
|
||||||||||||||||
|
|
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 244 of file utilities.C. |
|
||||||||||||||||
|
determine if a triangle is degenerate or not.
Definition at line 1150 of file utilities.C. Referenced by Surf::compute. |
|
||||||||||||||||
|
||||||||||||
|
||||||||||||
|
increment 1st vector by 2nd vector.
Definition at line 168 of file utilities.h. Referenced by ring_axes. |
|
||||||||||||||||||||
|
perform linear interpolation between two vectors a = b + frac*(c-b).
Definition at line 210 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 189 of file utilities.h. Referenced by FileRenderer::cone_trunc, 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. |
|
|
||||||||||||||||
|
||||||||||||||||
|
a = b*c.
Definition at line 175 of file utilities.h. |
|
||||||||||||||||
|
a += c*d.
Definition at line 196 of file utilities.h. Referenced by compute_pbcminmax, get_transform_to_orthonormal_cell, icosahedron_geodesic, measure_pbc_neighbors, overlap_S12_contracted, ribbon_spline, and triangulate. |
|
||||||||||||||||
|
||||||||||||||||||||
|
a = b + c*d (name taken from STREAM benchmark routine).
Definition at line 203 of file utilities.h. Referenced by orthonormal_basis. |
|
|
Definition at line 217 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 262 of file utilities.C. |
|
|
VMD file deletion function (portable).
Definition at line 1275 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 1410 of file utilities.C. |
|
|
return the percentage of physical memory available.
Definition at line 1482 of file utilities.C. |
|
|
return the number of MB of physical memory installed in the system.
Definition at line 1355 of file utilities.C. |
|
|
return the uid of the currently logged-on user.
Definition at line 318 of file utilities.C. |
|
|
Definition at line 1294 of file utilities.C. Referenced by VMDCollab::act_on_command, MSMSInterface::compute_from_socket, FreeVRScene::draw, CaveScene::draw, VMDTitle::prepare, IMDSimThread::reader, VMDApp::VMDexit, 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 1313 of file utilities.C. |
|
|
Slow but accurate standard distribution random number generator (variance = 1).
Definition at line 1331 of file utilities.C. |
|
|
VMD process sleep functions (portable).
Definition at line 1286 of file utilities.C. Referenced by VMDCollab::connect, text_cmd_sleep, VMDApp::VMDexit, and VMDinitialize. |
|
|
portable random number generation, NOT thread-safe however.
Definition at line 1321 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 1305 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 1231 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 298 of file utilities.C. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002