Use templates to improve performance when not using triclinic boxes