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

Measure.C File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Measure.h"
#include "AtomSel.h"
#include "Matrix4.h"
#include "utilities.h"
#include "fitrms.h"
#include "ResizeArray.h"
#include "SpatialSearch.h"
#include "MoleculeList.h"
#include "Inform.h"
#include "Timestep.h"
#include "VMDApp.h"
#include "WKFThreads.h"
#include "WKFUtils.h"

Go to the source code of this file.

Compounds

struct  gofrparms_t

Defines

#define ROTATE(a, i, j, k, l)
#define SWAP(qq, ww)
#define NPTS   500
#define SWAP(qq, ww)

Functions

const char * measure_error (int errnum)
int measure_move (const AtomSel *sel, float *framepos, const Matrix4 &mat)
int measure_sumweights (const AtomSel *sel, int numweights, const float *weights, float *weightsum)
int measure_center (const AtomSel *sel, const float *framepos, const float *weight, float *com)
int measure_minmax (int num, const int *on, const float *framepos, const float *radii, float *min_coord, float *max_coord)
int measure_avpos (const AtomSel *sel, MoleculeList *mlist, int start, int end, int step, float *avpos)
int measure_dipole (const AtomSel *sel, MoleculeList *mlist, float *dipole, int unitsdebye, int usecenter)
int measure_rmsf (const AtomSel *sel, MoleculeList *mlist, int start, int end, int step, float *rmsf)
int measure_rgyr (const AtomSel *sel, MoleculeList *mlist, const float *weight, float *rgyr)
 measure the radius of gyration, including the given weights. More...

int measure_rmsd (const AtomSel *sel1, const AtomSel *sel2, int num, const float *framepos1, const float *framepos2, float *weight, float *rmsd)
 measure the rmsd given a selection and weight term. More...

int jacobi (float a[4][4], float d[3], float v[3][3])
int transvecinv (const double *v, Matrix4 &res)
int transvec (const double *v, Matrix4 &res)
Matrix4 myfit2 (const float *x, const float *y, const float *comx, const float *comy)
Matrix4 myfit3 (const float *x1, const float *x2, const float *y1, const float *y2, const float *comx, const float *comy)
int measure_fit (const AtomSel *sel1, const AtomSel *sel2, const float *x, const float *y, const float *weight, const int *order, Matrix4 *mat)
int measure_sasa (const AtomSel *sel, const float *framepos, const float *radius, float srad, float *sasa, ResizeArray< float > *sasapts, const AtomSel *restrictsel, const int *nsamples)
float fix_pbc_n_sqr (float delta, const float boxby2)
float min_dist_with_pbc (const float *a, const float *b, const float *boxby2)
double spherical_cap (const double &radius, const double &boxby2)
 the volume of a sperical cap. More...

void * measure_gofr_orth (void *voidparms)
int measure_gofr (AtomSel *sel1, AtomSel *sel2, MoleculeList *mlist, const int count_h, double *gofr, double *numint, double *histog, const float delta, int first, int last, int step, int *framecntr, int usepbc, int selupdate)
int measure_geom (MoleculeList *mlist, int *molid, int *atmid, ResizeArray< float > *gValues, int frame, int first, int last, int defmolid, int geomtype)
int calculate_bond (MoleculeList *mlist, int *molid, int *atmid, float *value)
int calculate_angle (MoleculeList *mlist, int *molid, int *atmid, float *value)
int calculate_dihed (MoleculeList *mlist, int *molid, int *atmid, float *value)
int normal_atom_coord (Molecule *mol, int a, float *pos)
int check_mol (Molecule *mol, int a)
int measure_energy (MoleculeList *mlist, int *molid, int *atmid, int natoms, ResizeArray< float > *gValues, int frame, int first, int last, int defmolid, double *params, int geomtype)
int compute_bond_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float k, float x0)
int compute_angle_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float k, float x0, float kub, float s0)
int compute_dihed_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float k, int n, float delta)
int compute_imprp_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float k, float x0)
int compute_vdw_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float eps1, float rmin1, float eps2, float rmin2, float cutoff, float switchdist)
int compute_elect_energy (MoleculeList *mlist, int *molid, int *atmid, float *energy, float q1, float q2, bool flag1, bool flag2, float cutoff)
void center_of_mass (AtomSel *sel, MoleculeList *mlist, float *rcom)
int measure_inertia (AtomSel *sel, MoleculeList *mlist, const float *coor, float rcom[3], float priaxes[3][3], float itensor[4][4], float evalue[3])

Variables

const char * measure_error_messages []


