OpenMD
3.2
Molecular Dynamics in the Open
Toggle main menu visibility
Loading...
Searching...
No Matches
RPYMobility.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 hydrodynamics/RPYMobility.hpp
38
\brief Per-molecule translation-only RPY mobility / resistance assembly.
39
40
Builds, for one molecule of N spherical beads, the 3N x 3N grand
41
translational mobility M (tt blocks only), inverts it to the grand
42
resistance R = M^{-1}, and Cholesky-factors R for fluctuation-dissipation
43
consistent random forces. The dipolar (td) rows enter only through the
44
effective ambient velocity
45
46
v_inf_eff_i = v_inf_i + sum_{j!=i} mu_td_ij : E ,
47
48
so the hydrodynamic drag in the no-projection (J = 1) inertial scheme is
49
50
f_hydro = R ( v_inf_eff - v ),
51
52
and the random force is sqrt(2 kT / dt) * S * Z, S S^T = R, Z ~ N(0,1).
53
54
This is the orientation-less (unstructured spherical atom) case: no
55
rotational degrees of freedom, hence no tr/rt/rr/rd blocks. Rotational
56
hydrodynamic coupling, which would feed the translational resistance
57
through the full 6N inversion, is therefore neglected here by construction.
58
*/
59
60
#ifndef HYDRODYNAMICS_RPYMOBILITY_HPP
61
#define HYDRODYNAMICS_RPYMOBILITY_HPP
62
63
#include <vector>
64
65
#include "
math/DynamicRectMatrix.hpp
"
66
#include "
math/SquareMatrix3.hpp
"
67
#include "
math/Vector3.hpp
"
68
69
namespace
OpenMD
{
70
71
class
RPYMobility {
72
public
:
73
RPYMobility(
const
std::vector<RealType>& radii, RealType viscosity);
74
75
//! (Re)build M, R = M^{-1}, and S = chol(R) from current bead positions.
76
//! Positions must be the unwrapped intramolecular coordinates. Returns
77
//! false if R is not positive definite (Cholesky hit a non-positive pivot).
78
bool
update
(
const
std::vector<Vector3d>& positions);
79
80
//! v_inf_eff_i = ambient_i + sum_{j!=i} mu_td_ij : E (E symmetric traceless)
81
std::vector<Vector3d>
effectiveAmbient
(
82
const
std::vector<Vector3d>& positions,
83
const
std::vector<Vector3d>& ambient,
const
Mat3x3d& E)
const
;
84
85
//! Hydrodynamic drag: f_i = sum_j R_ij ( vEff_j - vel_j ).
86
std::vector<Vector3d>
dragForce
(
const
std::vector<Vector3d>& vEff,
87
const
std::vector<Vector3d>& vel)
const
;
88
89
//! FDT random force: sqrt(2 kT / dt) * S * Z, with Z a 3N vector of
90
//! independent standard normal draws (row 3i+a is bead i, component a).
91
std::vector<Vector3d>
randomForce
(
const
std::vector<RealType>& Z,
92
RealType kT, RealType dt)
const
;
93
94
std::size_t size()
const
{
return
N_; }
95
bool
isPositiveDefinite()
const
{
return
spd_; }
96
const
DynamicRectMatrix<RealType>
& mobility()
const
{
return
M_; }
97
const
DynamicRectMatrix<RealType>
& resistance()
const
{
return
R_; }
98
const
DynamicRectMatrix<RealType>
& cholesky()
const
{
return
S_; }
99
100
private
:
101
std::size_t N_;
102
RealType eta_;
103
std::vector<RealType> a_;
104
bool
spd_ {
false
};
105
DynamicRectMatrix<RealType>
M_, R_, S_;
106
};
107
}
// namespace OpenMD
108
109
#endif
// HYDRODYNAMICS_RPYMOBILITY_HPP
DynamicRectMatrix.hpp
SquareMatrix3.hpp
Vector3.hpp
OpenMD::DynamicRectMatrix
Rectangular matrix class with contiguous flat storage.
Definition
DynamicRectMatrix.hpp:78
OpenMD::RPYMobility::randomForce
std::vector< Vector3d > randomForce(const std::vector< RealType > &Z, RealType kT, RealType dt) const
FDT random force: sqrt(2 kT / dt) * S * Z, with Z a 3N vector of independent standard normal draws (r...
Definition
RPYMobility.cpp:136
OpenMD::RPYMobility::dragForce
std::vector< Vector3d > dragForce(const std::vector< Vector3d > &vEff, const std::vector< Vector3d > &vel) const
Hydrodynamic drag: f_i = sum_j R_ij ( vEff_j - vel_j ).
Definition
RPYMobility.cpp:115
OpenMD::RPYMobility::update
bool update(const std::vector< Vector3d > &positions)
(Re)build M, R = M^{-1}, and S = chol(R) from current bead positions. Positions must be the unwrapped...
Definition
RPYMobility.cpp:60
OpenMD::RPYMobility::effectiveAmbient
std::vector< Vector3d > effectiveAmbient(const std::vector< Vector3d > &positions, const std::vector< Vector3d > &ambient, const Mat3x3d &E) const
vinf_eff_i = ambient_i + sum{j!=i} mu_td_ij : E (E symmetric traceless)
Definition
RPYMobility.cpp:101
OpenMD
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Definition
ActionCorrFunc.cpp:63
hydrodynamics
RPYMobility.hpp
Generated on
for OpenMD by
1.17.0