/* []----------------------------------------[] | DistanceConstraint.h | []----------------------------------------[] | | | AUTHOR: MFSomers 2005. | | USE: Distance constraint | | definitions... | | | []----------------------------------------[] */ // Copyright (C) 2005 M.F. Somers, Theoretical Chemistry Department, Leiden University // // This is free software; you can redistribute it and/or modify it under the terms of // the GNU Lesser General Public License as published by the Free Software Foundation. // // http://www.gnu.org/licenses/lgpl.txt #if !defined(__DISTANCECONSTRAINT_INCLUDED__) #define __DISTANCECONSTRAINT_INCLUDED__ #include #include "Global.h" #include "Vector.h" #include "Constants.h" #include "ClassicalDynamics.h" /* ----------------------------------------------------------------------- */ /* Definition of a distance constraint */ class DistanceConstraint; typedef DistanceConstraint *DistanceConstraintPointer; class DistanceConstraint : public Constraint { public: inline DistanceConstraint( double TheDistance = -1.0, double TheTolerance = CONST_EPSILON, int TheMaxItterations = 1000, unsigned int TheId = GET_NEW_ID ) : Constraint( TheId ) { Distance = ( TheDistance >= CONST_EPSILON ? TheDistance : -1.0 ); Tolerance = ( TheTolerance >= CONST_EPSILON ? TheTolerance : CONST_EPSILON ); MaxItterations = ( TheMaxItterations > 0 ? TheMaxItterations : 1000 ); Type = AGeneralDistanceConstraint; }; inline DistanceConstraint( DistanceConstraint& C ) : Constraint( C ) { Distance = C.Distance; Tolerance = C.Tolerance; MaxItterations = C.MaxItterations; } virtual DistanceConstraint& operator=( DistanceConstraint& C ) { if( &C == &(*this) ) return( (*this) ); Constraint::operator=( C ); Distance = C.Distance; Tolerance = C.Tolerance; MaxItterations = C.MaxItterations; return( (*this) ); } double Distance, Tolerance; int MaxItterations; }; /* ----------------------------------------------------------------------- */ #endif