OpenMD
3.2
Molecular Dynamics in the Open
Toggle main menu visibility
Loading...
Searching...
No Matches
LHDForceModifier.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2004-present, The University of Notre Dame. All rights
3
* reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
*
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
*
11
* 2. Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
*
15
* 3. Neither the name of the copyright holder nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
* POSSIBILITY OF SUCH DAMAGE.
30
*
31
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32
* research, please cite the following paper when you publish your work:
33
*
34
* [1] Drisko et al., J. Open Source Softw. 9, 7004 (2024).
35
*/
36
37
/*! \file integrators/LHDForceModifier.hpp
38
\brief Langevin force modifier with intramolecular RPY hydrodynamic
39
interactions for flexible bead molecules in a background flow.
40
41
Translation-only (unstructured spherical atom) case. Each molecule is a
42
hydrodynamically coupled group of N spherical beads; molecules do not
43
interact hydrodynamically with each other. Per step and per molecule:
44
45
- assemble the 3N x 3N RPY mobility and its resistance R = M^{-1}
46
(RPYMobility), Cholesky factor S of R;
47
- sample the background flow at each bead (VelocityField) and fold in
48
the dipolar disturbance to get v_inf_eff;
49
- add the FDT-consistent correlated random force sqrt(2 kT/dt) S Z;
50
- solve the coupled friction f = R (v_inf_eff - v) self-consistently for
51
the full-step velocity (the LDForceModifier iteration, now coupled
52
across the molecule's beads).
53
54
Pairs with a velocity-Verlet (LangevinDynamics-style) integrator, which
55
performs the actual velocity update; this modifier only injects forces.
56
*/
57
58
#ifndef INTEGRATOR_LHDFORCEMODIFIER_HPP
59
#define INTEGRATOR_LHDFORCEMODIFIER_HPP
60
61
#include <memory>
62
#include <random>
63
#include <vector>
64
65
#include "brains/ForceModifier.hpp"
66
#include "brains/Velocitizer.hpp"
67
#include "
hydrodynamics/RPYMobility.hpp
"
68
#include "
perturbations/VelocityField.hpp
"
69
#include "
primitives/Atom.hpp
"
70
#include "
primitives/StuntDouble.hpp
"
71
#include "utils/RandNumGen.hpp"
72
73
namespace
OpenMD
{
74
75
class
LHDForceModifier :
public
ForceModifier {
76
public
:
77
LHDForceModifier(
SimInfo
* info);
78
79
void
modifyForces()
override
;
80
81
int
getMaxIterationNumber()
const
{
return
maxIterNum_; }
82
void
setMaxIterationNumber(
int
n) { maxIterNum_ = n; }
83
RealType getForceTolerance()
const
{
return
forceTolerance_; }
84
void
setForceTolerance(RealType t) { forceTolerance_ = t; }
85
86
private
:
87
//! Hydrodynamic radius of a bead, following the LDForceModifier rules:
88
//! Lennard-Jones sigma/2, else the element van der Waals radius.
89
RealType beadRadius(
Atom
* atom)
const
;
90
91
//! One hydrodynamically coupled group (a molecule).
92
struct
HydroMolecule {
93
std::vector<StuntDouble*> beads;
94
std::vector<RealType> masses;
95
std::unique_ptr<RPYMobility> mobility;
96
};
97
98
std::vector<HydroMolecule> molecules_;
99
100
int
maxIterNum_;
101
RealType forceTolerance_;
102
RealType dt_;
103
RealType dt2_;
104
RealType viscosity_;
105
RealType kT_;
// Constants::kb * targetTemp
106
107
Globals
* simParams_;
108
Utils::RandNumGenPtr randNumGen_;
109
std::normal_distribution<RealType> normal_ {0.0, 1.0};
110
std::unique_ptr<VelocityField> velField_;
111
std::unique_ptr<Velocitizer> veloMunge_;
112
};
113
}
// namespace OpenMD
114
115
#endif
// INTEGRATOR_LHDFORCEMODIFIER_HPP
Atom.hpp
RPYMobility.hpp
Per-molecule translation-only RPY mobility / resistance assembly.
StuntDouble.hpp
VelocityField.hpp
Linear (homogeneous) ambient velocity field, queried at a location.
OpenMD::Atom
Definition
Atom.hpp:62
OpenMD::Globals
Definition
Globals.hpp:70
OpenMD::SimInfo
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition
SimInfo.hpp:96
OpenMD
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Definition
ActionCorrFunc.cpp:63
integrators
LHDForceModifier.hpp
Generated on
for OpenMD by
1.17.0