Modelling of the two-dimensional polymerization of 1,4-benzene diboronic acid molecules on the Ag(111) surface, which leads to the formation of a covalent organic framework, is reported. An estimation of free enthalpy is given that takes into account the constraints induced by the molecular adsorption on the surface. The various thermodynamic functions, enthalpies, entropies, and free enthalpies, are obtained from DFT calculations. The entropic effect of the surface plays an important role in the polymerization free energy. A germination threshold is obtained.