Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brownian Dynamics within the existing VV loop #1842

Merged
merged 207 commits into from
Jan 25, 2020
Merged
Changes from 1 commit
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
1ac37f9
Brownian Dynamics feature: core/python/test
bogdan-tanygin Sep 12, 2017
fe27b61
Partial fix of the BD thermo test
bogdan-tanygin Sep 12, 2017
2534899
Fix
bogdan-tanygin Sep 16, 2017
d9cf057
Merge branch 'python' of git://github.com/espressomd/espresso into es…
bogdan-tanygin Oct 19, 2017
e42ca43
Merge branch 'espressomd-python' into bd
bogdan-tanygin Oct 19, 2017
ec68653
maxset build fix
bogdan-tanygin Oct 19, 2017
d4836e3
Travis BD improvement
bogdan-tanygin Oct 19, 2017
4310a0e
Merge pull request #157 from espressomd/python
bogdan-tanygin Oct 20, 2017
797255c
Merge pull request #158 from espressomd/python
bogdan-tanygin Oct 23, 2017
d551f17
BD maxset update by head changes
bogdan-tanygin Oct 23, 2017
ea20f77
BD thermo test merge into LD test as test cases
bogdan-tanygin Oct 23, 2017
f13c04f
Travis BD test infra fix
bogdan-tanygin Oct 23, 2017
99b5089
Merge pull request #160 from espressomd/python
bogdan-tanygin Oct 25, 2017
06ef662
Merge pull request #162 from espressomd/python
bogdan-tanygin Oct 26, 2017
c51d96f
Drift test stub
bogdan-tanygin Oct 29, 2017
a7c3b3c
Merge branch 'deceleration-test' into bd
bogdan-tanygin Oct 29, 2017
30112e5
Drift accuracy calc improvement
bogdan-tanygin Oct 29, 2017
3a697db
Positional drift tests: rotational and translational ones
bogdan-tanygin Oct 29, 2017
b030f9a
The sin() validation in the drift tests
bogdan-tanygin Oct 29, 2017
8da44b5
Tolerance tuning
bogdan-tanygin Oct 29, 2017
6e971c3
Test utils: reference frame conversion
bogdan-tanygin Nov 5, 2017
badd2e1
Rotational diffusion validation
bogdan-tanygin Nov 5, 2017
522cee9
Rot diffusion tests without any fixed axes
bogdan-tanygin Nov 6, 2017
a98aea9
Merge branch 'python' of git://github.com/espressomd/espresso into es…
bogdan-tanygin Nov 13, 2017
f614304
Merge branch 'espressomd-python' into rot-diffusion-test
bogdan-tanygin Nov 13, 2017
0f0ed38
Anisotropic rotational diffusion test, its speed-up
bogdan-tanygin Nov 13, 2017
5bdb382
BD: Maxwell distribution enablement
bogdan-tanygin Nov 16, 2017
71c3653
BD docs, corrections
bogdan-tanygin Nov 26, 2017
23982e9
Drag terminal velocity tests
bogdan-tanygin Jan 10, 2018
e849a85
Merge branch 'drift-tests-2' into bd
bogdan-tanygin Feb 8, 2018
33524e7
BD feature test requirement
bogdan-tanygin Feb 9, 2018
d49e0d2
Feature configuration condition
bogdan-tanygin Feb 9, 2018
ed19f3b
Repeating code move to the function
bogdan-tanygin Feb 9, 2018
7cda92f
Merge branch 'bd' of https://github.com/psci2195/espresso-ffans into bd
bogdan-tanygin Feb 9, 2018
ad66308
Merge branch 'rot-diffusion-test' into bd
bogdan-tanygin Feb 9, 2018
78de70a
Naming convention
bogdan-tanygin Feb 10, 2018
a8f3a00
Interim durable test
bogdan-tanygin Feb 10, 2018
8572134
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Feb 10, 2018
8db143c
Merge branch 'espressomd-python' into bd
bogdan-tanygin Feb 10, 2018
a728951
Long run rot diffusion test
bogdan-tanygin Feb 10, 2018
1475fae
Merge pull request #183 from espressomd/python
bogdan-tanygin Feb 10, 2018
bdd2c30
Test call correction
bogdan-tanygin Feb 10, 2018
edb628c
Test speed up
bogdan-tanygin Feb 10, 2018
c50cc11
Test speed up
bogdan-tanygin Feb 10, 2018
c39d875
BD documentation improvement
bogdan-tanygin Mar 11, 2018
e0c0dae
BD infrastructure correction, cleanup
bogdan-tanygin Mar 11, 2018
f697be0
Formatting and code style polishing
bogdan-tanygin Mar 11, 2018
3aa767f
Requested refactoring, bibliography references
bogdan-tanygin Mar 12, 2018
a669b45
CPU number in the Brownian Dynamics test
bogdan-tanygin Mar 12, 2018
5f37f3c
Infra: special maxset-bd configuration removal
bogdan-tanygin Mar 12, 2018
90e4179
Merge pull request #184 from psci2195/pr1842
bogdan-tanygin Mar 12, 2018
8695916
Making more BD functions inline
bogdan-tanygin Mar 12, 2018
9a3071e
Merge pull request #185 from psci2195/pr1842
bogdan-tanygin Mar 12, 2018
59f307c
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Mar 13, 2018
cc3eb12
Merge branch 'espressomd-python' into pr1842
bogdan-tanygin Mar 13, 2018
4122b80
Merge pull request #187 from psci2195/pr1842
bogdan-tanygin Mar 13, 2018
7919b0a
Code cleanup
bogdan-tanygin Mar 13, 2018
0629002
Refactoring
bogdan-tanygin Mar 13, 2018
95f6d99
Test cleanup, speed up
bogdan-tanygin Mar 13, 2018
fd34faa
Test speed up
bogdan-tanygin Mar 13, 2018
937f778
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Mar 13, 2018
30fb410
Merge branch 'espressomd-python' into pr1842
bogdan-tanygin Mar 13, 2018
5414c55
Cleanup of test fragments which are out of the BD scope
bogdan-tanygin Mar 13, 2018
c075ec8
Rotational diffusion test fix
bogdan-tanygin Mar 13, 2018
8660921
Merge pull request #189 from psci2195/pr1842
bogdan-tanygin Mar 13, 2018
5952c1c
Trigger
bogdan-tanygin Mar 13, 2018
c7086e9
Merge branch 'bd' of https://github.com/psci2195/espresso-ffans into bd
bogdan-tanygin Mar 13, 2018
78e5975
The changes cleanup
bogdan-tanygin Mar 18, 2018
2744188
BD: additional documentation
bogdan-tanygin Mar 19, 2018
571e80c
Merge pull request #191 from espressomd/python
bogdan-tanygin Mar 21, 2018
fb26fc6
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Apr 23, 2018
3fd27fa
Merge branch 'espressomd-python' into bd
bogdan-tanygin Apr 23, 2018
050881b
BD doc update
bogdan-tanygin Apr 23, 2018
e1be03c
Merge branch 'python' into bd
bogdan-tanygin Apr 23, 2018
e53666c
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin May 27, 2018
401ab2a
Reduction of the box
bogdan-tanygin May 27, 2018
464d03d
Merge branch 'espressomd-python' into bd-merge
bogdan-tanygin May 27, 2018
a4b1bda
BD test fix according to new accumulators package
bogdan-tanygin May 28, 2018
7927b16
Merge pull request #196 from espressomd/python
bogdan-tanygin May 28, 2018
d2ad2f0
Merge pull request #197 from espressomd/python
bogdan-tanygin May 28, 2018
f11a284
Merge pull request #199 from psci2195/bd-merge
bogdan-tanygin May 28, 2018
86196d5
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Jun 5, 2018
247b11b
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Jun 5, 2018
3477114
Merge branch 'espressomd-python' into bd-merge
bogdan-tanygin Jun 5, 2018
d9a36e9
Merge pull request #201 from psci2195/bd-merge
bogdan-tanygin Jun 5, 2018
bae3fa3
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Jun 14, 2018
3db0d09
Merge branch 'espressomd-python' into bd-merge-2
bogdan-tanygin Jun 14, 2018
16faae2
Longrun removal
bogdan-tanygin Jun 14, 2018
d0faa2c
Refactoring according to previous review
bogdan-tanygin Jun 14, 2018
274cf76
BD thermo viscous test
bogdan-tanygin Jun 14, 2018
8930afe
Refactoring
bogdan-tanygin Jun 14, 2018
2e97d59
Significant performance improvement due to BD advantages
bogdan-tanygin Jun 14, 2018
5753d65
Different random generators related fine-tuning
bogdan-tanygin Jun 14, 2018
0369aed
Merge pull request #210 from psci2195/bd-merge-2
bogdan-tanygin Jun 14, 2018
adf54a5
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Sep 10, 2018
a35dc68
Merge branch 'espressomd-python' into bd-merge-3
bogdan-tanygin Sep 10, 2018
e4728c9
Merge pull request #220 from psci2195/bd-merge-3
bogdan-tanygin Sep 10, 2018
28ef0dd
Runtime error fix
bogdan-tanygin Sep 11, 2018
f663ec4
Test fix and speed-up
bogdan-tanygin Sep 11, 2018
e277747
Refactoring according to the CodeFactor critical requirement
bogdan-tanygin Sep 11, 2018
66df6f5
Refactoring
bogdan-tanygin Sep 11, 2018
c14b5bc
Clang build fix: zero division removal
bogdan-tanygin Sep 12, 2018
b8e2ceb
Trigger
bogdan-tanygin Sep 12, 2018
a2c43c4
Refactoring
bogdan-tanygin Sep 13, 2018
86db6a9
nocheck build fix (BD)
bogdan-tanygin Sep 14, 2018
ab7fbf1
Formatting
bogdan-tanygin Sep 14, 2018
5c49fc7
Merge branch 'python' of https://github.com/espressomd/espresso into bd
KaiSzuttor Sep 27, 2018
0143da4
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Oct 15, 2018
16e2ee3
Merge branch 'espressomd-python' into bd
bogdan-tanygin Oct 15, 2018
b5e6978
Merge pull request #224 from psci2195/bd
bogdan-tanygin Dec 25, 2018
3b3a4c5
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Dec 28, 2018
94ea5f8
Merge branch 'espressomd-python' into pr1842
bogdan-tanygin Dec 28, 2018
0fd8bec
Merge pull request #226 from psci2195/pr1842
bogdan-tanygin Dec 30, 2018
0f25fd8
Formatting rules alignments
bogdan-tanygin Dec 30, 2018
e390bd8
Merge pull request #227 from psci2195/pr1842
bogdan-tanygin Dec 30, 2018
49906b6
Merge pull request #236 from espressomd/python
bogdan-tanygin Jan 10, 2019
b091e8c
Added get_state of the BD thermostat
bogdan-tanygin Jan 10, 2019
c740070
Refactoring: BD test cases separation where one makes sense
bogdan-tanygin Jan 11, 2019
bcabe8f
Style
bogdan-tanygin Jan 11, 2019
f12edb6
Style
bogdan-tanygin Jan 11, 2019
098b14f
Disable BD for virtual sites by default
bogdan-tanygin Jan 13, 2019
807a8ea
Test refactoring
bogdan-tanygin Jan 13, 2019
daefcb9
Style
bogdan-tanygin Jan 13, 2019
fcd6ca3
More tight tolerance
bogdan-tanygin Jan 13, 2019
ee03e44
Tune the tolerance for specific Gitlab platforms
bogdan-tanygin Jan 13, 2019
711e4ce
Virtual sites propagation only for rotations
bogdan-tanygin Jan 14, 2019
6db21f8
Formatting
bogdan-tanygin Jan 14, 2019
179d801
Virtual sites translational thermostat control
bogdan-tanygin Jan 14, 2019
4b99052
Formatting
bogdan-tanygin Jan 15, 2019
b8e0135
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Jan 16, 2019
8fb7d86
Merge branch 'espressomd-python' into bd-temp
bogdan-tanygin Jan 16, 2019
f687f27
Perrin's rot test for BD
bogdan-tanygin Jan 17, 2019
d1bfcbd
Merge pull request #245 from psci2195/bd-temp
bogdan-tanygin Jan 17, 2019
cc43e1a
Formatting
bogdan-tanygin Jan 17, 2019
109627d
Parameters for multi-core stable run / refactoring
bogdan-tanygin Jan 20, 2019
fbc00a8
Making the algorithm to be independ on an order of the rotations
bogdan-tanygin Jan 20, 2019
b23e23d
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin May 30, 2019
8bb339c
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin May 30, 2019
0052047
Merge branch 'espressomd-python' into bd-mergework
bogdan-tanygin May 30, 2019
a155190
Merge pull request #257 from psci2195/bd-mergework
bogdan-tanygin May 30, 2019
093a0a0
Merge pull request #258 from espressomd/python
bogdan-tanygin Jun 1, 2019
ac64fe1
Merge pull request #262 from espressomd/python
bogdan-tanygin Jun 6, 2019
d22265b
documentation rules fixing
bogdan-tanygin Jun 6, 2019
4eacd66
technical revert
bogdan-tanygin Jun 6, 2019
e7ce993
style
bogdan-tanygin Jun 6, 2019
5d1c93e
documentation rules fixing
bogdan-tanygin Jun 6, 2019
6e4f4c5
clang build fix
bogdan-tanygin Jun 6, 2019
04c7550
default build fix
bogdan-tanygin Jun 6, 2019
8357b86
clang build fix
bogdan-tanygin Jun 6, 2019
9b98323
clang build fixes
bogdan-tanygin Jun 6, 2019
ce15708
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Jun 13, 2019
f24a55e
Merge branch 'espressomd-python' into bd-merge
bogdan-tanygin Jun 13, 2019
8f6dc02
Merge branch 'bd-merge' into bd
bogdan-tanygin Jun 13, 2019
4420866
Merge pull request #265 from espressomd/python
bogdan-tanygin Jun 17, 2019
ed669fa
Merge branch 'python' of git://github.com/espressomd/espresso into pr…
RudolfWeeber Aug 2, 2019
c3fdb00
Merge regression and accuracy in testsuite
RudolfWeeber Aug 2, 2019
ce3196e
Merge branch 'python' of git://github.com/espressomd/espresso into pr…
RudolfWeeber Aug 2, 2019
a98f392
Formatting
RudolfWeeber Aug 2, 2019
2b11644
Merge branch 'python' of git://github.com/espressomd/espresso into pr…
RudolfWeeber Sep 3, 2019
c4d9aad
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Oct 26, 2019
a943e77
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Oct 26, 2019
032ee9d
Merge branch 'espressomd-python' into bd-pr1842
bogdan-tanygin Oct 26, 2019
4dbe052
Merge pull request #275 from psci2195/bd-pr1842
bogdan-tanygin Oct 26, 2019
e31368e
Merge pull request #276 from espressomd/python
bogdan-tanygin Nov 9, 2019
c7d10cc
Style
bogdan-tanygin Nov 9, 2019
f9abec9
Merge typo fix
bogdan-tanygin Nov 9, 2019
1a8b181
Trivial parametric issue (the rnd sequence has been changed by extra …
bogdan-tanygin Nov 9, 2019
f68443d
Refactoring: new mask routine usage
bogdan-tanygin Nov 9, 2019
c64d488
Brownian dynamics docs update
bogdan-tanygin Nov 9, 2019
7c9254e
Merge branch 'bd' of ssh://github.com/psci2195/espresso-ffans into bd
bogdan-tanygin Nov 9, 2019
d8842ca
Merge branch 'python' of https://github.com/espressomd/espresso into bd
fweik Nov 12, 2019
b5af9e2
Formatting
fweik Nov 12, 2019
4508842
config: Remove BROWNIAN_DyNAMICS as compile-time feature
RudolfWeeber Nov 13, 2019
ab6a54f
BD: body gamma and lab force match
bogdan-tanygin Nov 30, 2019
adf9fb4
Code deduplication
bogdan-tanygin Nov 30, 2019
ffe1de0
Merge branch 'python' of https://github.com/espressomd/espresso into …
bogdan-tanygin Nov 30, 2019
66d880c
Merge branch 'espressomd-python' into bd
bogdan-tanygin Nov 30, 2019
70a9341
Style aligning
bogdan-tanygin Nov 30, 2019
f203cfa
Empty and nortation build and tests fixes
bogdan-tanygin Nov 30, 2019
2a62b41
Unset the unused variable
bogdan-tanygin Nov 30, 2019
d16a340
Trigger
bogdan-tanygin Dec 1, 2019
e611efb
Refactoring for unused values
bogdan-tanygin Dec 1, 2019
84afe2c
Merge commit 'b7ff4' into pr1842
RudolfWeeber Jan 20, 2020
9e73eed
Merge commit 'refs/pull/1842/head' of git://github.com/espressomd/esp…
RudolfWeeber Jan 20, 2020
6a86e44
Core: Add RNG salts for all different randoms used in Brownian dynamics
RudolfWeeber Jan 20, 2020
fd04ef1
Core: Increment Langevin counter for Brownian dynamics
RudolfWeeber Jan 20, 2020
adce6a9
Py: Cope with Brownian-dynamics/ Langevin entanglement
RudolfWeeber Jan 20, 2020
0361b0e
Formatting
RudolfWeeber Jan 20, 2020
e78dfb8
Testsuite: Brownian dynamics, minor fixes
RudolfWeeber Jan 20, 2020
cc831ec
Formatting
RudolfWeeber Jan 20, 2020
138fe00
Revert rotational-diffusion-aniso test to before merge and use low pe…
RudolfWeeber Jan 21, 2020
379bff1
Tutorial 12: support both pint 0.9 and 10.1 (#3423)
kodiakhq[bot] Jan 20, 2020
4eeaf9f
Merge branch 'python' into bd
jngrad Jan 21, 2020
4634a6a
Fix typos, code formatting, constants
jngrad Jan 21, 2020
545f4e2
Update bibliography and doxygen
jngrad Jan 21, 2020
b522d04
Test Brownian Dynamics checkpointing
jngrad Jan 21, 2020
ede6e7e
Split Brownian and Langevin code
jngrad Jan 21, 2020
9fefd1b
Merge branch 'python' of git://github.com/espressomd/espresso into pr…
RudolfWeeber Jan 22, 2020
3f29600
Make sentinels constexpr and move them
jngrad Jan 22, 2020
c6c8963
Move Brownian Dynamics globals in a struct
jngrad Jan 22, 2020
03dd0ba
Merge commit 'refs/pull/1842/head' of git://github.com/espressomd/esp…
RudolfWeeber Jan 23, 2020
35995b3
Merge branch 'python' into bd
RudolfWeeber Jan 23, 2020
a5624cc
Core: Brownian Dynamics Fix handling of thermo_virtual
RudolfWeeber Jan 23, 2020
602ce2c
Merge commit 'refs/pull/1842/head' of git://github.com/espressomd/esp…
RudolfWeeber Jan 23, 2020
ef28de2
Formatting
RudolfWeeber Jan 23, 2020
26676a2
Fix typo in the BD vel assignment
bogdan-tanygin Jan 24, 2020
1438ecf
Fix: rotational gamma assignment to the sigma_pos_rotation_inv
bogdan-tanygin Jan 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move Brownian Dynamics globals in a struct
jngrad committed Jan 22, 2020
commit c6c896395332435c46d4ac54921ab79ce547adf9
16 changes: 8 additions & 8 deletions src/core/global.cpp
Original file line number Diff line number Diff line change
@@ -171,21 +171,21 @@ const std::unordered_map<int, Datafield> fields{
{&thermo_virtual, Datafield::Type::BOOL, 1, "thermo_virtual"}},
#ifndef PARTICLE_ANISOTROPY
{FIELD_BROWNIAN_GAMMA_ROTATION,
{&brownian_gamma_rotation, Datafield::Type::DOUBLE, 1,
"gamma_rot"}}, /* 57 from thermostat.cpp */
{&brownian.gamma_rotation, Datafield::Type::DOUBLE, 1,
"brownian.gamma_rotation"}}, /* 57 from thermostat.cpp */
#else
{FIELD_BROWNIAN_GAMMA_ROTATION,
{brownian_gamma_rotation.data(), Datafield::Type::DOUBLE, 3,
"gamma_rot"}}, /* 57 from thermostat.cpp */
{brownian.gamma_rotation.data(), Datafield::Type::DOUBLE, 3,
"brownian.gamma_rotation"}}, /* 57 from thermostat.cpp */
#endif
#ifndef PARTICLE_ANISOTROPY
{FIELD_BROWNIAN_GAMMA,
{&brownian_gamma, Datafield::Type::DOUBLE, 1,
"gamma"}}, /* 58 from thermostat.cpp */
{&brownian.gamma, Datafield::Type::DOUBLE, 1,
"brownian.gamma"}}, /* 58 from thermostat.cpp */
#else
{FIELD_BROWNIAN_GAMMA,
{brownian_gamma.data(), Datafield::Type::DOUBLE, 3,
"gamma"}}, /* 58 from thermostat.cpp */
{brownian.gamma.data(), Datafield::Type::DOUBLE, 3,
"brownian.gamma"}}, /* 58 from thermostat.cpp */
#endif // PARTICLE_ANISOTROPY
};

