This notebook contains material from PyRosetta; content is available on Github.

In [5]:
!pip install pyrosettacolabsetup
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta; pyrosetta.init()
In [ ]:
import pyrosetta 
pyrosetta.init()
In [ ]:
import os, sys
if os.getenv("DEBUG"): sys.exit(0)
import pyrosetta.network

# make sure to supply unique secret here and use _the same_ secrete when running PyMOL-Rosetta-relay-client.python3.py in PyMOL on your desktop machine
# note that PyMOL-Rosetta-relay-client scripts could be downloaded from: https://www.pyrosetta.org/downloads (see section 'PyMOL-RosettaServer scripts')
pyrosetta.network.start_udp_to_tcp_bridge_daemon(secret='my-super-unique-secret-please-change-me')

# note that you can use random numbers to generate _good_ unique secret, like this: 
# import random, string; print( "".join( random.sample( string.ascii_letters + string.digits, 16 ) ) )
In [ ]:
import time as time_module

import pyrosetta
import pyrosetta.rosetta as rosetta

pose = pyrosetta.pose_from_sequence('SERGEY'*2)
rosetta.protocols.moves.AddPyMOLObserver(pose, keep_history=False)

scorefxn = pyrosetta.get_fa_scorefxn() #  rosetta.create_score_function('standard')

psi = 0.0
phi = 0.0
i = 1
while True:
    pose.set_psi(i, pose.psi(i) + 87)
    pose.set_phi(i, pose.phi(i) + 19)
    scorefxn(pose)

    time_module.sleep(.05)
    i += 1
    if i >pose.size(): i=1