The two-body scattering amplitude and energy spectrum of confined ultracold atoms are of fundamental importance for both theoretical and experimental studies of ultracold-atom physics. For many systems, one can efficiently calculate these quantities via the zero-range Huang-Yang pseudopotential (HYP), in which the interatomic interaction is characterized by the scattering length . Furthermore, when the scattering length is dependent on the kinetic energy of two-atom relative motion, i.e., , the results are applicable for a broad energy region. However, when the free Hamiltonian of atomic internal state (e.g., the Zeeman Hamiltonian) does not commute with the interatomic interaction, or the center-of-mass (c.m.) motion is coupled to the relative motion, the generalization of this technique is still lacking. In this work we solve this problem and construct a reasonable energy-dependent multichannel HYP, which is characterized by a “scattering length operator” , for the above complicated cases. Here, is an operator for atomic internal states and c.m. motion, and depends on both the total two-atom energy and the external field as well as the trapping parameter. The effects from the internal-state or c.m.-relative motion coupling can be self-consistently taken into account by . We further show a method based on the quantum defect theory, with which can be analytically derived for systems with van der Waals interatomic interaction. To demonstrate our method, we calculate the spectrum of two ultracold fermionic alkaline-earth-like atoms [in electronic and states, respectively] confined in an optical lattice. By comparing our results with the recent experimental measurements for two atoms and two atoms, we calibrate the scattering lengths with respect to antisymmetric and symmetric nuclear-spin states to be and for , and and for .