Grid methods for cold molecules: Determination of photoassociation line shapes and rate constants