Formation of 24 cooperative hydrogen bonds drives the spontaneous assembly of a rigid bifunctional trimelamine and bis(barbituric acid) to give selectively the [2 x 2] hydrogen-bonded grid, in preference to the corresponding [1 x 1] or polymeric assemblies.