Vector Class Reference

#include <Vector.h>

Inheritance diagram for Vector:
AlignVector zVector

List of all members.

Public Member Functions

 Vector (void)
 Vector (BigReal newx, BigReal newy, BigReal newz)
 Vector (BigReal newv)
 Vector (const FloatVector &v)
BigRealoperator[] (int i)
Vectoroperator= (const BigReal &v2)
void operator+= (const Vector &v2)
void operator-= (const Vector &v2)
void operator*= (const BigReal &v2)
void operator/= (const BigReal &v2)
BigReal length (void) const
BigReal length2 (void) const
BigReal rlength (void)
Vector unit (void) const
void cross (const Vector &v2)
BigReal dot (const Vector &v2)
Bool set (const char *s)

Public Attributes

BigReal x
BigReal y
BigReal z

Friends

int operator== (const Vector &v1, const Vector &v2)
int operator!= (const Vector &v1, const Vector &v2)
Vector operator+ (const Vector &v1, const Vector &v2)
Vector operator- (const Vector &v1)
Vector operator- (const Vector &v1, const Vector &v2)
BigReal operator* (const Vector &v1, const Vector &v2)
Vector operator* (const BigReal &f, const Vector &v1)
Vector operator* (const Vector &v1, const BigReal &f)
Vector operator/ (const Vector &v1, const BigReal &f)
Vector cross (const Vector &v1, const Vector &v2)
Vector cross (const Real &k, const Vector &v1, const Vector &v2)
Vector cross (const BigReal &k, const Vector &v1, const Vector &v2)

Detailed Description

Definition at line 64 of file Vector.h.


Constructor & Destructor Documentation

Vector::Vector ( void   )  [inline]

Definition at line 69 of file Vector.h.

Referenced by unit().

00069 : x(-99999), y(-99999), z(-99999) { ; }

Vector::Vector ( BigReal  newx,
BigReal  newy,
BigReal  newz 
) [inline]

Definition at line 74 of file Vector.h.

00075        : x(newx), y(newy), z(newz) { ; }

Vector::Vector ( BigReal  newv  )  [inline]

Definition at line 77 of file Vector.h.

00078        : x(newv), y(newv), z(newv) { ; }

Vector::Vector ( const FloatVector v  )  [inline]

Definition at line 80 of file Vector.h.

00080 : x(v.x), y(v.y), z(v.z) { ; }


Member Function Documentation

void Vector::cross ( const Vector v2  )  [inline]

Definition at line 212 of file Vector.h.

References x, xx, y, yy, and z.

00212                                   {
00213        BigReal xx =  y*v2.z-v2.y*z;
00214        // BigReal yy = -x*v2.z+v2.x*z;
00215        BigReal yy = v2.x*z-x*v2.z;
00216        z =  x*v2.y-v2.x*y;
00217        y=yy;
00218        x=xx;
00219      }

BigReal Vector::dot ( const Vector v2  )  [inline]

Definition at line 222 of file Vector.h.

References x, y, and z.

Referenced by ComputeStir::doForce().

00222                                    {
00223        return x*v2.x + y*v2.y + z*v2.z;
00224      }

BigReal Vector::length ( void   )  const [inline]
BigReal Vector::length2 ( void   )  const [inline]
void Vector::operator*= ( const BigReal v2  )  [inline]

Definition at line 113 of file Vector.h.

References x, y, and z.

00113                                                {
00114        x *= v2;
00115        y *= v2;
00116        z *= v2;
00117      }

void Vector::operator+= ( const Vector v2  )  [inline]

Definition at line 99 of file Vector.h.

References x, y, and z.

00099                                               {
00100        x += v2.x;
00101        y += v2.y;
00102        z += v2.z;
00103      }

void Vector::operator-= ( const Vector v2  )  [inline]

Definition at line 106 of file Vector.h.

References x, y, and z.

00106                                               {
00107        x -= v2.x;
00108        y -= v2.y;
00109        z -= v2.z;
00110      }

