Skip to content

Commit 241032d

Browse files
committed
still fixing paths issues...
1 parent 74e61f9 commit 241032d

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

src/msad.jl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ mutable struct MSADTracker{T} <: AriannaAlgorithm
9292
files_thresh::Vector{IOStream} # file to write rotation vector in threshold method
9393
end
9494

95-
function MSADTracker(chains; theta_T::T, output_schedule::Vector{Int}, path::String, scheduler::Vector{Int}=Int[], kwargs...) where {T}
95+
function MSADTracker(chains;
96+
theta_T::Float64,
97+
output_schedule::Vector{Int}=Int[],
98+
path::String=".",
99+
scheduler::Vector{Int}=Int[],
100+
kwargs...)
96101

97102
compute_schedule = scheduler
98103

@@ -103,15 +108,15 @@ function MSADTracker(chains; theta_T::T, output_schedule::Vector{Int}, path::Str
103108
"""
104109
end
105110

106-
n = length(chains)
107-
states = [MSADState{T}() for _ in 1:n] # one empty state per chain filled during initialise
111+
n = length(chains)
112+
states = [MSADState{Float64}() for _ in 1:n]
108113

109-
dirs = [joinpath(path, "chains", "$c") for c in 1:n]
114+
files_integral = Vector{IOStream}(undef, n)
115+
files_thresh = Vector{IOStream}(undef, n)
110116

111-
algorithm.files_integral[c] = open(joinpath(dirs, "phi_integral.dat"), "w")
112-
algorithm.files_thresh[c] = open(joinpath(dirs, "phi_thresh.dat"), "w")
113-
114-
return MSADTracker{T}(states, theta_T, compute_schedule, output_schedule, paths_integral, paths_thresh, files_integral, files_thresh)
117+
return MSADTracker{Float64}(states, theta_T, compute_schedule,
118+
output_schedule, path,
119+
files_integral, files_thresh)
115120
end
116121

117122
##### Function to write phi frame #####
@@ -139,13 +144,12 @@ function Arianna.initialise(algorithm::MSADTracker, simulation::Simulation)
139144
T = typeof(system.temperature) # get the float type from system so one can choose Float64 or 32 (generic)
140145

141146
# create output directory if it doesn't exist
142-
mkpath(dirname(algorithm.paths_integral[c]))
147+
dir = joinpath(algrithm.path, "chains", "$c")
148+
mkpath(dir)
143149

144150
# open output file — write header
145-
algorithm.files_integral[c] = open(algorithm.paths_integral[c], "w")
146-
algorithm.files_thresh[c] = open(algorithm.paths_thresh[c], "w")
147-
148-
println(algorithm.files[c], "# t msad_euler msad_integral msad_thresh")
151+
algorithm.files_integral[c] = open(joinpath(dir, "phi_integral.dat"), "w")
152+
algorithm.files_thresh[c] = open(joinpath(dir, "phi_thresh.dat"), "w")
149153

150154
# compute initial body frames
151155
R_all = get_all_body_frames(system)

0 commit comments

Comments
 (0)