  Exchange-correlation functionals with corrections for van der Waals
interactions (PBE-D2, PBE-D3, PBE-D3(BJ), PBE-TS, optPBE-vdW and vdW-DF2) are
tested for graphene and hexagonal boron nitride, both in the form of bulk and
bilayer. The characteristics of the potential energy surface, such as the
barrier to relative sliding of the layers and magnitude of corrugation, and
physically measurable properties associated with relative in-plane and
out-of-plane motion of the layers including the shear modulus and modulus for
axial compression, shear mode frequency and frequency of out-of-plane
vibrations are considered. The PBE-D3(BJ) functional gives the best results for
the stackings of hexagonal boron nitride and graphite that are known to be
ground-state from the experimental studies. However, it fails to describe the
order of metastable states of boron nitride in energy. The PBE-D3 and vdW-DF2
functionals, which reproduce this order correctly, are identified as the
optimal choice for general studies. The vdW-DF2 functional is preferred for
evaluation of the modulus for axial compression and frequency of out-of-plane
vibrations, while the PBE-D3 functional is somewhat more accurate in
calculations of the shear modulus and shear mode frequency. The best
description of the latter properties, however, is achieved also using the
vdW-DF2 functional combined with consideration of the experimental interlayer
distance. In the specific case of graphene, the PBE-D2 functional works very
well and can be further improved by adjustment of the parameters.