void Vector::operator/= ( const BigReal v2  )  [inline]

Definition at line 120 of file Vector.h.

References namd_reciprocal, x, y, and z.

00120                                                {
00121        BigReal v2_recip = namd_reciprocal(v2);
00122        x *= v2_recip;
00123        y *= v2_recip;
00124        z *= v2_recip;
00125      }

Vector& Vector::operator= ( const BigReal v2  )  [inline]

Definition at line 91 of file Vector.h.

References x, y, and z.

00091                                                  {
00092        x = v2;
00093        y = v2;
00094        z = v2;
00095        return *this;
00096      }

BigReal& Vector::operator[] ( int  i  )  [inline]

Definition at line 82 of file Vector.h.

References NAMD_die(), x, y, and z.

00082                                        {
00083        return i==0 ? x
00084              :i==1 ? y
00085              :i==2 ? z
00086              :(NAMD_die("Vector reference out of bounds."), x);
00087 
00088      }

BigReal Vector::rlength ( void   )  [inline]

Definition at line 177 of file Vector.h.

References namd_rsqrt, x, y, and z.

Referenced by TholeElem::computeForce(), DihedralElem::computeForce(), AnisoElem::computeForce(), AngleElem::computeForce(), and rescale_nonperiodic_cell().

00177                                    {
00178        return namd_rsqrt (x*x + y*y + z*z);
00179      }

Bool Vector::set ( const char *  s  )  [inline]

Definition at line 228 of file Vector.h.

References FALSE, TRUE, x, y, and z.

Referenced by colvarproxy_namd::calculate(), and ParseOptions::get().

00228                              {
00229         double a[3];    // read into doubles, since I don't know what
00230         char tmp[100];  // a "BigReal" is in real life
00231         // cheap way to get commas, etc.  a poor regex
00232        int i=sscanf(s, "%lf%99[ \t,]%lf%99[ \t,]%lf%99s",
00233                     a, tmp, a+1, tmp, a+2, tmp);
00234        if (i != 5) return FALSE;
00235        const char *t = s;       // now count commas (for "1,,,,2,  , 3")
00236        int flg = 0;                 // and check for "1 2,,3"
00237        i = 0;
00238        for (;*t;t++) {
00239           if (*t == ',') { 
00240              if (flg == 0) {   // expecting non-whitespace
00241                 return FALSE;  //    so error
00242              }
00243              flg = 0;          // now expect non-whitespace
00244              i++;              // and increment comma counter
00245           }
00246           else if (*t != ' ' && *t != '\t') {  // got non-whitespace
00247              flg = 1;          // so the next can be whitespace or commas
00248           }
00249        }
00250        if (i == 0 || i == 2) {  // allow "1 2 3" or "1, 2,3" forms
00251           x = a[0]; y = a[1]; z = a[2];
00252           return TRUE;
00253        }
00254        return FALSE;
00255      }

Vector Vector::unit ( void   )  const [inline]

Friends And Related Function Documentation

Vector cross ( const BigReal k,
const Vector v1,
const Vector v2 
) [friend]

Definition at line 204 of file Vector.h.

00204                                                                                       {
00205        return Vector( k*(v1.y*v2.z-v2.y*v1.z),
00206                       // k*(-v1.x*v2.z+v2.x*v1.z),
00207                       k*(v2.x*v1.z-v1.x*v2.z),
00208                       k*(v1.x*v2.y-v2.x*v1.y) );
00209      }

Vector cross ( const Real k,
const Vector v1,
const Vector v2 
) [friend]

Definition at line 197 of file Vector.h.

00197                                                                                    {
00198        return Vector( k*(v1.y*v2.z-v2.y*v1.z),
00199                       // k*(-v1.x*v2.z+v2.x*v1.z),
00200                       k*(v2.x*v1.z-v1.x*v2.z),
00201                       k*(v1.x*v2.y-v2.x*v1.y) );
00202      }

