/* []----------------------------------------[] | LennardJones.h | []----------------------------------------[] | | | AUTHOR: MFSomers 2005. | | USE: Defines a Lennard-Jones | | 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(__LENNARDJONES_INCLUDED__) #define __LENNARDJONES_INCLUDED__ #include "Global.h" #include "Vector.h" #include "Constants.h" #include "ClassicalDynamics.h" #include "PointPair.h" /* --------------------------------------------------------- */ /* Defines a LennardJones pointpair interaction between particles */ class LennardJonesInteraction; typedef LennardJonesInteraction *LennardJonesInteractionPointer; class LennardJonesInteraction : public PointPairInteraction { public: inline LennardJonesInteraction( double TheEpsilon, double TheR, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) : PointPairInteraction( TheId, UsePeriodicBox ) { Epsilon = TheEpsilon; R = TheR; Type = ALennardJonesInteraction; } inline LennardJonesInteraction( LennardJonesInteraction& I ) : PointPairInteraction( I ) { Epsilon = I.Epsilon; R = I.R; } virtual LennardJonesInteraction& operator=( LennardJonesInteraction& I ) { if( &I == &(*this) ) return( (*this) ); PointPairInteraction::operator=( I ); Epsilon = I.Epsilon; R = I.R; return( (*this) ); } virtual LennardJonesInteractionPointer Clone() { return( new LennardJonesInteraction( (*this) ) ); } virtual LennardJonesInteractionPointer Create( double TheEpsilon = 1.0, double TheR = 1.0, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) { return( new LennardJonesInteraction( TheEpsilon, TheR, TheId, UsePeriodicBox ) ); } virtual double PointPairPotential( Particle& P1, Particle& P2 ); virtual Vector PointPairForce( Particle& P1, Particle& P2 ); double Epsilon, R; /* V(r) = Epsilon * { (R/r)^12 - 2 * (R/r)^6 } */ }; /* --------------------------------------------------------- */ #endif