Real-time simulation of AFM tip-surface cohesive interactions