diff --git a/scripts/multitraj.jl b/scripts/multitraj.jl index f050c32..50dc6b4 100644 --- a/scripts/multitraj.jl +++ b/scripts/multitraj.jl @@ -20,19 +20,21 @@ molecule = load_trajectory(pdbfile) pdist_inds = restricted_localpdistinds(molecule, MAXRADIUS, atom_indices(pdbfile, "not water and name==CA")) + datas = map(trajfiles) do trajfile traj = load_trajectory(trajfile, top=pdbfile, stride=STRIDE) # for large datasets you may use the memory-mapped LazyTrajectory - feats = pdists(traj, pdist_inds) - data = data_from_trajectory(feats, reverse=true) + xs, ys = data_from_trajectory(traj, reverse=true) end -data = reduce(mergedata, datas) +xs, ys = reduce(mergedata, datas) + +data = pdists(xs, pdist_inds), pdists(ys, pdist_inds) -iso = Iso(data) +iso = Iso(data, opt=NesterovRegularized()) run!(iso, 1000) # saving the reactive path for multiple trajectories could work like this # note that the above data is probably too big for this to terminate in sufficient time # coords = ISOKANN.LazyMultiTrajectory(ISOKANN.LazyTrajectory.(trajfiles)) -# save_reactive_path(iso, coords, sigma=.1, source=pdbfile) \ No newline at end of file +save_reactive_path(iso, xs, sigma=0.1, source=pdbfile) \ No newline at end of file diff --git a/src/ISOKANN.jl b/src/ISOKANN.jl index 4e1ce54..23ecd08 100644 --- a/src/ISOKANN.jl +++ b/src/ISOKANN.jl @@ -72,6 +72,7 @@ export exit_rates export load_trajectory, save_trajectory export atom_indices export localpdistinds, pdists, restricted_localpdistinds +export data_from_trajectory, mergedata export reactionpath_minimum, reactionpath_ode diff --git a/src/molutils.jl b/src/molutils.jl index 5bfab68..ffb29d2 100644 --- a/src/molutils.jl +++ b/src/molutils.jl @@ -143,9 +143,9 @@ save the trajectory given in `coords` to `filename` with the topology provided b """ function save_trajectory(filename, coords::AbstractMatrix; top::String) mdtraj = pyimport_conda("mdtraj", "mdtraj", "conda-forge") - traj = mdtraj.load(filename, stride=-1) + traj = mdtraj.load(top, stride=-1) xyz = reshape(coords, 3, :, size(coords, 2)) - traj.xyz = PyReverseDims(xyz) + traj = mdtraj.Trajectory(PyReverseDims(xyz), traj.topology) traj.save(filename) end