/* []----------------------------------------[] | PointPair.cpp | []----------------------------------------[] | | | AUTHOR: MFSomers 2005. | | USE: Point pair interaction | | functions... | | | []----------------------------------------[] */ // 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 #include "Global.h" #include "Vector.h" #include "Constants.h" #include "ClassicalDynamics.h" #include "PointPair.h" /* ----------------------------------------------------------------------- */ double PointPairInteraction::InteractionPotential( void ) { int Pos1, Pos2; double TotalPointPairPotential; ParticlePointer P1, P2; TotalPointPairPotential = 0.0; for( Pos1 = 0; Pos1 < Particles.size(); Pos1++ ) { P1 = Particles[ Pos1 ]; if( P1 == NULL ) continue; for( Pos2 = Pos1 + 1; Pos2 < Particles.size(); Pos2++ ) { P2 = Particles[ Pos2 ]; if( P2 == NULL ) continue; TotalPointPairPotential += PointPairPotential( *P1, *P2 ); } } return( TotalPointPairPotential ); } /* ----------------------------------------------------------------------- */ Vector PointPairInteraction::InteractionForce( unsigned int ID ) { int Pos1, Pos2; Vector TotalPointPairVector; ParticlePointer P1, P2; TotalPointPairVector.X = 0.0; TotalPointPairVector.Y = 0.0; TotalPointPairVector.Z = 0.0; Pos1 = IsParticleIncluded( ID ); if( Pos1 <= -1 ) return( TotalPointPairVector ); P1 = Particles[ Pos1 ]; for( Pos2 = 0; Pos2 < Particles.size(); Pos2++ ) { if( Pos1 == Pos2 ) continue; P2 = Particles[ Pos2 ]; if( P2 == NULL ) continue; TotalPointPairVector += PointPairForce( *P1, *P2 ); } return( TotalPointPairVector ); } /* ----------------------------------------------------------------------- */ double PointPairInteraction::PointPairPotential( unsigned int ID1, unsigned int ID2 ) { int Pos1, Pos2; if( ID1 == ID2 ) return( 0.0 ); Pos1 = IsParticleIncluded( ID1 ); if( Pos1 <= -1 ) return( 0.0 ); Pos2 = IsParticleIncluded( ID2 ); if( Pos2 <= -1 ) return( 0.0 ); return( PointPairPotential( *(Particles[ Pos1 ]), *(Particles[ Pos2 ]) ) ); } /* ----------------------------------------------------------------------- */ Vector PointPairInteraction::PointPairForce( unsigned int ID1, unsigned int ID2 ) { int Pos1, Pos2; Vector ZeroVector; ZeroVector.X = ZeroVector.Y = ZeroVector.Z = 0.0; if( ID1 == ID2 ) return( ZeroVector ); Pos1 = IsParticleIncluded( ID1 ); if( Pos1 <= -1 ) return( ZeroVector ); Pos2 = IsParticleIncluded( ID2 ); if( Pos2 <= -1 ) return( ZeroVector ); return( PointPairForce( *(Particles[ Pos1 ]), *(Particles[ Pos2 ]) ) ); } /* ----------------------------------------------------------------------- */ double PointPairInteraction::PointPairPotential( Particle& P1, Particle& P2 ) { return( 0.0 ); } /* ----------------------------------------------------------------------- */ Vector PointPairInteraction::PointPairForce( Particle& P1, Particle& P2 ) { Vector ZeroVector; ZeroVector.X = ZeroVector.Y = ZeroVector.Z = 0.0; return( ZeroVector ); } /* ----------------------------------------------------------------------- */