The density-functional tight-binding (DFTB) formulation of the fragment molecular orbital method is combined with periodic boundary conditions. Long-range electrostatics and dispersion are evaluated with the Ewald summation technique. The first analytic derivatives of the energy with respect to atomic coordinates and lattice parameters are formulated. The accuracy of the method is established in comparison to numerical gradients and DFTB without fragmentation. The largest elementary cell in this work has 1631 atoms. The method is applied to elucidate the polarization, charge transfer, and interactions in the solution.