The fragment molecular orbital method (FMO) has been used with a large number of wave functions for single-point calculations, and its high accuracy in comparison to ab initio methods has been well established. We have developed the analytic derivative of the electrostatic interaction between far separated fragments and performed a number of restricted Hartree-Fock (RHF) geometry optimizations using FMO and ab initio methods. In particular, the alpha-helix, beta-turn, and extended conformers of a 10-residue polyalanine were studied and the good FMO accuracy was established (the rms deviations for the former two forms were about 0.2 A and for the latter structure about 0.001 A). Met-enkephalin dimer was used as a model for the polypeptide binding and computed at the 3-21G and 6-31G* levels with a similar accuracy achieved; the error in the binding energy predictions (FMO vs ab initio) was 1-3 kcal/mol. Chignolin (PDB: 1uao) and an agonist polypeptide of the erythropoietin receptor protein (emp1) were optimized at the 3-21(+)G level, with the rms deviation from ab initio of about 0.2 A, or 0.5 degrees in terms of bond angles. The effect of solvation on the structure optimization was studied in chignolin and the Trp-cage miniprotein construct (PDB:1l2y), by describing water with TIP3P. The computed structures in gas phase and solution are compared to each other and experiment.