eabfTcl.C File Reference

#include "eabf.h"
#include "eabf1D.h"
#include "eabf2D.h"
#include "eabffunc.h"
#include <tcl.h>

Go to the source code of this file.

Functions

static int Tcl_startrun (ClientData useless, Tcl_Interp *stupidTcl, int argc, Tcl_Obj *CONST objv[])
static int Tcl_updaterun (ClientData useless, Tcl_Interp *stupidTcl, int argc, Tcl_Obj *CONST argv[])
static int Tcl_setcol (ClientData useless, Tcl_Interp *stupidTcl, int argc, Tcl_Obj *CONST argv[])
static int Tcl_mergefile (ClientData useless, Tcl_Interp *stupidTcl, int argc, Tcl_Obj *CONST objv[])
int Eabf_Init (Tcl_Interp *stupidTcl)
int eabf_static_init (Tcl_Interp *interp)

Variables

static eABFparse = 0


Function Documentation

int Eabf_Init ( Tcl_Interp *  stupidTcl  ) 

Definition at line 165 of file eabfTcl.C.

References Tcl_mergefile(), Tcl_setcol(), Tcl_startrun(), and Tcl_updaterun().

Referenced by eabf_static_init().

00166 {
00167         // create Tcl process "startrun" and "updaterun"
00168         Tcl_CreateObjCommand(stupidTcl, "startrun", Tcl_startrun, (ClientData)0, (Tcl_CmdDeleteProc*)0);
00169         Tcl_CreateObjCommand(stupidTcl, "updaterun", Tcl_updaterun, (ClientData)0, (Tcl_CmdDeleteProc*)0);
00170         Tcl_CreateObjCommand(stupidTcl, "mergefile", Tcl_mergefile, (ClientData)0, (Tcl_CmdDeleteProc*)0);
00171         Tcl_CreateObjCommand(stupidTcl, "setcol", Tcl_setcol, (ClientData)0, (Tcl_CmdDeleteProc*)0);
00172         Tcl_PkgProvide(stupidTcl, "Eabf", "1.0.0");
00173 
00174         Tcl_Eval(stupidTcl, "puts \"eABF [package require Eabf]\"");
00175 
00176         return TCL_OK;
00177 }

int eabf_static_init ( Tcl_Interp *  interp  ) 

Definition at line 179 of file eabfTcl.C.

References Eabf_Init().

Referenced by ScriptTcl::ScriptTcl(), and ScriptTcl::tclsh().

00179                                          {
00180   Tcl_StaticPackage(0,"Eabf",Eabf_Init,0);
00181   return Tcl_Eval(interp,"package ifneeded Eabf 1.0.0 {load {} Eabf}");
00182 }

static int Tcl_mergefile ( ClientData  useless,
Tcl_Interp *  stupidTcl,
int  argc,
Tcl_Obj *CONST  objv[] 
) [static]

Definition at line 105 of file eabfTcl.C.

References eabffunc::chartodouble(), eabffunc::chartoint(), eABF::mergefile(), and parse.

Referenced by Eabf_Init().

00106 {
00107         std::string* argv = new std::string[argc];
00108         // the last objv is the dimension of free-energy surface
00109         for (int i = 0; i < argc; i++)
00110         {
00111                 argv[i] = Tcl_GetString(objv[i]);
00112         }
00113 
00114         // 1D eABF
00115         if (eabffunc::chartoint(argv[1]) == 1)
00116         {
00117                 parse = new eABF1D(eabffunc::chartodouble(argv[2]),      // lowerboundary
00118                         eabffunc::chartodouble(argv[3]),      // upperboundary
00119                         eabffunc::chartodouble(argv[4]),      // width
00120                         0,                                 //krestr
00121                         std::string(argv[5]),             // outputfile
00122                         0,         // outputfreq
00123                         0,   // restart
00124                         "",             // inputfile
00125                         0,  // outputgrad
00126                         0,        // gradfreq
00127                         0);    // temperature
00128 
00129                 // merge file
00130                 for (int i = 6; i < argc; i++)
00131                 {
00132                         parse->mergefile(argv[i], std::string(argv[5]));
00133                 }
00134         }
00135 
00136         if (eabffunc::chartoint(argv[1]) == 2)
00137         {
00138                 parse = new eABF2D(eabffunc::chartodouble(argv[2]),      // lowerboundary
00139                         eabffunc::chartodouble(argv[3]),      // upperboundary
00140                         eabffunc::chartodouble(argv[4]),      // width
00141                         0,                                  //krestr
00142                         eabffunc::chartodouble(argv[5]),      // lowerboundary2
00143                         eabffunc::chartodouble(argv[6]),      // upperboundary2
00144                         eabffunc::chartodouble(argv[7]),      // width2
00145                         0,                                 //krestr2
00146                         std::string(argv[8]),             // outputfile
00147                         0,         // outputfreq
00148                         0,   // restart
00149                         "",             // inputfile
00150                         0,  // outputgrad
00151                         0,   // gradfreq
00152                         0);        //temperature
00153 
00154                         // merge file 
00155                 for (int i = 9; i < argc; i++)
00156                 {
00157                         parse->mergefile(argv[i], std::string(argv[8]));
00158                 }
00159         }
00160 
00161         delete[] argv;
00162         return TCL_OK;
00163 }

