Skip to content

Commit

Permalink
configure villin experiment
Browse files Browse the repository at this point in the history
hamiltonian mechanics with velocity resampling
  • Loading branch information
axsk committed May 16, 2024
1 parent 5d68e9a commit 8ee112f
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions scripts/villin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ using PyCall

## Config

comment = ""
comment = "hamilton"

pdb = "data/villin nowater.pdb"
steps = 20_000
steps = 10_000
step = 0.002
temp = 310
friction = 1
friction = 0
integrator = :langevinmiddle
minimize = true
momenta = true
momenta = false
features = 0.5 # 0 => backbone only
#forcefields = OpenMM.FORCE_AMBER_IMPLICIT # TODO: this shouldnb be an option the way we build addwater now
forcefields = ISOKANN.OpenMM.FORCE_AMBER
addwater = true
padding = 1
ionicstrength = 0.0

nx = 20
nx = 10
nchistrat = 10
nk = 1
iter = 1000
generations = 1000
cutoff = 2500
generations = 2500
cutoff = 20_000

kde_padding = 0.02
extrapolates = 0 # *2
Expand All @@ -49,7 +50,7 @@ readdata = nothing
## Initialisation

lagtime = steps * step / 1000 # in nanoseconds
simtime_per_gen = lagtime * (nx + 2 * extrapolates) * nk # in nanoseconds
simtime_per_gen = lagtime * (nx + nchistrat + 2 * extrapolates) * nk # in nanoseconds

println("lagtime: $lagtime ns")
println("simtime per generation: $simtime_per_gen ns")
Expand All @@ -72,6 +73,10 @@ elseif integrator == :nosehoover
sim.pysim.context._integrator = openmm.NoseHooverIntegrator(sim.temp * kelvin, sim.friction / picosecond, sim.step * picosecond)
elseif integrator == :anderson
sim.pysim.context._integrator = openmm.AndersenThermostat(sim.temp * kelvin, sim.friction)
elseif integrator == :verlet
sim.pysim.context._integrator = openmm.VerletIntegrator(sim.step * picosecond)
else
error("unknown integrator")
end


Expand All @@ -94,26 +99,28 @@ data = nothing
## Running

newsim = true
simtime = ISOKANN.simulationtime(iso)

for i in 1:generations
global simtime

GC.gc()
if length(iso.data) > cutoff
iso.data = iso.data[end-cutoff+1:end]
end
@show varinfo()

#@show varinfo()
GC.gc()

simtime -= ISOKANN.simulationtime(iso)
@time "chistratsampling" ISOKANN.adddata!(iso, nchistrat; keepedges)
@time "extrapolating" ISOKANN.addextrapolates!(iso, extrapolates, stepsize=extrapolate)
@time "kde sampling" ISOKANN.resample_kde!(iso, nx; padding=kde_padding)


simtime += ISOKANN.simulationtime(iso)

@time "training" run!(iso, iter)



simtime = ISOKANN.simulationtime(iso)

@time "saving" begin

try
Expand All @@ -137,11 +144,12 @@ for i in 1:generations
#ISOKANN.savecoords("$path/data.pdb", iso)
ISOKANN.Plots.savefig(plot_training(iso), "$path/snapshot/villin_fold_$(simtime)ps.png")


symlink("$path/snapshot/villin_fold_$(simtime)ps.pdb", "$path/path.pdb")
symlink("$path/snapshot/villin_fold_$(simtime)ps.png", "$path/training.png")
println("status: $path/ training.png")
ISOKANN.save("$path/iso.jld2", iso)

run(`ln -sf snapshot/villin_fold_$(simtime)ps.pdb $path/path.pdb`)
run(`ln -sf snapshot/villin_fold_$(simtime)ps.png $path/training.png`)

println("status: $path/training.png")
catch e
@show e

Expand Down

0 comments on commit 8ee112f

Please sign in to comment.