Structural changes as a function of torsional motion studied by ab initio calculations. Part 2. X2A-AX2 (A = N, P and X = H, F, Cl) and some implications for electron diffraction analysis