subroutine finalize_local_spin_measurement() if (allocated(inst_local_spin)) deallocate(inst_local_spin) if (allocated(all_local_spin)) deallocate(all_local_spin) end subroutine finalize_local_spin_measurement