An Algorithm to Explore Molecular Potential Energy Surfaces