subroutine init_en_pert_t(en_pert, sign_length, max_ndets, nhashes)
! Initialise an en_pert_t object.
! Out: en_pert - en_pert_t object to be initialised.
! In: sign_length - the number of signs which can be stored for each element.
! In: max_ndets - the length of the en_pert%dets array.
! In: nhashes - the number of unique hashes for indexing the hash table.
use hash, only: init_hash_table
type(en_pert_t), intent(out) :: en_pert
integer, intent(in) :: sign_length, max_ndets, nhashes
integer :: ierr
en_pert%sign_length = sign_length
en_pert%max_ndets = max_ndets
en_pert%nhashes = nhashes
en_pert%ndets = 0
allocate(en_pert%dets(0:sign_length + nifd, max_ndets))
en_pert%dets = 0_n_int
allocate(en_pert%hash_table(nhashes), stat=ierr)
call init_hash_table(en_pert%hash_table)
end subroutine init_en_pert_t