Halogenated ligands are nowadays commonly designed in order to increase their potency against protein targets. Although novel computational methods of evaluating the affinity of such halogenated inhibitors have emerged, they still lack the sufficient accuracy, which is especially noticeable in the case of empirical scoring functions, being the method of choice in the drug design process. Here, we evaluated a series of halogenated inhibitors of phosphodiesterase type 5 with ab initio methods, revealing the physical nature of ligand binding and determining the components of interaction energy that are essential for proper inhibitor ranking. In particular, a nonempirical scoring model combining long-range contributions to the interaction energy provided a significant correlation with experimental binding potency, outperforming a number of commonly used empirical scoring functions. Considering the low computational cost associated with remarkable predictive abilities of the aforementioned model, it could be used for rapid assessment of the ligand affinity in the process of rational design of novel halogenated compounds.Electronic supplementary materialThe online version of this article (10.1007/s00894-018-3897-z) contains supplementary material, which is available to authorized users.