File tree 9 files changed +28
-35
lines changed
9 files changed +28
-35
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ hdf5-sys = { version = "0.7", optional = true }
36
36
approx = " 0.4"
37
37
criterion = " 0.3"
38
38
nalgebra = " 0.26"
39
+ serial_test = " 0.5"
39
40
velvet-test-utils = { path = " crates/velvet-test-utils" }
40
41
41
42
[features ]
@@ -55,7 +56,10 @@ rayon = [
55
56
]
56
57
57
58
[package .metadata .docs .rs ]
58
- features = [" hdf5-sys/static" , " hdf5-sys/zlib" ]
59
+ features = [
60
+ " hdf5-sys/static" ,
61
+ " hdf5-sys/zlib"
62
+ ]
59
63
60
64
[[bench ]]
61
65
name = " argon-benchmarks"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ repository = "https://github.com/seatonullberg/velvet"
8
8
edition = " 2018"
9
9
10
10
[dependencies ]
11
+ indicatif = " 0.15"
11
12
nalgebra = " 0.26"
12
13
rand = " 0.7"
13
14
rand_distr = " 0.3"
Original file line number Diff line number Diff line change 1
1
//! High level abstraction for an atomistic simulation.
2
2
3
+ use indicatif:: { ProgressBar , ProgressStyle , ProgressDrawTarget } ;
4
+
3
5
use crate :: config:: Configuration ;
4
6
use crate :: potentials:: Potentials ;
5
7
use crate :: propagators:: Propagator ;
@@ -40,6 +42,11 @@ impl Simulation {
40
42
// setup propagation
41
43
self . propagator . setup ( & mut self . system , & self . potentials ) ;
42
44
45
+ // setup progress bar
46
+ let pb = ProgressBar :: new ( steps as u64 ) ;
47
+ pb. set_style ( ProgressStyle :: default_bar ( )
48
+ . template ( "[{eta_precise}] {bar:40.cyan/blue} {pos:>7} /{len:>7} steps" ) ) ;
49
+
43
50
// start iteration loop
44
51
for i in 0 ..steps {
45
52
// do one propagation step
@@ -72,8 +79,10 @@ impl Simulation {
72
79
}
73
80
}
74
81
}
75
- }
82
+ }
83
+ pb. inc ( 1 ) ;
76
84
}
85
+ pb. finish ( ) ;
77
86
}
78
87
79
88
/// Consume the simulation and return its [`System`] and [`Potentials`].
Original file line number Diff line number Diff line change @@ -26,16 +26,7 @@ fn main() {
26
26
// Run MD with no thermostat to simulate the NVE ensemble.
27
27
let md = MolecularDynamics :: new ( velocity_verlet, NullThermostat ) ;
28
28
29
- // Create an output group which writes scalar properties to stderr (the default destination).
30
- let stderr_group = RawOutputGroupBuilder :: new ( )
31
- . interval ( 100 )
32
- . output ( PotentialEnergy )
33
- . output ( KineticEnergy )
34
- . output ( TotalEnergy )
35
- . output ( Temperature )
36
- . build ( ) ;
37
-
38
- // Write the same outputs to a file for post-processing.
29
+ // Create an output group which writes scalar properties to a file for post-processing.
39
30
let file_group = RawOutputGroupBuilder :: new ( )
40
31
. destination ( std:: fs:: File :: create ( "argon.txt" ) . unwrap ( ) )
41
32
. interval ( 100 )
@@ -47,7 +38,6 @@ fn main() {
47
38
48
39
// Build the configuration.
49
40
let config = ConfigurationBuilder :: new ( )
50
- . raw_output_group ( stderr_group)
51
41
. raw_output_group ( file_group)
52
42
. build ( ) ;
53
43
Original file line number Diff line number Diff line change @@ -36,16 +36,7 @@ fn main() {
36
36
// Run MD with a Nose-Hoover thermostat to simulate the NVT ensemble.
37
37
let md = MolecularDynamics :: new ( velocity_verlet, nose_hoover) ;
38
38
39
- // Create an output group which writes scalar properties to stderr (the default destination).
40
- let stderr_group = RawOutputGroupBuilder :: new ( )
41
- . interval ( 100 )
42
- . output ( PotentialEnergy )
43
- . output ( KineticEnergy )
44
- . output ( TotalEnergy )
45
- . output ( Temperature )
46
- . build ( ) ;
47
-
48
- // Write the same outputs to a file for post-processing.
39
+ // Create an output group which writes scalar properties to a file for post-processing.
49
40
let file_group = RawOutputGroupBuilder :: new ( )
50
41
. destination ( std:: fs:: File :: create ( "binary-gas.txt" ) . unwrap ( ) )
51
42
. interval ( 100 )
@@ -57,7 +48,6 @@ fn main() {
57
48
58
49
// Build the configuration.
59
50
let config = ConfigurationBuilder :: new ( )
60
- . raw_output_group ( stderr_group)
61
51
. raw_output_group ( file_group)
62
52
. build ( ) ;
63
53
Original file line number Diff line number Diff line change @@ -39,16 +39,7 @@ fn main() {
39
39
// Run MD with a Nose-Hoover thermostat to simulate the NVT ensemble.
40
40
let md = MolecularDynamics :: new ( velocity_verlet, nose_hoover) ;
41
41
42
- // Create an output group which writes scalar properties to stderr (the default destination).
43
- let stderr_group = RawOutputGroupBuilder :: new ( )
44
- . interval ( 100 )
45
- . output ( PotentialEnergy )
46
- . output ( KineticEnergy )
47
- . output ( TotalEnergy )
48
- . output ( Temperature )
49
- . build ( ) ;
50
-
51
- // Write the same outputs to a file for post-processing.
42
+ // Create an output group which writes scalar properties to a file for post-processing.
52
43
let file_group = RawOutputGroupBuilder :: new ( )
53
44
. destination ( std:: fs:: File :: create ( "magnesium-oxide.txt" ) . unwrap ( ) )
54
45
. interval ( 100 )
@@ -60,7 +51,6 @@ fn main() {
60
51
61
52
// Build the configuration.
62
53
let config = ConfigurationBuilder :: new ( )
63
- . raw_output_group ( stderr_group)
64
54
. raw_output_group ( file_group)
65
55
. build ( ) ;
66
56
Original file line number Diff line number Diff line change 1
1
use approx:: * ;
2
+ use serial_test:: serial;
2
3
3
4
use velvet:: prelude:: * ;
4
5
use velvet_test_utils as test_utils;
5
6
6
7
static ITERATIONS : usize = 10_000 ;
7
8
8
9
#[ test]
10
+ #[ serial]
9
11
fn nve ( ) {
10
12
let system = test_utils:: argon_system ( ) ;
11
13
let potentials = test_utils:: argon_potentials ( ) ;
@@ -37,6 +39,7 @@ fn nve() {
37
39
}
38
40
39
41
#[ test]
42
+ #[ serial]
40
43
fn nvt ( ) {
41
44
let system = test_utils:: argon_system ( ) ;
42
45
let potentials = test_utils:: argon_potentials ( ) ;
Original file line number Diff line number Diff line change 1
1
use approx:: * ;
2
+ use serial_test:: serial;
2
3
3
4
use velvet:: prelude:: * ;
4
5
use velvet_test_utils as test_utils;
5
6
6
7
static ITERATIONS : usize = 10_000 ;
7
8
8
9
#[ test]
10
+ #[ serial]
9
11
fn nve ( ) {
10
12
let system = test_utils:: binary_gas_system ( ) ;
11
13
let potentials = test_utils:: binary_gas_potentials ( ) ;
@@ -37,6 +39,7 @@ fn nve() {
37
39
}
38
40
39
41
#[ test]
42
+ #[ serial]
40
43
fn nvt ( ) {
41
44
let system = test_utils:: binary_gas_system ( ) ;
42
45
let potentials = test_utils:: binary_gas_potentials ( ) ;
Original file line number Diff line number Diff line change 1
1
use approx:: * ;
2
+ use serial_test:: serial;
2
3
3
4
use velvet:: prelude:: * ;
4
5
use velvet_test_utils as test_utils;
5
6
6
7
static ITERATIONS : usize = 10_000 ;
7
8
8
9
#[ test]
10
+ #[ serial]
9
11
fn nve ( ) {
10
12
let system = test_utils:: xenon_system ( ) ;
11
13
let potentials = test_utils:: xenon_potentials ( ) ;
@@ -37,6 +39,7 @@ fn nve() {
37
39
}
38
40
39
41
#[ test]
42
+ #[ serial]
40
43
fn nvt ( ) {
41
44
let system = test_utils:: xenon_system ( ) ;
42
45
let potentials = test_utils:: xenon_potentials ( ) ;
You can’t perform that action at this time.
0 commit comments