Detection of Tip-Sample Interaction in Atomic Force Microscopy