rs.append(ev)

# Scoring Function from restraints
sf = IMP.core.RestraintsScoringFunction(rs, "SF")
#print(h_root.get_children())

# -------- III. System dynamic: --------
bd = IMP.atom.BrownianDynamics(m)
bd.set_log_level(IMP.SILENT)
bd.set_scoring_function(sf)
bd.set_maximum_time_step(bd_step_size_fs) # in femtoseconds
bd.set_temperature(310.15)

# -------- Add RMF visualization --------
rmf = RMF.create_rmf_file("pathway.rmf")
rmf.set_description("Brownian dynamics trajectory with {}fs timestep.\n"\
                    .format(bd_step_size_fs))
IMP.rmf.add_hierarchy(rmf, h_root)
IMP.rmf.add_restraints(rmf, rs)
IMP.rmf.add_geometry(rmf, IMP.display.BoundingBoxGeometry(bb))
IMP.rmf.add_geometry(rmf, IMP.display.SphereGeometry(pbc_sphere))
    
# Pair RMF with model using an OptimizerState ("listener")
sos = IMP.rmf.SaveOptimizerState(m, rmf)
sos.set_log_level(IMP.SILENT)
sos.set_simulator(bd)
sos.set_period(rmf_dump_interval_frames)
bd.add_optimizer_state(sos)
#bd.add_optimizer_state(gaos)

# Dump initial frame to RMF
sos.update_always("initial conformation")
    rb.set_coordinates_are_optimized(True)

m.update()

#-----run-----
print("run")
frames = 10000

bd = IMP.atom.BrownianDynamics(m)
bd.set_log_level(IMP.SILENT)
bd.set_scoring_function(sf)
bd.set_maximum_time_step(10000)
bd.set_temperature(310)

rmf = RMF.create_rmf_file("mimic_cell_sim.rmf")
rmf.set_description("Brownian dynamics trajectory with 10fs timestep.\n")
IMP.rmf.add_hierarchy(rmf, hc)
IMP.rmf.add_hierarchy(rmf, rs)
IMP.rmf.add_geometry(rmf, IMP.display.BoundingBoxGeometry(bb))
IMP.rmf.add_geometry(rmf, IMP.display.SphereGeometry(pbc_sphere))
IMP.rmf.add_geometry(rmf, IMP.display.SphereGeometry(cortex_sphere))

# optimizer state
os = IMP.rmf.SaveOptimizerState(m, rmf)
os.update_always("initial conformation")
os.set_log_level(IMP.SILENT)
os.set_simulator(bd)
os.set_period(1000)
bd.add_optimizer_state(os)
bd.optimize(frames)
Example #3
0
bbss = IMP.core.BoundingBox3DSingletonScore(
    IMP.core.HarmonicUpperBound(0, k), bb)
bbr = IMP.container.SingletonsRestraint(bbss, ps)
rs.append(bbr)

sf = IMP.core.RestraintsScoringFunction(rs, "SF")

bd = IMP.atom.BrownianDynamics(m)
bd.set_log_level(IMP.base.SILENT)
bd.set_scoring_function(sf)

bd.set_maximum_time_step(10)

name = IMP.base.create_temporary_file_name("brownian", ".rmf")
rmf = RMF.create_rmf_file(name)
rmf.set_description("Brownian dyanmics trajectory with 10fs timestep.\n")
IMP.rmf.add_hierarchy(rmf, h)
IMP.rmf.add_restraints(rmf, rs)
IMP.rmf.add_geometry(rmf, IMP.display.BoundingBoxGeometry(bb))

os = IMP.rmf.SaveOptimizerState(rmf)
os.update_always("initial conformation")
os.set_log_level(IMP.base.SILENT)
os.set_simulator(bd)
bd.add_optimizer_state(os)

bd.optimize(frames)

print "file is", rmf.get_name()
Example #4
0
IMP.base.set_log_level(IMP.base.VERBOSE)