Define Documentation

#define NPTS   500
 

Definition at line 1066 of file Measure.C.

Referenced by measure_sasa.

#define ROTATE a,
i,
j,
k,
 
 

Value:

g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\
        a[k][l]=h+s*(g-h*tau);

Definition at line 592 of file Measure.C.

Referenced by CmdRotate::CmdRotate, and jacobi.

#define SWAP qq,
ww   
 

Value:

{                                           \
    float v; float *v1;                                         \
    v = evalue[qq]; evalue[qq] = evalue[ww]; evalue[ww] = v;    \
    v1 = a[qq]; a[qq] = a[ww]; a[ww] = v1;                      \
}

#define SWAP qq,
ww   
 

Value:

{                                           \
    float v; float *v1;                                         \
    v = evalue[qq]; evalue[qq] = evalue[ww]; evalue[ww] = v;    \
    v1 = a[qq]; a[qq] = a[ww]; a[ww] = v1;                      \
}


Function Documentation

int calculate_angle MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    value
 

Definition at line 1731 of file Measure.C.

References angle, MEASURE_NOERR, MoleculeList::mol_from_id, normal_atom_coord, and vec_sub.

int calculate_bond MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    value
 

Definition at line 1714 of file Measure.C.

References MEASURE_NOERR, MoleculeList::mol_from_id, norm, normal_atom_coord, and vec_sub.

int calculate_dihed MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    value
 

Definition at line 1751 of file Measure.C.

References dihedral, MEASURE_NOERR, MoleculeList::mol_from_id, and normal_atom_coord.

void center_of_mass AtomSel   sel,
MoleculeList   mlist,
float *    rcom
[static]
 

Definition at line 2023 of file Measure.C.

References AtomSel::coordinates, AtomSel::firstsel, AtomSel::lastsel, BaseMolecule::mass, MoleculeList::mol_from_id, AtomSel::molid, and AtomSel::on.

Referenced by measure_inertia.

int check_mol Molecule   mol,
int    a
 

Definition at line 1802 of file Measure.C.

References MEASURE_ERR_BADATOMID, MEASURE_ERR_NOMOLECULE, MEASURE_NOERR, and BaseMolecule::nAtoms.

int compute_angle_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    k,
float    x0,
float    kub,
float    s0
 

Definition at line 1905 of file Measure.C.

References calculate_angle, calculate_bond, DEGTORAD, and MEASURE_NOERR.

int compute_bond_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    k,
float    x0
 

Definition at line 1891 of file Measure.C.

References calculate_bond, and MEASURE_NOERR.

int compute_dihed_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    k,
int    n,
float    delta
 

Definition at line 1931 of file Measure.C.

References calculate_dihed, DEGTORAD, and MEASURE_NOERR.

int compute_elect_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    q1,
float    q2,
bool    flag1,
bool    flag2,
float    cutoff
 

Definition at line 1993 of file Measure.C.

References calculate_bond, BaseMolecule::charge, MEASURE_NOERR, and MoleculeList::mol_from_id.

int compute_imprp_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    k,
float    x0
 

Definition at line 1945 of file Measure.C.

References calculate_dihed, DEGTORAD, and MEASURE_NOERR.

int compute_vdw_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
float *    energy,
float    eps1,
float    rmin1,
float    eps2,
float    rmin2,
float    cutoff,
float    switchdist
 

Definition at line 1963 of file Measure.C.

References calculate_bond, and MEASURE_NOERR.

float fix_pbc_n_sqr float    delta,
const float    boxby2
[static]
 

Definition at line 1190 of file Measure.C.

Referenced by min_dist_with_pbc.

int jacobi float    a[4][4],
float    d[3],
float    v[3][3]
[static]
 

Definition at line 595 of file Measure.C.

References ROTATE.

Referenced by measure_fit, and measure_inertia.

int measure_avpos const AtomSel   sel,
MoleculeList   mlist,
int    start,
int    end,
int    step,
float *    avpos
 

Definition at line 282 of file Measure.C.

References AtomSel::firstsel, DrawMolecule::get_frame, AtomSel::lastsel, MEASURE_ERR_BADFRAMERANGE, MEASURE_ERR_NOATOMS, MEASURE_ERR_NOSEL, MEASURE_NOERR, MoleculeList::mol_from_id, AtomSel::molid, AtomSel::num_atoms, DrawMolecule::numframes, AtomSel::on, and AtomSel::selected.

int measure_center const AtomSel   sel,
const float *    framepos,
const float *    weight,
float *    com
 

