I am trying to model a complex using IMP however, I can't use the older IMP on a server. My problem is that when I try to change to using BuildSystem, my simulation fails.
I attach, the original modeling.py and the new modeling.py with the two inputs.
import datetime
import IMP
import IMP.core
import IMP.algebra
import IMP.atom
import IMP.container
import IMP.pmi.restraints.crosslinking
import IMP.pmi.restraints.stereochemistry
import IMP.pmi.restraints.em
import IMP.pmi.restraints.basic
import IMP.pmi.representation
import IMP.pmi.tools
import IMP.pmi.samplers
import IMP.pmi.output
import IMP.pmi.macros
import IMP.pmi.topology
import os
import sys
#---------------------------
# Define Input Files
#---------------------------
datadirectory = "../data/"
topology_file = datadirectory+"topology2.txt"
#--------------------------
# Monte-Carlo Sampling
#--------------------------
#--------------------------
# Set MC Sampling Parameters
#--------------------------
num_frames = 20000
if '--test' in sys.argv: num_frames=100
num_mc_steps = 10
#---------------------------
# Define Input Degrees of Freedom
#---------------------------
bead_max_trans = 5.00
rb_max_trans = 5.00
rb_max_rot = 0
# Initialize model
m = IMP.Model()
# Read in the topology file.
# Specify the directory wheere the PDB files, fasta files and GMM files are
topology = IMP.pmi.topology.TopologyReader(topology_file,
pdb_dir=datadirectory,
fasta_dir=datadirectory,
gmm_dir=datadirectory)
# Use the BuildSystem macro to build states from the topology file
bs = IMP.pmi.macros.BuildSystem(m)
# Each state can be specified by a topology file.
bs.add_state(topology)
starttime = datetime.datetime.now()
#Root-hierarchy and degrees of freedom
root_hier, dof = bs.execute_macro(max_rb_trans=rb_max_trans,
max_rb_rot=rb_max_rot,
max_bead_trans=bead_max_trans,
max_srb_trans=4.0,
max_srb_rot=0.3)
# Fix all rigid bodies but not Rpb4 and Rpb7 (the stalk)
# First select and gather all particles to fix.
fixed_particles=[]
for prot in ["Kir-I","Kir-J","Kir-K","Kir-L","Kir2-I","Kir2-J","Kir2-K","Kir2-L"]:
fixed_particles+=IMP.atom.Selection(root_hier,molecule=prot).get_selected_particles()
# Fix the Corresponding Rigid movers and Super Rigid Body movers using dof
# The flexible beads will still be flexible (fixed_beads is an empty list)!
fixed_beads,fixed_rbs=dof.disable_movers(fixed_particles,
[IMP.core.RigidBodyMover,
IMP.pmi.TransformMover])
"""
# Randomize the initial configuration before sampling, of only the molecules
# we are interested in (Rpb4 and Rpb7)
IMP.pmi.tools.shuffle_configuration(root_hier,
excluded_rigid_bodies=fixed_rbs,
max_translation=50,
verbose=False,
cutoff=5.0,
niterations=100)
"""
# Connectivity keeps things connected along the backbone (ignores if inside
# same rigid body)
outputobjects=[] # reporter objects (for stat files)
mols = IMP.pmi.tools.get_molecules(root_hier)
for mol in mols:
molname=mol.get_name()
IMP.pmi.tools.display_bonds(mol)
cr = IMP.pmi.restraints.stereochemistry.ConnectivityRestraint(mol,scale=2.0)
cr.add_to_model()
cr.set_label(molname)
outputobjects.append(cr)
ev = IMP.pmi.restraints.stereochemistry.ExcludedVolumeSphere(
included_objects=root_hier,
resolution=10)
ev.add_to_model()
outputobjects.append(ev)
#---------------------------
# Give Cross-Links
#---------------------------
# Crosslinks - dataset 2
# We can easily add a second set of crosslinks.
# These have a different format and label, but other settings are the same
sampleobjects=[]
xldbkwc = IMP.pmi.io.crosslink.CrossLinkDataBaseKeywordsConverter()
xldbkwc.set_protein1_key("prot1")
xldbkwc.set_protein2_key("prot2")
xldbkwc.set_residue1_key("res1")
xldbkwc.set_residue2_key("res2")
xl2db = IMP.pmi.io.crosslink.CrossLinkDataBase(xldbkwc)
xl2db.create_set_from_file(datadirectory+'interactions2.csv')
xl2 = IMP.pmi.restraints.crosslinking.CrossLinkingMassSpectrometryRestraint(
root_hier=root_hier,
CrossLinkDataBase=xl2db,
length=21.0,
slope=0.01,
resolution=1.0,
label="Chen",
weight=1.)
xl2.add_to_model()
outputobjects.append(xl2)
sampleobjects.append(xl2)
#---------------------------
# Give EM restraints - NO
#---------------------------
#---------------------------
# SAMPLING
#---------------------------
mc1=IMP.pmi.macros.ReplicaExchange0(m,
root_hier=root_hier,
monte_carlo_sample_objects=sampleobjects,#dof.get_movers(),
output_objects=outputobjects,
crosslink_restraints=xl2,
monte_carlo_temperature=1.0,
simulated_annealing=True,
simulated_annealing_minimum_temperature=1.0,
simulated_annealing_maximum_temperature=2.5,
simulated_annealing_minimum_temperature_nframes=200,
simulated_annealing_maximum_temperature_nframes=20,
replica_exchange_minimum_temperature=1.0,
replica_exchange_maximum_temperature=2.5,
number_of_best_scoring_models=100,
monte_carlo_steps=num_mc_steps,
number_of_frames=num_frames,
global_output_directory="output")
mc1.execute_macro()
endtime = datetime.datetime.now()
file = open("simulation_data.txt","w")
file.write("\n")
file.write("Start: ")
file.write(str(starttime))
file.write("End: ")
file.write(str(endtime))
file.write("Elapsed: ")
file.write(str(endtime-starttime))
file.close()
print("\n")
print("Start: ")
print(starttime)
print("End: ")
print(endtime)
print("Elapsed: ")
print(endtime-starttime)