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

Remove ESPResSo system seed mechanism #3482

Merged
merged 7 commits into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions doc/doxygen/bibliography.bib
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,20 @@ @Article{neumann85b
doi = {10.1063/1.448553},
}

@article{panneton06a,
author = {Panneton, Fran\c{c}ois and L'Ecuyer, Pierre and Matsumoto, Makoto},
title = {Improved long-period generators based on linear recurrences modulo 2},
year = {2006},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {32},
number = {1},
issn = {0098-3500},
doi = {10.1145/1132973.1132974},
journal = {ACM Transactions on Mathematical Software (TOMS)},
pages = {1-16},
}

@Book{Pottier2010,
title={{Nonequilibrium Statistical Physics}},
subtitle={{Linear Irreversible Processes}},
Expand Down
5 changes: 2 additions & 3 deletions doc/tutorials/01-lennard_jones/01-lennard_jones.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The next step would be to create an instance of the System class and to seed espresso. This instance is used as a handle to the simulation system. At any time, only one instance of the System class can exist."
"The next step would be to create an instance of the System class. This instance is used as a handle to the simulation system. At any time, only one instance of the System class can exist."
]
},
{
Expand All @@ -177,8 +177,7 @@
"metadata": {},
"outputs": [],
"source": [
"system = espressomd.System(box_l=BOX_L)\n",
"system.seed = 42"
"system = espressomd.System(box_l=BOX_L)"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/02-charged_system/02-charged_system-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"# Setup System\n",
"box_l = (n_part / density)**(1. / 3.)\n",
"system = System(box_l=[box_l, box_l, box_l])\n",
"system.seed = 42\n",
"system.periodicity = [True, True, True]\n",
"system.time_step = time_step\n",
"system.cell_system.skin = 0.3"
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/02-charged_system/02-charged_system-2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
"box_z = box_l + 2.0 * (lj_sigmas[\"Electrode\"] + wall_margin)\n",
"elc_gap = box_z * 0.15\n",
"system = System(box_l=[box_l, box_l, box_z + elc_gap])\n",
"system.seed = 42\n",
"box_volume = numpy.prod([box_l, box_l, box_z])\n",
"\n",
"system.periodicity = [True, True, True]\n",
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/02-charged_system/scripts/nacl.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
# Setup System
box_l = (n_part / density)**(1. / 3.)
system = espressomd.System(box_l=[box_l] * 3)
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
system.periodicity = [True, True, True]
system.time_step = time_step
system.cell_system.skin = 0.3
Expand Down
3 changes: 1 addition & 2 deletions doc/tutorials/02-charged_system/scripts/nacl_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
assert_features(["ELECTROSTATICS", "MASS", "LENNARD_JONES"])

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
numpy.random.seed(system.seed)
numpy.random.seed(seed=42)

print("\n--->Setup system")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
assert_features(["ELECTROSTATICS", "MASS", "LENNARD_JONES"])

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
numpy.random.seed(system.seed)
numpy.random.seed(seed=42)

print("\n--->Setup system")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
assert_features(["ELECTROSTATICS", "MASS", "LENNARD_JONES"])

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
numpy.random.seed(system.seed)
numpy.random.seed(seed=42)

print("\n--->Setup system")

Expand Down
3 changes: 1 addition & 2 deletions doc/tutorials/02-charged_system/scripts/nacl_units_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
assert_features(["ELECTROSTATICS", "MASS", "LENNARD_JONES"])

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
numpy.random.seed(system.seed)
numpy.random.seed(seed=42)

visualizer = visualization_opengl.openGLLive(
system,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"# System setup\n",
"#############################################################\n",
"system = espressomd.System(box_l=[box_l] * 3)\n",
"system.set_random_state_PRNG()\n",
"system.time_step = time_step"
]
},
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/06-active_matter/EXERCISES/flow_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
TIME_STEP = 0.01

system = espressomd.System(box_l=[LENGTH, LENGTH, LENGTH])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
system.cell_system.skin = 0.3
system.time_step = TIME_STEP
system.min_global_cut = 1.0
Expand Down
1 change: 0 additions & 1 deletion doc/tutorials/08-visualization/08-visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"\n",
"# integration parameters\n",
"system = espressomd.System(box_l=[box_l, box_l, box_l])\n",
"system.seed = system.cell_system.get_state()['n_nodes'] * [1234]\n",
"system.time_step = 0.0001\n",
"system.cell_system.skin = 0.4\n",
"system.thermostat.set_langevin(kT=1.0, gamma=1.0, seed=42)\n",
Expand Down
3 changes: 1 addition & 2 deletions maintainer/benchmarks/ferrofluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@

# PRNG seeds
#############################################################
system.random_number_generator_state = list(range(
n_proc * (system._get_PRNG_state_size() + 1)))
# np.random.seed(1)

# Integration parameters
#############################################################
system.time_step = 0.01
Expand Down
2 changes: 0 additions & 2 deletions maintainer/benchmarks/lj.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@

# PRNG seeds
#############################################################
system.random_number_generator_state = list(range(
n_proc * (system._get_PRNG_state_size() + 1)))
# np.random.seed(1)

# Integration parameters
Expand Down
4 changes: 2 additions & 2 deletions maintainer/benchmarks/p3m.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@

# PRNG seeds
#############################################################
system.random_number_generator_state = list(range(
n_proc * (system._get_PRNG_state_size() + 1)))
# np.random.seed(1)

# Integration parameters
#############################################################
system.time_step = 0.01
Expand Down
4 changes: 1 addition & 3 deletions samples/MDAnalysisIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
# set up a minimal sample system

system = espressomd.System(box_l=[10.0, 10.0, 10.0])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.001
system.cell_system.skin = 0.1
Expand Down
1 change: 0 additions & 1 deletion samples/billiard.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

# ESPRESSO
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
table_dim = [2.24, 1.12]
system.box_l = [table_dim[0], 3, table_dim[1]]

Expand Down
1 change: 0 additions & 1 deletion samples/chamber_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

box = np.array([1500.0, 500.0, 150.0])
system = espressomd.System(box_l=box)
system.set_random_state_PRNG()

# PARAMETERS

Expand Down
5 changes: 1 addition & 4 deletions samples/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@

box_l = 50.0
system = espressomd.System(box_l=[box_l] * 3)
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)

