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
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)