distance calculation for QD and membrane is now working