コード例 #1
0
ファイル: heat_capacity.py プロジェクト: q10/bioe243
def MC_step(present_configuration, sequence, T_star):
    # run over all beads in configuration
    present_V = energy_function(present_configuration,sequence)
    for m in range(len(sequence)):
        moves = find_move(m, present_configuration, len(sequence))
        if not moves: continue

        next_configuration = apply_move(moves, present_configuration)
        next_V = energy_function(next_configuration, sequence)
        if calc_acceptance(present_V, next_V, sequence, T_star):
            present_configuration = next_configuration
            present_V = next_V

    return present_configuration, present_V
コード例 #2
0
ファイル: MFPT_Seq2.py プロジェクト: q10/bioe243
def MC_step(present_configuration, sequence, T_star,sequence_traversals, nbr_moves):
    # run over all beads in configuration
    present_V = energy_function(present_configuration,sequence)
    for m in range(len(sequence)):
        moves = find_move(m, present_configuration, len(sequence))
        if not moves: continue

        next_configuration = apply_move(moves, present_configuration)
        next_V = energy_function(next_configuration, sequence)
        if calc_acceptance(present_V, next_V, sequence, T_star):
            present_configuration = next_configuration
            present_V = next_V
            nbr_moves += 1
            #~ print 'Moved! Number of moves = %f and presentV = %f .' % (nbr_moves, present_V)
    sequence_traversals += 1
    return (present_configuration, sequence_traversals, nbr_moves)