Added a template function for qchem