Position-based fluids

Example of the deeptime.data.position_based_fluids() simulation engine.

 8 import numpy as np
 9 import matplotlib.pyplot as plt
10
11 from deeptime.data import position_based_fluids
12
13 init_pos_x = np.arange(-12, 12, 1.4).astype(np.float32)
14 init_pos_y = np.arange(-12, 0, 1.4).astype(np.float32)
15 initial_positions = np.dstack(np.meshgrid(init_pos_x, init_pos_y)).reshape(-1, 2)
16
17 pbf = position_based_fluids(n_burn_in=0, n_jobs=8, initial_positions=initial_positions)
18 ftraj = pbf.simulate_oscillatory_force(2, n_steps=400)
19 ani = pbf.make_animation(ftraj, agg_backend=False, figsize=(6, 4), stride=5)
20 plt.show()

Total running time of the script: ( 0 minutes 32.788 seconds)

Estimated memory usage: 10 MB