/* []----------------------------------------[] | Harmonic.h | []----------------------------------------[] | | | AUTHOR: MFSomers 2005. | | USE: Defines a harmonic type | | interaction... | | | []----------------------------------------[] */ // 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(__HARMONIC_INCLUDED__) #define __HARMONIC_INCLUDED__ #include "Global.h" #include "Vector.h" #include "Constants.h" #include "ClassicalDynamics.h" #include "PointPair.h" #include "Bending.h" #include "Torsional.h" /* --------------------------------------------------------- */ /* Defines a harmonic pointpair interaction between particles */ class HarmonicInteraction; typedef HarmonicInteraction *HarmonicInteractionPointer; class HarmonicInteraction : public PointPairInteraction { public: inline HarmonicInteraction( double TheFactor, double TheR, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) : PointPairInteraction( TheId, UsePeriodicBox ) { InteractionFactor = TheFactor; R = TheR; Type = AHarmonicInteraction; }; inline HarmonicInteraction( HarmonicInteraction& I ) : PointPairInteraction( I ) { InteractionFactor = I.InteractionFactor; R = I.R; } virtual HarmonicInteraction& operator=( HarmonicInteraction& I ) { if( &I == &(*this) ) return( (*this) ); PointPairInteraction::operator=( I ); InteractionFactor = I.InteractionFactor; R = I.R; return( (*this) ); } virtual HarmonicInteractionPointer Clone() { return( new HarmonicInteraction( (*this) ) ); } virtual HarmonicInteractionPointer Create( double TheFactor = 1.0, double TheR = 1.0, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) { return( new HarmonicInteraction( TheFactor, TheR, TheId ) ); } virtual double PointPairPotential( Particle& P1, Particle& P2 ); virtual Vector PointPairForce( Particle& P1, Particle& P2 ); double InteractionFactor, R; /* V(r) = 0.5 * TheFactor * (r-R)^2 */ }; /* --------------------------------------------------------- */ #endif