From 44b8d2344a61192af9ed5ae578e4082a44d86316 Mon Sep 17 00:00:00 2001 From: Leandro Martinez Date: Wed, 27 Nov 2024 09:13:16 -0300 Subject: [PATCH] format all code --- docs/make.jl | 16 +-- src/AtomSelection.jl | 155 +++++++++++++------------ src/ComplexMixtures.jl | 4 +- src/Options.jl | 72 ++++++------ src/Trajectory.jl | 57 +++++----- src/compare.jl | 12 +- src/io.jl | 2 +- src/mddf.jl | 60 +++++----- src/minimum_distances.jl | 40 +++---- src/parallel_setup.jl | 2 +- src/precompile.jl | 6 +- src/results.jl | 168 ++++++++++++++-------------- src/rigid_body.jl | 16 +-- src/tools/contributions.jl | 2 +- src/tools/coordination_number.jl | 8 +- src/tools/gr.jl | 8 +- src/tools/grid3D.jl | 76 ++++++------- src/tools/plotting.jl | 2 +- src/tools/residue_contributions.jl | 34 +++--- src/tools/write.jl | 88 +++++++-------- src/trajectory_formats/ChemFiles.jl | 22 ++-- src/trajectory_formats/NamdDCD.jl | 6 +- src/update_counters.jl | 6 +- test/allocations.jl | 38 +++---- test/benchmark.jl | 10 +- test/gromacs.jl | 18 +-- test/namd.jl | 22 ++-- test/namd_chemfiles.jl | 30 ++--- test/pdb.jl | 16 +-- test/runtests.jl | 2 +- 30 files changed, 498 insertions(+), 500 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 40f2e2a90..b537d7a59 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,12 +6,12 @@ using PDBTools using Plots push!(LOAD_PATH, "../src/") makedocs( - modules = [ - ComplexMixtures, + modules=[ + ComplexMixtures, isdefined(Base, :get_extension) ? Base.get_extension(ComplexMixtures, :Plotting) : ComplexMixtures.Plotting, ], - sitename = "ComplexMixtures.jl", - pages = [ + sitename="ComplexMixtures.jl", + pages=[ "Introduction" => "index.md", "Installation" => "installation.md", "Parallel execution" => "parallel.md", @@ -35,8 +35,8 @@ makedocs( ], ) deploydocs( - repo = "github.com/m3g/ComplexMixtures.jl.git", - target = "build", - branch = "gh-pages", - versions = ["stable" => "v^", "v#.#"], + repo="github.com/m3g/ComplexMixtures.jl.git", + target="build", + branch="gh-pages", + versions=["stable" => "v^", "v#.#"], ) diff --git a/src/AtomSelection.jl b/src/AtomSelection.jl index 447bf120f..3f8f89188 100644 --- a/src/AtomSelection.jl +++ b/src/AtomSelection.jl @@ -55,12 +55,12 @@ $(TYPEDFIELDS) custom_groups::Bool group_atom_indices::Vector{Vector{Int}} # Group (or atom) names. - group_names::Vector{String} + group_names::Vector{String} end # AtomSelection show functions function Base.show(io::IO, atsel::AtomSelection) - (; nmols, natomspermol, custom_groups, group_atom_indices) = atsel + (; nmols, natomspermol, custom_groups, group_atom_indices) = atsel ngroups = custom_groups ? length(group_atom_indices) : natomspermol print(io, chomp( """ @@ -108,12 +108,12 @@ julia> atom_group_name(atsel, 1) ``` """ -function atom_group(atsel::AtomSelection, i::Integer) - atsel.custom_groups || _error_custom_groups() +function atom_group(atsel::AtomSelection, i::Integer) + atsel.custom_groups || _error_custom_groups() atsel.group_atom_indices[i] end -function atom_group(atsel::AtomSelection, group_name::String) - atsel.custom_groups || _error_custom_groups() +function atom_group(atsel::AtomSelection, group_name::String) + atsel.custom_groups || _error_custom_groups() igroup = findfirst(==(group_name), atsel.group_names) if isnothing(igroup) throw(ArgumentError("""\n @@ -158,24 +158,24 @@ julia> atom_group_names(atsel) ``` """ -function atom_group_name(atsel::AtomSelection, i::Int) +function atom_group_name(atsel::AtomSelection, i::Int) atsel.group_names[i] end -@doc (@doc atom_group_name) function atom_group_names(atsel) +@doc (@doc atom_group_name) function atom_group_names(atsel) atsel.group_names end @testitem "atom_group" begin using ComplexMixtures - s = AtomSelection([1,2,3], nmols=1, group_names=["A","B"], group_atom_indices=[[1],[2,3]]) + s = AtomSelection([1, 2, 3], nmols=1, group_names=["A", "B"], group_atom_indices=[[1], [2, 3]]) @test atom_group(s, 1) == [1] @test atom_group(s, "A") == [1] - @test atom_group(s, 2) == [2,3] - @test atom_group(s, "B") == [2,3] + @test atom_group(s, 2) == [2, 3] + @test atom_group(s, "B") == [2, 3] @test atom_group_name(s, 1) == "A" @test atom_group_name(s, 2) == "B" @test_throws ArgumentError atom_group(s, "C") - s = AtomSelection([1,2,3], nmols=1) + s = AtomSelection([1, 2, 3], nmols=1) @test_throws ArgumentError atom_group(s, 1) @test_throws ArgumentError atom_group(s, "A") end @@ -278,7 +278,7 @@ AtomSelection ``` """ -function AtomSelection(args...; kargs...) +function AtomSelection(args...; kargs...) throw(ArgumentError("""\n No constructor for AtomSelection with these arguments. Please check the documentation. @@ -291,10 +291,10 @@ end # function AtomSelection( indices::Vector{<:Integer}; - nmols::Integer = 0, - natomspermol::Integer = 0, - group_atom_indices::AbstractVector{<:AbstractVector{<:Integer}} = Vector{Int}[], - group_names::AbstractVector{<:AbstractString} = String[] + nmols::Integer=0, + natomspermol::Integer=0, + group_atom_indices::AbstractVector{<:AbstractVector{<:Integer}}=Vector{Int}[], + group_names::AbstractVector{<:AbstractString}=String[] ) nmols, natomspermol = set_nmols_natomspermol(indices, nmols, natomspermol) @@ -320,17 +320,16 @@ function AtomSelection( Group indices are not sorted. The array will be sorted for faster search. """ - end _file=nothing _line=nothing + end _file = nothing _line = nothing sort!(inds) end # Check if the groups have only unique entries if !(allunique(inds)) throw(ArgumentError("""\n - Found repeated indices in custom group atom indices. The group atom indices must have unique entries. - + """)) end @@ -353,7 +352,7 @@ function AtomSelection( The group contributions will be only retrieved by the group indices. """ - end _file=nothing _line=nothing + end _file = nothing _line = nothing else if length(group_atom_indices) != length(group_names) throw(ArgumentError("""\n @@ -365,12 +364,12 @@ function AtomSelection( end return AtomSelection( - indices = indices, - nmols = nmols, - natomspermol = natomspermol, - custom_groups = custom_groups, - group_atom_indices = group_atom_indices, - group_names = group_names, + indices=indices, + nmols=nmols, + natomspermol=natomspermol, + custom_groups=custom_groups, + group_atom_indices=group_atom_indices, + group_names=group_names, ) end @@ -381,7 +380,7 @@ end pdbfile = ComplexMixtures.Testing.pdbfile atoms = readPDB(pdbfile, "protein and residue 2") indices = index.(atoms) - s = AtomSelection(indices, nmols = 1, natomspermol = 11) + s = AtomSelection(indices, nmols=1, natomspermol=11) @test s.indices == [12 + i for i = 1:11] @test s.group_names == String[] @test length(s.indices) == 11 @@ -390,7 +389,7 @@ end @test s.custom_groups == false @test s.group_names == String[] @test ComplexMixtures.natoms(s) == s.nmols * s.natomspermol - s = AtomSelection(indices, group_names = fill("C", length(indices)), nmols = 1, natomspermol = 11) + s = AtomSelection(indices, group_names=fill("C", length(indices)), nmols=1, natomspermol=11) @test s.custom_groups == false @test s.group_names == fill("C", length(indices)) @test_throws ArgumentError atom_group(s, "C") @@ -399,8 +398,8 @@ end # Test shuffled indices in the custom group atoms = readPDB(pdbfile, "protein") indices = index.(atoms) - s1 = AtomSelection(indices, nmols=1, group_atom_indices= [ findall(sel"resname ARG", atoms) ]) - s2 = AtomSelection(indices, nmols=1, group_atom_indices= [ shuffle!(findall(sel"resname ARG", atoms)) ]) + s1 = AtomSelection(indices, nmols=1, group_atom_indices=[findall(sel"resname ARG", atoms)]) + s2 = AtomSelection(indices, nmols=1, group_atom_indices=[shuffle!(findall(sel"resname ARG", atoms))]) @test atom_group(s1, 1) == atom_group(s2, 1) end @@ -409,58 +408,58 @@ end import ComplexMixtures #using ComplexMixtures: AtomSelection using PDBTools: select, readPDB, Select - @test_throws ArgumentError AtomSelection([1,2,3]) - @test_throws ArgumentError AtomSelection([1,2,3]; natomspermol=2) - @test_throws ArgumentError AtomSelection([1,2,3]; natomspermol=1, nmols=2) - @test_throws ArgumentError AtomSelection([1,2,3]; natomspermol=1, nmols=2) - @test_throws ArgumentError AtomSelection([1,2,3]; natomspermol=1, group_names=["A", "B"]) - @test_throws ArgumentError AtomSelection([1,2,3]; natomspermol=1, group_names=["A", "B", "C"]) - @test_throws ArgumentError AtomSelection(Int[], nmols = 1, natomspermol = 11) - - @test_throws ArgumentError AtomSelection([1,2,3], ["A", "B", "C"]) - @test_throws MethodError AtomSelection([1,2,3]; abc = 1) - @test_throws ArgumentError AtomSelection([1,2,3], ["A", "B", "C"]; nmols = 1) - @test_throws ArgumentError AtomSelection([1,2,3], natomspermol=1, group_atom_indices=[[1,2,2],[3]]) - @test_throws ArgumentError AtomSelection([1,2,3], nmols=1, group_names=["A","B"], group_atom_indices=[[1],[2,3],[2]]) - - @test_logs (:warn,) AtomSelection([1,2,3], natomspermol=1, group_atom_indices=[[1,2],[3]]) - @test_logs (:warn,) AtomSelection([1,2,3], natomspermol=1, group_atom_indices=[[2,1],[3]], group_names = ["A", "B"]) + @test_throws ArgumentError AtomSelection([1, 2, 3]) + @test_throws ArgumentError AtomSelection([1, 2, 3]; natomspermol=2) + @test_throws ArgumentError AtomSelection([1, 2, 3]; natomspermol=1, nmols=2) + @test_throws ArgumentError AtomSelection([1, 2, 3]; natomspermol=1, nmols=2) + @test_throws ArgumentError AtomSelection([1, 2, 3]; natomspermol=1, group_names=["A", "B"]) + @test_throws ArgumentError AtomSelection([1, 2, 3]; natomspermol=1, group_names=["A", "B", "C"]) + @test_throws ArgumentError AtomSelection(Int[], nmols=1, natomspermol=11) + + @test_throws ArgumentError AtomSelection([1, 2, 3], ["A", "B", "C"]) + @test_throws MethodError AtomSelection([1, 2, 3]; abc=1) + @test_throws ArgumentError AtomSelection([1, 2, 3], ["A", "B", "C"]; nmols=1) + @test_throws ArgumentError AtomSelection([1, 2, 3], natomspermol=1, group_atom_indices=[[1, 2, 2], [3]]) + @test_throws ArgumentError AtomSelection([1, 2, 3], nmols=1, group_names=["A", "B"], group_atom_indices=[[1], [2, 3], [2]]) + + @test_logs (:warn,) AtomSelection([1, 2, 3], natomspermol=1, group_atom_indices=[[1, 2], [3]]) + @test_logs (:warn,) AtomSelection([1, 2, 3], natomspermol=1, group_atom_indices=[[2, 1], [3]], group_names=["A", "B"]) pdb = readPDB(ComplexMixtures.Testing.pdbfile) @test_throws ArgumentError AtomSelection( - select(pdb, "protein and name CA"), - nmols = 1, - group_atom_indices = [ findall(Select("protein and name N"), pdb) ] - ) - + select(pdb, "protein and name CA"), + nmols=1, + group_atom_indices=[findall(Select("protein and name N"), pdb)] + ) + end # # Initialize the structure providing a vector of PDBTools.Atom(s) # function AtomSelection( - atoms::AbstractVector{<:PDBTools.Atom}; - nmols::Integer = 0, - natomspermol::Integer = 0, - group_atom_indices::AbstractVector{<:AbstractVector{<:Integer}} = Vector{Int}[], - group_names::AbstractVector{<:AbstractString} = String[] + atoms::AbstractVector{<:PDBTools.Atom}; + nmols::Integer=0, + natomspermol::Integer=0, + group_atom_indices::AbstractVector{<:AbstractVector{<:Integer}}=Vector{Int}[], + group_names::AbstractVector{<:AbstractString}=String[] ) custom_groups = !isempty(group_atom_indices) - indices = [ Int64(PDBTools.index(at)) for at in atoms ] + indices = [Int64(PDBTools.index(at)) for at in atoms] nmols, natomspermol = set_nmols_natomspermol(indices, nmols, natomspermol) - if !custom_groups && isempty(group_names) + if !custom_groups && isempty(group_names) if nmols == 1 - group_names = [ String(PDBTools.name(at)) for at in atoms ] + group_names = [String(PDBTools.name(at)) for at in atoms] else - group_names = [ String(PDBTools.name(atoms[i])) for i in 1:natomspermol ] + group_names = [String(PDBTools.name(atoms[i])) for i in 1:natomspermol] end end return AtomSelection( indices; - nmols = nmols, - natomspermol = natomspermol, - group_atom_indices = group_atom_indices, - group_names = group_names, + nmols=nmols, + natomspermol=natomspermol, + group_atom_indices=group_atom_indices, + group_names=group_names, ) end @@ -470,7 +469,7 @@ end import Random: shuffle! pdbfile = ComplexMixtures.Testing.pdbfile atoms = PDBTools.readPDB(pdbfile, "protein and residue 2") - s = AtomSelection(atoms, nmols = 1, natomspermol = 11) + s = AtomSelection(atoms, nmols=1, natomspermol=11) @test s.indices == [12 + i for i = 1:11] @test s.custom_groups == false @test atom_group_names(s) == ["N", "HN", "CA", "HA", "CB", "HB1", "HB2", "SG", "HG1", "C", "O"] @@ -478,11 +477,11 @@ end @test s.natomspermol == 11 @test s.nmols == 1 @test ComplexMixtures.natoms(s) == s.nmols * s.natomspermol - @test_throws ArgumentError AtomSelection(select(atoms, "name XX"), nmols = 1, natomspermol = 11) + @test_throws ArgumentError AtomSelection(select(atoms, "name XX"), nmols=1, natomspermol=11) # Test shuffled indices in the custom group - s1 = AtomSelection(atoms, nmols=1, group_atom_indices= [ findall(sel"resname ARG", atoms) ]) - s2 = AtomSelection(atoms, nmols=1, group_atom_indices= [ shuffle!(findall(sel"resname ARG", atoms)) ]) + s1 = AtomSelection(atoms, nmols=1, group_atom_indices=[findall(sel"resname ARG", atoms)]) + s2 = AtomSelection(atoms, nmols=1, group_atom_indices=[shuffle!(findall(sel"resname ARG", atoms))]) @test atom_group(s1, 1) == atom_group(s2, 1) end @@ -581,16 +580,16 @@ end #_round(x::Real; digits=2) = round(x; digits=digits) _round(x::Integer; digits=nothing) = x _round(x::String; digits=nothing) = x -@views function print_vector_summary(x::AbstractVector{T}; digits=2) where T +@views function print_vector_summary(x::AbstractVector{T}; digits=2) where {T} if length(x) <= 4 - return "[ "*join(_round.(x;digits), ", ")*" ]" + return "[ " * join(_round.(x; digits), ", ") * " ]" end - return "[ "*join(_round.(x[begin:begin+1];digits), ", ")* - ", ..., " * - join(_round.(x[end-1:end];digits), ", ")*" ]" + return "[ " * join(_round.(x[begin:begin+1]; digits), ", ") * + ", ..., " * + join(_round.(x[end-1:end]; digits), ", ") * " ]" end -function Base.show(io::IO, sg::Union{SoluteGroup, SolventGroup}) +function Base.show(io::IO, sg::Union{SoluteGroup,SolventGroup}) type = sg isa SoluteGroup ? "Solute" : "Solvent" println(io, "$(type)Group defined by:") if !isnothing(sg.group_index) @@ -645,7 +644,7 @@ SolventGroup(residue::PDBTools.Residue) = SolventGroup(nothing, nothing, PDBTool sg = SoluteGroup(select(pdb, "protein and residue 2")) @test sg.atom_indices == [12 + i for i = 1:11] @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 - @test SoluteGroup([1,2,3]).atom_indices == [1,2,3] + @test SoluteGroup([1, 2, 3]).atom_indices == [1, 2, 3] @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 @test SoluteGroup("N").group_name == "N" @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 @@ -661,7 +660,7 @@ SolventGroup(residue::PDBTools.Residue) = SolventGroup(nothing, nothing, PDBTool sg = SolventGroup(select(pdb, "protein and residue 2")) @test sg.atom_indices == [12 + i for i = 1:11] @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 - @test SolventGroup([1,2,3]).atom_indices == [1,2,3] + @test SolventGroup([1, 2, 3]).atom_indices == [1, 2, 3] @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 @test SolventGroup("N").group_name == "N" @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 @@ -675,7 +674,7 @@ SolventGroup(residue::PDBTools.Residue) = SolventGroup(nothing, nothing, PDBTool @test count(!isnothing, getfield(sg, field) for field in fieldnames(SoluteGroup)) == 1 # error if the atomic selection itself is provided - atsel = AtomSelection([1,2,3], natomspermol=1) + atsel = AtomSelection([1, 2, 3], natomspermol=1) @test_throws ArgumentError SolventGroup(atsel) @test_throws ArgumentError SoluteGroup(atsel) end diff --git a/src/ComplexMixtures.jl b/src/ComplexMixtures.jl index 4357d9454..12a9cf266 100644 --- a/src/ComplexMixtures.jl +++ b/src/ComplexMixtures.jl @@ -20,7 +20,7 @@ using TestItems: @testitem # Data types -export Trajectory, Options, Result +export Trajectory, Options, Result export AtomSelection, SoluteGroup, SolventGroup # Functions @@ -31,7 +31,7 @@ export atom_group, atom_group_name, atom_group_names # Tools export ResidueContributions -export contributions +export contributions export coordination_number export gr export grid3D diff --git a/src/Options.jl b/src/Options.jl index 759d67598..b9adb7f90 100644 --- a/src/Options.jl +++ b/src/Options.jl @@ -66,23 +66,23 @@ Create an Options object with the specified options. """ function Options(; - firstframe::Int = 1, - lastframe::Int = -1, - stride::Int = 1, - irefatom::Int = -1, - n_random_samples::Int = 10, - binstep::Float64 = 0.02, - dbulk::Union{Nothing,Real} = nothing, - cutoff::Union{Nothing,Real} = nothing, - usecutoff::Union{Nothing,Bool} = nothing, + firstframe::Int=1, + lastframe::Int=-1, + stride::Int=1, + irefatom::Int=-1, + n_random_samples::Int=10, + binstep::Float64=0.02, + dbulk::Union{Nothing,Real}=nothing, + cutoff::Union{Nothing,Real}=nothing, + usecutoff::Union{Nothing,Bool}=nothing, bulk_range=nothing, - lcell::Int = 1, - GC::Bool = true, - GC_threshold::Float64 = 0.3, - seed::Int = 321, - StableRNG::Bool = false, - nthreads::Int = 0, - silent::Bool = false + lcell::Int=1, + GC::Bool=true, + GC_threshold::Float64=0.3, + seed::Int=321, + StableRNG::Bool=false, + nthreads::Int=0, + silent::Bool=false ) # warning flag for default values of dbulk, cutoff, and usecutoff @@ -90,7 +90,7 @@ function Options(; # Check for simple input errors if stride < 1 - throw(ArgumentError("in MDDF options: stride cannot be less than 1. ")) + throw(ArgumentError("in MDDF options: stride cannot be less than 1. ")) end if lastframe > 0 && lastframe < firstframe throw(ArgumentError("in MDDF options: lastframe must be greater or equal to firstframe. ")) @@ -106,8 +106,8 @@ function Options(; if !isnothing(bulk_range) && any(!isnothing, (dbulk, cutoff, usecutoff)) throw(ArgumentError("""\n The bulk_range argument implies that dbulk, cutoff, and usecutoff are not needed. - - """)) + + """)) end if all(isnothing, (bulk_range, dbulk, cutoff, usecutoff)) dbulk = 10.0 @@ -159,7 +159,7 @@ function Options(; system size and correlations of the distribution function with, for example: Options(bulk_range = (8.0, 12.0)) - """ _file=nothing _line=nothing + """ _file = nothing _line = nothing end if usecutoff && dbulk >= cutoff throw(ArgumentError(" in MDDF options: The bulk volume is zero (dbulk must be smaller than cutoff). ")) @@ -197,36 +197,36 @@ end @test o.dbulk == 10.0 @test o.cutoff == 10.0 @test o.usecutoff == false - o = Options(bulk_range = (10.0, 14.0)) + o = Options(bulk_range=(10.0, 14.0)) @test o.dbulk == 10.0 @test o.cutoff == 14.0 @test o.usecutoff == true o = Options(dbulk=10.0) @test o.dbulk == 10.0 @test o.cutoff == 10.0 - @test o.usecutoff == false - o = Options(dbulk = 10.0, usecutoff = false) + @test o.usecutoff == false + o = Options(dbulk=10.0, usecutoff=false) @test o.dbulk == 10.0 @test o.cutoff == 10.0 @test o.usecutoff == false - o = Options(bulk_range = (10.0, 14.0)) + o = Options(bulk_range=(10.0, 14.0)) @test o.dbulk == 10.0 @test o.cutoff == 14.0 @test o.usecutoff == true # input errors - @test_throws ArgumentError Options(dbulk = 10.0, binstep = 0.3) - @test_throws ArgumentError Options(dbulk = 10.0, cutoff = 10.0, usecutoff = true) - @test_throws ArgumentError Options(dbulk = 6.0, cutoff = 10.0, binstep = 0.3, usecutoff = true) - @test_throws ArgumentError Options(dbulk = 8.0, cutoff = 10.0, binstep = 0.3, usecutoff = true) - @test_throws ArgumentError Options(bulk_range = (10.0, 12.0), binstep = 0.3) - @test_throws ArgumentError Options(stride = 0) - @test_throws ArgumentError Options(lastframe = 1, firstframe = 2) - @test_throws ArgumentError Options(bulk_range = (12.0, 10.0)) - @test_throws ArgumentError Options(bulk_range = (12.0, 10.0), dbulk=8.0) - @test_throws ArgumentError Options(bulk_range = (12.0, 10.0), cutoff=15.0) - @test_throws ArgumentError Options(bulk_range = (12.0, 10.0), usecutoff=false) - @test_throws ArgumentError Options(dbulk = 10.0, cutoff = 15.0, usecutoff = false) + @test_throws ArgumentError Options(dbulk=10.0, binstep=0.3) + @test_throws ArgumentError Options(dbulk=10.0, cutoff=10.0, usecutoff=true) + @test_throws ArgumentError Options(dbulk=6.0, cutoff=10.0, binstep=0.3, usecutoff=true) + @test_throws ArgumentError Options(dbulk=8.0, cutoff=10.0, binstep=0.3, usecutoff=true) + @test_throws ArgumentError Options(bulk_range=(10.0, 12.0), binstep=0.3) + @test_throws ArgumentError Options(stride=0) + @test_throws ArgumentError Options(lastframe=1, firstframe=2) + @test_throws ArgumentError Options(bulk_range=(12.0, 10.0)) + @test_throws ArgumentError Options(bulk_range=(12.0, 10.0), dbulk=8.0) + @test_throws ArgumentError Options(bulk_range=(12.0, 10.0), cutoff=15.0) + @test_throws ArgumentError Options(bulk_range=(12.0, 10.0), usecutoff=false) + @test_throws ArgumentError Options(dbulk=10.0, cutoff=15.0, usecutoff=false) @test_throws ArgumentError Options(n_random_samples=0) end diff --git a/src/Trajectory.jl b/src/Trajectory.jl index c70cd5ba1..ae2c2aaeb 100644 --- a/src/Trajectory.jl +++ b/src/Trajectory.jl @@ -30,9 +30,8 @@ function Trajectory( filename::String, solute::AtomSelection, solvent::AtomSelection; - format::String = "", - chemfiles = false, - + format::String="", + chemfiles=false, ) filename = expanduser(filename) # expand tilde on Unix systems, to username if !chemfiles && (format == "dcd" || split(filename, '.')[end] == "dcd") @@ -40,14 +39,14 @@ function Trajectory( elseif !chemfiles && format == "PDBTraj" trajectory = PDBTraj(filename, solute, solvent) else - trajectory = ChemFile(filename, solute, solvent, format = format) + trajectory = ChemFile(filename, solute, solvent, format=format) end return trajectory end # If only one selection is provided, assume that the solute and the solvent are the same -Trajectory(filename::String, solvent::AtomSelection; format::String = "", chemfiles = false) = - Trajectory(filename, solvent, solvent, format = format, chemfiles = chemfiles) +Trajectory(filename::String, solvent::AtomSelection; format::String="", chemfiles=false) = + Trajectory(filename, solvent, solvent, format=format, chemfiles=chemfiles) #= convert_unitcell(unitcell::Union{SVector{3}, SMatrix{3,3}}) @@ -56,15 +55,15 @@ Function to return the unit cell as a vector or matrix, depending on if the cell is diagonal or not, up to a relative precision of 1e-10 by default. =# -function convert_unitcell(unitcell::AbstractMatrix; tol = 1e-10) - size(unitcell) == (3,3) || error("Unit cell must be a 3x3 matrix.") +function convert_unitcell(unitcell::AbstractMatrix; tol=1e-10) + size(unitcell) == (3, 3) || error("Unit cell must be a 3x3 matrix.") s = minimum(diag(unitcell)) - is_diag = all(unitcell[i,j] < tol*s for i in 1:3, j in 1:3 if i != j) - return is_diag ? SVector{3}(diag(unitcell)) : SMatrix{3,3}(unitcell) + is_diag = all(unitcell[i, j] < tol * s for i in 1:3, j in 1:3 if i != j) + return is_diag ? SVector{3}(diag(unitcell)) : SMatrix{3,3}(unitcell) end # Version to ensure type stability when we know the type of the unit cell -convert_unitcell(::SVector, unitcell::AbstractMatrix) = SVector{3}(unitcell[1,1], unitcell[2,2], unitcell[3,3]) +convert_unitcell(::SVector, unitcell::AbstractMatrix) = SVector{3}(unitcell[1, 1], unitcell[2, 2], unitcell[3, 3]) convert_unitcell(::SMatrix, unitcell::AbstractMatrix) = SMatrix{3,3}(unitcell) @testitem "convert_unitcell" begin @@ -106,8 +105,8 @@ end using StaticArrays atoms = readPDB(Testing.pdbfile) - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) # NAMD DCD file traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao) @@ -120,7 +119,7 @@ end "$(Testing.data_dir)/PDB/trajectory.pdb", protein, tmao, - format = "PDBTraj", + format="PDBTraj", ) @test ComplexMixtures.natoms(traj.solute) == 1463 @test ComplexMixtures.natoms(traj.solvent) == 2534 @@ -131,7 +130,7 @@ end "$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao, - chemfiles = true, + chemfiles=true, ) @test traj.nframes == 20 @test ComplexMixtures.convert_unitcell(ComplexMixtures.getunitcell(traj)) ≈ SVector(84.42188262939453, 84.42188262939453, 84.42188262939453) @@ -140,8 +139,8 @@ end # Chemfiles with Gromacs atoms = readPDB("$(Testing.data_dir)/Gromacs/system.pdb") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - emi = AtomSelection(select(atoms, "resname EMI"), natomspermol = 20) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + emi = AtomSelection(select(atoms, "resname EMI"), natomspermol=20) traj = Trajectory("$(Testing.data_dir)/Gromacs/trajectory.xtc", protein, emi) @test traj.nframes == 26 @test ComplexMixtures.convert_unitcell(ComplexMixtures.getunitcell(traj)) ≈ SVector(95.11481285095215, 95.11481285095215, 95.13440132141113) @@ -179,7 +178,7 @@ function TrajectoryMetaData(trajectory::Trajectory, options::Options) firstframe!(trajectory) # Get unitcell from the trajectory: returns vector or matrix depending on the data - unitcell = convert_unitcell(getunitcell(trajectory)) + unitcell = convert_unitcell(getunitcell(trajectory)) # Set reference atom as the closest one to the center of coordinates of the molecule, as default if options.irefatom == -1 @@ -206,7 +205,7 @@ function TrajectoryMetaData(trajectory::Trajectory, options::Options) # Initialize the arrays that contain groups counts, depending on wheter # groups were defined or not in the input Options - n_groups_solute = if !trajectory.solute.custom_groups + n_groups_solute = if !trajectory.solute.custom_groups trajectory.solute.natomspermol else length(trajectory.solute.group_atom_indices) @@ -218,12 +217,12 @@ function TrajectoryMetaData(trajectory::Trajectory, options::Options) end return TrajectoryMetaData( - irefatom = irefatom, - lastframe_read = lastframe_read, - nframes_read = nframes_read, - n_groups_solute = n_groups_solute, - n_groups_solvent = n_groups_solvent, - unitcell = unitcell, + irefatom=irefatom, + lastframe_read=lastframe_read, + nframes_read=nframes_read, + n_groups_solute=n_groups_solute, + n_groups_solvent=n_groups_solvent, + unitcell=unitcell, ) end @@ -232,20 +231,20 @@ end using ComplexMixtures.Testing using PDBTools atoms = readPDB(Testing.pdbfile) - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao) options = Options() tmeta = ComplexMixtures.TrajectoryMetaData(traj, options) @test tmeta.irefatom == 1 - @test tmeta.lastframe_read == 20 + @test tmeta.lastframe_read == 20 @test tmeta.nframes_read == 20 @test tmeta.n_groups_solute == 1463 @test tmeta.n_groups_solvent == 14 @test tmeta.unitcell ≈ [84.42188262939453, 84.42188262939453, 84.42188262939453] - options = Options(;irefatom = 2, lastframe = 10, stride = 2) + options = Options(; irefatom=2, lastframe=10, stride=2) tmeta = ComplexMixtures.TrajectoryMetaData(traj, options) @test tmeta.irefatom == 2 @test tmeta.lastframe_read == 10 diff --git a/src/compare.jl b/src/compare.jl index e06668e75..3d97a30dd 100644 --- a/src/compare.jl +++ b/src/compare.jl @@ -7,7 +7,7 @@ const ComplexMixturesTypes = Union{Result,Density,Volume,AtomSelection,Options} _isapprox(x, y) = isapprox(x, y) _isapprox(x::Vector{<:String}, y::Vector{<:String}) = all(x .== y) -_isapprox(x::String, y::String) = x == y +_isapprox(x::String, y::String) = x == y _isapprox(x::Vector{<:Vector{<:Real}}, y::Vector{<:Vector{<:Real}}) = all(x .≈ y) #= @@ -16,14 +16,14 @@ _isapprox(x::Vector{<:Vector{<:Real}}, y::Vector{<:Vector{<:Real}}) = all(x .≈ Function to test if two runs offered similar results. Mostly used in the package testing routines. =# -Base.isapprox(x::T, y::T; debug = false) where {T<:ComplexMixturesTypes} = - _compare(_isapprox, x, y; debug = debug) +Base.isapprox(x::T, y::T; debug=false) where {T<:ComplexMixturesTypes} = + _compare(_isapprox, x, y; debug=debug) # Compare two ComplexMixtures types import Base.== -==(x::T, y::T; debug = false) where {T<:ComplexMixturesTypes} = _compare(==, x, y; debug = debug) +==(x::T, y::T; debug=false) where {T<:ComplexMixturesTypes} = _compare(==, x, y; debug=debug) -function _compare(_similar::F, x::T, y::T; debug = false) where {T<:ComplexMixturesTypes} where {F<:Function} +function _compare(_similar::F, x::T, y::T; debug=false) where {T<:ComplexMixturesTypes} where {F<:Function} check = true diff_list = Symbol[] for field in fieldnames(T) @@ -32,7 +32,7 @@ function _compare(_similar::F, x::T, y::T; debug = false) where {T<:ComplexMixtu end xf = getfield(x, field) yf = getfield(y, field) - try + try if !(_similar(xf, yf)) check = false if debug diff --git a/src/io.jl b/src/io.jl index fc4bdec75..af89ac719 100644 --- a/src/io.jl +++ b/src/io.jl @@ -77,7 +77,7 @@ function _check_version(filename) You can pin the version of ComplexMixtures to the one you installed with: julia> import Pkg; Pkg.pkg"pin ComplexMixtures@$json_version" - + """)) end return nothing diff --git a/src/mddf.jl b/src/mddf.jl index 76e200aaa..bef36c386 100644 --- a/src/mddf.jl +++ b/src/mddf.jl @@ -180,10 +180,10 @@ julia> results = mddf(trajectory_file, solute, solvent, options); function mddf end function mddf( - trajectory_file::String, - solute::AtomSelection, - solvent::AtomSelection, - options::Options; + trajectory_file::String, + solute::AtomSelection, + solvent::AtomSelection, + options::Options; trajectory_format::String="", chemfiles::Bool=false, kargs...) @@ -192,9 +192,9 @@ function mddf( end function mddf( - trajectory_file::String, - solute_and_solvent::AtomSelection, - options::Options; + trajectory_file::String, + solute_and_solvent::AtomSelection, + options::Options; trajectory_format::String="", chemfiles::Bool=false, kargs... @@ -231,7 +231,7 @@ function mddf( # Skip initial frames if desired progress = Progress(options.firstframe; dt=1) - for _ in 1:options.firstframe - 1 + for _ in 1:options.firstframe-1 nextframe!(trajectory) if options.GC && (Sys.free_memory() / Sys.total_memory() < options.GC_threshold) GC.gc() @@ -247,7 +247,7 @@ function mddf( # Print some information about this run if !options.silent title(R, trajectory.solute, trajectory.solvent, nthreads) - if low_memory + if low_memory println("Running with low-memory option:") println(" - Parallel CellListMap can be used.") println(" - Number of parallel minimum-distance computations: $nchunks") @@ -277,7 +277,7 @@ function mddf( local compute, frame_weight # Read frame coordinates @lock read_lock begin - iframe, compute = goto_nextframe!(iframe, R, trajectory, to_compute_frames, options) + iframe, compute = goto_nextframe!(iframe, R, trajectory, to_compute_frames, options) if compute # Read frame for computing # The solute coordinates must be read in intermediate arrays, because the @@ -514,48 +514,48 @@ julia> results = coordination_number(trajectory_file, solute, solvent, options); ``` """ -function coordination_number(::String, args...; kargs...) +function coordination_number(::String, args...; kargs...) throw(ArgumentError("""\n Invalid arguments for the `coordination_number` function. Plese check the documentation for the correct call signature, by typing: julia> ? coordination_number - + """)) end function coordination_number( - trajectory_file::String, - solute::AtomSelection, - solvent::AtomSelection, - options::Options; + trajectory_file::String, + solute::AtomSelection, + solvent::AtomSelection, + options::Options; trajectory_format::String="", chemfiles::Bool=false, kargs...) - _coordination_number_call_error(;kargs...) + _coordination_number_call_error(; kargs...) trajectory = Trajectory(trajectory_file, solute, solvent; format=trajectory_format, chemfiles) return mddf(trajectory, options; coordination_number_only=true, kargs...) end function coordination_number( - trajectory_file::String, - solute_and_solvent::AtomSelection, - options::Options; + trajectory_file::String, + solute_and_solvent::AtomSelection, + options::Options; trajectory_format::String="", chemfiles::Bool=false, kargs... ) - _coordination_number_call_error(;kargs...) + _coordination_number_call_error(; kargs...) trajectory = Trajectory(trajectory_file, solute_and_solvent; format=trajectory_format, chemfiles) return mddf(trajectory, options; coordination_number_only=true, kargs...) end function coordination_number(traj::Trajectory, options::Options=Options(); kargs...) - _coordination_number_call_error(;kargs...) + _coordination_number_call_error(; kargs...) return mddf(traj, options; coordination_number_only=true, kargs...) end -function _coordination_number_call_error(;kargs...) +function _coordination_number_call_error(; kargs...) if haskey(kargs, :coordination_number_only) throw(ArgumentError("""\n The keyword argument `coordination_number_only` is not allowed in the `coordination_number` function. @@ -577,7 +577,7 @@ end water = AtomSelection(select(atoms, "resname WAT and model 1"), natomspermol=3) trajectory_file = "$data_dir/toy/cross.pdb" trajectory_format = "PDBTraj" - for nthreads in [1,2], lastframe in [1, 2], low_memory in [true, false] + for nthreads in [1, 2], lastframe in [1, 2], low_memory in [true, false] options = Options(; seed=321, StableRNG=true, @@ -617,7 +617,7 @@ end trajectory_file = "$data_dir/toy/self_monoatomic.pdb" trajectory_format = "PDBTraj" # without atoms in the bulk - for nthreads in [1,2], low_memory in [false, true] + for nthreads in [1, 2], low_memory in [false, true] options = Options(; seed=321, StableRNG=true, @@ -729,12 +729,12 @@ end # Throw insufficent memory error @test_throws ErrorException mddf(trajectory_file, protein, tmao, Options(nthreads=10^10)) - for nthreads in [1,2], low_memory in [true, false] + for nthreads in [1, 2], low_memory in [true, false] options = Options(; - seed=1, - stride=1, - StableRNG=true, - nthreads, + seed=1, + stride=1, + StableRNG=true, + nthreads, n_random_samples=100, silent=true ) diff --git a/src/minimum_distances.jl b/src/minimum_distances.jl index f180a9228..b8a568804 100644 --- a/src/minimum_distances.jl +++ b/src/minimum_distances.jl @@ -143,14 +143,14 @@ function minimum_distances!( (x, y, i, j, d2, list) -> update_list!(i, j, d2, jref_atom, jnatomspermol, isolute, list), system; - update_lists = update_lists, + update_lists=update_lists, ) else map_pairwise!( (x, y, i, j, d2, list) -> update_list!(i, j, d2, jref_atom, jnatomspermol, list), system; - update_lists = update_lists, + update_lists=update_lists, ) end return system.list @@ -164,23 +164,23 @@ will be setup such that `xpositions` corresponds to one molecule of the solute, =# function CellListMap.ParticleSystem( - trajectory::Trajectory, - unitcell, - options::Options, + trajectory::Trajectory, + unitcell, + options::Options, parallel::Bool, nbatches::Tuple{Int,Int}, ) system = ParticleSystem(; - xpositions = zeros(SVector{3,Float64}, trajectory.solute.natomspermol), - ypositions = zeros(SVector{3,Float64}, trajectory.solvent.nmols * trajectory.solvent.natomspermol), + xpositions=zeros(SVector{3,Float64}, trajectory.solute.natomspermol), + ypositions=zeros(SVector{3,Float64}, trajectory.solvent.nmols * trajectory.solvent.natomspermol), unitcell, - cutoff = options.usecutoff ? options.cutoff : options.dbulk, - output = fill(zero(MinimumDistance), trajectory.solvent.nmols), - output_name = :list, - lcell = options.lcell, + cutoff=options.usecutoff ? options.cutoff : options.dbulk, + output=fill(zero(MinimumDistance), trajectory.solvent.nmols), + output_name=:list, + lcell=options.lcell, parallel, # true only if low_memory is set nbatches, - autoswap = false, # The lists will be built for the solvent, always + autoswap=false, # The lists will be built for the solvent, always ) return system end @@ -193,14 +193,14 @@ end import CellListMap atoms = readPDB(Testing.pdbfile) - options = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + options = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) # Cross-correlation - protein = AtomSelection(select(atoms, "protein"), nmols = 1) + protein = AtomSelection(select(atoms, "protein"), nmols=1) traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao) - tmeta = ComplexMixtures.TrajectoryMetaData(traj, options) - system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options, false, (1,1)) + tmeta = ComplexMixtures.TrajectoryMetaData(traj, options) + system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options, false, (1, 1)) @test system.cutoff == 10.0 @test system.list == fill(zero(ComplexMixtures.MinimumDistance), 181) @test system.output == fill(zero(ComplexMixtures.MinimumDistance), 181) @@ -210,13 +210,13 @@ end @test system.unitcell ≈ [84.42188262939453 0.0 0.0; 0.0 84.42188262939453 0.0; 0.0 0.0 84.42188262939453] @test system._box == CellListMap.Box( ComplexMixtures.convert_unitcell(ComplexMixtures.getunitcell(traj)), - 10.0, lcell = options.lcell + 10.0, lcell=options.lcell ) # Auto-correlation traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", tmao) tmeta = ComplexMixtures.TrajectoryMetaData(traj, options) - system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options, false, (1,1)) + system = ComplexMixtures.ParticleSystem(traj, tmeta.unitcell, options, false, (1, 1)) @test system.cutoff == 10.0 @test system.list == fill(zero(ComplexMixtures.MinimumDistance), 181) # one molecule less @test system.output == fill(zero(ComplexMixtures.MinimumDistance), 181) @@ -226,7 +226,7 @@ end @test system.unitcell ≈ [84.42188262939453 0.0 0.0; 0.0 84.42188262939453 0.0; 0.0 0.0 84.42188262939453] @test system._box == CellListMap.Box( ComplexMixtures.convert_unitcell(ComplexMixtures.getunitcell(traj)), - 10.0, lcell = options.lcell + 10.0, lcell=options.lcell ) end diff --git a/src/parallel_setup.jl b/src/parallel_setup.jl index 09f76b76d..86372fbd9 100644 --- a/src/parallel_setup.jl +++ b/src/parallel_setup.jl @@ -47,7 +47,7 @@ function parallel_setup(options::Options, R::Result, low_memory::Bool) Here, we suggest at most N=$(Int(fld(0.2 * total_memory, results_memory))). """ - end _file = nothing _line = nothing + end _file=nothing _line=nothing end if nchunks * results_memory > total_memory throw(ErrorException("The memory required for the computation is larger than the total system memory.")) diff --git a/src/precompile.jl b/src/precompile.jl index ab924c408..be5dfca82 100644 --- a/src/precompile.jl +++ b/src/precompile.jl @@ -6,9 +6,9 @@ PrecompileTools.@setup_workload begin prot = PDBTools.select(atoms, "protein and resnum < 4") tmao = PDBTools.select(atoms, "resname TMAO and resnum <= 2") PrecompileTools.@compile_workload begin - options = Options(lastframe = 1, silent = true, n_random_samples=1) - solute = AtomSelection(prot, nmols = 1) - solvent = AtomSelection(tmao, natomspermol = 14) + options = Options(lastframe=1, silent=true, n_random_samples=1) + solute = AtomSelection(prot, nmols=1) + solvent = AtomSelection(tmao, natomspermol=14) trajectory_file = "$dir/trajectory.dcd" R = mddf(trajectory_file, solute, solvent, options) rc = ResidueContributions(R, prot; silent=true) diff --git a/src/results.jl b/src/results.jl index d7ffeeeb7..fb135ec57 100644 --- a/src/results.jl +++ b/src/results.jl @@ -121,9 +121,9 @@ end # function Result( trajectory::Trajectory, - options::Options; - trajectory_data::TrajectoryMetaData = TrajectoryMetaData(trajectory, options), - frame_weights::Vector{Float64} = Float64[] + options::Options; + trajectory_data::TrajectoryMetaData=TrajectoryMetaData(trajectory, options), + frame_weights::Vector{Float64}=Float64[] ) # Number of bins of the histogram @@ -136,10 +136,10 @@ function Result( if length(frame_weights) < trajectory_data.lastframe_read throw(ArgumentError(chomp("""\n The length of the frame_weights vector provided must at least the number of frames to be read. - + Input given: length(frame_weights) = $(length(frame_weights)) last frame to be read: $(trajectory_data.lastframe_read) - + """))) end range_considered = options.firstframe:options.stride:trajectory_data.lastframe_read @@ -154,29 +154,29 @@ function Result( end # Initialize group count arrays - solute_group_count = [ zeros(nbins) for _ in 1:trajectory_data.n_groups_solute ] - solvent_group_count = [ zeros(nbins) for _ in 1:trajectory_data.n_groups_solvent ] + solute_group_count = [zeros(nbins) for _ in 1:trajectory_data.n_groups_solute] + solvent_group_count = [zeros(nbins) for _ in 1:trajectory_data.n_groups_solvent] return Result( - nbins = nbins, - dbulk = options.dbulk, - cutoff = options.cutoff, - autocorrelation = isautocorrelation(trajectory), - solute = trajectory.solute, - solvent = trajectory.solvent, - solute_group_count = solute_group_count, - solvent_group_count = solvent_group_count, - files = [ + nbins=nbins, + dbulk=options.dbulk, + cutoff=options.cutoff, + autocorrelation=isautocorrelation(trajectory), + solute=trajectory.solute, + solvent=trajectory.solvent, + solute_group_count=solute_group_count, + solvent_group_count=solvent_group_count, + files=[ TrajectoryFileOptions( - filename = trajectory.filename, - options = options, - irefatom = trajectory_data.irefatom, - lastframe_read = trajectory_data.lastframe_read, - nframes_read = trajectory_data.nframes_read, - frame_weights = frame_weights, + filename=trajectory.filename, + options=options, + irefatom=trajectory_data.irefatom, + lastframe_read=trajectory_data.lastframe_read, + nframes_read=trajectory_data.nframes_read, + frame_weights=frame_weights, ) ], - weights = [1.0], + weights=[1.0], ) end @@ -185,14 +185,14 @@ end using ComplexMixtures.Testing: data_dir using PDBTools: readPDB, select atoms = readPDB("$data_dir/NAMD/structure.pdb") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - water = AtomSelection(select(atoms, "water"), natomspermol = 3) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + water = AtomSelection(select(atoms, "water"), natomspermol=3) trajectory = Trajectory("$data_dir/NAMD/trajectory.dcd", tmao, water) - @test_throws ArgumentError mddf(trajectory, Options(lastframe = 100)) - @test_throws ArgumentError mddf(trajectory, Options(irefatom = 1000)) - @test_throws ArgumentError mddf(trajectory, Options(lastframe = 5), frame_weights = [1.0, 1.0, 1.0]) + @test_throws ArgumentError mddf(trajectory, Options(lastframe=100)) + @test_throws ArgumentError mddf(trajectory, Options(irefatom=1000)) + @test_throws ArgumentError mddf(trajectory, Options(lastframe=5), frame_weights=[1.0, 1.0, 1.0]) options = Options(firstframe=2, lastframe=5, stride=2) - @test_throws ArgumentError mddf(trajectory, options, frame_weights = [1.0, 0.0, 1.0, 0.0, 1.0]) + @test_throws ArgumentError mddf(trajectory, options, frame_weights=[1.0, 0.0, 1.0, 0.0, 1.0]) end # @@ -217,9 +217,9 @@ to the correct weight relative to the random sample. =# function set_samples(R::Result) if R.autocorrelation - samples = (solvent_nmols = R.solvent.nmols - 1, random = R.files[1].options.n_random_samples) + samples = (solvent_nmols=R.solvent.nmols - 1, random=R.files[1].options.n_random_samples) else - samples = (solvent_nmols = R.solvent.nmols, random = R.files[1].options.n_random_samples) + samples = (solvent_nmols=R.solvent.nmols, random=R.files[1].options.n_random_samples) end return samples end @@ -375,14 +375,14 @@ function _mddf_final_results!(R::Result, options::Options) R.coordination_number_random[ibin-1] + R.md_count_random[ibin] end else - if !warned_already && !options.silent + if !warned_already && !options.silent @warn begin """\n Ideal-gas histogram bins with zero samples. Increase n_random_samples, number of trajectory frames, and/or bin size. """ - end _file=nothing _line=nothing + end _file = nothing _line = nothing warned_already = true end end @@ -422,7 +422,7 @@ function _coordination_number_final_results!(R::Result, options::Options) (to remove this warning use `Options(silent=true)`) """ - end _file=nothing _line=nothing + end _file = nothing _line = nothing end # Setup the distance vector @@ -531,21 +531,21 @@ function Base.merge(results::Vector{<:Result}) end # Initialize group counts - solute_group_count = [ zeros(results[1].nbins) for _ in 1:length(results[1].solute_group_count) ] - solvent_group_count = [ zeros(results[1].nbins) for _ in 1:length(results[1].solvent_group_count) ] + solute_group_count = [zeros(results[1].nbins) for _ in 1:length(results[1].solute_group_count)] + solvent_group_count = [zeros(results[1].nbins) for _ in 1:length(results[1].solvent_group_count)] # Structure for merged results R = Result( - nbins = results[1].nbins, - dbulk = results[1].dbulk, - cutoff = results[1].cutoff, - autocorrelation = results[1].autocorrelation, - solute = results[1].solute, - solvent = results[1].solvent, - solute_group_count = solute_group_count, - solvent_group_count = solvent_group_count, - files = files, - weights = weights, + nbins=results[1].nbins, + dbulk=results[1].dbulk, + cutoff=results[1].cutoff, + autocorrelation=results[1].autocorrelation, + solute=results[1].solute, + solvent=results[1].solvent, + solute_group_count=solute_group_count, + solvent_group_count=solvent_group_count, + files=files, + weights=weights, ) # Average results weighting the data considering the weights of the frames of each data set @@ -556,12 +556,12 @@ function Base.merge(results::Vector{<:Result}) w = sum_frame_weights(result) / tot_frame_weight if !(w ≈ R.weights[ifile]) && !warn warn = true - @warn begin + @warn begin """\n Frame weights and file weights differ, because crustom frame weights were provided. - """ - end _file=nothing _line=nothing + """ + end _file = nothing _line = nothing end @. R.mddf += w * result.mddf @. R.kb += w * result.kb @@ -599,34 +599,34 @@ end # Test simple three-molecule system atoms = readPDB("$data_dir/toy/cross.pdb") - protein = AtomSelection(select(atoms, "protein and model 1"), nmols = 1) - water = AtomSelection(select(atoms, "resname WAT and model 1"), natomspermol = 3) - traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format = "PDBTraj") + protein = AtomSelection(select(atoms, "protein and model 1"), nmols=1) + water = AtomSelection(select(atoms, "resname WAT and model 1"), natomspermol=3) + traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format="PDBTraj") options = Options( - seed = 321, - StableRNG = true, - nthreads = 1, - silent = true, - n_random_samples = 10^5, - lastframe = 1, + seed=321, + StableRNG=true, + nthreads=1, + silent=true, + n_random_samples=10^5, + lastframe=1, ) R1 = mddf(traj, options) options = Options( - seed = 321, - StableRNG = true, - nthreads = 1, - silent = true, - n_random_samples = 10^5, - firstframe = 2, + seed=321, + StableRNG=true, + nthreads=1, + silent=true, + n_random_samples=10^5, + firstframe=2, ) R2 = mddf(traj, options) R = merge([R1, R2]) @test R.volume.total == 27000.0 @test R.volume.domain ≈ R.volume.total - R.volume.bulk - @test isapprox(R.volume.domain, (4π / 3) * R.dbulk^3; rtol = 0.01) + @test isapprox(R.volume.domain, (4π / 3) * R.dbulk^3; rtol=0.01) @test R.density.solute ≈ 1 / R.volume.total @test R.density.solvent ≈ 3 / R.volume.total @test R.density.solvent_bulk ≈ 2 / R.volume.bulk @@ -634,19 +634,19 @@ end # Test loading a saved merged file dir = mktempdir() - save(R,"$dir/merged.json") + save(R, "$dir/merged.json") R_save = load("$dir/merged.json") - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Test merging files for which weights are provided for the frames - R2 = mddf(traj, options, frame_weights = [0.0, 2.0]) + R2 = mddf(traj, options, frame_weights=[0.0, 2.0]) @test R.weights == [0.5, 0.5] @test length(R.files) == 2 # Two-atom system at1 = AtomSelection([1], nmols=1) at2 = AtomSelection([2], nmols=1) - traj = Trajectory("$data_dir/toy/self_monoatomic.pdb", at1, at2, format = "PDBTraj") + traj = Trajectory("$data_dir/toy/self_monoatomic.pdb", at1, at2, format="PDBTraj") R1 = mddf(traj, Options(lastframe=1)) @test sum(R1.md_count) == 1 R2 = mddf(traj, Options(firstframe=2)) @@ -657,24 +657,24 @@ end R1 = mddf(traj, Options(lastframe=1), frame_weights=[2.0]) @test sum(R1.md_count) == 1 R = merge([R1, R2]) - @test sum(R.md_count) == 2/3 + @test sum(R.md_count) == 2 / 3 @test sum(sum.(R1.solute_group_count)) == 1 @test sum(sum.(R1.solvent_group_count)) == 1 @test sum(sum.(R2.solute_group_count)) == 0 @test sum(sum.(R2.solvent_group_count)) == 0 - @test sum(sum.(R.solute_group_count)) == 2/3 - @test sum(sum.(R.solvent_group_count)) == 2/3 + @test sum(sum.(R.solute_group_count)) == 2 / 3 + @test sum(sum.(R.solvent_group_count)) == 2 / 3 # Test throwing merging incompatible results - protein = AtomSelection(select(atoms, "protein and model 1"), nmols = 1) - traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format = "PDBTraj") + protein = AtomSelection(select(atoms, "protein and model 1"), nmols=1) + traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format="PDBTraj") R1 = mddf(traj, options) protein = AtomSelection( - select(atoms, "protein and model 1"), nmols = 1, - group_names = ["acidic"], - group_atom_indices = [selindex(atoms, "protein and acidic")] + select(atoms, "protein and model 1"), nmols=1, + group_names=["acidic"], + group_atom_indices=[selindex(atoms, "protein and acidic")] ) - traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format = "PDBTraj") + traj = Trajectory("$data_dir/toy/cross.pdb", protein, water, format="PDBTraj") R2 = mddf(traj, options) @@ -687,8 +687,8 @@ end atoms = readPDB(pdbfile) protein = select(atoms, "protein") tmao = select(atoms, "resname TMAO") - solute = AtomSelection(protein, nmols = 1) - solvent = AtomSelection(tmao, natomspermol = 14) + solute = AtomSelection(protein, nmols=1) + solvent = AtomSelection(tmao, natomspermol=14) traj = Trajectory("$data_dir/NAMD/trajectory.dcd", solute, solvent) options = Options() # At this point we can only test an empty Result struct @@ -784,7 +784,7 @@ function load(filename::String, ::Type{Result}) _check_version(filename) R = try open(filename, "r") do io - JSON3.read(io, Result) + JSON3.read(io, Result) end catch throw(ArgumentError("""\n @@ -839,7 +839,7 @@ if the distribution function was computed for all molecules. Thus, the necessity to identify the types of atoms involved in a selection. =# -function which_types(s::AtomSelection, indices::AbstractVector{<:Integer}; warning = true) +function which_types(s::AtomSelection, indices::AbstractVector{<:Integer}; warning=true) selected_types = Int[] ntypes = 0 for i in indices @@ -990,7 +990,7 @@ function Base.show(io::IO, ov::Overview) Long range RDF mean (expected 1.0): $long_range_mean_rdf ± $long_range_std_rdf $bars""" - ) + ) end """ @@ -1000,7 +1000,7 @@ Function that outputs the volumes and densities in the most natural units. """ function overview(R::Result) - ov = Overview(R = R) + ov = Overview(R=R) # Molar volume of the solute domain ov.domain_molar_volume = R.volume.domain * units.Angs3tocm3permol diff --git a/src/rigid_body.jl b/src/rigid_body.jl index cc78bdc7b..e8564e8bf 100644 --- a/src/rigid_body.jl +++ b/src/rigid_body.jl @@ -161,10 +161,10 @@ end # Orthorhombic cell x = [-1.0 .+ 2 * rand(SVector{3,Float64}) for _ = 1:5] system = ParticleSystem( - positions = x, - cutoff = 0.1, - unitcell = SVector(10.0, 10.0, 10.0), - output = 0.0, + positions=x, + cutoff=0.1, + unitcell=SVector(10.0, 10.0, 10.0), + output=0.0, ) @test check_internal_distances(x, ComplexMixtures.random_move!(copy(x), 1, system, RNG)) system.xpositions .= [-9.0 .+ 2 * rand(SVector{3,Float64}) for _ = 1:5] @@ -175,10 +175,10 @@ end # Triclinic cell x = [-1.0 .+ 2 * rand(SVector{3,Float64}) for _ = 1:5] system = ParticleSystem( - positions = x, - cutoff = 0.1, - unitcell = @SMatrix[10.0 5.0 0.0; 0.0 10.0 0.0; 0.0 0.0 10.0], - output = 0.0, + positions=x, + cutoff=0.1, + unitcell=@SMatrix[10.0 5.0 0.0; 0.0 10.0 0.0; 0.0 0.0 10.0], + output=0.0, ) @test check_internal_distances(x, ComplexMixtures.random_move!(copy(x), 1, system, RNG)) system.xpositions .= [-9.0 .+ 2 * rand(SVector{3,Float64}) for _ = 1:5] diff --git a/src/tools/contributions.jl b/src/tools/contributions.jl index 100e2f281..fd5f2a8dc 100644 --- a/src/tools/contributions.jl +++ b/src/tools/contributions.jl @@ -103,7 +103,7 @@ function contributions( Custom groups are defined. Cannot retrieve general group contributions. Please provide a group name or index. For example, use SoluteGroup(1) or SoluteGroup("Group1_NAME") - """)) + """)) end else if isnothing(group.atom_indices) && isnothing(group.atom_names) diff --git a/src/tools/coordination_number.jl b/src/tools/coordination_number.jl index d207fe8d0..568d14520 100644 --- a/src/tools/coordination_number.jl +++ b/src/tools/coordination_number.jl @@ -103,7 +103,7 @@ julia> coordination_number(R, SoluteGroup("alanine residues"))[i5] """ function coordination_number end coordination_number(R::Result) = R.coordination_number -coordination_number(R::Result, atsel::Union{SoluteGroup,SolventGroup}) = contributions(R, atsel; type = :coordination_number) +coordination_number(R::Result, atsel::Union{SoluteGroup,SolventGroup}) = contributions(R, atsel; type=:coordination_number) @testitem "coordination_number" begin using ComplexMixtures: coordination_number, contributions, mddf, Trajectory, Options, AtomSelection, load @@ -112,9 +112,9 @@ coordination_number(R::Result, atsel::Union{SoluteGroup,SolventGroup}) = contrib dir = "$data_dir/NAMD" atoms = readPDB("$dir/structure.pdb") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - options = Options(lastframe = 1, seed = 321, StableRNG = true, nthreads = 1, silent = true, n_random_samples=200) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + options = Options(lastframe=1, seed=321, StableRNG=true, nthreads=1, silent=true, n_random_samples=200) traj = Trajectory("$dir/trajectory.dcd", protein, tmao) R = mddf(traj, options) diff --git a/src/tools/gr.jl b/src/tools/gr.jl index cab1aabb5..1e7fe6d7c 100644 --- a/src/tools/gr.jl +++ b/src/tools/gr.jl @@ -38,12 +38,12 @@ gr(R::Result) = gr(R.d, R.rdf_count, R.density.solvent_bulk, R.files[1].options. using PDBTools: readPDB, select using ComplexMixtures.Testing: data_dir atoms = readPDB("$data_dir/NAMD/structure.pdb") - options = Options(seed = 321, StableRNG = true, nthreads = 1, silent = true) - OH2 = AtomSelection(select(atoms, "water and name OH2"), natomspermol = 1) + options = Options(seed=321, StableRNG=true, nthreads=1, silent=true) + OH2 = AtomSelection(select(atoms, "water and name OH2"), natomspermol=1) traj = Trajectory("$data_dir/Gromacs/trajectory.xtc", OH2) R = mddf(traj, options) gr1, kb1 = gr(R) @test R.rdf_count ≈ R.md_count - @test gr1[end] ≈ 1.0 rtol = 0.1 - @test kb1[end] ≈ 20.0 rtol = 0.1 + @test gr1[end] ≈ 1.0 rtol = 0.1 + @test kb1[end] ≈ 20.0 rtol = 0.1 end diff --git a/src/tools/grid3D.jl b/src/tools/grid3D.jl index 30d8f39a7..230f8f08e 100644 --- a/src/tools/grid3D.jl +++ b/src/tools/grid3D.jl @@ -41,13 +41,13 @@ Examples of how the grid can be visualized are provided in the user guide of `Co """ function grid3D( - result::Result, - atoms, - output_file::Union{Nothing,String} = nothing; - dmin=1.5, - dmax=5.0, + result::Result, + atoms, + output_file::Union{Nothing,String}=nothing; + dmin=1.5, + dmax=5.0, step=0.5, - silent = false, + silent=false, ) if result.solute.custom_groups @@ -98,19 +98,19 @@ function grid3D( ) if cᵣ > 0 gridpoint = AtomType( - index = PDBTools.index(at), - index_pdb = PDBTools.index_pdb(at), - name = PDBTools.name(at), - chain = PDBTools.chain(at), - resname = PDBTools.resname(at), - resnum = PDBTools.resnum(at), - x = x, - y = y, - z = z, - occup = r, - beta = cᵣ, - model = PDBTools.model(at), - segname = PDBTools.segname(at), + index=PDBTools.index(at), + index_pdb=PDBTools.index_pdb(at), + name=PDBTools.name(at), + chain=PDBTools.chain(at), + resname=PDBTools.resname(at), + resnum=PDBTools.resnum(at), + x=x, + y=y, + z=z, + occup=r, + beta=cᵣ, + model=PDBTools.model(at), + segname=PDBTools.segname(at), ) if rgrid < 0 @lock grid_lock begin @@ -118,7 +118,7 @@ function grid3D( push!(grid, gridpoint) end elseif r < rgrid - @lock grid_lock begin + @lock grid_lock begin grid[igrid] = gridpoint end end @@ -155,14 +155,14 @@ end atoms = readPDB("$dir/structure.pdb") # Test argument error: no custom groups can be defined - protein = AtomSelection(select(atoms, "protein"); group_atom_indices = [ findall(sel"resname ARG", atoms) ], nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + protein = AtomSelection(select(atoms, "protein"); group_atom_indices=[findall(sel"resname ARG", atoms)], nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) options = Options( - stride = 5, - seed = 321, - StableRNG = true, - nthreads = 1, - silent = true, + stride=5, + seed=321, + StableRNG=true, + nthreads=1, + silent=true, n_random_samples=100, ) traj = Trajectory("$dir/trajectory.dcd", protein, tmao) @@ -170,20 +170,20 @@ end @test_throws ArgumentError grid3D(R, atoms, tempname()) # Test properties of the grid around a specific residue - solute = AtomSelection(select(atoms, "protein and residue 46"), nmols = 1) + solute = AtomSelection(select(atoms, "protein and residue 46"), nmols=1) solvent = AtomSelection(select(atoms, "water"), natomspermol=3) traj = Trajectory("$dir/trajectory.dcd", solute, solvent) - grid_file = tempname()*".pdb" + grid_file = tempname() * ".pdb" options = Options( - stride = 5, - seed = 321, - StableRNG = true, - nthreads = 1, - silent = true, + stride=5, + seed=321, + StableRNG=true, + nthreads=1, + silent=true, ) R = mddf(traj, options) grid = grid3D(R, atoms, grid_file) - @test length(grid) ≈ 1539 atol=3 + @test length(grid) ≈ 1539 atol = 3 c05 = filter(at -> beta(at) > 0.5, grid) @test length(c05) == 14 @test all(at -> element(at) == "O", c05) @@ -191,11 +191,11 @@ end # Test if the file was properly written grid_read = readPDB(grid_file) - for property in [:name, :resname, :chain, :resnum ] + for property in [:name, :resname, :chain, :resnum] @test all(p -> getproperty(first(p), property) == getproperty(last(p), property), zip(grid, grid_read)) end - for property in [ :x, :y, :z, :occup, :beta ] - @test all(p -> isapprox(getproperty(first(p), property),getproperty(last(p), property),atol=1e-2), zip(grid, grid_read)) + for property in [:x, :y, :z, :occup, :beta] + @test all(p -> isapprox(getproperty(first(p), property), getproperty(last(p), property), atol=1e-2), zip(grid, grid_read)) end end diff --git a/src/tools/plotting.jl b/src/tools/plotting.jl index 22820428a..ae6de7928 100644 --- a/src/tools/plotting.jl +++ b/src/tools/plotting.jl @@ -13,7 +13,7 @@ function contourf_per_residue(args...; kwargs...) Use `using Plots` before calling this function. 2. The function was called with the wrong arguments. Please read the documentation, by typing `? contourf_per_residue`. - + """)) end diff --git a/src/tools/residue_contributions.jl b/src/tools/residue_contributions.jl index e8e82591e..4b3f3c9f5 100644 --- a/src/tools/residue_contributions.jl +++ b/src/tools/residue_contributions.jl @@ -146,7 +146,7 @@ rc4 = rc2 / 2 Saving and loading was introduced in v2.8.0. Iterators were introduced in v2.10.0. """ -@kwdef struct ResidueContributions{N<:Union{SingleResidueContribution, MultipleResidueContribution}} +@kwdef struct ResidueContributions{N<:Union{SingleResidueContribution,MultipleResidueContribution}} Version::VersionNumber = pkgversion(@__MODULE__) d::Vector{Float64} residue_contributions::Vector{Vector{Float64}} @@ -270,7 +270,7 @@ end # Base.length(rc::ResidueContributions{SingleResidueContribution}) = length(first(rc.residue_contributions)) Base.getindex(rc::ResidueContributions{SingleResidueContribution}, i) = first(rc.residue_contributions)[i] -Base.firstindex(rc::ResidueContributions{SingleResidueContribution}) = firstindex(first(rc.residue_contributions)) +Base.firstindex(rc::ResidueContributions{SingleResidueContribution}) = firstindex(first(rc.residue_contributions)) Base.lastindex(rc::ResidueContributions{SingleResidueContribution}) = length(first(rc.residue_contributions)) Base.keys(rc::ResidueContributions{SingleResidueContribution}) = firstindex(rc):lastindex(rc) function Base.iterate(rc::ResidueContributions{SingleResidueContribution}, state=firstindex(first(rc.residue_contributions))) @@ -571,19 +571,19 @@ end # version issues N = ComplexMixtures.MultipleResidueContribution rc_future = ResidueContributions{N}( - Version=v"1000.0.0", - d=rc.d, - residue_contributions=rc.residue_contributions, - resnums=rc.resnums, + Version=v"1000.0.0", + d=rc.d, + residue_contributions=rc.residue_contributions, + resnums=rc.resnums, xticks=rc.xticks ) save(tmpfile, rc_future) @test_throws ArgumentError load(tmpfile, ResidueContributions) rc_past = ResidueContributions{N}( - Version=v"1.0.0", - d=rc.d, - residue_contributions=rc.residue_contributions, - resnums=rc.resnums, + Version=v"1.0.0", + d=rc.d, + residue_contributions=rc.residue_contributions, + resnums=rc.resnums, xticks=rc.xticks ) save(tmpfile, rc_past) @@ -609,14 +609,14 @@ end rc1 = rc[1] @test count(true for r in rc) == 104 @test count(true for r in rc1) == 101 - @test [ r[end] for r in rc ] == [ r[end] for r in rc.residue_contributions ] - @test last.(rc) == [ r[end] for r in rc ] - @test first.(findmax.(rc[3:4])) ≈ [ 8.8, 4.0 ] - @test last.(findmax.(rc[3:4])) == [ 101, 101 ] + @test [r[end] for r in rc] == [r[end] for r in rc.residue_contributions] + @test last.(rc) == [r[end] for r in rc] + @test first.(findmax.(rc[3:4])) ≈ [8.8, 4.0] + @test last.(findmax.(rc[3:4])) == [101, 101] @test findfirst.(>=(0.5), rc[3:4]) == [8, 18] - @test_throws ArgumentError findmax(rc) - @test_throws ArgumentError count(>(0.01), rc) - @test_throws ArgumentError count(<(0.01), rc) + @test_throws ArgumentError findmax(rc) + @test_throws ArgumentError count(>(0.01), rc) + @test_throws ArgumentError count(<(0.01), rc) # empty plot (just test if the show function does not throw an error) rc2 = copy(rc) diff --git a/src/tools/write.jl b/src/tools/write.jl index be8ca41ab..9463ef463 100644 --- a/src/tools/write.jl +++ b/src/tools/write.jl @@ -13,8 +13,8 @@ If they are not defined, the user can pass the names of the groups as strings in """ function Base.write( filename::String, R::Result; - solute_group_names::Union{Nothing,AbstractVector{<:AbstractString}} = nothing, - solvent_group_names::Union{Nothing,AbstractVector{<:AbstractString}} = nothing, + solute_group_names::Union{Nothing,AbstractVector{<:AbstractString}}=nothing, + solvent_group_names::Union{Nothing,AbstractVector{<:AbstractString}}=nothing, ) filename = expanduser(filename) @@ -57,20 +57,20 @@ function Base.write( println(output, "# Using cutoff distance: $(R.cutoff)") println(output, @sprintf("# Average and standard deviation of bulk-gmd: %11.5f +/- %12.5f", bulkerror, sdbulkerror)) end - println(output, - """ - # - # COLUMNS CORRESPOND TO: - # 0 Minimum distance to solute (dmin) - # 1 MDDF (md count normalized by md count of random-solute distribution) - # 2 Kirwood-Buff integral (cc/mol) computed [(1/bulkdensity)*(col(6)-col(7))]. - # 3 Minimum distance site count for each dmin. - # 4 Minimum distance site count for each dmin for random solute distribution. - # 5 Cumulative number of molecules within dmin in the simulation (coordination number) - # 6 Cumulative number of molecules within dmin for random solute distribution. - # 7 Volume of the shell of distance dmin and width binstep. - # - # 0-DISTANCE 2-GMD 3-KB INT 4-MD COUNT 5-COUNT RAND 6-SUM MD 7-SUM RAND 8-SHELL VOL""") + println(output, + """ + # + # COLUMNS CORRESPOND TO: + # 0 Minimum distance to solute (dmin) + # 1 MDDF (md count normalized by md count of random-solute distribution) + # 2 Kirwood-Buff integral (cc/mol) computed [(1/bulkdensity)*(col(6)-col(7))]. + # 3 Minimum distance site count for each dmin. + # 4 Minimum distance site count for each dmin for random solute distribution. + # 5 Cumulative number of molecules within dmin in the simulation (coordination number) + # 6 Cumulative number of molecules within dmin for random solute distribution. + # 7 Volume of the shell of distance dmin and width binstep. + # + # 0-DISTANCE 2-GMD 3-KB INT 4-MD COUNT 5-COUNT RAND 6-SUM MD 7-SUM RAND 8-SHELL VOL""") for i in eachindex(R.d) line = " " * format(R.d[i]) # 0-DISTANCE line = line * " " * format(R.mddf[i]) # 1-GMD @@ -92,7 +92,7 @@ function Base.write( """) # Solute and solvent contribution files - solute_file = write_group_contributions(R, filename, :solute, solute_group_names) + solute_file = write_group_contributions(R, filename, :solute, solute_group_names) solvent_file = write_group_contributions(R, filename, :solvent, solvent_group_names) return filename, solute_file, solvent_file @@ -126,8 +126,8 @@ end # Writting gmd per atom contributions for the solvent # function write_group_contributions( - R::Result, - filename::String, + R::Result, + filename::String, type::Symbol, group_names::AbstractVector{<:AbstractString}, ) @@ -197,12 +197,12 @@ function write_group_contributions( return group_contributions_output end - + # legacy order Base.write( R::Result, filename::String; - solute_group_names::Union{Nothing,AbstractVector{<:AbstractString}} = nothing, - solvent_group_names::Union{Nothing,AbstractVector{<:AbstractString}} = nothing, + solute_group_names::Union{Nothing,AbstractVector{<:AbstractString}}=nothing, + solvent_group_names::Union{Nothing,AbstractVector{<:AbstractString}}=nothing, ) = write(filename, R; solute_group_names, solvent_group_names) @testitem "write" begin @@ -212,45 +212,45 @@ Base.write( using ComplexMixtures.Testing: data_dir atoms = readPDB("$data_dir/NAMD/structure.pdb") # Using or not bulk-range - options1 = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true, bulk_range=(8.0, 10.0)) - options2 = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true, dbulk=8.0, usecutoff=false) - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - traj = Trajectory("$data_dir/NAMD/trajectory.dcd", protein, tmao, chemfiles = true) + options1 = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true, bulk_range=(8.0, 10.0)) + options2 = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true, dbulk=8.0, usecutoff=false) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + traj = Trajectory("$data_dir/NAMD/trajectory.dcd", protein, tmao, chemfiles=true) for options in (options1, options2) r = mddf(traj, options) - tmpfile = tempname()*".dat" + tmpfile = tempname() * ".dat" out1, out2, out3 = write(tmpfile, r) r_read = readdlm(out1, comments=true, comment_char='#') # Main output file - @test r.d ≈ r_read[:,1] - @test r.mddf ≈ r_read[:,2] - @test r.kb ≈ r_read[:,3] rtol = 1e-5 - @test r.md_count ≈ r_read[:,4] - @test r.md_count_random ≈ r_read[:,5] rtol = 1e-5 - @test r.coordination_number ≈ r_read[:,6] rtol = 1e-5 - @test r.coordination_number_random ≈ r_read[:,7] rtol = 1e-5 - @test r.volume.shell ≈ r_read[:,8] rtol = 1e-5 + @test r.d ≈ r_read[:, 1] + @test r.mddf ≈ r_read[:, 2] + @test r.kb ≈ r_read[:, 3] rtol = 1e-5 + @test r.md_count ≈ r_read[:, 4] + @test r.md_count_random ≈ r_read[:, 5] rtol = 1e-5 + @test r.coordination_number ≈ r_read[:, 6] rtol = 1e-5 + @test r.coordination_number_random ≈ r_read[:, 7] rtol = 1e-5 + @test r.volume.shell ≈ r_read[:, 8] rtol = 1e-5 # Solute contributions r_read = readdlm(out2, comments=true, comment_char='#') - @test r.d ≈ r_read[:,1] - @test r.mddf ≈ r_read[:,2] + @test r.d ≈ r_read[:, 1] + @test r.mddf ≈ r_read[:, 2] for i in eachindex(r.solute.group_names) - @test contributions(r, SoluteGroup([i])) ≈ r_read[:,i+2] rtol = 1e-5 + @test contributions(r, SoluteGroup([i])) ≈ r_read[:, i+2] rtol = 1e-5 end # Solvent contributions r_read = readdlm(out3, comments=true, comment_char='#') - @test r.d ≈ r_read[:,1] - @test r.mddf ≈ r_read[:,2] + @test r.d ≈ r_read[:, 1] + @test r.mddf ≈ r_read[:, 2] for (i, name) in enumerate(atom_group_names(r.solvent)) - @test contributions(r, SolventGroup([name])) ≈ r_read[:,i+2] rtol = 1e-5 + @test contributions(r, SolventGroup([name])) ≈ r_read[:, i+2] rtol = 1e-5 end end # legacy order of arguments r = mddf(traj, options1) - tmpfile = tempname()*".dat" + tmpfile = tempname() * ".dat" out1, out2, out3 = write(r, tmpfile) r_read = readdlm(out1, comments=true, comment_char='#') # Main output file - @test r.d ≈ r_read[:,1] + @test r.d ≈ r_read[:, 1] end diff --git a/src/trajectory_formats/ChemFiles.jl b/src/trajectory_formats/ChemFiles.jl index f91e86fc0..8e9097fb1 100644 --- a/src/trajectory_formats/ChemFiles.jl +++ b/src/trajectory_formats/ChemFiles.jl @@ -52,8 +52,8 @@ function ChemFile( filename::String, solute::AtomSelection, solvent::AtomSelection; - format = "", - T::Type = SVector{3,Float64}, + format="", + T::Type=SVector{3,Float64}, ) st = redirect_stdout(() -> Chemfiles.Trajectory(filename, 'r', format), devnull) @@ -88,12 +88,12 @@ function ChemFile( end function Base.show(io::IO, trajectory::ChemFile) - print(io,strip(""" - Trajectory read by Chemfiles with: - $(trajectory.nframes) frames. - $(trajectory.natoms) atoms. - Unit cell in current frame: $(convert_unitcell(getunitcell(trajectory))) - """)) + print(io, strip(""" + Trajectory read by Chemfiles with: + $(trajectory.nframes) frames. + $(trajectory.natoms) atoms. + Unit cell in current frame: $(convert_unitcell(getunitcell(trajectory))) + """)) end # @@ -166,9 +166,9 @@ end using StaticArrays atoms = readPDB(Testing.pdbfile) - options = Options(stride = 4, seed = 321, StableRNG = true, nthreads = 1, silent = true) - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + options = Options(stride=4, seed=321, StableRNG=true, nthreads=1, silent=true) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) traj = Trajectory("$(Testing.data_dir)/NAMD/trajectory.dcd", protein, tmao) ComplexMixtures.opentraj!(traj) ComplexMixtures.firstframe!(traj) diff --git a/src/trajectory_formats/NamdDCD.jl b/src/trajectory_formats/NamdDCD.jl index ac1f6d6ba..726f648b1 100644 --- a/src/trajectory_formats/NamdDCD.jl +++ b/src/trajectory_formats/NamdDCD.jl @@ -10,7 +10,7 @@ #$(TYPEDFIELDS) # #""" -struct NamdDCD{T<:AbstractVector, ST<:Stream{<:FortranFile}} <: Trajectory +struct NamdDCD{T<:AbstractVector,ST<:Stream{<:FortranFile}} <: Trajectory # # Mandatory data for things to work @@ -51,7 +51,7 @@ function NamdDCD( filename::String, solute::AtomSelection, solvent::AtomSelection; - T::Type = SVector{3,Float64}, + T::Type=SVector{3,Float64}, ) st = FortranFile(filename) @@ -179,7 +179,7 @@ function getunitcell(trajectory::NamdDCD) β = 90.0 γ = 90.0 end - return transpose(SMatrix{3,3}(Chemfiles.matrix(Chemfiles.UnitCell([A,B,C], [α, β, γ])))) + return transpose(SMatrix{3,3}(Chemfiles.matrix(Chemfiles.UnitCell([A, B, C], [α, β, γ])))) end # diff --git a/src/update_counters.jl b/src/update_counters.jl index 27f0e8f37..b1150be66 100644 --- a/src/update_counters.jl +++ b/src/update_counters.jl @@ -6,7 +6,7 @@ # (goes from 1 to natomspermol). The `first` argument is the index of the first Atom # in the molecule. The default value is 1. # -atom_type(iatom::Integer, natomspermol::Integer; first::Integer = 1) = mod1(iatom - first + 1, natomspermol) +atom_type(iatom::Integer, natomspermol::Integer; first::Integer=1) = mod1(iatom - first + 1, natomspermol) @testitem "atom_type" begin using ComplexMixtures: atom_type @@ -24,7 +24,7 @@ function update_group_count!(group_count, ibin, iatom, frame_weight, sol::AtomSe itype = atom_type(iatom, sol.natomspermol) group_count[itype][ibin] += frame_weight else - iat = sol.indices[iatom] + iat = sol.indices[iatom] for (igroup, indices) in enumerate(sol.group_atom_indices) ifind = searchsortedfirst(indices, iat) if ifind <= length(indices) && indices[ifind] == iat @@ -45,7 +45,7 @@ function update_counters!(R::Result, system::AbstractParticleSystem, frame_weigh !md.within_cutoff && continue ibin = setbin(md.d, R.files[1].options.binstep) R.md_count[ibin] += frame_weight - if R.autocorrelation + if R.autocorrelation # the atoms belong to the same set, so their contributions must be halved, # and contribute, both, to the solute count. The solute count is copied to the # solvent count in the `finalresults!` function. diff --git a/test/allocations.jl b/test/allocations.jl index 1fb613f0f..a486dd9d8 100644 --- a/test/allocations.jl +++ b/test/allocations.jl @@ -9,37 +9,37 @@ atoms = readPDB("$dir/structure.pdb") options = Options( - lastframe = 1, - nthreads = 1, - silent = true, - seed = 321, - StableRNG = true, + lastframe=1, + nthreads=1, + silent=true, + seed=321, + StableRNG=true, ) t = @benchmark Options( - lastframe = 1, - seed = 321, - StableRNG = true, - nthreads = 1, - silent = true, + lastframe=1, + seed=321, + StableRNG=true, + nthreads=1, + silent=true, ) samples = 1 evals = 1 @test t.allocs == 0 - + prot_atoms = select(atoms, "protein") indices = index.(prot_atoms) - b = @benchmark AtomSelection($(Int.(indices)), nmols = 1, natomspermol = 11, group_names=$(String[]), group_atom_indices=$(Vector{Int}[])) samples=1 evals=1 + b = @benchmark AtomSelection($(Int.(indices)), nmols=1, natomspermol=11, group_names=$(String[]), group_atom_indices=$(Vector{Int}[])) samples = 1 evals = 1 @test b.allocs == 0 - protein = AtomSelection(prot_atoms, nmols = 1) - t_selection1A = @benchmark AtomSelection($prot_atoms, nmols = 1) samples = 1 evals = 1 + protein = AtomSelection(prot_atoms, nmols=1) + t_selection1A = @benchmark AtomSelection($prot_atoms, nmols=1) samples = 1 evals = 1 @test t_selection1A.allocs < 1500 # one String per atom name n = String.(name.(prot_atoms)) - t_selection1B = @benchmark AtomSelection($prot_atoms, nmols = 1, group_names=$n, group_atom_indices=$(Vector{Int}[])) samples = 1 evals = 1 - @test t_selection1B.allocs <= 5 + t_selection1B = @benchmark AtomSelection($prot_atoms, nmols=1, group_names=$n, group_atom_indices=$(Vector{Int}[])) samples = 1 evals = 1 + @test t_selection1B.allocs <= 5 tmao_atoms = select(atoms, "resname TMAO") - tmao = AtomSelection(tmao_atoms, natomspermol = 14) + tmao = AtomSelection(tmao_atoms, natomspermol=14) t_selection2 = - @benchmark AtomSelection($tmao_atoms, natomspermol = 14) samples = 1 evals = 1 + @benchmark AtomSelection($tmao_atoms, natomspermol=14) samples = 1 evals = 1 @test t_selection2.allocs < 100 trajfile = "$dir/trajectory.dcd" # because of the interpolation of @benchmark @@ -67,7 +67,7 @@ @. buff.solute_read = traj.x_solute @. buff.solvent_read = traj.x_solvent ComplexMixtures.update_unitcell!(system, ComplexMixtures.convert_unitcell(ComplexMixtures.getunitcell(traj))) - t_mddf_frame = + t_mddf_frame = @benchmark ComplexMixtures.mddf_frame!($R, $system, $buff, $options, 1.0, $RNG) samples = 1 evals = 1 @test t_mddf_frame.allocs < 100 diff --git a/test/benchmark.jl b/test/benchmark.jl index 9c22ea3cf..e58262c0b 100644 --- a/test/benchmark.jl +++ b/test/benchmark.jl @@ -3,12 +3,12 @@ const CM = ComplexMixtures dir = "$(@__DIR__ )/data/NAMD" atoms = readPDB("$dir/structure.pdb") -protein = AtomSelection(select(atoms, "protein"), nmols = 1) -tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) -water = AtomSelection(select(atoms, "water"), natomspermol = 3) +protein = AtomSelection(select(atoms, "protein"), nmols=1) +tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) +water = AtomSelection(select(atoms, "water"), natomspermol=3) -options_single = Options(stride = 1, seed = 321, nthreads = 1, silent = true) -options_multi = Options(stride = 1, seed = 321, silent = true) +options_single = Options(stride=1, seed=321, nthreads=1, silent=true) +options_multi = Options(stride=1, seed=321, silent=true) nthreads = options_multi.nthreads diff --git a/test/gromacs.jl b/test/gromacs.jl index 41690922f..0175aabea 100644 --- a/test/gromacs.jl +++ b/test/gromacs.jl @@ -8,32 +8,32 @@ # dir = "$data_dir/Gromacs" atoms = readPDB("$dir/system.pdb") - options = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true) + options = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true) # Example 1: protein-EMIM # save(R,"$dir/protein_EMI.json") R_save = load("$dir/protein_EMI.json") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - emi = AtomSelection(select(atoms, "resname EMI"), natomspermol = 20) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + emi = AtomSelection(select(atoms, "resname EMI"), natomspermol=20) traj = Trajectory("$dir/trajectory.xtc", protein, emi) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 2: EMIM-DCA # save(R,"$dir/EMI_DCA.json") R_save = load("$dir/EMI_DCA.json") - emi = AtomSelection(select(atoms, "resname EMI"), natomspermol = 20) - dca = AtomSelection(select(atoms, "resname NC"), natomspermol = 5) + emi = AtomSelection(select(atoms, "resname EMI"), natomspermol=20) + dca = AtomSelection(select(atoms, "resname NC"), natomspermol=5) traj = Trajectory("$dir/trajectory.xtc", emi, dca) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 3: EMIM-EMIM # save(R,"$dir/EMI_EMI.json") R_save = load("$dir/EMI_EMI.json") - emi = AtomSelection(select(atoms, "resname EMI"), natomspermol = 20) + emi = AtomSelection(select(atoms, "resname EMI"), natomspermol=20) traj = Trajectory("$dir/trajectory.xtc", emi) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) end diff --git a/test/namd.jl b/test/namd.jl index ab5d3ff9f..bffc922dd 100644 --- a/test/namd.jl +++ b/test/namd.jl @@ -10,16 +10,16 @@ # dir = "$data_dir/NAMD" atoms = readPDB("$dir/structure.pdb") - options = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true, bulk_range=(8.0, 10.0)) + options = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true, bulk_range=(8.0, 10.0)) # Example 1: protein-tmao # save(R,"$dir/protein_tmao.json") R_save = load("$dir/protein_tmao.json") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) traj = Trajectory("$dir/trajectory.dcd", protein, tmao) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Test save and load temp_output = tempname() @@ -30,26 +30,26 @@ # Example 2: water-tmao # save(R,"$dir/water_tmao.json") R_save = load("$dir/water_tmao.json") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - water = AtomSelection(select(atoms, "water"), natomspermol = 3) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + water = AtomSelection(select(atoms, "water"), natomspermol=3) traj = Trajectory("$dir/trajectory.dcd", tmao, water) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 3: tmao-tmao # save(R,"$dir/tmao_tmao.json") R_save = load("$dir/tmao_tmao.json") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) traj = Trajectory("$dir/trajectory.dcd", tmao) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 3: water-water # save(R,"$dir/water_water.json") R_save = load("$dir/water_water.json") - water = AtomSelection(select(atoms, "water"), natomspermol = 3) + water = AtomSelection(select(atoms, "water"), natomspermol=3) traj = Trajectory("$dir/trajectory.dcd", water) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) end diff --git a/test/namd_chemfiles.jl b/test/namd_chemfiles.jl index dc2439bcb..0144cbf7f 100644 --- a/test/namd_chemfiles.jl +++ b/test/namd_chemfiles.jl @@ -10,16 +10,16 @@ dir = "$data_dir/NAMD" atoms = readPDB("$dir/structure.pdb") - options = Options(stride = 5, seed = 321, StableRNG = true, nthreads = 1, silent = true, bulk_range=(8.0, 10.0)) + options = Options(stride=5, seed=321, StableRNG=true, nthreads=1, silent=true, bulk_range=(8.0, 10.0)) # Example 1: protein-tmao # save(R,"$dir/protein_tmao.json") R_save = load("$dir/protein_tmao.json") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - traj = Trajectory("$dir/trajectory.dcd", protein, tmao, chemfiles = true) + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + traj = Trajectory("$dir/trajectory.dcd", protein, tmao, chemfiles=true) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Test save and load temp_output = tempname() @@ -37,26 +37,26 @@ # Example 2: water-tmao # save(R,"$dir/water_tmao.json") R_save = load("$dir/water_tmao.json") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - water = AtomSelection(select(atoms, "water"), natomspermol = 3) - traj = Trajectory("$dir/trajectory.dcd", tmao, water, chemfiles = true) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + water = AtomSelection(select(atoms, "water"), natomspermol=3) + traj = Trajectory("$dir/trajectory.dcd", tmao, water, chemfiles=true) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 3: tmao-tmao # save(R,"$dir/tmao_tmao.json") R_save = load("$dir/tmao_tmao.json") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - traj = Trajectory("$dir/trajectory.dcd", tmao, tmao, chemfiles = true) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + traj = Trajectory("$dir/trajectory.dcd", tmao, tmao, chemfiles=true) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 3: water-water # save(R,"$dir/water_water.json") R_save = load("$dir/water_water.json") - water = AtomSelection(select(atoms, "water"), natomspermol = 3) - traj = Trajectory("$dir/trajectory.dcd", water, water, chemfiles = true) + water = AtomSelection(select(atoms, "water"), natomspermol=3) + traj = Trajectory("$dir/trajectory.dcd", water, water, chemfiles=true) R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) end diff --git a/test/pdb.jl b/test/pdb.jl index 6fa99c570..374f1baa4 100644 --- a/test/pdb.jl +++ b/test/pdb.jl @@ -8,22 +8,22 @@ # dir = "$data_dir/PDB" atoms = readPDB("$dir/trajectory.pdb", "model 1") - options = Options(stride = 1, seed = 321, StableRNG = true, nthreads = 1, silent = true) + options = Options(stride=1, seed=321, StableRNG=true, nthreads=1, silent=true) # Example 1: protein-tmao # save(R,"$dir/protein_tmao.json") R_save = load("$dir/protein_tmao.json") - protein = AtomSelection(select(atoms, "protein"), nmols = 1) - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - traj = Trajectory("$dir/trajectory.pdb", protein, tmao, format = "PDBTraj") + protein = AtomSelection(select(atoms, "protein"), nmols=1) + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + traj = Trajectory("$dir/trajectory.pdb", protein, tmao, format="PDBTraj") R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) # Example 2: tmao-tmao # save(R,"$dir/tmao_tmao.json") R_save = load("$dir/tmao_tmao.json") - tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol = 14) - traj = Trajectory("$dir/trajectory.pdb", tmao, format = "PDBTraj") + tmao = AtomSelection(select(atoms, "resname TMAO"), natomspermol=14) + traj = Trajectory("$dir/trajectory.pdb", tmao, format="PDBTraj") R = mddf(traj, options) - @test isapprox(R, R_save, debug = true) + @test isapprox(R, R_save, debug=true) end diff --git a/test/runtests.jl b/test/runtests.jl index 8ccd4f409..713fe755e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using TestItemRunner: @run_package_tests, @testitem -@run_package_tests +@run_package_tests @testitem "Aqua.test_all" begin import Aqua