# if no seed is provided espresso generates a seed
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 10.0
Expand Down
4 changes: 1 addition & 3 deletions samples/diffusion_coefficient.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
dt = 0.05

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

p = system.part.add(pos=(0, 0, 0), id=0)
system.time_step = dt
Expand Down
4 changes: 1 addition & 3 deletions samples/dpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@

# Activate the thermostat
system.thermostat.set_dpd(kT=kT, seed=123)
system.set_random_state_PRNG()
np.random.seed(seed=system.seed)
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=42)

# Set up the DPD friction interaction
system.non_bonded_inter[0, 0].dpd.set_params(
Expand Down
1 change: 0 additions & 1 deletion samples/drude_bmimpf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@

system = espressomd.System(box_l=[box_l, box_l, box_l])
system.virtual_sites = VirtualSitesRelative(have_velocity=True)
system.set_random_state_PRNG()

if args.visu:
d_scale = 0.988 * 0.5
Expand Down
2 changes: 0 additions & 2 deletions samples/ekboundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import os

system = System(box_l=[10, 10, 10])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]

system.cell_system.skin = 0.4
system.time_step = 0.1
Expand Down
4 changes: 1 addition & 3 deletions samples/espresso_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@

box_l = 50
system = espressomd.System(box_l=[box_l, 15, box_l])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

yoff = 3

Expand Down
4 changes: 1 addition & 3 deletions samples/grand_canonical.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l, box_l, box_l])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
2 changes: 0 additions & 2 deletions samples/h5md.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
from espressomd import interactions

system = espressomd.System(box_l=[100.0, 100.0, 100.0])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]

system.time_step = 0.01
system.thermostat.set_langevin(kT=1.0, gamma=1.0, seed=42)
Expand Down
1 change: 0 additions & 1 deletion samples/lbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

box_l = 50
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()

system.time_step = 0.01
system.cell_system.skin = 0.1
Expand Down
2 changes: 0 additions & 2 deletions samples/lj-demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l, box_l, box_l])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/lj_liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/lj_liquid_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/lj_liquid_structurefactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/load_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
print("\n### Integrate until user presses ctrl+c ###")
print("Integrating...")

system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)
while True:
system.integrator.run(1000)
4 changes: 1 addition & 3 deletions samples/minimal-charged-particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/minimal-diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
#############################################################

system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.set_random_state_PRNG()
system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.seed = system.seed
np.random.seed(seed=42)
system.time_step = 0.01
system.cell_system.skin = 0.4
system.cell_system.set_n_square(use_verlet_lists=False)
Expand Down
4 changes: 1 addition & 3 deletions samples/minimal-polymer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
#############################################################

system = espressomd.System(box_l=[100, 100, 100])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/observables_correlators.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

# System setup
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.part.add(pos=(0, 0, 0), v=(1, 2, 3))
system.time_step = 0.01
Expand Down
4 changes: 1 addition & 3 deletions samples/p3m.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.01
system.cell_system.skin = 0.4
Expand Down
4 changes: 1 addition & 3 deletions samples/reaction_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
# Integration parameters
#############################################################
system = espressomd.System(box_l=[box_l] * 3)
system.set_random_state_PRNG()
#system.seed = system.cell_system.get_state()['n_nodes'] * [1234]
np.random.seed(seed=system.seed)
np.random.seed(seed=42)

system.time_step = 0.02
system.cell_system.skin = 0.4
Expand Down
Loading