Member Site Forums PyRosetta PyRosetta – General Define custom potential? Reply To: Define custom potential?

#5603
Anonymous

    Using constraints in PyRosetta will depend on which object (mover) you are interacting with. For example, using constraints in PyRosetta for docking is very straight forward. Since DockingProtocol was written to interact with the options system via public accessor functions, the following code will result in a docking run with constraints:

    pose = pose_from_pdb( '1brs.pdb' )
    dock = DockingProtocol()
    dock.set_cst_file( 'constraint.site' )
    dock.apply( pose )

    Other protocols might not behave so nicely. To get around that, you can explicitly add constraints yourself:

    pose = pose_from_pdb( '1brs.pdb' )
    cst_mover = ConstraintSetMover()
    cst_mover.constraint_file( 'constraint.site' )
    cst_mover.apply( pose )
    sf = create_score_function( 'standard' )
    sf.set_weight( atom_pair_constraint, 1.0 )
    sf( pose )

    As far as making your own custom constraints in PyRosetta, this is not yet supported but is planned for a future release. In the above examples, the file ‘constraint.site’ is simply a text file constraint information as detailed in documentation linked from Steven’s post.