4 changes: 2 additions & 2 deletions src/core/global.hpp
Original file line number Diff line number Diff line change
@@ -99,9 +99,9 @@ enum Fields {
FIELD_FORCE_CAP,
FIELD_THERMO_VIRTUAL,
FIELD_SWIMMING_PARTICLES_EXIST,
/** index of \ref brownian_gamma */
/** index of \ref BrownianThermostat::gamma */
FIELD_BROWNIAN_GAMMA,
/** index of \ref brownian_gamma_rotation */
/** index of \ref BrownianThermostat::gamma_rotation */
FIELD_BROWNIAN_GAMMA_ROTATION,
};

186 changes: 84 additions & 102 deletions src/core/integrators/brownian_inline.hpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
Copyright (C) 2010-2018 The ESPResSo project
Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
Max-Planck-Institute for Polymer Research, Theory Group
This file is part of ESPResSo.
ESPResSo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ESPResSo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2010-2019 The ESPResSo project
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
* Max-Planck-Institute for Polymer Research, Theory Group
*
* This file is part of ESPResSo.
*
* ESPResSo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ESPResSo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file */

#ifndef BROWNIAN_INLINE_HPP
@@ -26,6 +26,8 @@
#include "random.hpp"
#include "thermostat.hpp"

extern BrownianThermostat brownian;

