Skip to content

Commit

Permalink
change some names
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Oct 3, 2023
1 parent 8c4ba61 commit 4bbdb9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/Selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ struct Selection
natomspermol::Int # Number of atoms per molecule
index::Vector{Int} # Index of each atom in the full vector of coordinates
imol::Vector{Int} # index of the molecule to which each atom belongs
names::Vector{String} # Types of the atoms, to be used in the atom-contributions
groups::Vector{Vector{Int}}
group_names::Vector{String} # Types of the atoms, to be used in the atom-contributions
end

# Initialize providing the file name, and calling by default PDBTools.select
Expand Down
26 changes: 13 additions & 13 deletions src/results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ The Result{Vector{Float64}} parametric type is necessary only for reading the JS
solute::SolSummary

# Atomic contributions to the MDDFs
solute_atom::T = zeros(nbins, solute.natomspermol)
solvent_atom::T = zeros(nbins, solvent.natomspermol)
solute_group_contributions = zeros(nbins, solute.ngroups)
solvent_group_contributions = zeros(nbins, solvent.ngroups)

# Data to compute a RDF and the KB integral from this count
rdf_count::Vector{Float64} = zeros(nbins)
Expand Down Expand Up @@ -718,22 +718,22 @@ If the solute and solvent selections are provides, pass on the atom names.
"""
write(R::Result, filename::String, solute::Selection, solvent::Selection) =
write(R, filename, solute_names = solute.names, solvent_names = solvent.names)
write(R, filename, solute_group_names = solute.names, solvent_group_names = solvent.group_names)


"""
write(R::ComplexMixtures.Result, filename::String;
solute_names::Vector{String} = ["nothing"],
solvent_names::Vector{String} = ["nothing"])
solute_group_names::Vector{String} = ["nothing"],
solvent_group_names::Vector{String} = ["nothing"])
Optional passing of atom names.
"""
function write(
R::Result,
filename::String;
solute_names::Vector{String} = ["nothing"],
solvent_names::Vector{String} = ["nothing"],
solute_group_names::Vector{String} = ["nothing"],
solvent_group_names::Vector{String} = ["nothing"],
)

# Names of output files containing atomic contibutions
Expand Down Expand Up @@ -809,20 +809,20 @@ function write(

# Writting gmd per atom contributions for the solvent

open(atom_contributions_solvent, "w") do output
open(group_contributions_solvent, "w") do output
println(output,
"""
# Solvent atomic contributions to total MDDF.
# Solvent group contributions to total MDDF.
#
# Trajectory files: $(R.files)
#
# Atoms:
""")
for i = 1:size(R.solvent_atom, 2)
if solvent_names[1] == "nothing"
if solvent_group_names[1] == "nothing"
println(output, @sprintf("# %9i", i))
else
println(output, @sprintf("# %9i %5s", i, solvent_names[i]))
println(output, @sprintf("# %9i %5s", i, solvent_group_names[i]))
end
end
println(output, "#")
Expand Down Expand Up @@ -853,10 +853,10 @@ function write(
# Atoms
""")
for i = 1:size(R.solute_atom, 2)
if solute_names[1] == "nothing"
if solute_group_names[1] == "nothing"
println(output, @sprintf("# %9i", i))
else
println(output, @sprintf("# %9i %5s", i, solute_names[i]))
println(output, @sprintf("# %9i %5s", i, solute_group_names[i]))
end
end
println(output, "#")
Expand Down

0 comments on commit 4bbdb9d

Please sign in to comment.