MRMD 0.4.0
Multi Resolution Molecular Dynamics
Loading...
Searching...
No Matches
LJ_IdealGas.hpp
Go to the documentation of this file.
1// Copyright 2024 Sebastian Eibl
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <algorithm>
18
19#include "LennardJones.hpp"
20#include "assert/assert.hpp"
21#include "data/Atoms.hpp"
22#include "data/Molecules.hpp"
24#include "datatypes.hpp"
26
27namespace mrmd::action
28{
29void updateMeanCompensationEnergy(data::MultiHistogram& compensationEnergy,
30 data::MultiHistogram& compensationEnergyCounter,
31 data::MultiHistogram& meanCompensationEnergy,
32 const real_t runningAverageFactor = 10_r);
33
35{
36private:
37 idx_t numTypes_;
38
40 real_t rcSqr_ = 0_r;
41
42 data::Molecules::pos_t moleculesPos_;
43 data::Molecules::force_t::atomic_access_slice moleculesForce_;
44 data::Molecules::lambda_t moleculesLambda_;
45 data::Molecules::modulated_lambda_t moleculesModulatedLambda_;
46 data::Molecules::grad_lambda_t moleculesGradLambda_;
47 data::Molecules::atoms_offset_t moleculesAtomsOffset_;
48 data::Molecules::num_atoms_t moleculesNumAtoms_;
49
50 data::Atoms::pos_t atomsPos_;
51 data::Atoms::force_t::atomic_access_slice atomsForce_;
52 data::Atoms::type_t atomsType_;
53
54 static constexpr idx_t COMPENSATION_ENERGY_BINS = 200;
55
56 data::MultiHistogram compensationEnergy_;
57 MultiScatterView compensationEnergyScatter_;
58
59 data::MultiHistogram compensationEnergyCounter_;
60
61 data::MultiHistogram meanCompensationEnergy_;
62
63 bool isDriftCompensationSamplingRun_ = false;
64
65 HalfVerletList verletList_;
66
67 idx_t runCounter_ = 0;
68
69 idx_t compensationEnergySamplingInterval = 200;
70 idx_t compensationEnergyUpdateInveral = 20000;
71
72public:
74 {
75 compensationEnergySamplingInterval = interval;
76 }
78 {
79 compensationEnergyUpdateInveral = interval;
80 }
81 const auto& getMeanCompensationEnergy() const { return meanCompensationEnergy_; }
82
89 KOKKOS_FUNCTION void operator()(const idx_t& alpha, real_t& sumEnergy) const;
90
91 real_t run(data::Molecules& molecules, HalfVerletList& verletList, data::Atoms& atoms);
92
93 LJ_IdealGas(const real_t& cappingDistance,
94 const real_t& rc,
95 const real_t& sigma,
96 const real_t& epsilon,
97 const bool doShift);
98
99 LJ_IdealGas(const std::vector<real_t>& cappingDistance,
100 const std::vector<real_t>& rc,
101 const std::vector<real_t>& sigma,
102 const std::vector<real_t>& epsilon,
103 const idx_t numTypes,
104 const bool doShift);
105};
106
107} // namespace mrmd::action
Definition LJ_IdealGas.hpp:35
KOKKOS_FUNCTION void operator()(const idx_t &alpha, real_t &sumEnergy) const
Loop over molecules.
Definition LJ_IdealGas.cpp:52
void setCompensationEnergySamplingInterval(const idx_t &interval)
Definition LJ_IdealGas.hpp:73
real_t run(data::Molecules &molecules, HalfVerletList &verletList, data::Atoms &atoms)
Definition LJ_IdealGas.cpp:227
void setCompensationEnergyUpdateInterval(const idx_t &interval)
Definition LJ_IdealGas.hpp:77
const auto & getMeanCompensationEnergy() const
Definition LJ_IdealGas.hpp:81
Data structure for storing information about atoms on the host and the device.
Definition Atoms.hpp:35
typename AtomsT::template member_slice_type< TYPE > type_t
Definition Atoms.hpp:59
typename AtomsT::template member_slice_type< POS > pos_t
Definition Atoms.hpp:56
Definition Molecules.hpp:29
typename MoleculesT::template member_slice_type< GRAD_LAMBDA > grad_lambda_t
Definition Molecules.hpp:54
typename MoleculesT::template member_slice_type< MODULATED_LAMBDA > modulated_lambda_t
Definition Molecules.hpp:53
typename MoleculesT::template member_slice_type< LAMBDA > lambda_t
Definition Molecules.hpp:52
typename MoleculesT::template member_slice_type< NUM_ATOMS > num_atoms_t
Definition Molecules.hpp:56
typename MoleculesT::template member_slice_type< ATOMS_OFFSET > atoms_offset_t
Definition Molecules.hpp:55
typename MoleculesT::template member_slice_type< POS > pos_t
Definition Molecules.hpp:50
Definition BerendsenBarostat.cpp:20
void updateMeanCompensationEnergy(data::MultiHistogram &compensationEnergy, data::MultiHistogram &compensationEnergyCounter, data::MultiHistogram &meanCompensationEnergy, const real_t runningAverageFactor)
Definition LJ_IdealGas.cpp:21
Cabana::VerletList< Kokkos::DefaultExecutionSpace::memory_space, Cabana::HalfNeighborTag, Cabana::VerletLayout2D, Cabana::TeamOpTag > HalfVerletList
Definition datatypes.hpp:187
int64_t idx_t
Definition datatypes.hpp:91
double real_t
Definition datatypes.hpp:99
Kokkos::Experimental::ScatterView< real_t ** > MultiScatterView
Definition datatypes.hpp:162
Definition MultiHistogram.hpp:30