Generalization of the Optimized‐Basis‐Set Multi‐Configuration Spin‐Coupled method for the ab initio calculation of atomic and molecular electronic wave functions