static int Tcl_setcol ( ClientData  useless,
Tcl_Interp *  stupidTcl,
int  argc,
Tcl_Obj *CONST  argv[] 
) [static]

Definition at line 92 of file eabfTcl.C.

References eabffunc::chartoint(), parse, and eABF::setcolumn().

Referenced by Eabf_Init().

00093 {
00094         std::vector<int> cols;
00095         for (int i = 1; i<argc; i++)
00096         {
00097                 cols.push_back(eabffunc::chartoint(Tcl_GetString(argv[i])));
00098         }
00099         parse->setcolumn(cols);
00100         return TCL_OK;
00101 }

static int Tcl_startrun ( ClientData  useless,
Tcl_Interp *  stupidTcl,
int  argc,
Tcl_Obj *CONST  objv[] 
) [static]

Definition at line 34 of file eabfTcl.C.

References eabffunc::chartodouble(), eabffunc::chartoint(), and parse.

Referenced by Eabf_Init().

00035 {
00036     std::string* argv = new std::string[argc];
00037     // the last objv is the dimension of free-energy surface
00038     for(int i=0; i<argc; i++)
00039     {
00040         argv[i] = Tcl_GetString(objv[i]);
00041     }
00042 
00043         // 1D eABF
00044         if (eabffunc::chartoint(argv[argc - 1]) == 1)
00045     {
00046                 parse = new eABF1D(eabffunc::chartodouble(argv[1]),      // lowerboundary
00047                         eabffunc::chartodouble(argv[2]),      // upperboundary
00048                         eabffunc::chartodouble(argv[3]),      // width
00049                         eabffunc::chartodouble(argv[4]),    //krestr
00050                         std::string(argv[5]),             // outputfile
00051                         eabffunc::chartoint(argv[6]),         // outputfreq
00052                         bool(eabffunc::chartoint(argv[7])),   // restart
00053                         std::string(argv[8]),             // inputfile
00054                         bool(eabffunc::chartoint(argv[9])),  // outputgrad
00055                         eabffunc::chartoint(argv[10]),        // gradfreq
00056                         eabffunc::chartodouble(argv[11]));     // temperature
00057     }
00058 
00059         // 2D eABF
00060         if (eabffunc::chartoint(argv[argc - 1]) == 2)
00061     {
00062                 parse = new eABF2D(eabffunc::chartodouble(argv[1]),      // lowerboundary
00063                         eabffunc::chartodouble(argv[2]),      // upperboundary
00064                         eabffunc::chartodouble(argv[3]),      // width
00065                         eabffunc::chartodouble(argv[4]),      // krestr
00066                         eabffunc::chartodouble(argv[5]),      // lowerboundary2
00067                         eabffunc::chartodouble(argv[6]),      // upperboundary2
00068                         eabffunc::chartodouble(argv[7]),      // width2
00069                         eabffunc::chartodouble(argv[8]),       // krestr2
00070                         std::string(argv[9]),             // outputfile
00071                         eabffunc::chartoint(argv[10]),         // outputfreq
00072                         bool(eabffunc::chartoint(argv[11])),   // restart
00073                         std::string(argv[12]),             // inputfile
00074                         bool(eabffunc::chartoint(argv[13])),  // outputgrad
00075                         eabffunc::chartoint(argv[14]),        // gradfreq
00076                         eabffunc::chartodouble(argv[15]));     // temperature
00077     }
00078 
00079         delete[] argv;
00080     return TCL_OK;
00081 }

static int Tcl_updaterun ( ClientData  useless,
Tcl_Interp *  stupidTcl,
int  argc,
Tcl_Obj *CONST  argv[] 
) [static]

Definition at line 84 of file eabfTcl.C.

References parse, and eABF::update().

Referenced by Eabf_Init().

00085 {
00086         std::string colvar = Tcl_GetString(argv[1]);
00087         parse->update(colvar);
00088     return TCL_OK;
00089 }


Variable Documentation

eABF* parse = 0 [static]

Definition at line 31 of file eabfTcl.C.

Referenced by Tcl_mergefile(), Tcl_setcol(), Tcl_startrun(), and Tcl_updaterun().


Generated on Tue Sep 26 01:17:16 2017 for NAMD by  doxygen 1.4.7