NAMD
Classes | Macros | Functions | Variables
ScriptTcl.C File Reference
#include "InfoStream.h"
#include "BackEnd.h"
#include "ScriptTcl.h"
#include "converse.h"
#include "Broadcasts.h"
#include "ConfigList.h"
#include "Node.h"
#include "PDB.h"
#include "WorkDistrib.h"
#include "NamdState.h"
#include "Output.h"
#include "Controller.h"
#include "SimParameters.h"
#include "Thread.h"
#include "ProcessorPrivate.h"
#include "PatchMgr.h"
#include "PatchMap.h"
#include "Measure.h"
#include "colvarmodule.h"
#include "colvarscript.h"
#include "DumpBench.h"
#include "ComputeMgr.h"
#include <stdio.h>
#include <ctype.h>
#include <strings.h>
#include "qd.h"
#include <tcl.h>
#include "TclCommands.h"
#include "DataExchanger.h"
#include "Debug.h"
#include "molfile_plugin.h"
#include "libmolfile_plugin.h"
#include "ComputeConsForceMsgs.h"

Go to the source code of this file.

Classes

struct  ScriptTcl::SimpleBroadcastObjectWrapper
 

Macros

#define MIN_DEBUG_LEVEL   4
 
#define CHECK_REPLICA(REP)
 
#define DEG2RAD   3.14159625359/180.0
 
#define UNITCELLSLOP   0.0001
 

Functions

static int register_cb (void *v, vmdplugin_t *p)
 
static int atoBool (const char *s)
 
int tcl_run_colvarscript_command (ClientData clientData, Tcl_Interp *interp_in, int objc, Tcl_Obj *const objv[])
 
static int replica_hash (const char *key)
 
void read_binary_coors (char *fname, PDB *pdbobj)
 
static int get_lattice_from_ts (Lattice *lattice, const molfile_timestep_t *ts)
 
void newhandle_msg (void *vdata, void *v, const char *msg)
 
void newhandle_msg_ex (void *vdata, void *v, const char *msg, int prepend, int newline)
 
int psfgen_static_init (Tcl_Interp *)
 
int eabf_static_init (Tcl_Interp *)
 

Variables

static molfile_plugin_t * dcdplugin
 
static int numatoms
 
static void * filehandle
 
static float * coords
 
static Vectorvcoords
 

Macro Definition Documentation

◆ CHECK_REPLICA

#define CHECK_REPLICA (   REP)
Value:
do {\
if ( (REP) < 0 ) { \
Tcl_SetResult(interp,(char*)"negative replica index",TCL_VOLATILE); \
return TCL_ERROR; \
} \
if ( (REP) >= CmiNumPartitions() ) { \
Tcl_SetResult(interp,(char*)"non-existent replica index",TCL_VOLATILE); \
return TCL_ERROR; \
} \
} while ( 0 )

Definition at line 567 of file ScriptTcl.C.

◆ DEG2RAD

#define DEG2RAD   3.14159625359/180.0

Definition at line 1802 of file ScriptTcl.C.

Referenced by get_lattice_from_ts().

◆ MIN_DEBUG_LEVEL

#define MIN_DEBUG_LEVEL   4

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 50 of file ScriptTcl.C.

◆ UNITCELLSLOP

#define UNITCELLSLOP   0.0001

Definition at line 1803 of file ScriptTcl.C.

Function Documentation

◆ atoBool()

static int atoBool ( const char *  s)
static

Definition at line 972 of file ScriptTcl.C.

973 {
974  if (!strcasecmp(s, "on")) return 1;
975  if (!strcasecmp(s, "off")) return 0;
976  if (!strcasecmp(s, "true")) return 1;
977  if (!strcasecmp(s, "false")) return 0;
978  if (!strcasecmp(s, "yes")) return 1;
979  if (!strcasecmp(s, "no")) return 0;
980  if (!strcasecmp(s, "1")) return 1;
981  if (!strcasecmp(s, "0")) return 0;
982  return -1;
983 }

◆ eabf_static_init()

int eabf_static_init ( Tcl_Interp *  )

Definition at line 179 of file eabfTcl.C.

References Eabf_Init().

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

179  {
180  Tcl_StaticPackage(0,"Eabf",Eabf_Init,0);
181  return Tcl_Eval(interp,"package ifneeded Eabf 1.0.0 {load {} Eabf}");
182 }
int Eabf_Init(Tcl_Interp *stupidTcl)
Definition: eabfTcl.C:165

◆ get_lattice_from_ts()

static int get_lattice_from_ts ( Lattice lattice,
const molfile_timestep_t *  ts 
)
static

Definition at line 1805 of file ScriptTcl.C.

References DEG2RAD, Lattice::set(), Vector::x, Vector::y, and Vector::z.

