/*
  ljbond.h
  by Wei Cai  caiwei@stanford.edu
  Last Modified : Fri Feb 16 09:59:52 2007

  FUNCTION  :  Two component Lennard-Jones potential, depending on group ID
*/

#ifndef _LJBOND_H
#define _LJBOND_H

#include "mdparallel.h"

//All physical constants starts with P_
#define P_KB 1.380662e-23  // (kg*m^2/s^2/K) Boltzmann constant
#define P_E 1.6021892e-19  // (C) electron charge

#define LJ_ENERGY (240.554*P_KB/P_E) // argon energy (sigma)
#define LJ_LENGTH 3.3333   // argon length (epsilon)
//#define LJ_RC     (2.37343077641*LJ_LENGTH) //4 neighbor

/* In principle, MAXSP can be the same as MAXSPECIES defined in md.h
 * here we make MAXSP smaller than MAXSPECIES to save memory 
 */
#define MAXSP 4
#define MAXNUMBOND 3
class LJBONDFrame : public MDPARALLELFrame /* Si with Stillinger-Weber potential */
{
public:
    /* Lennard-Jones parameters */
    double   _C12[MAXSP][MAXSP];
    double   _C9 [MAXSP][MAXSP];
    double   _C6 [MAXSP][MAXSP];
    double    C12[MAXSP][MAXSP];
    double    C9 [MAXSP][MAXSP];
    double    C6 [MAXSP][MAXSP];
    double     Uc[MAXSP][MAXSP];
    double  DUDRc[MAXSP][MAXSP];
    double    LJ_RC;
    double  BOND_R0, BOND_K;

    //double  WALL_X0, WALL_K;
    //double  ATTRAC_R0, ATTRAC_K;
    //double  WALL2_X0, WALL2_K;
    //double  ATTRAC2_Y0,ATTRAC2_K;
    //double  WALL3_X0MAX, WALL3_X0, WALL3_K, EWALL3, TNPT_WALL3;

    double ATTRAC_W, ATTRAC_K;
    double PROBE1_WX, PROBE1_WY, PROBE1_DY, PROBE1_SY0, PROBE1_K;
    double PROBE2_WX, PROBE2_WY, PROBE2_DY, PROBE2_SY0, PROBE2_K;

    double  LMAX, XMAX, YMAX, ZMAX, LAMBDA;
    double  dUdLAM,dUdLAM_L;
    double  dUdLAM_WALL,dUdLAM_ATT;
    double  dUdLAM_WALL2,dUdLAM_ATT2,dUdLAM_WALL3;
    double  dUdLAM_ALKANE;
    double  dUdLAM_XYZ, dUdLAM_X, dUdLAM_Y, dUdLAM_Z;
    
    int *num_bonds;
    int *bond_index;
 
    char usrfile[200];           /* atomeye usr file name */

    LJBONDFrame(): LJ_RC(0),
                   BOND_R0(0),BOND_K(0),
                   //WALL_X0(0),WALL_K(0),
                   //ATTRAC_R0(0),ATTRAC_K(0),
		   //WALL2_X0(0),WALL2_K(0),
                   //ATTRAC2_Y0(0),ATTRAC2_K(0),

                   ATTRAC_W(0),ATTRAC_K(0),
                   PROBE1_WX(0), PROBE1_WY(0), PROBE1_DY(1), PROBE1_SY0(0), PROBE1_K(0),
                   PROBE2_WX(0), PROBE2_WY(0), PROBE2_DY(1), PROBE2_SY0(0), PROBE2_K(0),
                   //WALL3_X0MAX(0),WALL3_X0(0),WALL3_K(0),
                   //EWALL3(0),TNPT_WALL3(0),

                   LMAX(0),XMAX(0),YMAX(0),ZMAX(0),LAMBDA(0),
                   dUdLAM(0),dUdLAM_L(0),
                   dUdLAM_WALL(0),dUdLAM_ATT(0),
                   dUdLAM_WALL2(0),dUdLAM_ATT2(0),dUdLAM_WALL3(0),
                   dUdLAM_ALKANE(),dUdLAM_XYZ(0),
                   dUdLAM_X(0),dUdLAM_Y(0),dUdLAM_Z(0){};
    void lennard_jones_bond();
    virtual void potential();
    virtual void initvars();

    virtual void initparser();
    virtual int exec(const char *name);
    virtual void calcprop();
    
    virtual void Alloc();

    void initLJ();
    void makelipids();
    void linklipids();
    
    void writeatomeyeusrfile(char *fname);

    /* from ljbond2.cpp */
    virtual void SWITCHpotential_user(double lambda);
    void Alloc1();
    void makealkanes();
    void linkalkanes();

    /* addition from Jichul Kim */
    void makeproteins();
    void linkproteins();
};



#endif // _LJBOND_H

