def test_converge_incomplete_md_only_mmvt(toy_mmvt_model): num_steps = 100000 toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True toy_mmvt_model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 toy_mmvt_model.calculation_settings.num_production_steps = num_steps toy_mmvt_model.calculation_settings.energy_reporter_interval = num_steps run.run(toy_mmvt_model, "any", force_overwrite=True) runner_openmm.cleanse_anchor_outputs(toy_mmvt_model, toy_mmvt_model.anchors[3]) cutoff = 0.1 minimum_anchor_transitions = 100 image_directory = common_analyze.make_image_directory(toy_mmvt_model, None) k_on_state = None data_sample_list = converge.converge(toy_mmvt_model, k_on_state, image_directory=image_directory, verbose=True) rmsd_convergence_results = common_converge.calc_RMSD_conv_amount( toy_mmvt_model, data_sample_list) transition_minima, transition_prob_results, transition_time_results \ = common_converge.calc_transition_steps( toy_mmvt_model, data_sample_list[-1]) bd_transition_counts = data_sample_list[-1].bd_transition_counts converge.print_convergence_results(toy_mmvt_model, rmsd_convergence_results, cutoff, transition_prob_results, transition_time_results, minimum_anchor_transitions, bd_transition_counts) return
def test_run_planar(planar_mmvt_model): check.check_pre_simulation_all(planar_mmvt_model) run.run(planar_mmvt_model, "1", min_total_simulation_length=10, force_overwrite=True) check.check_post_simulation_all(planar_mmvt_model)
def test_converge_default_md_only_elber(toy_elber_model): num_steps = 100000 fwd_rev_interval = 100 toy_elber_model.openmm_settings.cuda_platform_settings = None toy_elber_model.openmm_settings.reference_platform = True toy_elber_model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 toy_elber_model.calculation_settings.num_umbrella_stage_steps = num_steps toy_elber_model.calculation_settings.fwd_rev_interval = fwd_rev_interval run.run(toy_elber_model, "any") cutoff = 0.1 minimum_anchor_transitions = 100 image_directory = common_analyze.make_image_directory( toy_elber_model, None) k_on_state = None data_sample_list = converge.converge(toy_elber_model, k_on_state, image_directory=image_directory, verbose=True) rmsd_convergence_results = common_converge.calc_RMSD_conv_amount( toy_elber_model, data_sample_list) transition_minima, transition_prob_results, transition_time_results \ = common_converge.calc_transition_steps( toy_elber_model, data_sample_list[-1]) bd_transition_counts = data_sample_list[-1].bd_transition_counts converge.print_convergence_results(toy_elber_model, rmsd_convergence_results, cutoff, transition_prob_results, transition_time_results, minimum_anchor_transitions, bd_transition_counts) return
def run_short_ci(model_input, cuda_device_index, long_check=True): start_dir = os.getcwd() model, xml_path = prepare.prepare(model_input, force_overwrite=False) model_dir = os.path.dirname(xml_path) model.anchor_rootdir = os.path.abspath(model_dir) check.check_pre_simulation_all(model) run.run(model, "any", min_b_surface_simulation_length=1000, num_rev_launches=10, cuda_device_index=cuda_device_index, save_state_file=True) data_sample_list = converge.converge(model, k_on_state=0) rmsd_convergence_results = common_converge.calc_RMSD_conv_amount( model, data_sample_list) transition_minima, transition_details, transition_times \ = common_converge.calc_transition_steps( model, data_sample_list[-1]) converge.print_convergence_results( model, rmsd_convergence_results, cutoff=0.1, transition_results=transition_details, transition_time_results=transition_times, minimum_anchor_transitions=10, bd_transition_counts=data_sample_list[-1].bd_transition_counts) check.check_post_simulation_all(model, long_check=long_check) analysis = analyze.analyze(model) analysis.print_results() os.chdir(start_dir) return
def test_run_tiwary(tiwary_mmvt_model): check.check_pre_simulation_all(tiwary_mmvt_model) run.run(tiwary_mmvt_model, "0", min_total_simulation_length=10, force_overwrite=True) check.check_post_simulation_all(tiwary_mmvt_model)
def test_normal_run_namd(host_guest_mmvt_model_namd): """ Test a normal toy run - no restarts or anything, using NAMD. """ num_steps = 10 dcd_interval = 1 host_guest_mmvt_model_namd.calculation_settings.num_production_steps \ = num_steps host_guest_mmvt_model_namd.calculation_settings\ .restart_checkpoint_interval = 1 host_guest_mmvt_model_namd.calculation_settings\ .trajectory_reporter_interval = dcd_interval num_dcd_frames = num_steps // dcd_interval run.run(host_guest_mmvt_model_namd, "0", force_overwrite=True) anchor = host_guest_mmvt_model_namd.anchors[0] output_glob = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.production_directory, anchor.md_output_glob) glob_list = glob.glob(output_glob) assert len(glob_list) == 1 output_directory = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.production_directory) restart_checkpoint_filename = os.path.join( output_directory, runner_namd.RESTART_CHECKPOINT_FILENAME + ".xsc") checkpoint_step = runner_namd.read_xsc_step_number( restart_checkpoint_filename) assert checkpoint_step == num_steps top_filename = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.building_directory, anchor.amber_params.prmtop_filename) dcd_length, dcd_file_number = get_trajectory_length( host_guest_mmvt_model_namd, anchor, top_filename) assert dcd_length == num_dcd_frames return
def test_normal_run_openmm(toy_mmvt_model): """ Test a normal toy run - no restarts or anything. """ num_steps = 10000 dcd_interval = toy_mmvt_model.calculation_settings\ .trajectory_reporter_interval num_dcd_frames = num_steps // dcd_interval toy_mmvt_model.calculation_settings.num_production_steps = num_steps toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True check.check_pre_simulation_all(toy_mmvt_model) run.run(toy_mmvt_model, "any", force_overwrite=True) check.check_post_simulation_all(toy_mmvt_model) for anchor in toy_mmvt_model.anchors: if anchor.bulkstate: continue checkpoint_step = get_checkpoint_step(toy_mmvt_model, anchor) assert checkpoint_step == num_steps dcd_length, dcd_file_number = get_trajectory_length( toy_mmvt_model, anchor) dummy_file = tempfile.NamedTemporaryFile() num_swarm = mmvt_sim_openmm.\ get_starting_structure_num_frames(toy_mmvt_model, anchor, dummy_file.name) assert dcd_length == num_dcd_frames * num_swarm return
def test_entropy_barrier_timescale_elber(toy_elber_model): """ Test entropy barrier system for if it recreates reasonable kinetics timescales. """ num_steps = 100000 fwd_rev_interval = 100 long_timescale_residence_time_in_ps = 1263.06 toy_elber_model.openmm_settings.cuda_platform_settings = None toy_elber_model.openmm_settings.reference_platform = True toy_elber_model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 toy_elber_model.calculation_settings.num_umbrella_stage_steps = num_steps toy_elber_model.calculation_settings.fwd_rev_interval = fwd_rev_interval run.run(toy_elber_model, "any") analysis = analyze.analyze(toy_elber_model, num_error_samples=100, skip_checks=False) #assert np.isclose(analysis.MFPTs[('anchor_0', 'bulk')], # long_timescale_residence_time_in_ps, # rtol=0.5) assert analysis.MFPTs is not None assert analysis.k_off is not None analysis.print_results() image_directory = common_analyze.make_image_directory(toy_elber_model, None) analysis.save_plots(image_directory) return
def test_normal_restart_namd(host_guest_mmvt_model_namd): """ Test a normal restart - no errors or interruptions, using NAMD """ # Test DCD frame number and checkpoint step first_steps = 10 dcd_interval = 1 host_guest_mmvt_model_namd.calculation_settings.num_production_steps \ = first_steps host_guest_mmvt_model_namd.calculation_settings\ .restart_checkpoint_interval = 1 host_guest_mmvt_model_namd.calculation_settings\ .trajectory_reporter_interval = dcd_interval num_dcd_frames = first_steps // dcd_interval run.run(host_guest_mmvt_model_namd, "0", force_overwrite=True) anchor = host_guest_mmvt_model_namd.anchors[0] output_directory = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.production_directory) restart_checkpoint_filename = os.path.join( output_directory, runner_namd.RESTART_CHECKPOINT_FILENAME + ".xsc") checkpoint_step = runner_namd.read_xsc_step_number( restart_checkpoint_filename) assert checkpoint_step == first_steps top_filename = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.building_directory, anchor.amber_params.prmtop_filename) dcd_length, dcd_file_number = get_trajectory_length( host_guest_mmvt_model_namd, anchor, top_filename) assert dcd_length == num_dcd_frames second_steps = 20 num_dcd_frames2 = second_steps // dcd_interval host_guest_mmvt_model_namd.calculation_settings.num_production_steps \ = second_steps run.run(host_guest_mmvt_model_namd, "0") anchor = host_guest_mmvt_model_namd.anchors[0] output_directory = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.production_directory) restart_checkpoint_filename = os.path.join( output_directory, runner_namd.RESTART_CHECKPOINT_FILENAME + ".xsc") checkpoint_step = runner_namd.read_xsc_step_number( restart_checkpoint_filename) assert checkpoint_step == second_steps top_filename = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.building_directory, anchor.amber_params.prmtop_filename) dcd_length, dcd_file_number = get_trajectory_length( host_guest_mmvt_model_namd, anchor, top_filename) assert dcd_length == num_dcd_frames2 # Test that there are two output files out_glob = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor.directory, anchor.production_directory, anchor.md_output_glob) out_file_list = glob.glob(out_glob) assert len(out_file_list) == 2 return
def test_normal_restart_openmm(toy_mmvt_model): """ Test a normal restart - no errors or interruptions. """ # Test DCD frame number and checkpoint step first_steps = 10000 dcd_interval = toy_mmvt_model.calculation_settings\ .trajectory_reporter_interval num_dcd_frames1 = first_steps // dcd_interval toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True toy_mmvt_model.calculation_settings.num_production_steps = first_steps toy_mmvt_model.calculation_settings.trajectory_reporter_interval \ = first_steps // 10 run.run(toy_mmvt_model, "1", force_overwrite=True) checkpoint_step = get_checkpoint_step(toy_mmvt_model, toy_mmvt_model.anchors[1]) assert checkpoint_step == first_steps dcd_length1, dcd_file_number1 = get_trajectory_length( toy_mmvt_model, toy_mmvt_model.anchors[1]) print("dcd_length1:", dcd_length1) print("dcd_file_number1:", dcd_file_number1) assert dcd_length1 == num_dcd_frames1 assert dcd_file_number1 == 1 second_steps = 20000 num_dcd_frames2 = second_steps // dcd_interval toy_mmvt_model.calculation_settings.num_production_steps = second_steps run.run(toy_mmvt_model, "1") checkpoint_step = get_checkpoint_step(toy_mmvt_model, toy_mmvt_model.anchors[1]) assert checkpoint_step == second_steps dcd_length2, dcd_file_number2 = get_trajectory_length( toy_mmvt_model, toy_mmvt_model.anchors[1]) print("dcd_length2:", dcd_length2) print("dcd_file_number2:", dcd_file_number2) assert dcd_length2 == num_dcd_frames2 assert dcd_file_number2 == 2 # Test that there are two output files out_glob = os.path.join(toy_mmvt_model.anchor_rootdir, toy_mmvt_model.anchors[1].directory, toy_mmvt_model.anchors[1].production_directory, toy_mmvt_model.anchors[1].md_output_glob) out_file_list = glob.glob(out_glob) assert len(out_file_list) == 2 return
def make_mmvt_data_sample(model): num_steps = 100000 model.openmm_settings.cuda_platform_settings = None model.openmm_settings.reference_platform = True model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 model.calculation_settings.num_production_steps = num_steps model.calculation_settings.energy_reporter_interval = num_steps for anchor in model.anchors: runner_openmm.cleanse_anchor_outputs( model, anchor, skip_umbrella_files=False) run.run(model, "1", force_overwrite = True) analysis = analyze.Analysis(model) analysis.extract_data() analysis.fill_out_data_samples() return analysis.main_data_sample
def test_interruption_restart_openmm(toy_mmvt_model): """ Test a restart caused by an error or interruption """ num_steps = 1000000 dcd_interval = toy_mmvt_model.calculation_settings\ .trajectory_reporter_interval num_dcd_frames = num_steps // dcd_interval toy_mmvt_model.calculation_settings.num_production_steps = num_steps toy_mmvt_model.calculation_settings.trajectory_reporter_interval \ = 10000 toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True try: signal.signal(signal.SIGALRM, handler) signal.alarm(1) run.run(toy_mmvt_model, "1", force_overwrite=True) except (Exception, SystemExit): pass checkpoint_step = get_checkpoint_step(toy_mmvt_model, toy_mmvt_model.anchors[1]) assert checkpoint_step != num_steps, \ "Interruption happens too late to catch runner." #dcd_length1, dcd_file_number1 = get_trajectory_length(toy_mmvt_model, # toy_mmvt_model.anchors[1]) #assert dcd_length1 != num_dcd_frames, \ # "Interruption happens too late to catch runner." #assert dcd_file_number1 == 1 run.run(toy_mmvt_model, "1") checkpoint_step = get_checkpoint_step(toy_mmvt_model, toy_mmvt_model.anchors[1]) assert checkpoint_step == num_steps #dcd_length2, dcd_file_number2 = get_trajectory_length(toy_mmvt_model, # toy_mmvt_model.anchors[1]) # NOTE: DCD writes will sometimes have too many frames, clearly this # is caused by an interruption that occurs between the checkpoint and # DCD write. This problem should be addressed, if ever, at the # postprocessing step - the run stage will not handle it - a # principle which is consistent with other parts of SEEKR. #assert dcd_length2 == num_dcd_frames #assert dcd_file_number2 == 2 return
def test_choose_next_simulation_browndye2(host_guest_mmvt_model): bd_milestone_info_to_run_unsorted = run.choose_next_simulation_browndye2( host_guest_mmvt_model, "b_surface", 100, True) assert bd_milestone_info_to_run_unsorted[0][0] == 100 assert bd_milestone_info_to_run_unsorted[0][1] == 0 assert bd_milestone_info_to_run_unsorted[0][2] == "b_surface" assert bd_milestone_info_to_run_unsorted[0][3] == False assert bd_milestone_info_to_run_unsorted[0][4] == 100 run.run(host_guest_mmvt_model, "b_surface", force_overwrite=True) # test restart host_guest_mmvt_model.k_on_info.b_surface_num_trajectories = 200 bd_milestone_info_to_run_unsorted = run.choose_next_simulation_browndye2( host_guest_mmvt_model, "b_surface", 200, False) assert bd_milestone_info_to_run_unsorted[0][0] == 100 #assert bd_milestone_info_to_run_unsorted[0][1] == 100 assert bd_milestone_info_to_run_unsorted[0][2] == "b_surface" assert bd_milestone_info_to_run_unsorted[0][3] == True assert bd_milestone_info_to_run_unsorted[0][4] == 100 run.run(host_guest_mmvt_model, "b_surface", force_overwrite=True) # test criteria satisfied bd_milestone_info_to_run_unsorted = run.choose_next_simulation_browndye2( host_guest_mmvt_model, "b_surface", 200, False) assert len(bd_milestone_info_to_run_unsorted) == 0 # test min_b_surface_encounters bd_transition_counts = common_converge.get_bd_transition_counts( host_guest_mmvt_model) min_b_surface_encounters = bd_transition_counts["b_surface"][11] + 1 bd_milestone_info_to_run_unsorted = run.choose_next_simulation_browndye2( host_guest_mmvt_model, "b_surface", 200, False, min_b_surface_encounters) assert bd_milestone_info_to_run_unsorted[0][0] \ == run.B_SURFACE_CONVERGENCE_INTERVAL - 200 #assert bd_milestone_info_to_run_unsorted[0][1] == 200 assert bd_milestone_info_to_run_unsorted[0][2] == "b_surface" assert bd_milestone_info_to_run_unsorted[0][3] == True assert bd_milestone_info_to_run_unsorted[0][4] == 200 return
def test_cleanse_anchor_outputs(host_guest_mmvt_model_namd): num_steps = 10 dcd_interval = 1 host_guest_mmvt_model_namd.calculation_settings.num_production_steps \ = num_steps host_guest_mmvt_model_namd.calculation_settings\ .restart_checkpoint_interval = 1 host_guest_mmvt_model_namd.calculation_settings\ .trajectory_reporter_interval = dcd_interval anchor1 = host_guest_mmvt_model_namd.anchors[0] prod_directory = os.path.join(host_guest_mmvt_model_namd.anchor_rootdir, anchor1.directory, anchor1.production_directory) run.run(host_guest_mmvt_model_namd, "0", force_overwrite=True, save_state_file=True) runner_namd.cleanse_anchor_outputs(host_guest_mmvt_model_namd, anchor1) #print("os.listdir(prod_directory):", os.listdir(prod_directory)) assert len(os.listdir(prod_directory)) == 0
def test_cleanse_anchor_outputs(toy_mmvt_model, toy_elber_model): num_steps = 10000 toy_mmvt_model.calculation_settings.num_production_steps = num_steps toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True anchor1 = toy_mmvt_model.anchors[0] prod_directory = os.path.join(toy_mmvt_model.anchor_rootdir, anchor1.directory, anchor1.production_directory) run.run(toy_mmvt_model, "0", force_overwrite=True, save_state_file=True) runner_openmm.cleanse_anchor_outputs(toy_mmvt_model, anchor1, skip_umbrella_files=False) assert len(os.listdir(prod_directory)) == 0 num_steps = 10000 toy_elber_model.calculation_settings.num_umbrella_stage_steps = num_steps toy_elber_model.openmm_settings.cuda_platform_settings = None toy_elber_model.openmm_settings.reference_platform = True anchor1 = toy_mmvt_model.anchors[1] prod_directory = os.path.join(toy_elber_model.anchor_rootdir, anchor1.directory, anchor1.production_directory) run.run(toy_elber_model, "1", force_overwrite=True, save_state_file=True) runner_openmm.cleanse_anchor_outputs(toy_elber_model, anchor1, skip_umbrella_files=False) assert len(os.listdir(prod_directory)) == 0 run.run(toy_elber_model, "1", force_overwrite=True, save_state_file=True) runner_openmm.cleanse_anchor_outputs(toy_elber_model, anchor1, skip_umbrella_files=True) assert os.listdir(prod_directory)[0].endswith("umbrella1.dcd")
def test_Analysis_mmvt_check_anchor_stats(toy_mmvt_model): num_steps = 1000000 long_timescale_residence_time_in_ps = 1263.06 toy_mmvt_model.openmm_settings.cuda_platform_settings = None toy_mmvt_model.openmm_settings.reference_platform = True toy_mmvt_model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 toy_mmvt_model.calculation_settings.num_production_steps = num_steps toy_mmvt_model.calculation_settings.energy_reporter_interval = num_steps run.run(toy_mmvt_model, "0") run.run(toy_mmvt_model, "1") run.run(toy_mmvt_model, "3") run.run(toy_mmvt_model, "4") analysis = analyze.Analysis(toy_mmvt_model, num_error_samples=100) analysis.extract_data() with pytest.raises(common_analyze.MissingStatisticsError): analysis.check_extraction() run.run(toy_mmvt_model, "any") analysis = analyze.Analysis(toy_mmvt_model, num_error_samples=100) analysis.extract_data() analysis.check_extraction() return
def test_Analysis_elber_check_anchor_stats(toy_elber_model): num_steps = 10000 fwd_rev_interval = 10 toy_elber_model.openmm_settings.cuda_platform_settings = None toy_elber_model.openmm_settings.reference_platform = True toy_elber_model.openmm_settings.langevin_integrator.friction_coefficient \ = 100.0 toy_elber_model.calculation_settings.num_umbrella_stage_steps = num_steps toy_elber_model.calculation_settings.fwd_rev_interval = fwd_rev_interval run.run(toy_elber_model, "0") run.run(toy_elber_model, "1") run.run(toy_elber_model, "3") run.run(toy_elber_model, "4") analysis = analyze.Analysis(toy_elber_model, num_error_samples=100) analysis.extract_data() with pytest.raises(common_analyze.MissingStatisticsError): analysis.check_extraction() run.run(toy_elber_model, "any") analysis = analyze.Analysis(toy_elber_model, num_error_samples=100) analysis.extract_data() analysis.check_extraction() return
def test_choose_next_simulation_openmm(toy_mmvt_model): anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "2", min_total_simulation_length=100000, max_total_simulation_length=1000000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=True, umbrella_restart_mode=False, load_state_file=None) assert anchor_info_to_run[0][0] == 100000 assert anchor_info_to_run[0][1] == 0 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == False assert anchor_info_to_run[0][4] == 100000 assert anchor_info_to_run[0][5] == None # Test swarm anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "0", min_total_simulation_length=100000, max_total_simulation_length=1000000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=True, umbrella_restart_mode=False, load_state_file=None) assert anchor_info_to_run[0][0] == 100000 assert anchor_info_to_run[0][1] == 0 assert anchor_info_to_run[0][2] == 0 assert anchor_info_to_run[0][3] == False assert anchor_info_to_run[0][4] == 100000 assert anchor_info_to_run[0][5] == 0 assert anchor_info_to_run[1][0] == 100000 assert anchor_info_to_run[1][1] == 0 assert anchor_info_to_run[1][2] == 0 assert anchor_info_to_run[1][3] == False assert anchor_info_to_run[1][4] == 100000 assert anchor_info_to_run[1][5] == 1 # Test swarm with loaded state file anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "0", min_total_simulation_length=100000, max_total_simulation_length=1000000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=True, umbrella_restart_mode=False, load_state_file="dummy") assert anchor_info_to_run[0][5] == None # Test restart toy_mmvt_model.calculation_settings.num_production_steps = 100000 run.run(toy_mmvt_model, "2", force_overwrite=True) anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "2", min_total_simulation_length=200000, max_total_simulation_length=10000000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=False, umbrella_restart_mode=False, load_state_file=None) assert anchor_info_to_run[0][0] == 100000 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == 200000 assert anchor_info_to_run[0][5] == None # test convergence anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "2", min_total_simulation_length=100000, max_total_simulation_length=1000000, convergence_cutoff=1e-20, minimum_anchor_transitions=None, force_overwrite=False, umbrella_restart_mode=False, load_state_file=None) assert anchor_info_to_run[0][0] == 0 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == 100000 + run.CONVERGENCE_INTERVAL # test max anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "2", min_total_simulation_length=100000, max_total_simulation_length=90000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=False, umbrella_restart_mode=False, load_state_file=None) assert len(anchor_info_to_run) == 0 # test minimum anchor transitions anchor_info_to_run = run.choose_next_simulation_openmm( toy_mmvt_model, "2", min_total_simulation_length=100000, max_total_simulation_length=None, convergence_cutoff=None, minimum_anchor_transitions=100000, force_overwrite=False, umbrella_restart_mode=False, load_state_file=None) assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == 100000 + run.CONVERGENCE_INTERVAL
def test_run_elber(toy_elber_model): check.check_pre_simulation_all(toy_elber_model) run.run(toy_elber_model, "0", min_total_simulation_length=1000) check.check_post_simulation_all(toy_elber_model)
def test_choose_next_simulation_namd(host_guest_mmvt_model_namd): anchor_info_to_run = run.choose_next_simulation_namd( host_guest_mmvt_model_namd, "2", min_total_simulation_length=10, max_total_simulation_length=10000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=True) assert anchor_info_to_run[0][0] == 10 assert anchor_info_to_run[0][1] == 0 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == False assert anchor_info_to_run[0][4] == 10 assert anchor_info_to_run[0][5] == None # Test restart host_guest_mmvt_model_namd.calculation_settings.num_production_steps = 10 run.run(host_guest_mmvt_model_namd, "2", force_overwrite=True) anchor_info_to_run = run.choose_next_simulation_namd( host_guest_mmvt_model_namd, "2", min_total_simulation_length=20, max_total_simulation_length=10000, convergence_cutoff=None, minimum_anchor_transitions=None, force_overwrite=False) assert anchor_info_to_run[0][0] == 10 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == 20 assert anchor_info_to_run[0][5] == None anchor_info_to_run = run.choose_next_simulation_namd( host_guest_mmvt_model_namd, "2", min_total_simulation_length=10, max_total_simulation_length=1000000, convergence_cutoff=0.2, minimum_anchor_transitions=None, force_overwrite=False) assert anchor_info_to_run[0][0] == 0 assert anchor_info_to_run[0][2] == 2 assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == run.CONVERGENCE_INTERVAL anchor_info_to_run = run.choose_next_simulation_namd( host_guest_mmvt_model_namd, "2", min_total_simulation_length=10, max_total_simulation_length=9, convergence_cutoff=0.2, minimum_anchor_transitions=None, force_overwrite=False) assert len(anchor_info_to_run) == 0 anchor_info_to_run = run.choose_next_simulation_namd( host_guest_mmvt_model_namd, "2", min_total_simulation_length=10, max_total_simulation_length=None, convergence_cutoff=None, minimum_anchor_transitions=10, force_overwrite=False) assert anchor_info_to_run[0][3] == True assert anchor_info_to_run[0][4] == run.CONVERGENCE_INTERVAL return