/** Propagate position: viscous drag driven by conservative forces.
* From eq. (14.39) in @cite Schlick2010.
* @param[in,out] p Particle
@@ -41,7 +43,7 @@ inline void bd_drag(Particle &p, double dt) {
} else
#endif
{
local_gamma = brownian_gamma;
local_gamma = brownian.gamma;
}

bool aniso_flag; // particle anisotropy flag
@@ -114,7 +116,7 @@ inline void bd_drag_vel(Particle &p, double dt) {
} else
#endif
{
local_gamma = brownian_gamma;
local_gamma = brownian.gamma;
}

bool aniso_flag; // particle anisotropy flag
@@ -195,52 +197,42 @@ void bd_random_walk(Particle &p, double dt) {
extern bool thermo_virtual;
if (p.p.is_virtual && !thermo_virtual)
return;
// Position dispersion is defined by the second eq. (14.38) of Schlick2010
// taking into account eq. (14.35). Its time interval factor will be added at
// the end of this function. Its square root is the standard deviation. A
// multiplicative inverse of the position standard deviation:
extern Thermostat::GammaType brown_sigma_pos_inv;
// Just a NAN setter, technical variable:
extern Thermostat::GammaType brown_gammatype_nan;
// first, set defaults
Thermostat::GammaType brown_sigma_pos_temp_inv = brown_sigma_pos_inv;
Thermostat::GammaType brown_sigma_pos_inv = brownian.sigma_pos_inv;

// Override defaults if per-particle values for T and gamma are given
#ifdef BROWNIAN_PER_PARTICLE
auto const constexpr brownian_temp_coeff = 2.0;
auto const constexpr brown_temp_coeff = 2.0;

if (p.p.gamma >= Thermostat::GammaType{}) {
// Is a particle-specific temperature also specified?
if (p.p.T >= 0.) {
if (p.p.T > 0.0) {
brown_sigma_pos_temp_inv =
sqrt(p.p.gamma / (brownian_temp_coeff * p.p.T));
brown_sigma_pos_inv = sqrt(p.p.gamma / (brown_temp_coeff * p.p.T));
} else {
brown_sigma_pos_temp_inv =
brown_gammatype_nan; // just an indication of the infinity
// just an indication of the infinity
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} else
// Default temperature but particle-specific gamma
// default temperature but particle-specific gamma
if (temperature > 0.0) {
brown_sigma_pos_temp_inv =
sqrt(p.p.gamma / (brownian_temp_coeff * temperature));
brown_sigma_pos_inv = sqrt(p.p.gamma / (brown_temp_coeff * temperature));
} else {
brown_sigma_pos_temp_inv = brown_gammatype_nan;
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} // particle specific gamma
} // particle-specific gamma
else {
// No particle-specific gamma, but is there particle-specific temperature
if (p.p.T >= 0.) {
if (p.p.T > 0.0) {
brown_sigma_pos_temp_inv =
sqrt(brownian_gamma / (brownian_temp_coeff * p.p.T));
brown_sigma_pos_inv = sqrt(brownian.gamma / (brown_temp_coeff * p.p.T));
} else {
brown_sigma_pos_temp_inv =
brown_gammatype_nan; // just an indication of the infinity
// just an indication of the infinity
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} else {
// Defaut values for both
brown_sigma_pos_temp_inv = brown_sigma_pos_inv;
// default values for both
brown_sigma_pos_inv = brownian.sigma_pos_inv;
}
}
#endif /* BROWNIAN_PER_PARTICLE */
@@ -249,8 +241,8 @@ void bd_random_walk(Particle &p, double dt) {

#ifdef PARTICLE_ANISOTROPY
// Particle frictional isotropy check.
aniso_flag = (brown_sigma_pos_temp_inv[0] != brown_sigma_pos_temp_inv[1]) ||
(brown_sigma_pos_temp_inv[1] != brown_sigma_pos_temp_inv[2]);
aniso_flag = (brown_sigma_pos_inv[0] != brown_sigma_pos_inv[1]) ||
(brown_sigma_pos_inv[1] != brown_sigma_pos_inv[2]);
#else
aniso_flag = false;
#endif // PARTICLE_ANISOTROPY
@@ -260,23 +252,22 @@ void bd_random_walk(Particle &p, double dt) {
// Eq. (14.37) is factored by the Gaussian noise (12.22) with its squared
// magnitude defined in the second eq. (14.38), Schlick2010.
Utils::Vector3d noise = Random::v_noise_g<RNGSalt::BROWNIAN_WALK>(
brownian_rng_counter->value(), p.p.identity);
brownian.rng_counter->value(), p.p.identity);
for (int j = 0; j < 3; j++) {
#ifdef EXTERNAL_FORCES
if (!(p.p.ext_flag & COORD_FIXED(j)))
#endif
{
#ifndef PARTICLE_ANISOTROPY
if (brown_sigma_pos_temp_inv > 0.0) {
delta_pos_body[j] =
(1.0 / brown_sigma_pos_temp_inv) * sqrt(dt) * noise[j];
if (brown_sigma_pos_inv > 0.0) {
delta_pos_body[j] = (1.0 / brown_sigma_pos_inv) * sqrt(dt) * noise[j];
} else {
delta_pos_body[j] = 0.0;
}
#else
if (brown_sigma_pos_temp_inv[j] > 0.0) {
if (brown_sigma_pos_inv[j] > 0.0) {
delta_pos_body[j] =
(1.0 / brown_sigma_pos_temp_inv[j]) * sqrt(dt) * noise[j];
(1.0 / brown_sigma_pos_inv[j]) * sqrt(dt) * noise[j];
} else {
delta_pos_body[j] = 0.0;
}
@@ -312,25 +303,24 @@ inline void bd_random_walk_vel(Particle &p, double dt) {
return;
// Just a square root of kT, see eq. (10.2.17) and comments in 2 paragraphs
// afterwards, Pottier2010
extern double brown_sigma_vel;
double brown_sigma_vel_temp;
double brown_sigma_vel;

// Override defaults if per-particle values for T and gamma are given
#ifdef BROWNIAN_PER_PARTICLE
auto const constexpr brownian_temp_coeff = 1.0;
auto const constexpr brown_temp_coeff = 1.0;
// Is a particle-specific temperature specified?
if (p.p.T >= 0.) {
brown_sigma_vel_temp = sqrt(brownian_temp_coeff * p.p.T);
brown_sigma_vel = sqrt(brown_temp_coeff * p.p.T);
} else {
brown_sigma_vel_temp = brown_sigma_vel;
brown_sigma_vel = brownian.sigma_vel;
}
#else
// defaults
brown_sigma_vel_temp = brown_sigma_vel;
brown_sigma_vel = brownian.sigma_vel;
#endif /* BROWNIAN_PER_PARTICLE */

Utils::Vector3d noise = Random::v_noise_g<RNGSalt::BROWNIAN_INC>(
brownian_rng_counter->value(), p.identity());
brownian.rng_counter->value(), p.identity());
for (int j = 0; j < 3; j++) {
#ifdef EXTERNAL_FORCES
if (!(p.p.ext_flag & COORD_FIXED(j)))
@@ -344,7 +334,7 @@ inline void bd_random_walk_vel(Particle &p, double dt) {
// of Schlick2010. A difference is the mass factor to the friction tensor.
// The noise is Gaussian according to the convention at p. 237 (last
// paragraph), Pottier2010.
p.m.v[j] += brown_sigma_vel_temp * noise[j] / sqrt(p.p.mass);
p.m.v[j] += brown_sigma_vel * noise[j] / sqrt(p.p.mass);
}
}
}
@@ -365,7 +355,7 @@ void bd_drag_rot(Particle &p, double dt) {
} else
#endif
{
local_gamma = brownian_gamma_rotation;
local_gamma = brownian.gamma_rotation;
}

Utils::Vector3d dphi = {0.0, 0.0, 0.0};
@@ -405,7 +395,7 @@ void bd_drag_vel_rot(Particle &p, double dt) {
} else
#endif
{
local_gamma = brownian_gamma_rotation;
local_gamma = brownian.gamma_rotation;
}

for (int j = 0; j < 3; j++) {
@@ -434,68 +424,65 @@ void bd_drag_vel_rot(Particle &p, double dt) {
* @param[in] dt Time interval
*/
void bd_random_walk_rot(Particle &p, double dt) {
extern Thermostat::GammaType brown_sigma_pos_rotation_inv;
extern Thermostat::GammaType brown_gammatype_nan;
// first, set defaults
Thermostat::GammaType brown_sigma_pos_temp_inv = brown_sigma_pos_rotation_inv;
Thermostat::GammaType brown_sigma_pos_inv = brownian.sigma_pos_rotation_inv;

// Override defaults if per-particle values for T and gamma are given
#ifdef BROWNIAN_PER_PARTICLE
auto const constexpr brownian_temp_coeff = 2.0;
auto const constexpr brown_temp_coeff = 2.0;

if (p.p.gamma_rot >= Thermostat::GammaType{}) {
// Is a particle-specific temperature also specified?
if (p.p.T >= 0.) {
if (p.p.T > 0.0) {
brown_sigma_pos_temp_inv =
sqrt(p.p.gamma_rot / (brownian_temp_coeff * p.p.T));
brown_sigma_pos_inv = sqrt(p.p.gamma_rot / (brown_temp_coeff * p.p.T));
} else {
brown_sigma_pos_temp_inv =
brown_gammatype_nan; // just an indication of the infinity
// just an indication of the infinity
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} else
// Default temperature but particle-specific gamma
if (temperature > 0.) {
brown_sigma_pos_temp_inv =
sqrt(p.p.gamma_rot / (brownian_temp_coeff * temperature));
} else if (temperature > 0.) {
// Default temperature but particle-specific gamma
brown_sigma_pos_inv =
sqrt(p.p.gamma_rot / (brown_temp_coeff * temperature));
} else {
brown_sigma_pos_temp_inv = brown_gammatype_nan;
// just an indication of the infinity
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} // particle specific gamma
} // particle-specific gamma
else {
// No particle-specific gamma, but is there particle-specific temperature
if (p.p.T >= 0.) {
if (p.p.T > 0.0) {
brown_sigma_pos_temp_inv =
sqrt(brownian_gamma_rotation / (brownian_temp_coeff * p.p.T));
brown_sigma_pos_inv =
sqrt(brownian.gamma_rotation / (brown_temp_coeff * p.p.T));
} else {
brown_sigma_pos_temp_inv =
brown_gammatype_nan; // just an indication of the infinity
// just an indication of the infinity
brown_sigma_pos_inv = brownian.gammatype_nan;
}
} else {
// Defaut values for both
brown_sigma_pos_temp_inv = brown_sigma_pos_rotation_inv;
brown_sigma_pos_inv = brownian.sigma_pos_rotation_inv;
}
}
#endif /* BROWNIAN_PER_PARTICLE */

Utils::Vector3d dphi = {0.0, 0.0, 0.0};
Utils::Vector3d noise = Random::v_noise_g<RNGSalt::BROWNIAN_ROT_INC>(
brownian_rng_counter->value(), p.p.identity);
brownian.rng_counter->value(), p.p.identity);
for (int j = 0; j < 3; j++) {
#ifdef EXTERNAL_FORCES
if (!(p.p.ext_flag & COORD_FIXED(j)))
#endif
{
#ifndef PARTICLE_ANISOTROPY
if (brown_sigma_pos_temp_inv > 0.0) {
dphi[j] = noise[j] * (1.0 / brown_sigma_pos_temp_inv) * sqrt(dt);
if (brown_sigma_pos_inv > 0.0) {
dphi[j] = noise[j] * (1.0 / brown_sigma_pos_inv) * sqrt(dt);
} else {
dphi[j] = 0.0;
}
#else
if (brown_sigma_pos_temp_inv[j] > 0.0) {
dphi[j] = noise[j] * (1.0 / brown_sigma_pos_temp_inv[j]) * sqrt(dt);
if (brown_sigma_pos_inv[j] > 0.0) {
dphi[j] = noise[j] * (1.0 / brown_sigma_pos_inv[j]) * sqrt(dt);
} else {
dphi[j] = 0.0;
}
@@ -518,34 +505,33 @@ void bd_random_walk_rot(Particle &p, double dt) {
* @param[in] dt Time interval
*/
void bd_random_walk_vel_rot(Particle &p, double dt) {
extern double brown_sigma_vel_rotation;
double brown_sigma_vel_temp;
double brown_sigma_vel;

// Override defaults if per-particle values for T and gamma are given
#ifdef BROWNIAN_PER_PARTICLE
auto const constexpr brownian_temp_coeff = 1.0;
auto const constexpr brown_temp_coeff = 1.0;
// Is a particle-specific temperature specified?
if (p.p.T >= 0.) {
brown_sigma_vel_temp = sqrt(brownian_temp_coeff * p.p.T);
brown_sigma_vel = sqrt(brown_temp_coeff * p.p.T);
} else {
brown_sigma_vel_temp = brown_sigma_vel_rotation;
brown_sigma_vel = brownian.sigma_vel_rotation;
}
#else
// set defaults
brown_sigma_vel_temp = brown_sigma_vel_rotation;
brown_sigma_vel = brownian.sigma_vel_rotation;
#endif /* BROWNIAN_PER_PARTICLE */

Utils::Vector3d domega;
Utils::Vector3d noise = Random::v_noise_g<RNGSalt::BROWNIAN_ROT_WALK>(
brownian_rng_counter->value(), p.p.identity);
brownian.rng_counter->value(), p.p.identity);
for (int j = 0; j < 3; j++) {
#ifdef EXTERNAL_FORCES
if (!(p.p.ext_flag & COORD_FIXED(j)))
#endif
{
// velocity is added here. It is already initialized in the terminal drag
// part.
domega[j] = brown_sigma_vel_temp * noise[j] / sqrt(p.p.rinertia[j]);
domega[j] = brown_sigma_vel * noise[j] / sqrt(p.p.rinertia[j]);
}
}
domega = mask(p.p.rotation, domega);
@@ -554,7 +540,6 @@ void bd_random_walk_vel_rot(Particle &p, double dt) {
#endif // ROTATION

inline void brownian_dynamics_propagator(const ParticleRange &particles) {
auto const skin2 = Utils::sqr(0.5 * skin);
for (auto &p : particles) {
// Don't propagate translational degrees of freedom of vs
#ifdef VIRTUAL_SITES
@@ -565,11 +550,8 @@ inline void brownian_dynamics_propagator(const ParticleRange &particles) {
bd_drag_vel(p, time_step);
bd_random_walk(p, time_step);
bd_random_walk_vel(p, time_step);
/* Verlet criterion check*/
if (Utils::sqr(p.r.p[0] - p.l.p_old[0]) +
Utils::sqr(p.r.p[1] - p.l.p_old[1]) +
Utils::sqr(p.r.p[2] - p.l.p_old[2]) >
skin2)
/* Verlet criterion check */
if ((p.r.p - p.l.p_old).norm2() > Utils::sqr(0.5 * skin))
set_resort_particles(Cells::RESORT_LOCAL);
}
#ifdef ROTATION
44 changes: 17 additions & 27 deletions src/core/thermostat.cpp
Original file line number Diff line number Diff line change
@@ -46,14 +46,7 @@ GammaType langevin_gamma_rotation = sentinel(GammaType{});
GammaType langevin_pref1;
GammaType langevin_pref2;
GammaType langevin_pref2_rotation;
GammaType brownian_gamma = sentinel(GammaType{});
GammaType brownian_gamma_rotation = sentinel(GammaType{});
// Brownian position random walk standard deviation
GammaType brown_sigma_pos_inv = sentinel(GammaType{});
GammaType brown_sigma_pos_rotation_inv = sentinel(GammaType{});
GammaType brown_gammatype_nan = set_nan(GammaType{});
double brown_sigma_vel;
double brown_sigma_vel_rotation;
BrownianThermostat brownian = {};

/* NPT ISOTROPIC THERMOSTAT */
double nptiso_gamma0 = 0.0;
@@ -76,7 +69,6 @@ double nptiso_pref4;
#endif

std::unique_ptr<Utils::Counter<uint64_t>> langevin_rng_counter;
std::unique_ptr<Utils::Counter<uint64_t>> brownian_rng_counter;

void mpi_bcast_langevin_rng_counter_slave(const uint64_t counter) {
langevin_rng_counter = std::make_unique<Utils::Counter<uint64_t>>(counter);
@@ -85,7 +77,7 @@ void mpi_bcast_langevin_rng_counter_slave(const uint64_t counter) {
REGISTER_CALLBACK(mpi_bcast_langevin_rng_counter_slave)

void mpi_bcast_brownian_rng_counter_slave(const uint64_t counter) {
brownian_rng_counter = std::make_unique<Utils::Counter<uint64_t>>(counter);
brownian.rng_counter = std::make_unique<Utils::Counter<uint64_t>>(counter);
}

REGISTER_CALLBACK(mpi_bcast_brownian_rng_counter_slave)
@@ -105,7 +97,7 @@ void langevin_rng_counter_increment() {

void brownian_rng_counter_increment() {
if (thermo_switch & THERMO_BROWNIAN)
brownian_rng_counter->increment();
brownian.rng_counter->increment();
}

bool langevin_is_seed_required() {
@@ -115,7 +107,7 @@ bool langevin_is_seed_required() {

bool brownian_is_seed_required() {
/* Seed is required if rng is not initialized */
return brownian_rng_counter == nullptr;
return brownian.rng_counter == nullptr;
}

void langevin_set_rng_state(const uint64_t counter) {
@@ -125,12 +117,12 @@ void langevin_set_rng_state(const uint64_t counter) {

void brownian_set_rng_state(const uint64_t counter) {
mpi_bcast_brownian_rng_counter(counter);
brownian_rng_counter = std::make_unique<Utils::Counter<uint64_t>>(counter);
brownian.rng_counter = std::make_unique<Utils::Counter<uint64_t>>(counter);
}

uint64_t langevin_get_rng_state() { return langevin_rng_counter->value(); }

uint64_t brownian_get_rng_state() { return brownian_rng_counter->value(); }
uint64_t brownian_get_rng_state() { return brownian.rng_counter->value(); }

void thermo_init_langevin() {
langevin_pref1 = -langevin_gamma;
@@ -168,18 +160,16 @@ void thermo_init_brownian() {
* which is only valid for the BD. Just a square root of kT, see (10.2.17)
* and comments in 2 paragraphs afterwards, @cite Pottier2010.
*/
// Heat velocity dispersion:
brown_sigma_vel = sqrt(temperature);
brownian.sigma_vel = sqrt(temperature);
/** The random walk position dispersion is defined by the second eq. (14.38)
* of @cite Schlick2010. Its time interval factor will be added in the
* Brownian Dynamics functions. Its square root is the standard deviation.
*/
// A multiplicative inverse of the position standard deviation:
if (temperature > 0.0) {
brown_sigma_pos_inv = sqrt(brownian_gamma / (2.0 * temperature));
brownian.sigma_pos_inv = sqrt(brownian.gamma / (2.0 * temperature));
} else {
brown_sigma_pos_inv =
brown_gammatype_nan; // just an indication of the infinity
brownian.sigma_pos_inv =
brownian.gammatype_nan; // just an indication of the infinity
}
#ifdef ROTATION
/** Note: the BD thermostat assigns the brownian viscous parameters as well.
@@ -188,16 +178,16 @@ void thermo_init_brownian() {
*/
/* If gamma_rotation is not set explicitly,
we use the translational one. */
if (brownian_gamma_rotation < GammaType{}) {
brownian_gamma_rotation = brownian_gamma;
if (brownian.gamma_rotation < GammaType{}) {
brownian.gamma_rotation = brownian.gamma;
}
brown_sigma_vel_rotation = sqrt(temperature);
// A multiplicative inverse of the position rotation standard deviation:
brownian.sigma_vel_rotation = sqrt(temperature);
if (temperature > 0.0) {
brown_sigma_pos_rotation_inv = sqrt(brownian_gamma / (2.0 * temperature));
brownian.sigma_pos_rotation_inv =
sqrt(brownian.gamma / (2.0 * temperature));
} else {
brown_sigma_pos_rotation_inv =
brown_gammatype_nan; // just an indication of the infinity
brownian.sigma_pos_rotation_inv =
brownian.gammatype_nan; // just an indication of the infinity
}
#endif // ROTATION
}
40 changes: 33 additions & 7 deletions src/core/thermostat.hpp
Original file line number Diff line number Diff line change
@@ -109,13 +109,39 @@ extern double nptiso_gammav;
/** Langevin RNG counter, used for both translation and rotation. */
extern std::unique_ptr<Utils::Counter<uint64_t>> langevin_rng_counter;

/** Brownian friction coefficient gamma for translation. */
extern Thermostat::GammaType brownian_gamma;
/** Brownian friction coefficient gamma for rotation. */
extern Thermostat::GammaType brownian_gamma_rotation;

/** Brownian RNG counter, used for both translation and rotation. */
extern std::unique_ptr<Utils::Counter<uint64_t>> brownian_rng_counter;
/** %Thermostat for Brownian dynamics. */
struct BrownianThermostat {
private:
using GammaType = Thermostat::GammaType;

public:
/** Translational friction coefficient @f$ \gamma_{\text{trans}} @f$. */
GammaType gamma = sentinel(GammaType{});
/** Rotational friction coefficient @f$ \gamma_{\text{rot}} @f$. */
GammaType gamma_rotation = sentinel(GammaType{});
/** Inverse of the translational noise standard deviation.
* Stores @f$ \left(\sqrt{2D_{\text{trans}}}\right)^{-1} @f$ with
* @f$ D_{\text{trans}} = k_B T/\gamma_{\text{trans}} @f$
* the translational diffusion coefficient
*/
GammaType sigma_pos_inv = sentinel(GammaType{});
/** Inverse of the rotational noise standard deviation.
* Stores @f$ \left(\sqrt{2D_{\text{rot}}}\right)^{-1} @f$ with
* @f$ D_{\text{rot}} = k_B T/\gamma_{\text{rot}} @f$
* the rotational diffusion coefficient
*/
GammaType sigma_pos_rotation_inv = sentinel(GammaType{});
/** Sentinel value for divisions by zero. */
GammaType const gammatype_nan = set_nan(GammaType{});
/** Translational velocity noise standard deviation. */
double sigma_vel = 0;
/** Angular velocity noise standard deviation. */
double sigma_vel_rotation = 0;
/** RNG counter, used for both translation and rotation. */
std::unique_ptr<Utils::Counter<uint64_t>> rng_counter;
};

extern BrownianThermostat brownian;

/************************************************
* functions
16 changes: 12 additions & 4 deletions src/python/espressomd/thermostat.pxd
Original file line number Diff line number Diff line change
@@ -36,13 +36,21 @@ cdef extern from "thermostat.hpp":
IF PARTICLE_ANISOTROPY:
Vector3d langevin_gamma_rotation
Vector3d langevin_gamma
Vector3d brownian_gamma_rotation
Vector3d brownian_gamma
ELSE:
double langevin_gamma_rotation
double langevin_gamma
double brownian_gamma_rotation
double brownian_gamma

IF PARTICLE_ANISOTROPY:
ctypedef struct brownian_thermostat_struct "BrownianThermostat":
Vector3d gamma_rotation
Vector3d gamma
ELSE:
ctypedef struct brownian_thermostat_struct "BrownianThermostat":
double gamma_rotation
double gamma

# links intern C-struct with python object
cdef extern brownian_thermostat_struct brownian

void langevin_set_rng_state(stdint.uint64_t counter)
void brownian_set_rng_state(stdint.uint64_t counter)
73 changes: 35 additions & 38 deletions src/python/espressomd/thermostat.pyx
Original file line number Diff line number Diff line change
@@ -157,18 +157,18 @@ cdef class Thermostat:
lang_dict["act_on_virtual"] = thermo_virtual
lang_dict["seed"] = int(brownian_get_rng_state())
IF PARTICLE_ANISOTROPY:
lang_dict["gamma"] = [brownian_gamma[0],
brownian_gamma[1],
brownian_gamma[2]]
lang_dict["gamma"] = [brownian.gamma[0],
brownian.gamma[1],
brownian.gamma[2]]
ELSE:
lang_dict["gamma"] = brownian_gamma
lang_dict["gamma"] = brownian.gamma
IF ROTATION:
IF PARTICLE_ANISOTROPY:
lang_dict["gamma_rotation"] = [brownian_gamma_rotation[0],
brownian_gamma_rotation[1],
brownian_gamma_rotation[2]]
lang_dict["gamma_rotation"] = [brownian.gamma_rotation[0],
brownian.gamma_rotation[1],
brownian.gamma_rotation[2]]
ELSE:
lang_dict["gamma_rotation"] = brownian_gamma_rotation
lang_dict["gamma_rotation"] = brownian.gamma_rotation
ELSE:
lang_dict["gamma_rotation"] = None

@@ -217,12 +217,12 @@ cdef class Thermostat:
ELSE:
langevin_gamma = 0.
mpi_bcast_parameter(FIELD_LANGEVIN_GAMMA)
global brownian_gamma
global brownian
IF PARTICLE_ANISOTROPY:
for i in range(3):
brownian_gamma[i] = 0.
brownian.gamma[i] = 0.
ELSE:
brownian_gamma = 0.
brownian.gamma = 0.
mpi_bcast_parameter(FIELD_BROWNIAN_GAMMA)
global langevin_gamma_rotation
IF ROTATION:
@@ -232,13 +232,12 @@ cdef class Thermostat:
ELSE:
langevin_gamma_rotation = 0.
mpi_bcast_parameter(FIELD_LANGEVIN_GAMMA_ROTATION)
global brownian_gamma_rotation
IF ROTATION:
IF PARTICLE_ANISOTROPY:
for i in range(3):
brownian_gamma_rotation[i] = 0.
brownian.gamma_rotation[i] = 0.
ELSE:
brownian_gamma_rotation = 0.
brownian.gamma_rotation = 0.
mpi_bcast_parameter(FIELD_BROWNIAN_GAMMA_ROTATION)

global thermo_switch
@@ -494,49 +493,47 @@ cdef class Thermostat:

global temperature
temperature = float(kT)
global brownian_gamma
global brownian
IF PARTICLE_ANISOTROPY:
if scalar_gamma_def:
brownian_gamma[0] = gamma
brownian_gamma[1] = gamma
brownian_gamma[2] = gamma
brownian.gamma[0] = gamma
brownian.gamma[1] = gamma
brownian.gamma[2] = gamma
else:
brownian_gamma[0] = gamma[0]
brownian_gamma[1] = gamma[1]
brownian_gamma[2] = gamma[2]
brownian.gamma[0] = gamma[0]
brownian.gamma[1] = gamma[1]
brownian.gamma[2] = gamma[2]
ELSE:
brownian_gamma = float(gamma)

global brownian_gamma_rotation
brownian.gamma = float(gamma)
IF ROTATION:
if gamma_rotation is not None:
IF PARTICLE_ANISOTROPY:
if scalar_gamma_rot_def:
brownian_gamma_rotation[0] = gamma_rotation
brownian_gamma_rotation[1] = gamma_rotation
brownian_gamma_rotation[2] = gamma_rotation
brownian.gamma_rotation[0] = gamma_rotation
brownian.gamma_rotation[1] = gamma_rotation
brownian.gamma_rotation[2] = gamma_rotation
else:
brownian_gamma_rotation[0] = gamma_rotation[0]
brownian_gamma_rotation[1] = gamma_rotation[1]
brownian_gamma_rotation[2] = gamma_rotation[2]
brownian.gamma_rotation[0] = gamma_rotation[0]
brownian.gamma_rotation[1] = gamma_rotation[1]
brownian.gamma_rotation[2] = gamma_rotation[2]
ELSE:
if scalar_gamma_rot_def:
brownian_gamma_rotation = gamma_rotation
brownian.gamma_rotation = gamma_rotation
else:
raise ValueError(
"gamma_rotation must be a scalar since feature PARTICLE_ANISOTROPY is disabled")
else:
IF PARTICLE_ANISOTROPY:
if scalar_gamma_def:
brownian_gamma_rotation[0] = gamma
brownian_gamma_rotation[1] = gamma
brownian_gamma_rotation[2] = gamma
brownian.gamma_rotation[0] = gamma
brownian.gamma_rotation[1] = gamma
brownian.gamma_rotation[2] = gamma
else:
brownian_gamma_rotation[0] = gamma[0]
brownian_gamma_rotation[1] = gamma[1]
brownian_gamma_rotation[2] = gamma[2]
brownian.gamma_rotation[0] = gamma[0]
brownian.gamma_rotation[1] = gamma[1]
brownian.gamma_rotation[2] = gamma[2]
ELSE:
brownian_gamma_rotation = brownian_gamma
brownian.gamma_rotation = brownian.gamma

global thermo_switch
thermo_switch = (thermo_switch | THERMO_BROWNIAN)