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

Do we need a Brownian Dynamics (BD) integrator ? #1360

Closed
bogdan-tanygin opened this issue Aug 30, 2017 · 6 comments · Fixed by #1842
Closed

Do we need a Brownian Dynamics (BD) integrator ? #1360

bogdan-tanygin opened this issue Aug 30, 2017 · 6 comments · Fixed by #1842

Comments

@bogdan-tanygin
Copy link
Contributor

Dear ESPResSo team,

My team always had been using the BD integrators for ferrofluid research: regular magnetite ferrofluid, conventional parameters, nothing special. We just need more particles and larger in silico durations.

Main question: are other users requesting this integrator? I'm asking because the SD and BD has been removed: #1094

Hence, before moving forward, I've decided to ask an opinion.

pros: at least, in case of the magnetite ferrofluid, BD provides 10-100 times speed up of in silico timeframes which could be simulated compare to Velocity Verlet Langevin Dynamics (VV LD). Stability is also much improved. The reason is simple: BD does not have anymore the restriction time_step < mass / gamma. Also, it is worth to mention, that if we are using real friction coefficients, i.e. gamma_trans and gamma_rot which are calculated according to the translational and rotational Stokes' law and the parameters are real material parameters (not ones selected for a simulation optimization) then VV LD usually is spending most part of computational resources to either translation or rotational motion while keeping an overall computational problem to be not well balanced. The BD does not have these issues.

cons: BD requires just position updates. Velocities are already analytically integrated. Hence, this approach does not organically fits to Velocity Verlet integrator. I've integrated BD directly into ESPResSo VV integrator for my personal usage. Architecturally it looks a bit artificial even though it is well theoretically derived. I could show my branch if it is of interest. Another cons: due to larger time_step and significant particle rotations, BD is not fully compatible with ESPResSo quaternion rotation mechanics. Again, I've integrated it a bit artificially to the existing architecture and all tests are passed.

Yours faithfully,
Dr. Theo Tanygin

@hmenke
Copy link
Member

hmenke commented Aug 30, 2017

You are correct that both, SD and BD, were removed in #1094. While the removal of SD was deliberate, the removal of BD was a mere consequence of the interwoven nature of implementation of the two methods.

In a past ESPResSo team meeting we discussed that we would want to keep BD, so if you have a proper implementation which does not do nonsensical things like duplicating the integration loop, as the removed variant did, we are happy to receive your pull request.

Regarding the conflicting features you mentioned, it is all about documentation in my opinion. If it is properly documented that quaternions cannot be used with BD and a user decides to ignore that note, well, bad luck.

@mkuron
Copy link
Member

mkuron commented Aug 30, 2017

We would certainly like to have BD. It was removed only for technical reasons; we had intended to reimplement BD. The old BD/SD had essentially duplicated integrate.cpp, which made them unmaintainable. If you can provide a minimally-invasive version inside the existing integrate_vv function (even if it looks artificial) and provide tests and documentation as required, I think nobody would object.

@RudolfWeeber
Copy link
Contributor

RudolfWeeber commented Aug 31, 2017 via email

@bogdan-tanygin
Copy link
Contributor Author

Thanks for your feedback! OK, I will prepare a pull request. Pure BD does not require a real noisy velocity, hence, it fundamentally does not match the VV loop. However, our team has found a workaround and all TCL and Python tests have been passed. I know how to include it via an analytical derivation of BD from stochastic equations. In this case, BD matches the VV loops precisely with a heat velocity and required BD position random walk. Maybe, this approach is even closer to the explicit solvent implications (to be validated further).

@bogdan-tanygin
Copy link
Contributor Author

The BD PR is almost ready. I've added some tests (see the linked references) which validate both VV-LD and BD and confirm the future BD functions, its kinematics / fluctuation–dissipation routines accuracy. These tests are useful even for VV-LD alone, hence, it is probably logically to separate corresponding PRs from the BD and to suggest ones before in a test-driven way.

@bogdan-tanygin
Copy link
Contributor Author

The PR has been opened.

@kodiakhq kodiakhq bot closed this as completed in #1842 Jan 25, 2020
kodiakhq bot added a commit that referenced this issue Jan 25, 2020
Fixes #1360, also it contains the integrated changes from PRs #1622, #1757 which were required to validate both existing Langevin- (LD) and new Brownian Dynamics (BD) viscous and fluctuation dynamics including the rotational one.

Description of changes:
- Generally, this is a conventional simplest BD [schlick2010].
- Corresponding Sphinx documentation section is populated with the required details to reveal the concept.
- A velocity, even though it is optional for a simplest implementation of the BD, has been added for a consistency with the existing VV loop (c.f. #1360 (comment)) and all the existing tests and new tests. It does not impact the positional mechanics though which is natural for the BD [schlick2010].
- The velocity and position random walk has been added according to the classical diffusion equations [schlick2010,Pottier2014].
- Rotational motion BD is implemented analogously. Existing quaternion approach has been reused where possible.
- New test `brownian_thermostat.py` is based on the existing `langevin_thermostat.py`. It contains some commented out fragments which are inconsistent for the simplest BD cause ones correspond to more fine dynamical structure compare to the BD temporal relation `time_step >> mass / gamma`. The Maxwell distribution test is passing well and the Gaussian noise type is crucial for this which has been done in the `thermostat.hpp`.
- The `mass-and-rinertia_per_particle.py` contains changes described within the PRs #1622, #1757. Probably, it is of interest for both the LD and BD independently. This is why I've opened that PRs in advance.
- Existing automatic tests execution timeline is minimized.
- Additional "heavy" test has been added without an automatic run: `mass-and-rinertia_per_particle_rotdiff-longrun.py`. It requires ~2 hours of a run and provides the intensive validation of the existing LD and new BD dynamics in the same way.

PR Checklist
------------
 - [ ] Tests?
   - [ ] Interface
   - [ ] Core 
 - [ ] Docs?

_References_
schlick2010: https://link.springer.com/book/10.1007%2F978-1-4419-6351-2
Pottier2014: https://link.springer.com/article/10.1007/s10955-010-0114-6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants