ScriptTcl.C File Reference

#include "InfoStream.h"
#include "BackEnd.h"
#include "ScriptTcl.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 <errno.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.

Defines

#define USE_COMPAT_CONST
#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)
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 *v, const char *msg)
void newhandle_msg_ex (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


Define Documentation

#define CHECK_REPLICA ( REP   ) 

Value:

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

Definition at line 448 of file ScriptTcl.C.

#define DEG2RAD   3.14159625359/180.0

Definition at line 1611 of file ScriptTcl.C.

Referenced by get_lattice_from_ts().

#define MIN_DEBUG_LEVEL   4

Definition at line 50 of file ScriptTcl.C.

#define UNITCELLSLOP   0.0001

Definition at line 1612 of file ScriptTcl.C.

#define USE_COMPAT_CONST

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

Definition at line 41 of file ScriptTcl.C.


Function Documentation

static int atoBool ( const char *  s  )  [static]

Definition at line 837 of file ScriptTcl.C.

00838 {
00839    if (!strcasecmp(s, "on")) return 1;
00840    if (!strcasecmp(s, "off")) return 0;
00841    if (!strcasecmp(s, "true")) return 1;
00842    if (!strcasecmp(s, "false")) return 0;
00843    if (!strcasecmp(s, "yes")) return 1;
00844    if (!strcasecmp(s, "no")) return 0;
00845    if (!strcasecmp(s, "1")) return 1;
00846    if (!strcasecmp(s, "0")) return 0;
00847    return -1;
00848 }

int eabf_static_init ( Tcl_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 get_lattice_from_ts ( Lattice lattice,
const molfile_timestep_t *  ts 
) [static]

Definition at line 1614 of file ScriptTcl.C.

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

01615 {
01616   // Check if valid unit cell data is contained in the timestep.  We don't
01617   // have any formalized way of doing this yet; for now, just check that
01618   // the length of the vector is greater than 1.
01619   if (ts->A <= 1 || ts->B <= 1 || ts->C <= 1) return 0;
01620 
01621   // convert from degrees to radians
01622   // Try to get exact results when the angles are exactly 90.
01623   double epsalpha = DEG2RAD*(ts->alpha-90.0);
01624   double epsbeta  = DEG2RAD*(ts->beta-90.0);
01625   double epsgamma = DEG2RAD*(ts->gamma-90.0);
01626   double cosAB = -sin(epsgamma);
01627   double sinAB = cos(epsgamma);
01628   double cosAC = -sin(epsbeta);
01629   double cosBC = -sin(epsalpha);
01630 
01631   // A will lie along the positive x axis.
01632   // B will lie in the x-y plane
01633   // The origin will be (0,0,0).
01634   Vector A(0), B(0), vecC(0);
01635   A.x = ts->A;
01636   B.x = ts->B*cosAB;
01637   B.y = ts->B*sinAB;
01638   //if (fabs(B.x) < UNITCELLSLOP) B.x = 0;
01639   //if (fabs(B.y) < UNITCELLSLOP) B.y = 0;
01640   vecC.x = ts->C * cosAC;
01641   vecC.y = (ts->B*ts->C*cosBC - B.x*vecC.x)/B.y;
01642   vecC.z = sqrt(ts->C*ts->C - vecC.x*vecC.x - vecC.y*vecC.y);
01643   //if (fabs(vecC.x) < UNITCELLSLOP) vecC.x = 0;
01644   //if (fabs(vecC.y) < UNITCELLSLOP) vecC.y = 0;
01645   //if (fabs(vecC.z) < UNITCELLSLOP) vecC.z = 0;
01646   lattice->set(A, B, vecC, Vector(0));
01647   return 1;
01648 }

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

Definition at line 1938 of file ScriptTcl.C.

01938                                                         {
01939   CkPrintf("psfgen) %s\n",msg);
01940 }

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

Definition at line 1942 of file ScriptTcl.C.

01942                                                                                      {
01943   CkPrintf("%s%s%s", (prepend ? "psfgen) " : ""), msg, (newline ? "\n" : ""));
01944 }

int psfgen_static_init ( Tcl_Interp *   ) 

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

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().

Referenced by NamdState::loadStructure().

00034                                                  {
00035   Vector *newcoords;    //  Array of vectors to hold coordinates from file
00036 
00037   //  Allocate an array to hold the new coordinates
00038   newcoords = new Vector[pdbobj->num_atoms()];
00039 
00040   //  Read the coordinate from the file
00041   read_binary_file(fname,newcoords,pdbobj->num_atoms());
00042 
00043   //  Set the coordinates in the PDB object to the new coordinates
00044   pdbobj->set_all_positions(newcoords);
00045 
00046   //  Clean up
00047   delete [] newcoords;
00048 
00049 } // END OF FUNCTION read_binary_coors()

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

Definition at line 57 of file ScriptTcl.C.

References dcdplugin.

00057                                                 {
00058         dcdplugin = (molfile_plugin_t *)p;
00059         return 0;
00060 }

static int replica_hash ( const char *  key  )  [static]

Definition at line 1439 of file ScriptTcl.C.

01439                                          {
01440   unsigned int hash = 0;
01441 
01442   while (*key) {
01443     hash *= 73;
01444     hash += *key++;
01445   }
01446 
01447   return hash % CmiNumPartitions();
01448 }


Variable Documentation

float* coords [static]

Definition at line 67 of file ScriptTcl.C.

Referenced by IMDOutput::gather_coordinates(), GlobalMasterIMD::send_fcoords(), and Tcl_loadCoords().

molfile_plugin_t* dcdplugin [static]

Definition at line 56 of file ScriptTcl.C.

Referenced by register_cb().

void* filehandle [static]

Definition at line 66 of file ScriptTcl.C.

int numatoms [static]

Definition at line 65 of file ScriptTcl.C.

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

Vector* vcoords [static]

Definition at line 68 of file ScriptTcl.C.


Generated on Mon Nov 20 01:17:16 2017 for NAMD by  doxygen 1.4.7