/* []----------------------------------------[] | Gravity.h | []----------------------------------------[] | | | AUTHOR: MFSomers 2005. | | USE: Defines a gravitational | | 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(__GRAVITY_INCLUDED__) #define __GRAVITY_INCLUDED__ #include "Global.h" #include "Vector.h" #include "Constants.h" #include "ClassicalDynamics.h" #include "PointPair.h" /* --------------------------------------------------------- */ /* Defines a gravitational pointpair interaction between particles */ class GravitationalInteraction; typedef GravitationalInteraction *GravitationalInteractionPointer; class GravitationalInteraction : public PointPairInteraction { public: inline GravitationalInteraction( double TheFactor = CONST_GRAVITATIONAL_CONST, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) : PointPairInteraction( TheId, UsePeriodicBox ) { InteractionFactor = TheFactor; Type = AGravitationalInteraction; }; inline GravitationalInteraction( GravitationalInteraction& I ) : PointPairInteraction( I ) { InteractionFactor = I.InteractionFactor; } virtual GravitationalInteraction& operator=( GravitationalInteraction& I ) { if( &I == &(*this) ) return( (*this) ); PointPairInteraction::operator=( I ); InteractionFactor = I.InteractionFactor; return( (*this) ); } virtual GravitationalInteractionPointer Clone() { return( new GravitationalInteraction( (*this) ) ); } virtual GravitationalInteractionPointer Create( double TheFactor = CONST_GRAVITATIONAL_CONST, unsigned int TheId = GET_NEW_ID, Vector *UsePeriodicBox = NULL ) { return( new GravitationalInteraction( TheFactor, TheId, UsePeriodicBox ) ); } virtual double PointPairPotential( Particle& P1, Particle& P2 ); virtual Vector PointPairForce( Particle& P1, Particle& P2 ); double InteractionFactor; }; /* --------------------------------------------------------- */ #endif