def log_result(result):
    # This is called whenever simulation(i) returns a result.
    # result_list is modified only by the main process, not the pool workers.
    final_states.insert(result[0], result[1].ptrace(0))
    philist.insert(result[0], Plotter.extract_phi(Plotter.bloch_vector(result[1].ptrace(0))))