@@ -68,7 +68,7 @@ Custom simulators should implement this function.
68
68
run_loggers= false ,
69
69
rng= Random. default_rng ())
70
70
# @inline needed to avoid Enzyme error
71
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
71
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
72
72
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
73
73
E = potential_energy (sys, neighbors; n_threads= n_threads)
74
74
apply_loggers! (sys, neighbors, 0 , run_loggers; n_threads= n_threads, current_potential_energy= E)
@@ -89,7 +89,7 @@ Custom simulators should implement this function.
89
89
coords_copy .= sys. coords
90
90
sys. coords .+ = hn .* F ./ max_force
91
91
using_constraints && apply_position_constraints! (sys, coords_copy; n_threads= n_threads)
92
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
92
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
93
93
94
94
neighbors_copy = neighbors
95
95
neighbors = find_neighbors (sys, sys. neighbor_finder, neighbors, step_n;
145
145
n_threads:: Integer = Threads. nthreads (),
146
146
run_loggers= true ,
147
147
rng= Random. default_rng ())
148
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
148
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
149
149
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
150
150
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
151
151
forces_nounits_t = ustrip_vec .(zero (sys. coords))
172
172
sys. coords .+ = sys. velocities .* sim. dt .+ ((accels_t .* sim. dt .^ 2 ) ./ 2 )
173
173
using_constraints && apply_position_constraints! (sys, cons_coord_storage, cons_vel_storage,
174
174
sim. dt; n_threads= n_threads)
175
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
175
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
176
176
177
177
forces_nounits_t_dt .= forces_nounits! (forces_nounits_t_dt, sys, neighbors, forces_buffer,
178
178
step_n; n_threads= n_threads)
236
236
n_threads:: Integer = Threads. nthreads (),
237
237
run_loggers= true ,
238
238
rng= Random. default_rng ())
239
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
239
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
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)
268
268
sys. velocities .= (sys. coords .- cons_coord_storage) ./ sim. dt
269
269
end
270
270
271
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
271
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
272
272
273
273
if ! iszero (sim. remove_CM_motion) && step_n % sim. remove_CM_motion == 0
274
274
remove_CM_motion! (sys)
@@ -312,7 +312,7 @@ StormerVerlet(; dt, coupling=NoCoupling()) = StormerVerlet(dt, coupling)
312
312
n_threads:: Integer = Threads. nthreads (),
313
313
run_loggers= true ,
314
314
rng= Random. default_rng ())
315
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
315
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
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
318
coords_last, coords_copy = zero (sys. coords), zero (sys. coords)
@@ -339,7 +339,7 @@ StormerVerlet(; dt, coupling=NoCoupling()) = StormerVerlet(dt, coupling)
339
339
340
340
using_constraints && apply_position_constraints! (sys, coords_copy; n_threads= n_threads)
341
341
342
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
342
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
343
343
# This is accurate to O(dt)
344
344
sys. velocities .= vector .(coords_copy, sys. coords, (sys. boundary,)) ./ sim. dt
345
345
396
396
n_threads:: Integer = Threads. nthreads (),
397
397
run_loggers= true ,
398
398
rng= Random. default_rng ())
399
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
399
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
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)
432
432
433
433
using_constraints && apply_position_constraints! (sys, cons_coord_storage, cons_vel_storage,
434
434
sim. dt; n_threads= n_threads)
435
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
435
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
436
436
437
437
if ! iszero (sim. remove_CM_motion) && step_n % sim. remove_CM_motion == 0
438
438
remove_CM_motion! (sys)
504
504
α_eff = exp .(- sim. friction * sim. dt .* M_inv / count (' O' , sim. splitting))
505
505
σ_eff = sqrt .((1 * unit (eltype (α_eff))) .- (α_eff .^ 2 ))
506
506
507
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
507
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
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)
553
553
step! (args... , neighbors, step_n)
554
554
end
555
555
556
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
556
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
557
557
if ! iszero (sim. remove_CM_motion) && step_n % sim. remove_CM_motion == 0
558
558
remove_CM_motion! (sys)
559
559
end
568
568
569
569
function A_step! (sys, dt_eff, neighbors, step_n)
570
570
sys. coords .+ = sys. velocities .* dt_eff
571
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
571
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
572
572
return sys
573
573
end
574
574
626
626
@warn " OverdampedLangevin is not currently compatible with constraints, " *
627
627
" constraints will be ignored"
628
628
end
629
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
629
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
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)
644
644
645
645
random_velocities! (noise, sys, sim. temperature; rng= rng)
646
646
sys. coords .+ = (accels_t ./ sim. friction) .* sim. dt .+ sqrt ((2 / sim. friction) * sim. dt) .* noise
647
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
647
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
648
648
649
649
if ! iszero (sim. remove_CM_motion) && step_n % sim. remove_CM_motion == 0
650
650
remove_CM_motion! (sys)
701
701
@warn " NoseHoover is not currently compatible with constraints, " *
702
702
" constraints will be ignored"
703
703
end
704
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
704
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
705
705
! iszero (sim. remove_CM_motion) && remove_CM_motion! (sys)
706
706
neighbors = find_neighbors (sys, sys. neighbor_finder; n_threads= n_threads)
707
707
forces_nounits_t = ustrip_vec .(zero (sys. coords))
721
721
v_half .= sys. velocities .+ (accels_t .- (sys. velocities .* zeta)) .* (sim. dt ./ 2 )
722
722
723
723
sys. coords .+ = v_half .* sim. dt
724
- sys. coords . = wrap_coords .(sys. coords, (sys. boundary,))
724
+ sys. coords, sys . img_flags . = wrap_coords .(sys. coords, (sys. boundary,), sys . img_flags )
725
725
726
726
zeta_half = zeta + (sim. dt / (2 * (sim. damping^ 2 ))) *
727
727
((temperature (sys) / sim. temperature) - 1 )
0 commit comments