#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include "utilities.h"
Go to the source code of this file.
Functions | |
char * | combine_arguments (int argc, const char **argv, int n) |
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 *s) |
make a copy of a string using c++ new routine for memory alloc. More... | |
char * | stringtoupper (char *s) |
convert the given string to upper case. More... | |
void | stripslashes (char *str) |
strip trailing '/' characters from a string. More... | |
int | strupcmp (const char *a, const char *b) |
do case-insensitive string comparisons. More... | |
int | strupncmp (const char *a, const char *b, int n) |
do case-insensitive string comparisons. More... | |
void | breakup_filename (const char *full, char **path, char **name) |
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 *newcmd, int *argc, char *argv[]) |
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... | |
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 * | vec_normalize (float *vect) |
normalizes the 3-vector to length one and returns the pointer note that this changes the vector. More... | |
float | norm (const float *vect) |
find and return the norm of a 3-vector. More... | |
int | tri_degenerate (const float *v0, const float *v1, const float *v2) |
determine if a triangle is degenerate or not. More... | |
float | angle (const float *a, const float *b) |
compute the angle between two vectors a & b (0 to 180 deg). More... | |
float | dihedral (const float *a1, const float *a2, const float *a3, const float *a4) |
Compute the dihedral angle for the given atoms, returning a value between -180 and 180. More... | |
float | distance (const float *a, const float *b) |
compute the distance between two points a & b. More... | |
char * | vmd_tempfile (const char *s) |
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 *path) |
VMD file deletion function (portable). More... | |
void | vmd_sleep (int secs) |
VMD process sleep functions (portable). More... | |
void | vmd_msleep (int msecs) |
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... | |
long | vmd_random (void) |
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... | |
void | vmd_srandom (unsigned int seed) |
portable random number generation, NOT thread-safe however. 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... | |
float | correction (int nrays) |
void | print_xyz (float *population, int nrays) |
float | arcdistance (float lambda1, float lambda2, float phi1, float phi2) |
int | k_candidates (int k, int nrays, int idx, int testpt, float minD, float *candidates, float *population) |
int | poisson_sample_on_sphere (float *population, int N, int k, int verbose) |
|
compute the angle between two vectors a & b (0 to 180 deg).
Definition at line 395 of file utilities.C. References cross_prod, and dot_prod. |
|
Definition at line 719 of file utilities.C. |
|
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. |
|
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. |
|
Definition at line 693 of file utilities.C. References VMD_PIF. |
|
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. |
|
Compute the dihedral angle for the given atoms, returning a value between -180 and 180.
Definition at line 407 of file utilities.C. References cross_prod, dot_prod, and vec_sub. |
|
compute the distance between two points a & b.
Definition at line 426 of file utilities.C. References distance2. |
|
Definition at line 735 of file utilities.C. References arcdistance, VMD_PIF, VMD_RAND_MAX, vmd_random, and VMD_TWOPIF. |
|
find and return the norm of a 3-vector.
Definition at line 343 of file utilities.C. |
|
Definition at line 785 of file utilities.C. References correction, k_candidates, NULL, result, VMD_PI, VMD_RAND_MAX, vmd_random, vmd_srandom, and VMD_TWOPI. |
|
Definition at line 704 of file utilities.C. References z. |
|
Definition at line 190 of file utilities.C. |
|
make a copy of a string using c++ new routine for memory alloc.
Definition at line 90 of file utilities.C. References NULL. |
|
convert the given string to upper case.
Definition at line 104 of file utilities.C. References NULL. |
|
strip trailing '/' characters from a string.
Definition at line 115 of file utilities.C. |
|
do case-insensitive string comparisons.
Definition at line 122 of file utilities.C. References stringdup, and stringtoupper. |
|
do case-insensitive string comparisons.
Definition at line 139 of file utilities.C. References n. |
|
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. Referenced by Animation::Animation, Animation::check_event, TclTextInterp::done_waiting, AtomColor::find, FPS::FPS, VMDTitle::prepare, FPS::prepare, VMDTitle::VMDTitle, and TclTextInterp::wait. |
|
determine if a triangle is degenerate or not.
Definition at line 349 of file utilities.C. |
|
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. |
|
check for input on stdin.
Definition at line 249 of file utilities.C. References NULL. Referenced by TclTextInterp::doEvent, PythonTextInterp::doEvent, and main. |
|
VMD file deletion function (portable).
Definition at line 474 of file utilities.C. |
|
return the number of MB of physical memory "free" (no VM/swap counted...).
Definition at line 609 of file utilities.C. References NULL. Referenced by vmd_gaussdensity_threaded, vmd_get_avail_physmem_percent, vmdinfo_tcl, VMDApp::VMDinit, volin_threaded, and volin_threaded_prob. |
|
return the percentage of physical memory available.
Definition at line 681 of file utilities.C. References vmd_get_avail_physmem_mb, and vmd_get_total_physmem_mb. Referenced by VMDApp::VMDinit. |
|
return the number of MB of physical memory installed in the system.
Definition at line 554 of file utilities.C. References NULL. Referenced by vmd_get_avail_physmem_percent. |
|
return the uid of the currently logged-on user.
Definition at line 305 of file utilities.C. Referenced by Surf::compute, NanoShaperInterface::compute_from_file, and MSMSInterface::compute_from_file. |
|
Definition at line 493 of file utilities.C. References NULL. |
|
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. Referenced by Surf::compute, NanoShaperInterface::compute_from_file, MSMSInterface::compute_from_file, k_candidates, measure_sasa, measure_sasa_perresidue, measure_sasalist, poisson_sample_on_sphere, vmd_measure_volinterior, and vmd_random_gaussian. |
|
Slow but accurate standard distribution random number generator (variance = 1).
Definition at line 530 of file utilities.C. References VMD_RAND_MAX, and vmd_random. Referenced by colvarproxy_vmd::rand_gaussian. |
|
VMD process sleep functions (portable).
Definition at line 485 of file utilities.C. |
|
portable random number generation, NOT thread-safe however.
Definition at line 520 of file utilities.C. |
|
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. |
|
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. References NULL, stringdup, and stripslashes. |
|
return the username of the currently logged-on user.
Definition at line 285 of file utilities.C. |