# Build a coarse grained model using the positions for the initial structure cgmodel = CGModel(polymer_length=polymer_length,backbone_lengths=backbone_lengths,sidechain_lengths=sidechain_lengths,sidechain_positions=sidechain_positions,masses=masses,sigmas=sigmas,epsilons=epsilons,bond_lengths=bond_lengths,bond_force_constants=bond_force_constants,torsion_force_constants=torsion_force_constants,equil_torsion_angles=equil_torsion_angles,torsion_periodicities=torsion_periodicities,include_nonbonded_forces=include_nonbonded_forces,include_bond_forces=include_bond_forces,include_bond_angle_forces=include_bond_angle_forces,include_torsion_forces=include_torsion_forces,constrain_bonds=constrain_bonds,positions=positions) if os.path.exists(output_data): # Search for existing data, and read it if possible print("Reading replica exchange data") replica_energies,replica_positions,replica_states = read_replica_exchange_data(system=cgmodel.system,topology=cgmodel.topology,temperature_list=temperature_list,output_data=output_data,print_frequency=print_frequency) else: # Run a replica exchange simulation with this cgmodel replica_energies,replica_positions,replica_states = run_replica_exchange(cgmodel.topology,cgmodel.system,cgmodel.positions,temperature_list=temperature_list,simulation_time_step=simulation_time_step,total_simulation_time=total_simulation_time,print_frequency=print_frequency,output_data=output_data) make_replica_pdb_files(cgmodel.topology,replica_positions) native_structure = get_native_structure(replica_positions,replica_energies,temperature_list) # Set parameters for definition/evaluation of native contacts native_structure_contact_distance_cutoff = 1.05 * cgmodel.get_sigma(0) # This distance cutoff determines which nonbonded interactions are considered 'native' contacts native_contact_cutoff_ratio = 1.1 # The distance ratio (in comparison with the distance of a contact in the native structure) below which a nonbonded interaction is considered 'native' native_fraction_cutoff = 0.95 # Poses with a fraction of native contacts greater than or equal to this value will be considered candidates for the native ensemble nonnative_fraction_cutoff = 0.8 # Poses with a fraction of native contacts lower than or equal to this value will be considered candidates for the nonnative ensemble native_ensemble_size = 10 nonnative_ensemble_size = 100 # Assemble "native" and "nonnative" ensembles from uncorrelated samples native_ensemble,native_ensemble_energies,nonnative_ensemble,nonnative_ensemble_energies = get_ensembles_from_replica_positions(cgmodel,replica_positions,replica_energies,temperature_list,decorrelate=True,native_fraction_cutoff=native_fraction_cutoff,nonnative_fraction_cutoff=nonnative_fraction_cutoff,native_structure_contact_distance_cutoff=native_structure_contact_distance_cutoff,native_ensemble_size=native_ensemble_size,nonnative_ensemble_size=nonnative_ensemble_size) e_unfolded_mean = mean(nonnative_ensemble_energies) # unfolded mean energy e_unfolded_sigma = stdev(nonnative_ensemble_energies) # unfolded standard deviation energy n_unfolded = len(nonnative_ensemble_energies) # ratio of number of unfolded states to folded states. We keep number of folded states at 1 e_folded = mean(native_ensemble_energies) # energy of the unfolded state Tmax = kB.__mul__(max_temp) # temperature max to plot; T in units of kBT
temperature_list=temperature_list, simulation_time_step=simulation_time_step, total_simulation_time=total_simulation_time, print_frequency=print_frequency, output_data=output_data) make_replica_pdb_files(cgmodel.topology, replica_positions) native_structure = get_native_structure(replica_positions, replica_energies, temperature_list) random_poses, random_pose_energies = get_decorrelated_samples( replica_positions, replica_energies, temperature_list) # Set parameters for definition/evaluation of native contacts native_structure_contact_distance_cutoff = 1.05 * cgmodel.get_sigma( 0 ) # This distance cutoff determines which nonbonded interactions are considered 'native' contacts native_contact_cutoff_ratio = 1.1 # The distance ratio (in comparison with the distance of a contact in the native structure) below which a nonbonded interaction is considered 'native' cutoff_list = [(1.0 + i * .01) * cgmodel.get_sigma(0) for i in range(30)] list_fraction_native_contacts = [] for cutoff in cutoff_list: # Get the number of nonbonded interactions that will be considered 'native' # Get the fraction of native contacts for the comparison pose nonnative_ensemble_Q_list = [] for pose in random_poses: Q = fraction_native_contacts( cgmodel,