@@ -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
@@ -154,14 +154,14 @@ end
154
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,13 +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))
511
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
512
512
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
513
513
forces_nounits_t .= forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, 0 ;
514
514
n_threads= n_threads)
515
515
forces_t = forces_nounits_t .* sys. force_units
516
516
accels_t = forces_t ./ masses (sys)
517
- noise = similar (sys. velocities)
517
+ noise = zero (sys. velocities)
518
518
519
519
effective_dts = [sim. dt / count (c, sim. splitting) for c in sim. splitting]
520
520
@@ -630,11 +630,11 @@ end
630
630
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
631
631
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
632
632
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads)
633
- forces_nounits_t = ustrip_vec .(similar (sys. coords))
633
+ forces_nounits_t = ustrip_vec .(zero (sys. coords))
634
634
forces_t = forces_nounits_t .* sys. force_units
635
635
forces_buffer = init_forces_buffer! (sys, forces_nounits_t, n_threads)
636
636
accels_t = forces_t ./ masses (sys)
637
- noise = similar (sys. velocities)
637
+ noise = zero (sys. velocities)
638
638
639
639
for step_n in 1 : n_steps
640
640
forces_nounits_t .= forces_nounits! (forces_nounits_t, sys, neighbors, forces_buffer, step_n;
710
710
n_threads= n_threads)
711
711
forces_t = forces_nounits_t .* sys. force_units
712
712
accels_t = forces_t ./ masses (sys)
713
- forces_nounits_t_dt = ustrip_vec .(similar (sys. coords))
713
+ forces_nounits_t_dt = ustrip_vec .(zero (sys. coords))
714
714
forces_t_dt = forces_nounits_t_dt .* sys. force_units
715
715
accels_t_dt = zero (accels_t)
716
716
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads, current_forces= forces_t)
@@ -1064,7 +1064,7 @@ end
1064
1064
rng= Random. default_rng ())
1065
1065
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
1066
1066
E_old = potential_energy (sys, neighbors; n_threads= n_threads)
1067
- coords_old = similar (sys. coords)
1067
+ coords_old = zero (sys. coords)
1068
1068
1069
1069
for step_n in 1 : n_steps
1070
1070
coords_old .= sys. coords
0 commit comments