/*
  meam-baskes.h
  by Wei Cai  caiwei@stanford.edu
  Last Modified : Wed Jan  3 15:05:53 2007

  FUNCTION  : MD++ with MEAM potential (using MDCASK Fortran Codes of Mike Baskes baskes@lanl.gov)
*/

#ifndef _MEAM_BASKES_H 
#define _MEAM_BASKES_H 

#include "mdparallel.h"

extern "C" int force_();
extern "C" int inter_();
extern "C" int phif_(double *,int *,int *);
extern "C" int phiid_(double *,int *);
extern "C" int cal_phiid_(double *,int *,double *);

/* utils/param.inc */
#define natmax  100000
#define neimax  150
#define ngrid   5010
#define ngridar 5010
#define ntable  10000
#define nelmax  3
#define natcmax 500
#define icmax   30
#define icmay   30
#define icmaz   30
#define neimx   3000

/* utils/utils.inc */
extern struct { double rcutsq, rcut; } interact_;
extern struct { double perub[3], perlb[3], perlen[3], alat, xbound[2], ybound[2], zbound[2];
                    int natoms; double latty; } lattice_;
extern struct { double rv[natmax][6]; int itype[natmax]; } particle_;
extern struct { double y[natmax][6]; } scaled_;
extern struct { double f[natmax][3], e[natmax], stresst[3][3], slocal[natmax][3][3],
                    avslocal[natmax][3][3]; int noutput; } forces_;
extern struct { double amass[nelmax]; int ielement[nelmax], netype[nelmax], ntypes ; } types_;
extern struct { double rctsqn, dradn; int nneigh, nneips, nmeth, nnindx[natmax+1],
                    newlst, nlstmx, nnlst[natmax*neimax]; } cneigh_;

/* meam/meam.inc */
extern struct { double omegas[nelmax], res[nelmax][nelmax],
                    esubs[nelmax][nelmax], alats[nelmax], zs[nelmax],
                    alphas[nelmax][nelmax],deltas[nelmax][nelmax],
                    betas[nelmax][4],ts[nelmax][4],asubs[nelmax],
                    rozros[nelmax],z0s[nelmax],
                    repuls[nelmax][nelmax],attrac[nelmax][nelmax];
                float legend; int ibarr[nelmax],irhos[nelmax];
                char enames[nelmax][4],lattces[nelmax][4]; } cmeam_;

extern struct { double rscrmax, cmin[nelmax][nelmax][nelmax],
                    cmax[nelmax][nelmax][nelmax]; int nscree,ipscree; } scr_;


/* meam/dyn88.f */
extern struct {char meamf[80],meafile[80]; } mea_;
extern struct {char kodes[nelmax][7]; } kodes_;
extern struct {int fid; } myoutput_;

class MEAMFrame : public MDPARALLELFrame
{ /* MEAM potential */
public:
    double cmin0[nelmax];
    
    MEAMFrame()  {};

    virtual void potential ();

    void readMEAM();
    void MEAM();

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

    void printpairpot();
};


#endif // _MEAM-BASKES_H

