/*
  eam.h
  by Wei Cai  caiwei@mit.edu
  Last Modified : Sat Dec 30 21:08:21 2006

  FUNCTION  : MD++ implementation of EAM/MEAM potential
*/

#ifndef _EAM_H
#define _EAM_H

#include "mdparallel.h"

class EAMFrame : public MDPARALLELFrame
{ /* EAM/MEAM potential */
public:
    int pottype; /* 1: EAM, 2: MEAM */
    int eamfiletype; /* 1: single element, 2: binary element */
    int eamgrid;
    /* EAM potential parameters */
#define NGRID 6000
    char title3[100];
    int ntyp;
    double rmass, rlatt, drar, drhoar, actual, actual2, rmin;
    double rho[2][NGRID], rhop[2][NGRID], phi[2][NGRID], phip[2][NGRID];
    double phix[NGRID], phipx[NGRID];
    double frho[2][NGRID], frhop[2][NGRID];
    double rho_spline[2][NGRID][4], phi_spline[2][NGRID][4];
    double phix_spline[NGRID][4], frho_spline[2][NGRID][4];
    double rval[NGRID], rhoval[NGRID];
    double petrip, rhocon, rhomax;
    double *atpe3b, *rhotot, *embf, *embfp;
    int *nbst;
    
    EAMFrame() : pottype(1), eamfiletype(0), eamgrid(NGRID),
                 ntyp(0), rmass(0), rlatt(0), drar(0), drhoar(0),
                 actual(0), actual2(0), rmin(0),
                 petrip(0), rhocon(0), rhomax(0) {};

    virtual void potential ();
    void kraeam();
    void rhoeam();
    void kraMEAM();
    void rhoMEAM();
    int readeam();
    int readMEAM();

    virtual void Alloc();
    virtual void initvars();
    virtual void initparser();
    
    virtual int exec(char *nam);

};


#endif // _EAM_H

