Multi Resolution Molecular Dynamics 0.4.0
Multi Resolution Molecular Dynamics
Loading...
Searching...
No Matches
Coulomb.hpp
Go to the documentation of this file.
1// Copyright 2024 Sebastian Eibl
2// Copyright 2026 Julian Friedrich Hille
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// https://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
18#include "data/Atoms.hpp"
19#include "datatypes.hpp"
20#include "util/math.hpp"
21
22namespace mrmd
23{
24namespace action
25{
26namespace impl
27{
28
35class Coulomb
36{
37public:
38 KOKKOS_INLINE_FUNCTION
39 real_t computeForce(const real_t& distSqr, const real_t q1, const real_t q2) const
40 {
41 real_t prefac = 138.935458_r * q1 * q2;
42 return prefac / distSqr;
43 }
44
45 KOKKOS_INLINE_FUNCTION
46 real_t computeEnergy(const real_t& distSqr, const real_t q1, const real_t q2) const
47 {
48 auto r = std::sqrt(distSqr);
49 real_t prefac = 138.935458_r * q1 * q2;
50 return prefac / r;
51 }
52};
53} // namespace impl
54
55} // namespace action
56} // namespace mrmd
Everything to evolve the simulation physically.
Top-level namespace of MRMD.
double real_t
Definition datatypes.hpp:99