Vector cross ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 188 of file Vector.h.

00188                                                                     {
00189        return Vector( v1.y*v2.z-v2.y*v1.z,
00190                      // -v1.x*v2.z+v2.x*v1.z,
00191                       v2.x*v1.z-v1.x*v2.z,
00192                       v1.x*v2.y-v2.x*v1.y  );
00193      }

int operator!= ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 130 of file Vector.h.

00130                                                                         {
00131        // return !(v1.x == v2.x && v1.y == v2.y && v1.z == v2.z);
00132        return v1.x != v2.x || v1.y != v2.y || v1.z != v2.z;
00133      }

Vector operator* ( const Vector v1,
const BigReal f 
) [friend]

Definition at line 158 of file Vector.h.

00158                                                                         {
00159        return Vector(f*v1.x, f*v1.y, f*v1.z);
00160      }

Vector operator* ( const BigReal f,
const Vector v1 
) [friend]

Definition at line 154 of file Vector.h.

00154                                                                         {
00155        return Vector(f*v1.x, f*v1.y, f*v1.z);
00156      }

BigReal operator* ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 150 of file Vector.h.

00150                                                                          {
00151        return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
00152      }

Vector operator+ ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 136 of file Vector.h.

00136                                                                         {
00137        return Vector( v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
00138      }

Vector operator- ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 146 of file Vector.h.

00146                                                                         {
00147        return Vector( v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
00148      }

Vector operator- ( const Vector v1  )  [friend]

Definition at line 141 of file Vector.h.

00141                                                       {
00142        return Vector( -v1.x, -v1.y, -v1.z);
00143      }

Vector operator/ ( const Vector v1,
const BigReal f 
) [friend]

Definition at line 162 of file Vector.h.

00162                                                                         {
00163 //       if (!f)
00164 //         NAMD_die("Division by 0 on a vector operation.");
00165        return Vector(v1.x/f, v1.y/f, v1.z/f);
00166      }

int operator== ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 127 of file Vector.h.

00127                                                                         {
00128        return v1.x == v2.x && v1.y == v2.y && v1.z == v2.z;
00129      }


Member Data Documentation

Definition at line 66 of file Vector.h.

Referenced by msm::PatchData::anterpolation(), msm::PatchData::anterpolationC1Hermite(), PatchMap::assignToPatch(), ComputeNonbondedUtil::calcGBIS(), ComputeQMMgr::calcMOPAC(), ComputeQMMgr::calcORCA(), GlobalMasterTest::calculate(), colvarproxy_namd::calculate(), ComputeQMMgr::calcUSR(), GridforceFullSubGrid::compute_b(), GridforceFullBaseGrid::compute_d2V(), GridforceFullBaseGrid::compute_dV(), PmeRealSpace::compute_forces_order4_partial(), GridforceLiteGrid::compute_VdV(), GridforceFullBaseGrid::compute_VdV(), GridforceLiteGrid::compute_wts(), ExclElem::computeForce(), ImproperElem::computeForce(), GromacsPairElem::computeForce(), DihedralElem::computeForce(), CrosstermElem::computeForce(), BondElem::computeForce(), AnisoElem::computeForce(), AngleElem::computeForce(), Controller::correctMomentum(), cross(), Lattice::delta(), ProxyPatch::depositCombinedResultMsg(), ProxyPatch::depositCombinedResultRawMsg(), Tensor::diagonal(), ComputeGridForce::do_calc(), HomePatch::doAtomMigration(), ComputeStir::doForce(), ComputeSphericalBC::doForce(), ComputeRestraints::doForce(), ComputeLCPO::doForce(), ComputeGridForce::doForce(), ComputeCylindricalBC::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doMarginCheck(), HomePatch::doPairlistCheck(), dot(), ComputePme::doWork(), ComputeNonbondedCUDA::doWork(), ComputeFullDirect::doWork(), ComputeEwald::doWork(), dump_param(), dumpbench(), PmeAtomFiler::fileAtoms(), PDB::find_extremes(), ComputeNonbondedCUDA::finishWork(), Patch::forceBoxClosed(), ProxyCombinedResultMsg::fromRaw(), ComputeMsmMgr::gc_c1hermite_elem_accum(), get_3D_vector(), PDB::get_all_positions(), get_lattice_from_ts(), PDB::get_position_for_atom(), GlobalMasterIMD::get_vmd_forces(), ProxyResultVarsizeMsg::getANewMsg(), HomePatch::hardWallDrude(), GridforceFullSubGrid::initialize(), ComputeMsmMgr::initialize(), msm::PatchData::interpolation(), msm::PatchData::interpolationC1Hermite(), Sequencer::langevinPiston(), length(), length2(), PatchMap::makePatches(), mat_multiply_vec(), HomePatch::minimize_rattle2(), Lattice::nearest(), obj_3D_vector(), sortop_x::operator()(), cr_sortop_distance::operator()(), operator*=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), operator[](), Lattice::orthogonal(), outer(), Tensor::outerAdd(), pairlist_from_pairlist(), pairlistFromAll(), ParallelIOMgr::ParallelIOMgr(), partition(), WorkDistrib::patchMapInit(), colvarproxy_namd::position_distance(), Patch::positionsReady(), HomePatch::positionsReady(), PRINT_VECTOR(), Controller::printEnergies(), proc_dihedralgrad(), ComputeQMMgr::procQMRes(), HomePatch::rattle1(), HomePatch::rattle1old(), HomePatch::rattle2(), SimParameters::readExtendedSystem(), GridforceFullBaseGrid::readHeader(), HomePatch::receiveResults(), ComputeMsmSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeNonbondedCUDA::recvYieldDevice(), register_cuda_compute_pair(), CudaComputeNonbonded::registerComputePair(), rescale_nonperiodic_cell(), rlength(), ComputeMsmSerial::saveResults(), ComputeFmmSerial::saveResults(), scale_coordinates(), scale_forces(), set(), PDB::set_all_positions(), SetEqual(), settle1(), settle1_SIMD(), PatchMap::sizeGrid(), CudaPmeKSpaceCompute::solve(), Sequencer::submitHalfstep(), Sequencer::submitReductions(), Tensor::symmetric(), Tcl_centerOfMass(), Tcl_centerOfNumber(), ProxyCombinedResultMsg::toRaw(), Tensor::triangular(), ComputePme::ungridForces(), unit(), ProxyResultMsg::unpack(), Lattice::unscale(), Node::updateGridScale(), vec_rotation_matrix(), and Controller::writeExtendedSystemData().

Definition at line 66 of file Vector.h.

Referenced by msm::PatchData::anterpolation(), msm::PatchData::anterpolationC1Hermite(), PatchMap::assignToPatch(), ComputeNonbondedUtil::calcGBIS(), ComputeQMMgr::calcMOPAC(), ComputeQMMgr::calcORCA(), GlobalMasterTest::calculate(), colvarproxy_namd::calculate(), ComputeQMMgr::calcUSR(), GridforceFullSubGrid::compute_b(), GridforceFullBaseGrid::compute_d2V(), GridforceFullBaseGrid::compute_dV(), PmeRealSpace::compute_forces_order4_partial(), GridforceLiteGrid::compute_VdV(), GridforceFullBaseGrid::compute_VdV(), GridforceLiteGrid::compute_wts(), ExclElem::computeForce(), ImproperElem::computeForce(), GromacsPairElem::computeForce(), DihedralElem::computeForce(), CrosstermElem::computeForce(), BondElem::computeForce(), AnisoElem::computeForce(), AngleElem::computeForce(), Controller::correctMomentum(), cross(), Lattice::delta(), ProxyPatch::depositCombinedResultMsg(), ProxyPatch::depositCombinedResultRawMsg(), Tensor::diagonal(), ComputeGridForce::do_calc(), HomePatch::doAtomMigration(), ComputeStir::doForce(), ComputeSphericalBC::doForce(), ComputeLCPO::doForce(), ComputeGridForce::doForce(), ComputeCylindricalBC::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doMarginCheck(), HomePatch::doPairlistCheck(), dot(), ComputePme::doWork(), ComputeNonbondedCUDA::doWork(), ComputeFullDirect::doWork(), ComputeEwald::doWork(), dump_param(), dumpbench(), PmeAtomFiler::fileAtoms(), PDB::find_extremes(), ComputeNonbondedCUDA::finishWork(), Patch::forceBoxClosed(), ProxyCombinedResultMsg::fromRaw(), ComputeMsmMgr::gc_c1hermite_elem_accum(), get_3D_vector(), PDB::get_all_positions(), get_lattice_from_ts(), PDB::get_position_for_atom(), GlobalMasterIMD::get_vmd_forces(), ProxyResultVarsizeMsg::getANewMsg(), HomePatch::hardWallDrude(), GridforceFullSubGrid::initialize(), ComputeMsmMgr::initialize(), msm::PatchData::interpolation(), msm::PatchData::interpolationC1Hermite(), Sequencer::langevinPiston(), length(), length2(), PatchMap::makePatches(), mat_multiply_vec(), HomePatch::minimize_rattle2(), Lattice::nearest(), obj_3D_vector(), sortop_y::operator()(), cr_sortop_distance::operator()(), operator*=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), operator[](), Lattice::orthogonal(), outer(), Tensor::outerAdd(), pairlist_from_pairlist(), pairlistFromAll(), ParallelIOMgr::ParallelIOMgr(), partition(), WorkDistrib::patchMapInit(), colvarproxy_namd::position_distance(), Patch::positionsReady(), HomePatch::positionsReady(), PRINT_VECTOR(), Controller::printEnergies(), proc_dihedralgrad(), ComputeQMMgr::procQMRes(), Sequencer::rattle1(), HomePatch::rattle1(), HomePatch::rattle1old(), HomePatch::rattle2(), SimParameters::readExtendedSystem(), GridforceFullBaseGrid::readHeader(), HomePatch::receiveResults(), ComputeMsmSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeNonbondedCUDA::recvYieldDevice(), register_cuda_compute_pair(), CudaComputeNonbonded::registerComputePair(), rescale_nonperiodic_cell(), rlength(), ComputeMsmSerial::saveResults(), ComputeFmmSerial::saveResults(), scale_coordinates(), scale_forces(), set(), PDB::set_all_positions(), SetEqual(), settle1(), settle1_SIMD(), PatchMap::sizeGrid(), CudaPmeKSpaceCompute::solve(), Sequencer::submitHalfstep(), Sequencer::submitReductions(), Tensor::symmetric(), Tcl_centerOfMass(), Tcl_centerOfNumber(), ProxyCombinedResultMsg::toRaw(), Tensor::triangular(), ComputePme::ungridForces(), unit(), ProxyResultMsg::unpack(), Lattice::unscale(), Node::updateGridScale(), vec_rotation_matrix(), and Controller::writeExtendedSystemData().

