/*
 *  Copyright (C) 1996-2017 Edward F. Valeev and Justin T. Fermann
 *
 *  This file is part of Libint.
 *
 *  Libint is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Libint is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Libint.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _psi3_libderiv_h
#define _psi3_libderiv_h

#include <libint/libint.h>

/* Maximum angular momentum of functions in a basis set plus 1 */
#define LIBDERIV_MAX_AM1 7
#define LIBDERIV_MAX_AM12 6
#ifdef DERIV_LVL
 #undef DERIV_LVL
#endif
#define DERIV_LVL 2

typedef struct {
  double *int_stack;
  prim_data *PrimQuartet;
  double *zero_stack;
  double *ABCD[12+144];
  double AB[3];
  double CD[3];
  double *deriv_classes[13][13][12];
  double *deriv2_classes[13][13][144];
  double *dvrr_classes[13][13];
  double *dvrr_stack;
  } Libderiv_t;

#ifdef __cplusplus
extern "C" {
#endif
extern void (*build_deriv1_eri[7][7][7][7])(Libderiv_t *, int);
extern void (*build_deriv12_eri[6][6][6][6])(Libderiv_t *, int);
void init_libderiv_base();

int  init_libderiv1(Libderiv_t *, int max_am, int max_num_prim_quartets, int max_cart_class_size);
int  init_libderiv12(Libderiv_t *, int max_am, int max_num_prim_quartets, int max_cart_class_size);
void free_libderiv(Libderiv_t *);

int  libderiv1_storage_required(int max_am, int max_num_prim_quartets, int max_cart_class_size);
int  libderiv12_storage_required(int max_am, int max_num_prim_quartets, int max_cart_class_size);
#ifdef __cplusplus
}
#endif

#endif
