Line data Source code
1 : // Copyright (C) 2015 Technische Universitaet Muenchen
2 : // This file is part of the Mamico project. For conditions of distribution
3 : // and use, please see the copyright notice in Mamico's main folder, or at
4 : // www5.in.tum.de/mamico
5 : #ifndef _MOLECULARDYNAMICS_CELLMAPPINGS_LENNARDJONESFORCEMAPPING_H_
6 : #define _MOLECULARDYNAMICS_CELLMAPPINGS_LENNARDJONESFORCEMAPPING_H_
7 :
8 : #include "simplemd/LinkedCell.h"
9 : #include "simplemd/services/ExternalForceService.h"
10 : #include "simplemd/services/MolecularPropertiesService.h"
11 : #include "tarch/la/ScalarOperations.h"
12 :
13 : #include <Kokkos_Core.hpp>
14 :
15 : namespace simplemd {
16 : namespace cellmappings {
17 : class LennardJonesForceMapping;
18 : }
19 : } // namespace simplemd
20 :
21 : /** applies the Lennard-Jones force to all particle pairs.
22 : * @author Philipp Neumann
23 : */
24 : class simplemd::cellmappings::LennardJonesForceMapping {
25 : public:
26 : LennardJonesForceMapping(simplemd::services::ExternalForceService& externalForceService,
27 : const simplemd::services::MolecularPropertiesService& molecularPropertiesService);
28 1068 : KOKKOS_FUNCTION virtual ~LennardJonesForceMapping() {}
29 :
30 : void beginCellIteration();
31 : void endCellIteration() {}
32 :
33 : KOKKOS_FUNCTION void handleCell(LinkedCell& cell) const;
34 : KOKKOS_FUNCTION void handleCellPair(const LinkedCell& cell1, const LinkedCell& cell2, const unsigned int& cellIndex1, const unsigned int& cellIndex2) const;
35 :
36 : /** returns the force acting on a particle placed at position1, resulting from an interaction of the particles at
37 : * positions position1 and position2. Remark: The force on the particle at position2 is just (-1.0)*returnValue.
38 : */
39 : KOKKOS_FUNCTION tarch::la::Vector<MD_DIM, double> getLennardJonesForce(const tarch::la::Vector<MD_DIM, double>& position1,
40 : const tarch::la::Vector<MD_DIM, double>& position2) const;
41 :
42 : static const bool IsParallel = true;
43 :
44 : private:
45 : /** epsilon */
46 : const double _epsilon;
47 : /** sigma^6 */
48 : const double _sigma6;
49 : /** cutOffRadius*cutOffRadius */
50 : const double _cutOffRadiusSquared;
51 :
52 : protected:
53 : /** external forces*/
54 : tarch::la::Vector<MD_DIM, double> _externalForce;
55 : };
56 :
57 : #endif // _MOLECULARDYNAMICS_CELLMAPPINGS_LENNARDJONESFORCEMAPPING_H_
|