dimer minimization and coordinate calculation