def build_cgmodel(rosetta_scoring): # Set values for the parameters in our coarse grained model: polymer_length = 2 backbone_lengths = [1] sidechain_lengths = [1] sidechain_positions = [0] include_bond_forces = False # NOTE: By default bonds are constrained to their equilibrium lengths, even when this variable is set to False, unless 'constrain_bonds'=False constrain_bonds = True include_bond_angle_forces = False include_nonbonded_forces = True include_torsion_forces = False # Particle properties mass = 100.0 * unit.amu masses = {'backbone_bead_masses': mass, 'sidechain_bead_masses': mass} bond_length = 1.0 * unit.angstrom bond_lengths = { 'bb_bb_bond_length': bond_length, 'bb_sc_bond_length': bond_length, 'sc_sc_bond_length': bond_length } bond_force_constant = 0.0 * unit.kilocalorie_per_mole / unit.nanometer / unit.nanometer bond_force_constants = { 'bb_bb_bond_k': bond_force_constant, 'bb_sc_bond_k': bond_force_constant, 'sc_sc_bond_k': bond_force_constant } r_min = bond_length sigma = r_min / (2.0**(1 / 6)) sigmas = {'bb_sigma': sigma, 'sc_sigma': sigma} epsilon = 0.2 * unit.kilocalorie_per_mole epsilons = {'bb_eps': epsilon, 'sc_eps': epsilon} exclusions = True # Get positions from a local PDB file written by PyRosetta, and modified (by hand) to have a geometry where the nonbonded interactions are easy to evaluate 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, 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, rosetta_scoring=rosetta_scoring, exclusions=exclusions, constrain_bonds=constrain_bonds) pyrosetta_sequence = ''.join([ str('X[' + str(monomer['monomer_name']) + ']') for monomer in cgmodel.sequence ]) pose = pyrosetta.pose_from_sequence(pyrosetta_sequence) pose.dump_pdb("test_pyrosetta.pdb") cgmodel.positions = PDBFile("test_pyrosetta.pdb").getPositions() cgmodel.topology = build_topology(cgmodel) return (cgmodel, pose)
def build_cgmodel(rosetta_scoring): # Set values for the parameters in our coarse grained model: polymer_length = 2 backbone_lengths = [1] sidechain_lengths = [1] sidechain_positions = [0] include_bond_forces = False # NOTE: By default bonds are constrained to their equilibrium lengths, even when this variable is set to False, unless 'constrain_bonds'=False constrain_bonds = True include_bond_angle_forces = True include_nonbonded_forces = True include_torsion_forces = True # Particle properties mass = 100.0 * unit.amu masses = {'backbone_bead_masses': mass, 'sidechain_bead_masses': mass} bond_length = 1.0 * unit.angstrom bond_lengths = { 'bb_bb_bond_length': bond_length, 'bb_sc_bond_length': bond_length, 'sc_sc_bond_length': bond_length } bond_force_constant = 0.0 * unit.kilocalorie_per_mole / unit.nanometer / unit.nanometer bond_force_constants = { 'bb_bb_bond_k': bond_force_constant, 'bb_sc_bond_k': bond_force_constant, 'sc_sc_bond_k': bond_force_constant } r_min = bond_length sigma = r_min / (2.0**(1 / 6)) sigmas = {'bb_sigma': sigma, 'sc_sigma': sigma} epsilon = 10.0 * unit.kilocalorie_per_mole epsilons = {'bb_eps': epsilon, 'sc_eps': epsilon} exclusions = True # Bond angle properties bond_angle_force_constant = 2 * unit.kilocalorie_per_mole / unit.radian / unit.radian bond_angle_force_constants = { 'bb_bb_sc_angle_k': bond_angle_force_constant } equil_bond_angle = 90.0 * (3.141 / 180.0) equil_bond_angles = {'bb_bb_sc_angle_0': equil_bond_angle} # Torsion properties torsion_force_constant = 3 * unit.kilocalorie_per_mole / unit.radian / unit.radian torsion_force_constants = {'sc_bb_bb_sc_torsion_k': torsion_force_constant} torsion_periodicity = 1 torsion_periodicities = {'sc_bb_bb_sc_period': torsion_periodicity} equil_torsion_angle = 0.0 * (3.141 / 180.0) equil_torsion_angles = {'sc_bb_bb_sc_torsion_0': equil_torsion_angle} # Get positions from a local PDB file written by PyRosetta, and modified (by hand) to have a geometry where the nonbonded interactions are easy to evaluate 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, 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, rosetta_scoring=rosetta_scoring, exclusions=exclusions, constrain_bonds=constrain_bonds, equil_torsion_angles=equil_torsion_angles, torsion_force_constants=torsion_force_constants, torsion_periodicities=torsion_periodicities, equil_bond_angles=equil_bond_angles, bond_angle_force_constants=bond_angle_force_constants) pyrosetta_sequence = ''.join([ str('X[' + str(monomer['monomer_name']) + ']') for monomer in cgmodel.sequence ]) res_file_list = list( set([ str(str(monomer['monomer_name']) + ".params") for monomer in cgmodel.sequence ])) res_file_list = " ".join(res_file_list) assign_mm_atom_properties_with_cgopenmm_cgmodel(cgmodel) exit() pose = pyrosetta.pose_from_sequence(pyrosetta_sequence) for residue_index in range(pose.total_residue()): print(pose.residue(residue_index)) exit() pose.dump_pdb("test_pyrosetta.pdb") cgmodel.positions = PDBFile("test_pyrosetta.pdb").getPositions() cgmodel.topology = build_topology(cgmodel) return (cgmodel, pose)
def build_cgmodel(): # Set values for the parameters in our coarse grained model: polymer_length = 3 backbone_lengths = [1] sidechain_lengths = [1] sidechain_positions = [0] include_bond_forces = False # NOTE: Bonds are constrained to their equilibrium lengths, by default, even when this variable is set to False. include_bond_angle_forces = False include_nonbonded_forces = True include_torsion_forces = False rosetta_scoring = True # Particle properties mass = 100.0 * unit.amu masses = {'backbone_bead_masses': mass, 'sidechain_bead_masses': mass} bond_length = 1.0 * unit.angstrom bond_lengths = { 'bb_bb_bond_length': bond_length, 'bb_sc_bond_length': bond_length, 'sc_sc_bond_length': bond_length } bond_force_constant = 0.0 * unit.kilocalorie_per_mole / unit.nanometer / unit.nanometer bond_force_constants = { 'bb_bb_bond_k': bond_force_constant, 'bb_sc_bond_k': bond_force_constant, 'sc_sc_bond_k': bond_force_constant } r_min = bond_length sigma = r_min / (2.0**(1 / 6)) sigmas = {'bb_bb_sigma': sigma, 'sc_sc_sigma': sigma} epsilon = 0.2 * unit.kilocalorie_per_mole epsilons = {'bb_bb_eps': epsilon, 'sc_sc_eps': epsilon} # Bond angle properties bond_angle_force_constant = 2 * unit.kilocalorie_per_mole / unit.radian / unit.radian bond_angle_force_constants = { 'bb_bb_bb_angle_k': bond_angle_force_constant, 'bb_bb_sc_angle_k': bond_angle_force_constant } equil_bond_angle = 120.0 * (3.141 / 180.0) equil_bond_angles = { 'bb_bb_bb_angle_0': equil_bond_angle, 'bb_bb_sc_angle_0': equil_bond_angle } # Torsion properties torsion_force_constant = 3 torsion_force_constants = { 'bb_bb_bb_bb_torsion_k': torsion_force_constant, 'sc_bb_bb_sc_torsion_k': 0.0, 'bb_bb_bb_sc_torsion_k': 0.0, 'sc_bb_bb_bb_torsion_k': 0.0 } torsion_periodicity = 3 torsion_periodicities = { 'bb_bb_bb_bb_period': torsion_periodicity, 'sc_bb_bb_sc_period': 0, 'bb_bb_bb_sc_period': 0, 'sc_bb_bb_bb_period': 0 } equil_torsion_angle = 0.0 * (3.141 / 180.0) equil_torsion_angles = { 'bb_bb_bb_bb_torsion_0': equil_torsion_angle, 'sc_bb_bb_sc_torsion_0': 0.0, 'bb_bb_bb_sc_torsion_0': 0.0, 'sc_bb_bb_bb_torsion_0': 0.0 } # Build a coarse grained model 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, bond_angle_force_constants=bond_angle_force_constants, torsion_force_constants=torsion_force_constants, equil_bond_angles=equil_bond_angles, equil_torsion_angles=equil_torsion_angles, 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, rosetta_scoring=rosetta_scoring, torsion_periodicities=torsion_periodicities) # Get positions by building a pose with PyRosetta pyrosetta_sequence = ''.join([ str('X[' + str(monomer['monomer_name']) + ']') for monomer in cgmodel.sequence ]) pose = pyrosetta.pose_from_sequence(pyrosetta_sequence) pose.dump_pdb("init.pdb") cgmodel.positions = PDBFile("init.pdb").getPositions() cgmodel.topology = build_topology(cgmodel) return (cgmodel)