Definition at line 157 of file Measure.C.

References AtomSel::firstsel, AtomSel::lastsel, MEASURE_ERR_BADWEIGHTSUM, MEASURE_ERR_NOCOM, MEASURE_ERR_NOFRAMEPOS, MEASURE_ERR_NOSEL, MEASURE_ERR_NOWEIGHT, MEASURE_NOERR, and AtomSel::on.

int measure_dipole const AtomSel   sel,
MoleculeList   mlist,
float *    dipole,
int    unitsdebye,
int    usecenter
 

Definition at line 325 of file Measure.C.

References BaseMolecule::charge, AtomSel::coordinates, AtomSel::firstsel, AtomSel::lastsel, BaseMolecule::mass, MEASURE_ERR_NOATOMS, MEASURE_ERR_NOSEL, MEASURE_NOERR, MoleculeList::mol_from_id, AtomSel::molid, AtomSel::num_atoms, AtomSel::on, and AtomSel::selected.

int measure_energy MoleculeList   mlist,
int *    molid,
int *    atmid,
int    natoms,
ResizeArray< float > *    gValues,
int    frame,
int    first,
int    last,
int    defmolid,
double *    params,
int    geomtype
 

Definition at line 1813 of file Measure.C.

References ResizeArray::append, compute_angle_energy, compute_bond_energy, compute_dihed_energy, compute_elect_energy, compute_imprp_energy, compute_vdw_energy, DrawMolecule::frame, MEASURE_ANGLE, MEASURE_BOND, MEASURE_DIHED, MEASURE_ELECT, MEASURE_ERR_NOFRAMES, MEASURE_ERR_NOMOLECULE, MEASURE_ERR_REPEATEDATOM, MEASURE_IMPRP, MEASURE_NOERR, MEASURE_VDW, MoleculeList::mol_from_id, DrawMolecule::numframes, and DrawMolecule::override_current_frame.

const char* measure_error int    errnum
 

Definition at line 65 of file Measure.C.

References measure_error_messages.

int measure_fit const AtomSel   sel1,
const AtomSel   sel2,
const float *    x,
const float *    y,
const float *    weight,
const int *    order,
Matrix4   mat
 

Definition at line 780 of file Measure.C.

References AtomSel::firstsel, jacobi, AtomSel::lastsel, Matrix4::mat, mat, MatrixFitRMS, measure_center, MEASURE_ERR_GENERAL, MEASURE_ERR_MISMATCHEDCNT, MEASURE_ERR_NONZEROJACOBI, MEASURE_ERR_NOTSUP, MEASURE_NOERR, Matrix4::multmatrix, Matrix4::multpoint3d, myfit2, myfit3, NULL, num, AtomSel::num_atoms, AtomSel::on, AtomSel::selected, Matrix4::translate, and vec_normalize.

int measure_geom MoleculeList   mlist,
int *    molid,
int *    atmid,
ResizeArray< float > *    gValues,
int    frame,
int    first,
int    last,
int    defmolid,
int    geomtype
 

Definition at line 1650 of file Measure.C.

References ResizeArray::append, calculate_angle, calculate_bond, calculate_dihed, DrawMolecule::frame, MEASURE_ANGLE, MEASURE_BOND, MEASURE_DIHED, MEASURE_ERR_NOFRAMES, MEASURE_ERR_NOMOLECULE, MEASURE_ERR_REPEATEDATOM, MEASURE_NOERR, MoleculeList::mol_from_id, DrawMolecule::numframes, and DrawMolecule::override_current_frame.

int measure_gofr AtomSel   sel1,
AtomSel   sel2,
MoleculeList   mlist,
const int    count_h,
double *    gofr,
double *    numint,
double *    histog,
const float    delta,
int    first,
int    last,
int    step,
int *    framecntr,
int    usepbc,
int    selupdate
 

Definition at line 1294 of file Measure.C.