Definition at line 66 of file Vector.h.

Referenced by msm::PatchData::anterpolation(), msm::PatchData::anterpolationC1Hermite(), PatchMap::assignToPatch(), ComputeNonbondedUtil::calcGBIS(), ComputeQMMgr::calcMOPAC(), ComputeQMMgr::calcORCA(), GlobalMasterTest::calculate(), colvarproxy_namd::calculate(), ComputeQMMgr::calcUSR(), GridforceFullSubGrid::compute_b(), GridforceFullBaseGrid::compute_d2V(), GridforceFullBaseGrid::compute_dV(), PmeRealSpace::compute_forces_order4_partial(), GridforceLiteGrid::compute_VdV(), GridforceFullBaseGrid::compute_VdV(), GridforceLiteGrid::compute_wts(), TholeElem::computeForce(), ExclElem::computeForce(), ImproperElem::computeForce(), GromacsPairElem::computeForce(), DihedralElem::computeForce(), CrosstermElem::computeForce(), BondElem::computeForce(), AnisoElem::computeForce(), AngleElem::computeForce(), Controller::correctMomentum(), cross(), Lattice::delta(), ProxyPatch::depositCombinedResultMsg(), ProxyPatch::depositCombinedResultRawMsg(), Tensor::diagonal(), ComputeGridForce::do_calc(), HomePatch::doAtomMigration(), ComputeStir::doForce(), ComputeSphericalBC::doForce(), ComputeNonbondedSelf::doForce(), ComputeNonbondedPair::doForce(), ComputeLCPO::doForce(), ComputeGridForce::doForce(), ComputeCylindricalBC::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doMarginCheck(), HomePatch::doPairlistCheck(), dot(), ComputePme::doWork(), ComputeNonbondedCUDA::doWork(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::doWork(), ComputeFullDirect::doWork(), ComputeEwald::doWork(), dump_param(), dumpbench(), PmeAtomFiler::fileAtoms(), PDB::find_extremes(), ComputeNonbondedCUDA::finishWork(), Patch::forceBoxClosed(), ProxyCombinedResultMsg::fromRaw(), ComputeMsmMgr::gc_c1hermite_elem_accum(), get_3D_vector(), PDB::get_all_positions(), get_lattice_from_ts(), PDB::get_position_for_atom(), GlobalMasterIMD::get_vmd_forces(), ProxyResultVarsizeMsg::getANewMsg(), HomePatch::hardWallDrude(), GridforceFullSubGrid::initialize(), ComputeMsmMgr::initialize(), msm::PatchData::interpolation(), msm::PatchData::interpolationC1Hermite(), Sequencer::langevinPiston(), Controller::langevinPiston1(), Controller::langevinPiston2(), length(), length2(), PatchMap::makePatches(), mat_multiply_vec(), HomePatch::minimize_rattle2(), Lattice::nearest(), obj_3D_vector(), sortop_z::operator()(), cr_sortop_distance::operator()(), operator*=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), operator[](), Lattice::orthogonal(), outer(), Tensor::outerAdd(), pairlist_from_pairlist(), pairlistFromAll(), ParallelIOMgr::ParallelIOMgr(), partition(), WorkDistrib::patchMapInit(), colvarproxy_namd::position_distance(), Patch::positionsReady(), HomePatch::positionsReady(), PRINT_VECTOR(), Controller::printEnergies(), proc_dihedralgrad(), ComputeQMMgr::procQMRes(), Sequencer::rattle1(), HomePatch::rattle1(), HomePatch::rattle1old(), HomePatch::rattle2(), SimParameters::readExtendedSystem(), GridforceFullBaseGrid::readHeader(), HomePatch::receiveResults(), ComputeMsmSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeNonbondedCUDA::recvYieldDevice(), register_cuda_compute_pair(), CudaComputeNonbonded::registerComputePair(), rescale_nonperiodic_cell(), rlength(), ComputeMsmSerial::saveResults(), ComputeFmmSerial::saveResults(), scale_coordinates(), scale_forces(), set(), PDB::set_all_positions(), SetEqual(), settle1(), settle1_SIMD(), PatchMap::sizeGrid(), CudaPmeKSpaceCompute::solve(), Sequencer::submitHalfstep(), Sequencer::submitReductions(), Tensor::symmetric(), Tcl_centerOfMass(), Tcl_centerOfNumber(), ProxyCombinedResultMsg::toRaw(), Tensor::triangular(), ComputePme::ungridForces(), unit(), ProxyResultMsg::unpack(), Lattice::unscale(), Node::updateGridScale(), vec_rotation_matrix(), and Controller::writeExtendedSystemData().


The documentation for this class was generated from the following file:

Generated on 21 Sep 2020 for NAMD by  doxygen 1.6.1