Understanding the profiles of longitudinal cognitive data is crucial in studies on cognitive aging. The substantial heterogeneity and nonlinearity in cognitive trajectories pose a major challenge in statistical analysis. Functional clustering has been a useful tool to characterize the heterogeneity of trajectories with nonlinear patterns. However, most existing approaches do not allow to control for the possible functional effects of covariates in clustering. In this paper, we propose a novel conditional functional clustering approach, based on a latent class functional mixed effects model, where the effects of covariates are controlled as fixed functions, and the random curves are assumed to be generated by a mixture of Gaussian processes, which facilitates a model-based clustering. As a by-product, it also offers a more accurate estimation of the covariate effects that are of particular interest in many studies. A transformed penalized B-spline approach and a modified BIC are employed for model estimation. We apply our new model to the data from the Religious Orders Study and Rush Memory and Aging Project; and four interesting subtypes of cognitive patterns are identified.