This article describes a novel algorithm for the optimization of valence bond self-consistent field (VBSCF) wave function for a complete active space (CAS), so-called VBSCF(CAS). This was achieved by applying the strategies adopted in the optimization of CASSCF wave functions to VBSCF(CAS) wave functions, using an auxiliary orthogonal orbital set that generates the same configuration space as the original nonorthogonal orbital set. Theoretical analyses and test calculations show that the VBSCF(CAS) method shares the same computational scaling as CASSCF. The test calculations show the current capability of VBSCF method, which involves millions of VB structures. © 2012 Wiley Periodicals, Inc.