def test_md(self): """Test you can setup MD""" mdl = IMP.Model() s = IMP.pmi.topology.System(mdl) st1 = s.create_state() seqs = IMP.pmi.topology.Sequences(self.get_input_file_name('seqs.fasta')) m1 = st1.create_molecule("Prot1",sequence=seqs["Protein_1"]) atomic_res = m1.add_structure(self.get_input_file_name('prot.pdb'), chain_id='A',res_range=(55,63),offset=-54) m1.add_representation(atomic_res,resolutions=[0]) hier = s.build() dof = IMP.pmi.dof.DegreesOfFreedom(mdl) md_ps = dof.setup_md(m1) rex = IMP.pmi.macros.ReplicaExchange0(mdl, root_hier=hier, molecular_dynamics_sample_objects=md_ps, number_of_frames=2, test_mode=True, replica_exchange_object=rem) rex.execute_macro()
def test_md(self): """Test you can setup MD""" mdl = IMP.Model() s = IMP.pmi.topology.System(mdl) st1 = s.create_state() seqs = IMP.pmi.topology.Sequences( self.get_input_file_name('seqs.fasta')) m1 = st1.create_molecule("Prot1", sequence=seqs["Protein_1"]) atomic_res = m1.add_structure(self.get_input_file_name('prot.pdb'), chain_id='A', res_range=(55, 63), offset=-54) m1.add_representation(atomic_res, resolutions=[0]) hier = s.build() dof = IMP.pmi.dof.DegreesOfFreedom(mdl) md_ps = dof.setup_md(m1) rex = IMP.pmi.macros.ReplicaExchange0( mdl, root_hier=hier, molecular_dynamics_sample_objects=md_ps, number_of_frames=2, test_mode=True, replica_exchange_object=rem) rex.execute_macro()
# add charmm restraints print("adding restraints") charmm = IMP.pmi.restraints.stereochemistry.CharmmForceFieldRestraint(hier) charmm.add_to_model() # add elastic network on secondary structure units sses = IMP.pmi.io.parse_dssp(IMP.pmi.get_example_path("data/gcp2.dssp"), "A") all_rs = [] for sse in sses["helix"] + sses["beta"]: er = IMP.pmi.restraints.stereochemistry.ElasticNetworkRestraint( selection_tuples=sse, strength=10.0, dist_cutoff=5.0, ca_only=True, hierarchy=hier ) all_rs.append(er) er.add_to_model() # seutp MD and run dof = IMP.pmi.dof.DegreesOfFreedom(mdl) md_ps = dof.setup_md(gcp2) rex = IMP.pmi.macros.ReplicaExchange0( mdl, root_hier=hier, crosslink_restraints=all_rs, # for visualizing SSEs in RMF molecular_dynamics_sample_objects=md_ps, molecular_dynamics_steps=5, number_of_best_scoring_models=0, # set >0 to store best PDB files (but this is slow to do online) number_of_frames=1, # increase number of frames to get better results! global_output_directory="atomistic_output/", ) rex.execute_macro()
# add elastic network on secondary structure units sses = IMP.pmi.io.parse_dssp(IMP.pmi.get_example_path('data/gcp2.dssp'), 'A', name_map={'A': 'GCP2'}) all_rs = [] for sse in sses['helix']+sses['beta']: er = IMP.pmi.restraints.stereochemistry.ElasticNetworkRestraint( selection_tuples=sse, strength=10.0, dist_cutoff=5.0, ca_only=True, hierarchy=hier) all_rs.append(er) er.add_to_model() # setup MD and run dof = IMP.pmi.dof.DegreesOfFreedom(mdl) md_ps = dof.setup_md(gcp2) rex = IMP.pmi.macros.ReplicaExchange0( mdl, root_hier=hier, # for visualizing SSEs in RMF crosslink_restraints=all_rs, molecular_dynamics_sample_objects=md_ps, molecular_dynamics_steps=5, # set >0 to store best PDB files (but this is slow to do online) number_of_best_scoring_models=0, # increase number of frames to get better results! number_of_frames=1, global_output_directory='atomistic_output/') rex.execute_macro()
rdihed.add_to_model() all_rs.append(rdihed) output_rs.append(rdihed) # add CHARMM restraints rcharmm = CharmmForceFieldRestraint(hier) rcharmm.add_to_model() all_rs.append(rcharmm) # set up simulation dof = IMP.pmi.dof.DegreesOfFreedom(m) dof.get_nuisances_from_restraint(rnoes) dof.get_nuisances_from_restraint(rdihed) # minimize via md md_ps = dof.setup_md(ubq) IMP.set_log_level(IMP.SILENT) # run replica exchange md with monte carlo rex = IMP.pmi.macros.ReplicaExchange0(m, root_hier=hier, crosslink_restraints=output_rs, output_objects=all_rs, number_of_frames=100000, monte_carlo_sample_objects=dof.get_movers(), monte_carlo_steps=10, molecular_dynamics_sample_objects=md_ps, molecular_dynamics_steps=10, replica_exchange_minimum_temperature=1., replica_exchange_maximum_temperature=2.5, number_of_best_scoring_models=0, atomistic=True,