# Create restrainer object
restrainer = IMP.restrainer.Main()

# Add representation, restraint, optimization and display to restrainer
rep = restrainer.add_representation(IMP.restrainer.get_example_path('input/nup84_representation.xml'))
rsr = restrainer.add_restraint(IMP.restrainer.get_example_path('input/nup84_restraint.xml'))

#BEGIN ADDED PART
import IMP.rmf
import RMF

rmf= RMF.create_rmf_file('nup84_simulation.rmf')
rmf.set_description("Simulate nup84.\n")

model = restrainer.get_model()
root_hierarchy = rep.get_root_imp_hierarchy()

IMP.rmf.add_hierarchy(rmf, root_hierarchy)
IMP.rmf.add_restraints(rmf, model.get_restraints())
IMP.rmf.save_frame(rmf, 0)

os= IMP.rmf.SaveOptimizerState(rmf)
os.update_always("initial conformation")
restrainer.log = os
#END ADDED PART

opt = restrainer.add_optimization(IMP.restrainer.get_example_path('input/nup84_optimization.xml'))
disp = restrainer.add_display(IMP.restrainer.get_example_path('input/nup84_display.xml'), 'some_log_name')
Example #5
0
    mc = IMP.core.MonteCarloWithLocalOptimization(cg, LSTEPS) 
    mc.set_return_best(True) 
    mc.set_name("MC")
    sm = IMP.core.SerialMover(movers)
    mc.add_mover(sm)
     
    # sf = IMP.core.RestraintsScoringFunction(restraints, "RSF")
    # mc.set_scoring_function(sf) #monte carlo
    # cg.set_scoring_function(sf)     
    
    ######################RMF VIDEO, INSTALL RMF AGAIN!! ######################    
    if rmf_video:
     
    #create the RMF file to show the movie
        rmf= RMF.create_rmf_file('genome.rmf')
        rmf.set_description("Simulate genome.\n")
         
        bd = IMP.atom.BrownianDynamics(m)
        bd.set_log_level(IMP.base.SILENT)
#         bd.set_scoring_function(sf)

        bd.set_maximum_time_step(100)
         
        IMP.rmf.add_hierarchy(rmf, hierarqy)
        IMP.rmf.add_restraints(rmf, restraints)

        os= IMP.rmf.SaveOptimizerState(m,rmf)

        os.update_always("initial conformation")
        os.set_log_level(IMP.base.SILENT)
        os.set_simulator(bd)
      " frames.")
print("RMF dump interval " + str(RMF_DUMP_INTERVAL_NS) + " / " +
      str(rmf_dump_interval_frames) + " frames.")

# Running
print("run")

bd = IMP.atom.BrownianDynamics(m)
bd.set_log_level(IMP.SILENT)
#bd.set_log_level(IMP.VERBOSE)
bd.set_scoring_function(sf)
bd.set_maximum_time_step(bd_step_size_fs)
bd.set_temperature(310)

rmf = RMF.create_rmf_file("test_granule_actin_interaction_functor.rmf")
rmf.set_description("Brownian dynamics trajectory with" +
                    str(bd_step_size_fs) + "fs timestep.\n")
IMP.rmf.add_hierarchy(rmf, h_root)
IMP.rmf.add_restraints(rmf, rs)
IMP.rmf.add_geometry(rmf, IMP.display.BoundingBoxGeometry(bb))
IMP.rmf.add_geometry(rmf, IMP.display.SphereGeometry(pbc_sphere))
# IMP.rmf.add_geometry(rmf, IMP.display.SphereGeometry(cortex_sphere))

# optimizer state
os = IMP.rmf.SaveOptimizerState(m, rmf)
os.update_always("initial conformation")
os.set_log_level(IMP.SILENT)
#os.set_log_level(IMP.VERBOSE)
os.set_simulator(bd)
os.set_period(rmf_dump_interval_frames)
bd.add_optimizer_state(os)
bd.optimize(sim_time_frames)