Analytical expressions of the free energy derivatives for molecules in solution. Application to the geometry optimization