/* 
  This file was generated automatically with /nfs/data-012/marques/software/source/libxc/svn/scripts/maple2c.pl.
  Do not edit this file directly as it can be overwritten!!

  This Source Code Form is subject to the terms of the Mozilla Public
  License, v. 2.0. If a copy of the MPL was not distributed with this
  file, You can obtain one at http://mozilla.org/MPL/2.0/.

  Maple version     : Maple 2016 (X86 64 LINUX)
  Maple source      : ../maple/gga_x_pbeint.mpl
  Type of functional: work_gga_x
*/

void xc_gga_x_pbeint_enhance
  (const xc_func_type *p,  xc_gga_work_x_t *r)
{
  double t1, t2, t3, t4, t5, t6, t7, t8;
  double t9, t10, t14, t15, t20, t23, t28, t29;
  double t31, t32, t36, t38, t39, t41, t42, t44;
  double t45, t50, t55, t58, t59, t62, t71, t72;
  double t73, t74, t77, t82, t89, t91, t108, t112;

  gga_x_pbeint_params *params;
 
  assert(p->params != NULL);
  params = (gga_x_pbeint_params * )(p->params);

  t1 = params->muPBE - params->muGE;
  t2 = t1 * params->alpha;
  t3 = M_CBRT6;
  t4 = t2 * t3;
  t5 = 0.31415926535897932385e1 * 0.31415926535897932385e1;
  t6 = cbrt(t5);
  t7 = t6 * t6;
  t8 = 0.1e1 / t7;
  t9 = r->x * r->x;
  t10 = t8 * t9;
  t14 = 0.1e1 + params->alpha * t3 * t10 / 0.24e2;
  t15 = 0.1e1 / t14;
  t20 = (params->muGE + t4 * t10 * t15 / 0.24e2) * t3;
  t23 = params->kappa + t20 * t10 / 0.24e2;
  r->f = 0.1e1 + params->kappa * (0.1e1 - params->kappa / t23);

  if(r->order < 1) return;

  t28 = params->kappa * params->kappa;
  t29 = t23 * t23;
  t31 = t28 / t29;
  t32 = t8 * r->x;
  t36 = params->alpha * params->alpha;
  t38 = t3 * t3;
  t39 = t1 * t36 * t38;
  t41 = 0.1e1 / t6 / t5;
  t42 = t9 * r->x;
  t44 = t14 * t14;
  t45 = 0.1e1 / t44;
  t50 = (t4 * t32 * t15 / 0.12e2 - t39 * t41 * t42 * t45 / 0.288e3) * t3;
  t55 = t50 * t10 / 0.24e2 + t20 * t32 / 0.12e2;
  r->dfdx = t31 * t55;

  if(r->order < 2) return;

  t58 = t28 / t29 / t23;
  t59 = t55 * t55;
  t62 = t3 * t8;
  t71 = t1 * t36 * params->alpha;
  t72 = t5 * t5;
  t73 = 0.1e1 / t72;
  t74 = t9 * t9;
  t77 = 0.1e1 / t44 / t14;
  t82 = (t2 * t62 * t15 / 0.12e2 - 0.5e1 / 0.288e3 * t39 * t41 * t9 * t45 + t71 * t73 * t74 * t77 / 0.288e3) * t3;
  t89 = t82 * t10 / 0.24e2 + t50 * t32 / 0.6e1 + t20 * t8 / 0.12e2;
  r->d2fdx2 = t31 * t89 - 0.2e1 * t58 * t59;

  if(r->order < 3) return;

  t91 = t29 * t29;
  t108 = t36 * t36;
  t112 = t44 * t44;
  r->d3fdx3 = 0.6e1 * t28 / t91 * t59 * t55 - 0.6e1 * t58 * t55 * t89 + t31 * ((-t39 * t41 * t45 * r->x / 0.24e2 + t71 * t73 * t42 * t77 / 0.32e2 - t1 * t108 * t73 * t74 * r->x / t112 * t62 / 0.1152e4) * t3 * t10 / 0.24e2 + t82 * t32 / 0.4e1 + t50 * t8 / 0.4e1);

  if(r->order < 4) return;


}

#define maple2c_order 3
#define maple2c_func  xc_gga_x_pbeint_enhance
