Skip to content

Commit

Permalink
remove file operations module
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Dec 1, 2023
1 parent 0efe0dc commit be64dc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/Trajectory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Trajectory(
format::String = "",
chemfiles = false,
)
if !chemfiles && (format == "dcd" || FileOperations.file_extension(filename) == "dcd")
if !chemfiles && (format == "dcd" || split(filename, '.')[end] == "dcd")
trajectory = NamdDCD(filename, solute, solvent)
elseif !chemfiles && format == "PDBTraj"
trajectory = PDBTraj(filename, solute, solvent)
Expand Down
51 changes: 0 additions & 51 deletions src/io.jl
Original file line number Diff line number Diff line change
@@ -1,54 +1,3 @@

module FileOperations

#
# Function that removes the extension of a file name
#
remove_extension(file::String) = file[1:findlast(==('.'), file)-1]

#
# Function that determines the basename of a file, removing the path and the extension
#
clearname(filename::String) = remove_extension(basename(filename))

#
# Function that return only the extension of the file
#
file_extension(file::String) = file[findlast(==('.'), file)+1:end]

#
# Function that determines if a character is empty
#
empty_char(c::Char) = in(c, (Char(9), Char(32)))

#
# Function that checks if a line is a comment line or if it is empty
#
function commentary(s::String)
i = findfirst(c -> !(empty_char(c)), s)
return isnothing(i) || s[i] == '#'
end

end # module


"""
$(INTERNAL)
$(TYPEDEF)
Structure to contain the names of the output files.
$(TYPEDFIELDS)
"""
@kwdef mutable struct OutputFiles
output::String
solute_atoms::String
solvent_atoms::String
end

"""
$(INTERNAL)
Expand Down
8 changes: 4 additions & 4 deletions src/legacy/write_results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ function write(

# Names of output files containing atomic contibutions
atom_contributions_solvent = normpath(
FileOperations.remove_extension(filename) *
filename[1:findlast(==('.'), filename)-1] *
"-ATOM_CONTRIBUTIONS_SOLVENT." *
FileOperations.file_extension(filename)
split(filename, '.')[end]
)
atom_contributions_solute = normpath(
FileOperations.remove_extension(filename) *
filename[1:findlast(==('.'), filename)-1] *
"-ATOM_CONTRIBUTIONS_SOLUTE." *
FileOperations.file_extension(filename)
split(filename, '.')[end]
)

#
Expand Down

0 comments on commit be64dc3

Please sign in to comment.