Skip to content

add ability for RNG to restart from a prior state#283

Merged
jkrajniak merged 2 commits intoespressopp:masterfrom
songbin6280:RNG
May 1, 2019
Merged

add ability for RNG to restart from a prior state#283
jkrajniak merged 2 commits intoespressopp:masterfrom
songbin6280:RNG

Conversation

@songbin6280
Copy link
Copy Markdown
Contributor

I have added two functions to the RNG class so that it is possible to save the state RNG to a file and restart from the same state from the file.

Comment thread src/esutil/RNG.cpp
@@ -3,27 +3,32 @@
Max Planck Institute for Polymer Research
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update copyright

Comment thread src/esutil/RNG.cpp Outdated
return boostRNG;
}

void RNG::save_state(int step){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferr to use camelCase in C++ code

Comment thread src/esutil/RNG.cpp Outdated
void RNG::save_state(int step){
std::ostringstream oss;
oss << *boostRNG;
if ( mpiWorld->rank()!=0 ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, the convention is usually to have if (rank==0) { ....} else {....}

@songbin6280
Copy link
Copy Markdown
Contributor Author

Hello Jakub,

I have made requested changes to the code.

Best,
Bin

@jkrajniak jkrajniak merged commit 875fac0 into espressopp:master May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants