Nucleon-nucleon potential from shell model calculations for doublet splittings