References Timestep::a_length, Timestep::alpha, Timestep::b_length, Timestep::beta, gofrparms_t::boxby2, Timestep::c_length, AtomSel::change, gofrparms_t::count_h, gofrparms_t::count_i, gofrparms_t::count_o_end, gofrparms_t::count_o_start, gofrparms_t::curframe, gofrparms_t::delta, Timestep::gamma, DrawMolecule::get_frame, gofrparms_t::hlist, gofrparms_t::ilist, gofrparms_t::maxframe, MEASURE_ERR_BADFRAMERANGE, MEASURE_ERR_GENERAL, MEASURE_ERR_MISMATCHEDMOLS, MEASURE_ERR_NOSEL, measure_gofr_orth, MEASURE_NOERR, MoleculeList::mol_from_id, AtomSel::molid, gofrparms_t::msgtp, NULL, AtomSel::num_atoms, DrawMolecule::numframes, gofrparms_t::olist, AtomSel::on, AtomSel::PARSE_SUCCESS, Timestep::pos, AtomSel::selected, spherical_cap, gofrparms_t::threadcount, gofrparms_t::threadid, AtomSel::timestep, VMD_PI, AtomSel::which_frame, wkf_msg_timer_create, wkf_msg_timer_destroy, wkf_thread_create, wkf_thread_join, wkf_thread_numprocessors, and wkf_thread_t.

void* measure_gofr_orth void *    voidparms
 

Definition at line 1241 of file Measure.C.

References gofrparms_t::boxby2, gofrparms_t::count_h, gofrparms_t::count_i, gofrparms_t::count_o_end, gofrparms_t::count_o_start, gofrparms_t::curframe, gofrparms_t::delta, gofrparms_t::hlist, gofrparms_t::ilist, gofrparms_t::maxframe, MEASURE_NOERR, min_dist_with_pbc, gofrparms_t::msgtp, gofrparms_t::olist, and wkf_msg_timer_timeout.

Referenced by measure_gofr.

int measure_inertia AtomSel   sel,
MoleculeList   mlist,
const float *    coor,
float    rcom[3],
float    priaxes[3][3],
float    itensor[4][4],
float    evalue[3]
 

Definition at line 2064 of file Measure.C.

References center_of_mass, AtomSel::coordinates, AtomSel::firstsel, jacobi, AtomSel::lastsel, BaseMolecule::mass, MEASURE_ERR_NOATOMS, MEASURE_ERR_NONZEROJACOBI, MEASURE_ERR_NOSEL, MEASURE_NOERR, MoleculeList::mol_from_id, AtomSel::molid, AtomSel::num_atoms, and AtomSel::on.

int measure_minmax int    num,
const int *    on,
const float *    framepos,
const float *    radii,
float *    min_coord,
float *    max_coord
 

Definition at line 192 of file Measure.C.

References MEASURE_ERR_NOATOMS, MEASURE_ERR_NOMINMAXCOORDS, MEASURE_ERR_NOSEL, MEASURE_NOERR, NULL, num, and vec_zero.

int measure_move const AtomSel   sel,
float *    framepos,
const Matrix4   mat
 

Definition at line 71 of file Measure.C.

References AtomSel::firstsel, AtomSel::lastsel, Matrix4::mat, mat, MEASURE_ERR_NOFRAMEPOS, MEASURE_ERR_NOSEL, MEASURE_NOERR, Matrix4::multpoint3d, AtomSel::num_atoms, AtomSel::on, and AtomSel::selected.

int measure_rgyr const AtomSel   sel,
MoleculeList   mlist,
const float *    weight,
float *    rgyr
 

measure the radius of gyration, including the given weights.

Definition at line 476 of file Measure.C.

References AtomSel::coordinates, distance2, AtomSel::firstsel, AtomSel::lastsel, measure_center, MEASURE_ERR_BADWEIGHTSUM, MEASURE_ERR_GENERAL, MEASURE_ERR_NORGYR, MEASURE_ERR_NOSEL, MEASURE_NOERR, and AtomSel::on.

int measure_rmsd const AtomSel   sel1,
const AtomSel   sel2,
int    num,
const float *    framepos1,
const float *    framepos2,
float *    weight,
float *    rmsd
 

measure the rmsd given a selection and weight term.

Definition at line 523 of file Measure.C.

References distance2, AtomSel::firstsel, MEASURE_ERR_BADWEIGHTSUM, MEASURE_ERR_MISMATCHEDCNT, MEASURE_ERR_NOSEL, MEASURE_ERR_NOWEIGHT, MEASURE_NOERR, num, AtomSel::num_atoms, AtomSel::on, and AtomSel::selected.

int measure_rmsf const AtomSel   sel,
MoleculeList   mlist,
int    start,
int    end,
int    step,
float *    rmsf
 

Definition at line 421 of file Measure.C.

References distance2, AtomSel::firstsel, DrawMolecule::get_frame, AtomSel::lastsel, measure_avpos, MEASURE_ERR_BADFRAMERANGE, MEASURE_ERR_NOATOMS, MEASURE_ERR_NOSEL, MEASURE_NOERR, MoleculeList::mol_from_id, AtomSel::molid, AtomSel::num_atoms, DrawMolecule::numframes, AtomSel::on, and AtomSel::selected.

