Ab-initio density-functional molecular dynamics simulations and full relaxation of all atomic positions are used to reconcile the crystal structures with IR spectra of dickite and kaolinite. The relaxation of atomic positions preserves the accepted space group symmetries. A pair of two hydroxyl groups oriented parallel to the layer is formed in structures of both dickite and kaolinite producing the high-frequency components of the OH-stretching frequencies. Other hydroxyls make relatively strong interlayer hydrogen bonds and produce down-shifted stretching bands. All hydroxyl groups are involved in effective hydrogen bonds. The OH-stretching frequencies depend linearly on the strength of the hydrogen bond.