fixed missing import of ket2dm
use logical instead of bit and