subroutine init_spin_measurements()
! routine to initialize spin measurement vectors
character(*), parameter :: this_routine = "init_spin_measurements"
integer :: ierr
if (allocated(spin_up_occ)) deallocate(spin_up_occ)
if (allocated(spin_down_occ)) deallocate(spin_down_occ)
if (allocated(spin_diff)) deallocate(spin_diff)
if (allocated(double_occ_vec)) deallocate(double_occ_vec)
if (allocated(inst_spin_diff)) deallocate(inst_spin_diff)
if (allocated(all_inst_spin_diff)) deallocate(all_inst_spin_diff)
if (allocated(inst_spatial_doub_occ)) deallocate(inst_spatial_doub_occ)
if (allocated(all_inst_spatial_doub_occ)) deallocate(all_inst_spatial_doub_occ)
if (allocated(sum_double_occ_vec)) deallocate(sum_double_occ_vec)
if (allocated(sum_spin_diff)) deallocate(sum_spin_diff)
allocate(spin_up_occ(nbasis / 2))
allocate(spin_down_occ(nBasis / 2))
allocate(spin_diff(nBasis / 2))
allocate(double_occ_vec(nBasis / 2))
allocate(inst_spin_diff(nBasis / 2))
allocate(all_inst_spin_diff(nBasis / 2))
allocate(inst_spatial_doub_occ(nBasis / 2))
allocate(all_inst_spatial_doub_occ(nBasis / 2))
allocate(sum_double_occ_vec(nBasis / 2))
allocate(sum_spin_diff(nBasis / 2))
spin_up_occ = 0.0_dp
spin_down_occ = 0.0_dp
spin_diff = 0.0_dp
double_occ_vec = 0.0_dp
inst_spin_diff = 0.0_dp
all_inst_spin_diff = 0.0_dp
inst_spatial_doub_occ = 0.0_dp
all_inst_spatial_doub_occ = 0.0_dp
sum_double_occ_vec = 0.0_dp
sum_spin_diff = 0.0_dp
end subroutine init_spin_measurements