Skip to content

Commit

Permalink
small code style change
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed May 14, 2024
1 parent e2fd8a7 commit 31066aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/mddf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function mddf(
Threads.@threads for frame_range in ChunkSplitters.chunks(to_read_frames; n=nchunks)
# Local data structures for this chunk
R_chunk = Result(trajectory, options; trajectory_data, frame_weights)
system_chunk = setup_ParticleSystem(trajectory, trajectory_data.unitcell, options)
system_chunk = ParticleSystem(trajectory, trajectory_data.unitcell, options)
buff_chunk = Buffer(trajectory, R)
# Reset the number of frames read by each chunk
R_chunk.files[1].nframes_read = 0
Expand Down
15 changes: 6 additions & 9 deletions src/minimum_distances.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,17 @@ function minimum_distances!(
end

#=
setup_ParticleSystem(trajectory::Trajectory, options::Options)
ParticleSystem(trajectory::Trajectory, options::Options)
Setup the periodic system from CellListMap, to compute minimimum distances. The system
will be setup such that `xpositions` corresponds to one molecule of the solute, and
`ypositions` contains all coordinates of all atoms of the solvent.
=#
function setup_ParticleSystem(trajectory::Trajectory, unitcell, options::Options)
function CellListMap.ParticleSystem(trajectory::Trajectory, unitcell, options::Options)
system = ParticleSystem(
xpositions = zeros(SVector{3,Float64}, trajectory.solute.natomspermol),
ypositions = zeros(
SVector{3,Float64},
trajectory.solvent.nmols * trajectory.solvent.natomspermol,
),
ypositions = zeros(SVector{3,Float64}, trajectory.solvent.nmols * trajectory.solvent.natomspermol),
unitcell = unitcell,
cutoff = options.usecutoff ? options.cutoff : options.dbulk,
output = fill(zero(MinimumDistance), trajectory.solvent.nmols),
Expand All @@ -182,7 +179,7 @@ function setup_ParticleSystem(trajectory::Trajectory, unitcell, options::Options
return system
end

@testitem "setup_ParticleSystem" begin
@testitem "build ParticleSystem" begin
using ComplexMixtures
using PDBTools
using ComplexMixtures.Testing
Expand All @@ -197,7 +194,7 @@ end
protein = AtomSelection(select(atoms, "protein"), nmols = 1)
traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao)
tmeta = ComplexMixtures.TrajectoryMetaData(traj, options)
system = ComplexMixtures.setup_ParticleSystem(traj, tmeta.unitcell, options)
system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options)
@test system.cutoff == 10.0
@test system.list == fill(zero(ComplexMixtures.MinimumDistance), 181)
@test system.output == fill(zero(ComplexMixtures.MinimumDistance), 181)
Expand All @@ -213,7 +210,7 @@ end
# Auto-correlation
traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", tmao)
tmeta = ComplexMixtures.TrajectoryMetaData(traj, options)
system = ComplexMixtures.setup_ParticleSystem(traj, tmeta.unitcell, options)
system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options)
@test system.cutoff == 10.0
@test system.list == fill(zero(ComplexMixtures.MinimumDistance), 181) # one molecule less
@test system.output == fill(zero(ComplexMixtures.MinimumDistance), 181)
Expand Down
2 changes: 1 addition & 1 deletion test/allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@test t_RNG.allocs < 5

tmeta = ComplexMixtures.TrajectoryMetaData(traj, options)
system = ComplexMixtures.setup_ParticleSystem(traj, tmeta.unitcell, options)
system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options)
buff = ComplexMixtures.Buffer(traj, R)
@. buff.solute_read = traj.x_solute
@. buff.solvent_read = traj.x_solvent
Expand Down

0 comments on commit 31066aa

Please sign in to comment.