예제 #1
0
    # three object are being created
    etable = ScoreTable( density_score_Dict, overlap_score_Dict, nonoverlap_score_Dict )     
    wts = Weights( args.density_score_wt, args.overlap_score_wt, args.closab_score_wt, args.clash_score_wt )
    scorefxn = ScoreFunction( etable, wts, args.null_frag_score )

    for each_round in range( 1, args.round+1 ):
        scorefxn.clean_selected_frags_dict()
        #mypose = Pose()

        if args.starts_with:
            assert not args.dump_results == args.starts_with
            print "Initialize with %s" % args.starts_with
            pkl = open( args.starts_with , "rb" )
            scorefxn.selected_frags_dict = pickle.load( pkl )
        else:
            scorefxn.initialize( args.initialization )

        for each_step in range( args.steps ):
            print "round: %s  cycle: %s" %( each_round, each_step )
            pos = pos_list[ random.randrange( 0, len( pos_list ) ) ] # pick a residue number to start with

            boltzmann_prob_Dict = {}
            ''' After picking a position to optimize, calculate compatibility scores for all the candidate placements at that residue'''
            for each_candidate_frag_id in density_score_Dict[ pos ].keys():  # loop over all candidate frags at the pos

                if ( each_candidate_frag_id[2], each_candidate_frag_id[3] ) == ( 0, 0 ): continue # skip null fragment

                container = scorefxn.score_evaluator( each_candidate_frag_id )
                boltzmann_prob_Dict[ each_candidate_frag_id ] = ( boltzmann_prob( container.score_, args.temperature_ ), container.score, container.rmsd )

                if args.verbose: