@@ -75,8 +75,8 @@ Custom simulators should implement this function.
75
75
using_constraints = length (sys. constraints) > 0
76
76
println (sim. log_stream, " Step 0 - potential energy " , E, " - max force N/A - N/A" )
77
77
hn = sim. step_size
78
- coords_copy = similar (sys. coords)
79
- F_nounits = ustrip_vec .(similar (sys. coords))
78
+ coords_copy = zero (sys. coords)
79
+ F_nounits = ustrip_vec .(zero (sys. coords))
80
80
F = F_nounits .* sys. force_units
81
81
forces_buffer = init_forces_buffer! (sys, F_nounits, n_threads)
82
82
@@ -150,18 +150,18 @@ end
150
150
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
151
151
forces_nounits_t = ustrip_vec .(zero (sys. coords))
152
152
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
153
- forces_nounits_t = forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
154
- n_threads= n_threads)
153
+ forces_nounits_t . = forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
154
+ n_threads= n_threads)
155
155
forces_t = forces_nounits_t .* sys. force_units
156
156
accels_t = forces_t ./ masses (sys)
157
- forces_nounits_t_dt = ustrip_vec .(similar (sys. coords))
157
+ forces_nounits_t_dt = ustrip_vec .(zero (sys. coords))
158
158
forces_t_dt = forces_nounits_t_dt .* sys. force_units
159
159
accels_t_dt = zero (accels_t)
160
160
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads, current_forces= forces_t)
161
161
using_constraints = length (sys. constraints) > 0
162
162
if using_constraints
163
- cons_coord_storage = similar (sys. coords)
164
- cons_vel_storage = similar (sys. velocities)
163
+ cons_coord_storage = zero (sys. coords)
164
+ cons_vel_storage = zero (sys. velocities)
165
165
end
166
166
167
167
for step_n in 1 : n_steps
@@ -240,13 +240,13 @@ end
240
240
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
241
241
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
242
242
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
243
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
243
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
244
244
forces_t = forces_nounits_t .* sys. force_units
245
245
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
246
246
accels_t = forces_t ./ masses (sys)
247
247
using_constraints = length (sys. constraints) > 0
248
248
if using_constraints
249
- cons_coord_storage = similar (sys. coords)
249
+ cons_coord_storage = zero (sys. coords)
250
250
end
251
251
252
252
for step_n in 1 : n_steps
@@ -315,8 +315,8 @@ StormerVerlet(; dt, coupling=NoCoupling()) = StormerVerlet(dt, coupling)
315
315
sys. coords .= wrap_coords .(sys. coords, (sys. boundary,))
316
316
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
317
317
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
318
- coords_last, coords_copy = similar (sys. coords), similar (sys. coords)
319
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
318
+ coords_last, coords_copy = zero (sys. coords), zero (sys. coords)
319
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
320
320
forces_t = forces_nounits_t .* sys. force_units
321
321
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
322
322
accels_t = forces_t ./ masses (sys)
@@ -400,15 +400,15 @@ end
400
400
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
401
401
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
402
402
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
403
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
403
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
404
404
forces_t = forces_nounits_t .* sys. force_units
405
405
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
406
406
accels_t = forces_t ./ masses (sys)
407
- noise = similar (sys. velocities)
407
+ noise = zero (sys. velocities)
408
408
using_constraints = length (sys. constraints) > 0
409
409
if using_constraints
410
- cons_coord_storage = similar (sys. coords)
411
- cons_vel_storage = similar (sys. velocities)
410
+ cons_coord_storage = zero (sys. coords)
411
+ cons_vel_storage = zero (sys. velocities)
412
412
end
413
413
414
414
for step_n in 1 : n_steps
@@ -508,11 +508,13 @@ end
508
508
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
509
509
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
510
510
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
511
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
512
- forces_t = forces_nounits_t .* sys. force_units
511
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
513
512
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
513
+ forces_nounits_t .= forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
514
+ n_threads= n_threads)
515
+ forces_t = forces_nounits_t .* sys. force_units
514
516
accels_t = forces_t ./ masses (sys)
515
- noise = similar (sys. velocities)
517
+ noise = zero (sys. velocities)
516
518
517
519
effective_dts = [sim. dt / count (c, sim. splitting) for c in sim. splitting]
518
520
@@ -628,11 +630,11 @@ end
628
630
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
629
631
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
630
632
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
631
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
633
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
632
634
forces_t = forces_nounits_t .* sys. force_units
633
635
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
634
636
accels_t = forces_t ./ masses (sys)
635
- noise = similar (sys. velocities)
637
+ noise = zero (sys. velocities)
636
638
637
639
for step_n in 1 : n_steps
638
640
forces_nounits_t .= forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, step_n;
@@ -704,11 +706,11 @@ end
704
706
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
705
707
forces_nounits_t = ustrip_vec .(zero (sys. coords))
706
708
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
707
- forces_nounits_t = forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
708
- n_threads= n_threads)
709
+ forces_nounits_t . = forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
710
+ n_threads= n_threads)
709
711
forces_t = forces_nounits_t .* sys. force_units
710
712
accels_t = forces_t ./ masses (sys)
711
- forces_nounits_t_dt = ustrip_vec .(similar (sys. coords))
713
+ forces_nounits_t_dt = ustrip_vec .(zero (sys. coords))
712
714
forces_t_dt = forces_nounits_t_dt .* sys. force_units
713
715
accels_t_dt = zero (accels_t)
714
716
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads, current_forces= forces_t)
@@ -1062,7 +1064,7 @@ end
1062
1064
rng= Random. default_rng ())
1063
1065
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
1064
1066
E_old = potential_energy (sys, neighbors; n_threads= n_threads)
1065
- coords_old = similar (sys. coords)
1067
+ coords_old = zero (sys. coords)
1066
1068
1067
1069
for step_n in 1 : n_steps
1068
1070
coords_old .= sys. coords
0 commit comments