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

utilities.C File Reference

#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...


Function Documentation

float angle const float *    a,
const float *    b
 

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.

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.

Definition at line 159 of file utilities.C.

References NULL, and stringdup.

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.

Definition at line 63 of file utilities.C.

References NULL.

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 317 of file utilities.C.

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.

Definition at line 407 of file utilities.C.

References cross_prod, dot_prod, and vec_sub.

float distance const float *    a,
const float *    b
 

compute the distance between two points a & b.

Definition at line 426 of file utilities.C.

References distance2.

float norm const float *    vect
 

find and return the norm of a 3-vector.

Definition at line 343 of file utilities.C.

char* str_tokenize const char *    newcmd,
int *    argc,
char *    argv[]
 

Definition at line 191 of file utilities.C.

References NULL, and stringdup.

char* stringdup const char *    s
 

make a copy of a string using c++ new routine for memory alloc.

Definition at line 90 of file utilities.C.

References NULL.

char* stringtoupper char *    s
 

convert the given string to upper case.

Definition at line 104 of file utilities.C.

References NULL.

void stripslashes char *    str
 

strip trailing '/' characters from a string.

Definition at line 116 of file utilities.C.

int strupcmp const char *    a,
const char *    b
 

do case-insensitive string comparisons.

Definition at line 123 of file utilities.C.

References stringdup, and stringtoupper.

int strupncmp const char *    a,
const char *    b,
int    n
 

do case-insensitive string comparisons.

Definition at line 140 of file utilities.C.

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.

Definition at line 232 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.

int tri_degenerate const float *    v0,
const float *    v1,
const float *    v2
 

determine if a triangle is degenerate or not.

Definition at line 349 of file utilities.C.

float* vec_normalize float *    vect
 

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.

int vmd_check_stdin void   
 

check for input on stdin.

Definition at line 250 of file utilities.C.

References NULL.

Referenced by TclTextInterp::doEvent, PythonTextInterp::doEvent, and main.

int vmd_delete_file const char *    path
 

VMD file deletion function (portable).

Definition at line 474 of file utilities.C.

long vmd_get_avail_physmem_mb void   
 

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_get_avail_physmem_percent, vmdinfo_tcl, and VMDinitialize.

long vmd_get_avail_physmem_percent void   
 

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 VMDinitialize.

long vmd_get_total_physmem_mb void   
 

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.

int vmd_getuid void   
 

return the uid of the currently logged-on user.

Definition at line 306 of file utilities.C.

Referenced by Surf::compute, and MSMSInterface::compute_from_file.

void vmd_msleep int    msecs
 

Definition at line 493 of file utilities.C.

References NULL.

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.

Definition at line 512 of file utilities.C.

Referenced by Surf::compute, MSMSInterface::compute_from_file, measure_sasa, trans_overlap, and vmd_random_gaussian.

float 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.

void vmd_sleep int    secs
 

VMD process sleep functions (portable).

Definition at line 485 of file utilities.C.

void vmd_srandom unsigned int    seed
 

portable random number generation, NOT thread-safe however.

Definition at line 520 of file utilities.C.

int vmd_system const char *    cmd
 

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.

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.

Definition at line 430 of file utilities.C.

References NULL, stringdup, and stripslashes.

char* vmd_username void   
 

return the username of the currently logged-on user.

Definition at line 286 of file utilities.C.

References NULL, and stringdup.


Generated on Wed Nov 25 01:33:36 2009 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002