int measure_sasa const AtomSel   sel,
const float *    framepos,
const float *    radius,
float    srad,
float *    sasa,
ResizeArray< float > *    sasapts,
const AtomSel   restrictsel,
const int *    nsamples
 

Definition at line 1067 of file Measure.C.

References ResizeArray::append, AtomSel::firstsel, GridSearchPair::ind1, GridSearchPair::ind2, AtomSel::lastsel, MEASURE_ERR_MISMATCHEDCNT, MEASURE_ERR_NOFRAMEPOS, MEASURE_ERR_NORADII, MEASURE_ERR_NOSEL, MEASURE_NOERR, GridSearchPair::next, NPTS, NULL, ResizeArray::num, AtomSel::num_atoms, AtomSel::on, AtomSel::selected, vmd_gridsearch1, VMD_PI, VMD_RAND_MAX, vmd_random, and vmd_srandom.

int measure_sumweights const AtomSel   sel,
int    numweights,
const float *    weights,
float *    weightsum
 

Definition at line 123 of file Measure.C.

References AtomSel::firstsel, AtomSel::lastsel, MEASURE_ERR_BADWEIGHTPARM, MEASURE_ERR_GENERAL, MEASURE_ERR_NOSEL, MEASURE_ERR_NOWEIGHT, MEASURE_NOERR, AtomSel::num_atoms, AtomSel::on, and AtomSel::selected.

float min_dist_with_pbc const float *    a,
const float *    b,
const float *    boxby2
[static]
 

Definition at line 1198 of file Measure.C.

References fix_pbc_n_sqr.

Referenced by measure_gofr_orth.

Matrix4 myfit2 const float *    x,
const float *    y,
const float *    comx,
const float *    comy
[static]
 

Definition at line 723 of file Measure.C.

References Matrix4::translate, transvec, and transvecinv.

Referenced by measure_fit.

Matrix4 myfit3 const float *    x1,
const float *    x2,
const float *    y1,
const float *    y2,
const float *    comx,
const float *    comy
[static]
 

Definition at line 742 of file Measure.C.

References Matrix4::inverse, Matrix4::multmatrix, Matrix4::multpoint3d, RADTODEG, Matrix4::rot, Matrix4::translate, and transvecinv.

Referenced by measure_fit.

int normal_atom_coord Molecule   mol,
int    a,
float *    pos
 

Definition at line 1773 of file Measure.C.

References check_mol, DrawMolecule::current, Timestep::get_transform_from_cell, mat, MEASURE_ERR_NOFRAMES, MEASURE_NOERR, Matrix4::multpoint3d, and Timestep::pos.

double spherical_cap const double &    radius,
const double &    boxby2
[inline, static]
 

the volume of a sperical cap.

the volume of a spherical cap is defined as:

 pi / 9 * h^2 * (3 * r  - h) 
with h = height of cap = radius - boxby2.

Definition at line 1211 of file Measure.C.

References VMD_PI.

int transvec const double *    v,
Matrix4   res
[static]
 

Definition at line 700 of file Measure.C.

References length, RADTODEG, and Matrix4::rot.

Referenced by myfit2.

int transvecinv const double *    v,
Matrix4   res
[static]
 

Definition at line 677 of file Measure.C.

References length, RADTODEG, and Matrix4::rot.

Referenced by myfit2, and myfit3.


Variable Documentation

const char* measure_error_messages[] [static]
 

Initial value:

 {
  "no atom selection",                                  
  "no atoms in selection",                              
  "incorrect number of weights for selection",          
  "internal error: NULL pointer given",                 
  "bad weight sum, would cause divide by zero",         
  "molecule was deleted(?)",                            
  "cannot understand weight parameter",                 
  "non-number given as parameter",                      
  "two selections don't have the same number of atoms", 
  "internal error: out of range",                       
  "no coordinates in selection",                        
  "couldn't compute eigenvalue/vectors",                
  "unknown Tcl problem",                                
  "no atom radii",                                      
  "order parameter contains out-of-range atom index",   
  "order parameter not supported in old RMS fit mode",  
  "specified frames are out of range",                  
  "both selections must reference the same molecule",   
  "one atom appears twice in list",                     
  "molecule contains no frames",                        
  "invalid atom id",                                    
  "cutoff must be smaller than cell dimension",         
  "Zero volmap gridsize"                                
}

Definition at line 39 of file Measure.C.

Referenced by measure_error.


Generated on Sat May 26 01:48:46 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002