void IntramolecularDRMSD::setup_targets(){ plumed_massert( bounds_were_set, "I am missing a call to DRMSD::setBoundsOnDistances"); for(unsigned i=0;i<nblocks;++i){ for(unsigned iatom=blocks[i]+1;iatom<blocks[i+1];++iatom){ for(unsigned jatom=blocks[i];jatom<iatom;++jatom){ double distance = delta( getReferencePosition(iatom), getReferencePosition(jatom) ).modulo(); if(distance < upper && distance > lower ) targets[std::make_pair(iatom,jatom)] = distance; } } } }
void DRMSD::setup_targets(){ plumed_massert( bounds_were_set, "I am missing a call to DRMSD::setBoundsOnDistances"); unsigned natoms = getNumberOfReferencePositions(); for(unsigned i=0;i<natoms-1;++i){ for(unsigned j=i+1;j<natoms;++j){ double distance = delta( getReferencePosition(i), getReferencePosition(j) ).modulo(); if(distance < upper && distance > lower ){ targets[std::make_pair(i,j)] = distance; } } } if( targets.empty() ) error("drmsd will compare no distances - check upper and lower bounds are sensible"); }
double Direction::calc( const std::vector<Vector>& pos, const Pbc& pbc, const std::vector<Value*>& vals, const std::vector<double>& args, ReferenceValuePack& myder, const bool& squared ) const { plumed_assert( squared ); for(unsigned i=0;i<getNumberOfReferenceArguments();++i) myder.addArgumentDerivatives( i, -2.*getReferenceArgument(i) ); for(unsigned i=0;i<getNumberOfAtoms();++i) myder.getAtomsDisplacementVector()[i]=getReferencePosition(i); return 0.0; }
// // returns true if the given point lies within the volume of this element // bool Tetra4::encloses( const math::Vec3f &globalPosition ) { // first transform position into reference space math::Vec3f referencePosition = getReferencePosition(globalPosition); // now check wether the coordinates are in valid ranges if( (referencePosition.x >= 0.0f) && (referencePosition.x <= 1.0f)&& (referencePosition.y >= 0.0f) && (referencePosition.y <= 1.0f)&& (referencePosition.z >= 0.0f) && (referencePosition.z <= 1.0f - referencePosition.x - referencePosition.y)) return true; return false; }
// // computes the shape function for the given global-space // coordinate (must be within element boundaries!) // linear shape function // float Tetra4::computeShapeFunction( size_t node, const math::Vec3f &globalPosition ) { // first transform position into reference space math::Vec3f referencePosition = getReferencePosition(globalPosition); // depending on the index of the node (topologic relation) we evaluate // the form function which is defined from the shape of a tehadron if( node == 0 ) return 1.0f - referencePosition[0] - referencePosition[1] - referencePosition[2]; if( node == 1 ) return referencePosition[0]; if( node == 2 ) return referencePosition[1]; if( node == 3 ) return referencePosition[2]; return 0.0f; }
double OptimalRMSD::calc( const std::vector<Vector>& pos, ReferenceValuePack& myder, const bool& squared ) const { double d; if( myder.calcUsingPCAOption() ) { std::vector<Vector> centeredreference( getNumberOfAtoms () ); d=myrmsd.calc_PCAelements(pos,myder.getAtomVector(),myder.rot[0],myder.DRotDPos,myder.getAtomsDisplacementVector(),myder.centeredpos,centeredreference,squared); unsigned nat = pos.size(); for(unsigned i=0; i<nat; ++i) { myder.getAtomsDisplacementVector()[i] -= getReferencePosition(i); myder.getAtomsDisplacementVector()[i] *= getDisplace()[i]; } } else if( fast ) { if( getAlign()==getDisplace() ) d=myrmsd.optimalAlignment<false,true>(getAlign(),getDisplace(),pos,getReferencePositions(),myder.getAtomVector(),squared); else d=myrmsd.optimalAlignment<false,false>(getAlign(),getDisplace(),pos,getReferencePositions(),myder.getAtomVector(),squared); } else { if( getAlign()==getDisplace() ) d=myrmsd.optimalAlignment<true,true>(getAlign(),getDisplace(),pos,getReferencePositions(),myder.getAtomVector(),squared); else d=myrmsd.optimalAlignment<true,false>(getAlign(),getDisplace(),pos,getReferencePositions(),myder.getAtomVector(),squared); } myder.clear(); for(unsigned i=0; i<pos.size(); ++i) myder.setAtomDerivatives( i, myder.getAtomVector()[i] ); if( !myder.updateComplete() ) myder.updateDynamicLists(); return d; }
void Direction::extractAtomicDisplacement( const std::vector<Vector>& pos, const bool& anflag, std::vector<Vector>& dirout ) const { for(unsigned i=0; i<getNumberOfAtoms(); ++i) dirout[i]=getReferencePosition(i); }
void OptimalRMSD::extractAtomicDisplacement( const std::vector<Vector>& pos, std::vector<Vector>& direction ) const { std::vector<Tensor> rot(1); Matrix<std::vector<Vector> > DRotDPos( 3, 3 ); std::vector<Vector> centeredreference( getNumberOfAtoms() ), centeredpos( getNumberOfAtoms() ), avector( getNumberOfAtoms() ); double d=myrmsd.calc_PCAelements(pos,avector,rot[0],DRotDPos,direction,centeredpos,centeredreference,true); unsigned nat = pos.size(); for(unsigned i=0; i<nat; ++i) direction[i] = getDisplace()[i]*( direction[i] - getReferencePosition(i) ); }