/* 
  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_optx.mpl
  Type of functional: work_gga_x
*/

void xc_gga_x_optx_enhance
  (const xc_func_type *p,  xc_gga_work_x_t *r)
{
  double t1, t2, t3, t4, t6, t7, t8, t11;
  double t15, t16, t18, t28, t29, t31, t32;

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

  t1 = params->gamma * params->gamma;
  t2 = params->b * t1;
  t3 = r->x * r->x;
  t4 = t3 * t3;
  t6 = params->gamma * t3 + 0.1e1;
  t7 = t6 * t6;
  t8 = 0.1e1 / t7;
  r->f = t2 * t4 * t8 + params->a;

  if(r->order < 1) return;

  t11 = t3 * r->x;
  t15 = params->b * t1 * params->gamma;
  t16 = t4 * r->x;
  t18 = 0.1e1 / t7 / t6;
  r->dfdx = 0.4e1 * t2 * t11 * t8 - 0.4e1 * t15 * t16 * t18;

  if(r->order < 2) return;

  t28 = t1 * t1;
  t29 = params->b * t28;
  t31 = t7 * t7;
  t32 = 0.1e1 / t31;
  r->d2fdx2 = 0.24e2 * t29 * t4 * t3 * t32 - 0.36e2 * t15 * t4 * t18 + 0.12e2 * t2 * t3 * t8;

  if(r->order < 3) return;

  r->d3fdx3 = 0.24e2 * t2 * r->x * t8 - 0.192e3 * t15 * t11 * t18 + 0.360e3 * t29 * t16 * t32 - 0.192e3 * params->b * t28 * params->gamma * t4 * t11 / t31 / t6;

  if(r->order < 4) return;


}

#define maple2c_order 3
#define maple2c_func  xc_gga_x_optx_enhance
