Melnikov method and detection of chaos for non-smooth systems