1806 {
1807  // Check if valid unit cell data is contained in the timestep. We don't
1808  // have any formalized way of doing this yet; for now, just check that
1809  // the length of the vector is greater than 1.
1810  if (ts->A <= 1 || ts->B <= 1 || ts->C <= 1) return 0;
1811 
1812  // convert from degrees to radians
1813  // Try to get exact results when the angles are exactly 90.
1814  double epsalpha = DEG2RAD*(ts->alpha-90.0);
1815  double epsbeta = DEG2RAD*(ts->beta-90.0);
1816  double epsgamma = DEG2RAD*(ts->gamma-90.0);
1817  double cosAB = -sin(epsgamma);
1818  double sinAB = cos(epsgamma);
1819  double cosAC = -sin(epsbeta);
1820  double cosBC = -sin(epsalpha);
1821 
1822  // A will lie along the positive x axis.
1823  // B will lie in the x-y plane
1824  // The origin will be (0,0,0).
1825  Vector A(0), B(0), vecC(0);
1826  A.x = ts->A;
1827  B.x = ts->B*cosAB;
1828  B.y = ts->B*sinAB;
1829  //if (fabs(B.x) < UNITCELLSLOP) B.x = 0;
1830  //if (fabs(B.y) < UNITCELLSLOP) B.y = 0;
1831  vecC.x = ts->C * cosAC;
1832  vecC.y = (ts->B*ts->C*cosBC - B.x*vecC.x)/B.y;
1833  vecC.z = sqrt(ts->C*ts->C - vecC.x*vecC.x - vecC.y*vecC.y);
1834  //if (fabs(vecC.x) < UNITCELLSLOP) vecC.x = 0;
1835  //if (fabs(vecC.y) < UNITCELLSLOP) vecC.y = 0;
1836  //if (fabs(vecC.z) < UNITCELLSLOP) vecC.z = 0;
1837  lattice->set(A, B, vecC, Vector(0));
1838  return 1;
1839 }
#define DEG2RAD
Definition: ScriptTcl.C:1802
Definition: Vector.h:72
NAMD_HOST_DEVICE void set(Vector A, Vector B, Vector C)
Definition: Lattice.h:31

◆ newhandle_msg()

void newhandle_msg ( void *  vdata,
void *  v,
const char *  msg 
)

Definition at line 2196 of file ScriptTcl.C.

2196  {
2197  CkPrintf("psfgen) %s\n",msg);
2198 }

◆ newhandle_msg_ex()

void newhandle_msg_ex ( void *  vdata,
void *  v,
const char *  msg,
int  prepend,
int  newline 
)

Definition at line 2200 of file ScriptTcl.C.

2200  {
2201  CkPrintf("%s%s%s", (prepend ? "psfgen) " : ""), msg, (newline ? "\n" : ""));
2202 }

◆ psfgen_static_init()

int psfgen_static_init ( Tcl_Interp *  )

◆ read_binary_coors()

void read_binary_coors ( char *  fname,
PDB pdbobj 
)

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 34 of file NamdOneTools.C.

References PDB::num_atoms(), read_binary_file(), and PDB::set_all_positions().

34  {
35  Vector *newcoords; // Array of vectors to hold coordinates from file
36 
37  // Allocate an array to hold the new coordinates
38  newcoords = new Vector[pdbobj->num_atoms()];
39 
40  // Read the coordinate from the file
41  read_binary_file(fname,newcoords,pdbobj->num_atoms());
42 
43  // Set the coordinates in the PDB object to the new coordinates
44  pdbobj->set_all_positions(newcoords);
45 
46  // Clean up
47  delete [] newcoords;
48 
49 } // END OF FUNCTION read_binary_coors()
Definition: Vector.h:72
void set_all_positions(Vector *)
Definition: PDB.C:331
int num_atoms(void)
Definition: PDB.C:323
void read_binary_file(const char *fname, Vector *data, int n)
Definition: NamdOneTools.C:52

◆ register_cb()

static int register_cb ( void *  v,
vmdplugin_t *  p 
)
static

Definition at line 57 of file ScriptTcl.C.

References dcdplugin.

Referenced by ScriptTcl::ScriptTcl().

57  {
58  dcdplugin = (molfile_plugin_t *)p;
59  return 0;
60 }
static molfile_plugin_t * dcdplugin
Definition: ScriptTcl.C:56

◆ replica_hash()

static int replica_hash ( const char *  key)
static

Definition at line 1594 of file ScriptTcl.C.

1594  {
1595  unsigned int hash = 0;
1596 
1597  while (*key) {
1598  hash *= 73;
1599  hash += *key++;
1600  }
1601 
1602  return hash % CmiNumPartitions();
1603 }

◆ tcl_run_colvarscript_command()

int tcl_run_colvarscript_command ( ClientData  clientData,
Tcl_Interp *  interp_in,
int  objc,
Tcl_Obj *const  objv[] 
)

Variable Documentation

◆ coords

float* coords
static

◆ dcdplugin

molfile_plugin_t* dcdplugin
static

Definition at line 56 of file ScriptTcl.C.

Referenced by register_cb().

◆ filehandle

void* filehandle
static

Definition at line 66 of file ScriptTcl.C.

◆ numatoms

int numatoms
static

Definition at line 65 of file ScriptTcl.C.

Referenced by NamdState::loadStructure(), rescale_nonperiodic_cell(), and spatial_hashing().

◆ vcoords

Vector* vcoords
static

Definition at line 68 of file ScriptTcl.C.