#include <stdlib.h>
#include <stddef.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_PIF 3.14159265358979323846f |
#define | VMD_TWOPIF (2.0f * VMD_PIF) |
#define | VMD_1_PIF 0.31830988618379067154f |
#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 |
Typedefs | |
typedef wkf_cpu_caps_struct | wkf_cpu_caps_t |
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) |
int | analyze_selection_aligned_dispatch (wkf_cpu_caps_t *cpucaps, int n, const int *on, int *firstsel, int *lastsel, int *selected) |
void | minmaxmean_1fv_aligned (const float *f, ptrdiff_t n, float *fmin, float *fmax, float *fmean) |
find min/max/mean values for an array of floats. More... | |
void | minmax_1fv_aligned (const float *f, ptrdiff_t n, float *min, float *max) |
find min/max values for an array of floats. More... | |
void | minmax_3fv_aligned (const float *f, const ptrdiff_t n3, float *fmin, float *fmax) |
int | minmax_selected_3fv_aligned (const float *f, const int *on, const ptrdiff_t n3, const ptrdiff_t firstsel, const ptrdiff_t 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... | |
void | vec_copy (double *v1, const double *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_sub (double *a, const double *b, const double *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_scaled_add (double *a, float b, const double *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 | vectrans (float *npoint, float *mat, double *vec) |
void | vec_zero (float *a) |
void | vec_zero (double *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... | |
int | k_candidates (int, int, int, int, float, float *, float *) |
float | arcdistance (float, float, float, float) |
void | print_xyz (float *, int) |
float | correction (int) |
int | poisson_sample_on_sphere (float *, int, int, int) |
|
Definition at line 55 of file utilities.h. |
|
Definition at line 72 of file utilities.h. Referenced by collinear, compute_angle_energy, compute_dihed_energy, compute_imprp_energy, do_density_rotate, do_rotate, dodecahedron, Timestep::get_transform_vectors, measure_surface_int, obj_transabout, Matrix4::rot, Quat::rotate, Symmetry::Symmetry, and vmd_volmap_ils. |
|
Definition at line 46 of file utilities.h. |
|
|
Definition at line 73 of file utilities.h. Referenced by dodecahedron, myfit3, Matrix4::rotate_axis, transvec, Matrix4::transvec, transvecinv, and Matrix4::transvecinv. |
|
Definition at line 47 of file utilities.h. |
|
Definition at line 61 of file utilities.h. Referenced by RenderManDisplayDevice::write_header, LibGelatoDisplayDevice::write_header, and GelatoDisplayDevice::write_header. |
|
Definition at line 66 of file utilities.h. |
|
Definition at line 69 of file utilities.h. |
|
|
Definition at line 64 of file utilities.h. Referenced by correction, GraphLayout::init_positions_circle, k_candidates, and vmd_DrawSphere. |
|
Definition at line 528 of file utilities.h. Referenced by k_candidates, measure_sasa, measure_sasa_perresidue, measure_sasalist, poisson_sample_on_sphere, vmd_measure_volinterior, and vmd_random_gaussian. |
|
Definition at line 60 of file utilities.h. Referenced by FileRenderer::cone_trunc, FileRenderer::cylinder, fullcirclearc, HSItoRGB, poisson_sample_on_sphere, DispCmdCylinder::putdata, Symmetry::score_axis, Symmetry::score_rotary_reflection, and vmd_DrawConic. |
|
Definition at line 65 of file utilities.h. Referenced by ColorscaleImage::draw, k_candidates, and vmd_DrawSphere. |
|
Definition at line 27 of file utilities.h. |
|
Definition at line 429 of file util_simd.C. Referenced by vmdbench_analyze_selection. |
|
Definition at line 545 of file util_simd.C. Referenced by AtomSel::change, measure_minmax, same_double, and same_int. |
|
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, measure_hbonds, and signed_angle. |
|
Definition at line 719 of file utilities.C. Referenced by k_candidates. |
|
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 158 of file utilities.C. Referenced by Molecule::Molecule. |
|
Definition at line 291 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 157 of file utilities.h. Referenced by MoleculeGraphics::add_spheretube, and 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. |
|
Definition at line 693 of file utilities.C. Referenced by poisson_sample_on_sphere. |
|
define a cubic spline with a B-Spline basis.
Definition at line 349 of file utilities.h. |
|
define a cubic spline with a Catmull-Rom basis.
Definition at line 369 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, X3DDisplayDevice::cone, Vrml2DisplayDevice::cone, FileRenderer::cone_trunc, FileRenderer::cylinder, dihedral, dodecahedron, hill_reilly_ring_pucker, DispCmdCylinder::putdata, DispCmdTriMesh::putdata, DispCmdSquare::putdata, DispCmdTriangle::putdata, ring_axes, signed_angle, POV3DisplayDevice::tricolor, and vmd_DrawConic. |
|
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 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 482 of file utilities.h. Referenced by cluster_get_rgyrd, distance, measure_rgyr, measure_rmsd, measure_rmsd_perresidue, measure_rmsf, measure_rmsf_perresidue, overlap_S12_contracted, trans_overlap, vmd_gridsearch1, vmd_gridsearch2, and vmd_gridsearch3. |
|
|
compute the inner dot product.
Definition at line 166 of file utilities.h. |
|
Definition at line 282 of file util_simd.C. Referenced by analyze_selection_aligned, and analyze_selection_aligned_dispatch. |
|
Definition at line 350 of file util_simd.C. Referenced by analyze_selection_aligned, and analyze_selection_aligned_dispatch. |
|
Definition at line 735 of file utilities.C. Referenced by poisson_sample_on_sphere. |
|
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 461 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 394 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 418 of file utilities.h. |
|
compute the midpoint a between two vectors b & c (a = (b + c)/2).
Definition at line 311 of file utilities.h. Referenced by GeometrySpring::create_cmd_list, GeometryDihedral::create_cmd_list, GeometryBond::create_cmd_list, GeometryAngle::create_cmd_list, colvarbias_restraint_centers_moving::init, and py_set_scale. |
|
find min/max values for an array of floats.
Definition at line 894 of file util_simd.C. Referenced by AtomColor::find, BaseMolecule::get_radii_minmax, and vmdbench_minmax_1fv. |
|
Definition at line 1082 of file util_simd.C. Referenced by vmd_gridsearch_bonds, and vmdbench_minmax_3fv. |
|
Definition at line 1183 of file util_simd.C. Referenced by calc_density_bounds, QuickSurf::calc_surf, and measure_minmax. |
|
find min/max/mean values for an array of floats.
Definition at line 671 of file util_simd.C. Referenced by vmdbench_minmaxmean_1fv. |
|
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, colvarmodule::rvector::unit, and vmd_volmap_compare. |
|
Definition at line 785 of file utilities.C. Referenced by vmd_measure_volinterior. |
|
Definition at line 704 of file utilities.C. Referenced by vmd_measure_volinterior. |
|
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 115 of file utilities.C. References n. Referenced by vmd_tempfile, and VMDreadStartup. |
|
|
|
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 231 of file utilities.C. |
|
determine if a triangle is degenerate or not.
Definition at line 349 of file utilities.C. Referenced by Surf::compute. |
|
|
|
copy the first 3 elements from v2 to v1.
Definition at line 175 of file utilities.h. |
|
increment 1st vector by 2nd vector.
Definition at line 216 of file utilities.h. Referenced by ring_axes. |
|
perform linear interpolation between two vectors a = b + frac*(c-b).
Definition at line 265 of file utilities.h. References vec_add, vec_scale, and vec_sub. Referenced by lerp_color_range, and VolumetricData::voxel_gradient_interpolate. |
|
|
|
|
a = b*c.
Definition at line 223 of file utilities.h. |
|
a += c*d.
Definition at line 251 of file utilities.h. Referenced by compute_pbcminmax, get_transform_to_orthonormal_cell, icosahedron_geodesic, measure_pbc_neighbors, overlap_S12_contracted, VolumetricData::pad, ribbon_spline, and triangulate. |
|
a += c*d.
Definition at line 244 of file utilities.h. |
|
|
subtract 3rd vector from 2nd and put into 1st in other words, a = b - c.
Definition at line 194 of file utilities.h. |
|
a = b + c*d (name taken from STREAM benchmark routine).
Definition at line 258 of file utilities.h. Referenced by FileRenderer::cube, and orthonormal_basis. |
|
Definition at line 285 of file utilities.h. Referenced by calc_density_bounds, cremer_pople_ring_color, dodecahedron, Timestep::get_transform_vectors, hotcold_gradient, hotcold_gradient_lerp, init_from_union, measure_minmax, VolMapCreateILS::set_probe, and vol_com. |
|
Definition at line 279 of file utilities.h. |
|
Definition at line 273 of file utilities.h. References mat. Referenced by vol_move. |
|
check for input on stdin.
Definition at line 249 of file utilities.C. |
|
VMD file deletion function (portable).
Definition at line 474 of file utilities.C. Referenced by Surf::compute, ss_from_dssp, 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 305 of file utilities.C. |
|
Definition at line 493 of file utilities.C. Referenced by VMDCollab::act_on_command, MSMSInterface::compute_from_socket, FreeVRScene::draw, CaveScene::draw, VMDTitle::prepare, IMDSimThread::reader, VideoStream::srv_send_frame, 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 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 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 colvarproxy_vmd::colvarproxy_vmd, measure_sasa, measure_sasa_perresidue, measure_sasalist, and poisson_sample_on_sphere. |
|
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, NanoShaperInterface::compute_from_file, MSMSInterface::compute_from_file, PlainTextInterp::evalString, FileRenderList::render, ss_from_dssp, 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, NanoShaperInterface::compute_from_file, MSMSInterface::compute_from_file, and text_cmd_mol. |
|
return the username of the currently logged-on user.
Definition at line 285 of file utilities.C. |