Structural analysis of porphyrin molecular squares using molecular mechanics and density-functional methods.