summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorEric Messick <ericm@nanorex.com>2008-01-24 05:59:06 +0000
committerEric Messick <ericm@nanorex.com>2008-01-24 05:59:06 +0000
commit4e0cd140c2144dda21cff23d81afc450c8c5d2b3 (patch)
tree6a5ed69f98664ff8b72dbe25bb621f35c4ed37b7 /sim
parent93027d05c213b3092c624b6ee45543c2b9e1cf89 (diff)
downloadnanoengineer-4e0cd140c2144dda21cff23d81afc450c8c5d2b3.tar.gz
nanoengineer-4e0cd140c2144dda21cff23d81afc450c8c5d2b3.zip
changes to python-pyrex simulator interface
Diffstat (limited to 'sim')
-rwxr-xr-xsim/src/globals.c14
-rwxr-xr-xsim/src/newtables.c27
-rw-r--r--sim/src/pam5_patterns.c8
-rwxr-xr-xsim/src/part.c7
-rw-r--r--sim/src/printGromacsTopology.c51
-rwxr-xr-xsim/src/sim-params.txt498
-rwxr-xr-xsim/src/sim.pyx271
-rwxr-xr-xsim/src/simhelp.c53
-rwxr-xr-xsim/src/simulator.c6
-rwxr-xr-xsim/src/tests.py43
10 files changed, 252 insertions, 726 deletions
diff --git a/sim/src/globals.c b/sim/src/globals.c
index 66472bfb6..cacf3f77e 100755
--- a/sim/src/globals.c
+++ b/sim/src/globals.c
@@ -59,7 +59,8 @@ double ThermostatGamma;
double ThermostatG1;
// absolute distance in nm beyond which gromacs will consider vdW
-// forces to be exactly zero.
+// forces to be exactly zero. If less than zero, user defined tables
+// will not be used, and a default value of 1.0 nm will be used.
double VanDerWaalsCutoffRadius;
// multiple of rvdW where interpolation table ends, and van der Waals
@@ -130,7 +131,7 @@ reinit_globals(void)
NumFrames = 100;
DumpAsText = 0;
DumpIntermediateText = 0;
- PrintFrameNums = 1;
+ PrintFrameNums = 0;
OutputFormat = 1;
KeyRecordInterval = 32;
DirectEvaluate = 0;
@@ -155,7 +156,7 @@ reinit_globals(void)
MinimizeThresholdEndRMS = 1.0;
MinimizeThresholdEndMax = 0.0; // set by constrainGlobals, below
- VanDerWaalsCutoffRadius = 1.0; // (nm) default for atomic minimization
+ VanDerWaalsCutoffRadius = -1.0; // use gromacs built in functions
VanDerWaalsCutoffFactor = 1.7;
EnableElectrostatic = 1;
@@ -223,9 +224,16 @@ printGlobals()
write_traceline("# MinimizeThresholdEndRMS: %f\n", MinimizeThresholdEndRMS);
write_traceline("# MinimizeThresholdEndMax: %f\n", MinimizeThresholdEndMax);
}
+ write_traceline("# VanDerWaalsCutoffRadius: %f\n", VanDerWaalsCutoffRadius);
write_traceline("# VanDerWaalsCutoffFactor: %f\n", VanDerWaalsCutoffFactor);
write_traceline("# EnableElectrostatic: %d\n", EnableElectrostatic);
write_traceline("# ThermostatGamma: %f\n", ThermostatGamma);
+ if (SystemParametersFileName != NULL) {
+ write_traceline("# SystemParametersFileName: %s\n", SystemParametersFileName);
+ }
+ if (GromacsOutputBaseName != NULL) {
+ write_traceline("# GromacsOutputBaseName: %s\n", GromacsOutputBaseName);
+ }
write_traceline("#\n");
}
diff --git a/sim/src/newtables.c b/sim/src/newtables.c
index 950289332..e5abb6644 100755
--- a/sim/src/newtables.c
+++ b/sim/src/newtables.c
@@ -642,6 +642,22 @@ tokenizeDouble(int *errp)
}
static void
+destroyElement(void *e)
+{
+ struct atomType *element = (struct atomType *)e;
+
+ if (element == NULL || element->refCount-- > 1) {
+ return;
+ }
+
+ free(element->name);
+ element->name = NULL;
+ free(element->symbol);
+ element->symbol = NULL;
+ free(element);
+}
+
+static void
destroyBondStretch(void *s)
{
struct bondStretch *stretch = (struct bondStretch *)s;
@@ -704,6 +720,8 @@ destroyElectrostatic(void *e)
static void
destroyStaticBondTable(void)
{
+ hashtable_destroy(periodicHashtable, destroyElement);
+ periodicHashtable = NULL;
hashtable_destroy(bondStretchHashtable, destroyBondStretch);
bondStretchHashtable = NULL;
hashtable_destroy(bendDataHashtable, destroyBendData);
@@ -964,7 +982,6 @@ initializeStaticBondTable(void)
#include "bonds.gen"
-
addDeTableEntry("H-1-N", 0.75);
addDeTableEntry("N-1-O", 0.383);
addDeTableEntry("N-1-F", 0.422);
@@ -976,12 +993,6 @@ initializeStaticBondTable(void)
addDeTableEntry("S-1-Cl", 0.489);
#include "bends.gen"
-
- // name rvdW evdW start end
-
- addVanDerWaalsInteraction("Pl-v-Pl", 7.2, 0.3, 100.0, 7.2);
- addVanDerWaalsInteraction("Pl-v-Pe", 7.2, 0.3, 100.0, 7.2);
- addVanDerWaalsInteraction("Pe-v-Pe", 7.2, 0.3, 100.0, 7.2);
}
static const char bends_rcsid[] = RCSID_BENDS_H;
@@ -1046,7 +1057,7 @@ initializeBondTable(void)
}
if (reloadSystemOverlay || reloadUserOverlay) {
initializeStaticBondTable();
-
+
readBondTableOverlay(systemBondTableOverlayFileName);
readBondTableOverlay(userBondTableOverlayFileName);
}
diff --git a/sim/src/pam5_patterns.c b/sim/src/pam5_patterns.c
index 66dab7527..56494498c 100644
--- a/sim/src/pam5_patterns.c
+++ b/sim/src/pam5_patterns.c
@@ -2,7 +2,7 @@
#include "simulator.h"
-static char const rcsid[] = "$Id:$";
+static char const rcsid[] = "$Id$";
/*
static struct bendData *pam5_Ax_Ax_Ss_low = NULL;
@@ -232,6 +232,12 @@ createPam5Patterns(void)
struct compiledPatternTraversal *t[10];
struct compiledPatternAtom *a[10];
//struct patternParameter *param;
+
+ if (VanDerWaalsCutoffRadius < 0.0) {
+ // this indicates that the model has no pam5 atoms
+ return;
+ }
+ stack_match_initialized = 0;
/*
a[0] = makePatternAtom(0, "Ax5");
diff --git a/sim/src/part.c b/sim/src/part.c
index 58fde8a7e..c15948ca0 100755
--- a/sim/src/part.c
+++ b/sim/src/part.c
@@ -469,7 +469,7 @@ makeTorsion(struct part *p, int index, struct bond *center, struct bond *b1, str
// These numbers are based on a torsion around a Carbon-Carbon bond.
switch (center->order) {
case '2':
- // Barrior to rotation of a simple alkene is about 265 kJ/mol, but
+ // Barrier to rotation of a simple alkene is about 265 kJ/mol, but
// can be on the order of 50 kJ/mol for "captodative ethylenes",
// where the charge density on the carbons involved in the double
// bond has been significantly altered.
@@ -483,7 +483,9 @@ makeTorsion(struct part *p, int index, struct bond *center, struct bond *b1, str
case 'a':
case 'g':
// Damian has calculated the following for a small graphitic system
- t->A = 0.37013376;
+ //t->A = 0.37013376;
+ t->A = 0.04;
+ //t->A = 0.0;
break;
default:
t->A = 0;
@@ -605,6 +607,7 @@ makeOutOfPlane(struct part *p, int index, struct atom *a)
// A is in aJ/pm^2
o->A = 0.00025380636; // This is for carbon in graphene with deflection less than 0.5 pm.
+ //o->A = 0.0;
//o->A = 0.0005; // XXX need to get actual value from real parameters
}
diff --git a/sim/src/printGromacsTopology.c b/sim/src/printGromacsTopology.c
index c0f3d5473..52359a170 100644
--- a/sim/src/printGromacsTopology.c
+++ b/sim/src/printGromacsTopology.c
@@ -90,7 +90,10 @@ writeExclusion(FILE *top,
return gotOne;
}
-#define DEPTH_TO_EXCLUDE 2
+
+// vdw cutoff radius divided by basepair to basepair distance
+// 11 nm / 318 pm = 34.6, round up and add some fudge
+#define DEPTH_TO_EXCLUDE 40
static void
writeGromacsExclusions(FILE *top, struct part *p, struct atom *a)
@@ -197,6 +200,8 @@ static char *closure_nonbondedPass1Symbol;
static int closure_nonbondedPass1Number;
static struct part *closure_part;
+static int nonbonded_function; // 1=Lennard-Jones, 2=Buckingham
+
static void
allNonBondedAtomtypesPass2(char *symbol, void *value)
{
@@ -205,9 +210,9 @@ allNonBondedAtomtypesPass2(char *symbol, void *value)
struct vanDerWaalsParameters *vdw;
double rvdW; // nm
double evdW; // kJ mol^-1
- double A; // kJ mol^-1
- double B; // nm^-1
- double C; // kJ mol^-1 nm^6
+ double A;
+ double B;
+ double C;
if (at != NULL) {
element = at->protons;
@@ -218,11 +223,18 @@ allNonBondedAtomtypesPass2(char *symbol, void *value)
if (rvdW > 1e-8) {
evdW = zJ_to_kJpermol(vdw->evdW);
- A = 2.48e5 * evdW;
- B = 12.5 / rvdW;
- C = evdW * 1.924 * pow(rvdW, 6.0);
+ if (nonbonded_function == 1) {
+ A = 2.0 * evdW * pow(rvdW, 6.0);
+ B = evdW * pow(rvdW, 12.0);
+
+ fprintf(closure_topologyFile, "%4s %4s 1 %12.5e %12.5e\n", closure_nonbondedPass1Symbol, symbol, A, B);
+ } else {
+ A = 2.48e5 * evdW; // kJ mol^-1
+ B = 12.5 / rvdW; // nm^-1
+ C = evdW * 1.924 * pow(rvdW, 6.0); // kJ mol^-1 nm^6
- fprintf(closure_topologyFile, "%4s %4s 2 %12.5e %12.5e %12.5e\n", closure_nonbondedPass1Symbol, symbol, A, B, C);
+ fprintf(closure_topologyFile, "%4s %4s 2 %12.5e %12.5e %12.5e\n", closure_nonbondedPass1Symbol, symbol, A, B, C);
+ }
}
}
}
@@ -262,9 +274,10 @@ printGromacsToplogy(char *basename, struct part *p)
FILE *mdp; // Gromacs configuration file (basename.mdp)
FILE *ndx; // Gromacs group (index) file (basename.ndx)
int len;
+ double vdwCutoff;
char *fileName;
char *ret = NULL;
-
+
len = strlen(basename) + 5;
fileName = allocate(len);
sprintf(fileName, "%s.top", basename);
@@ -317,10 +330,22 @@ printGromacsToplogy(char *basename, struct part *p)
fprintf(mdp, "nstcgsteep = 100\n"); // frequency of steep steps during cg
fprintf(mdp, "nstlist = 10\n"); // update frequency for neighbor list
fprintf(mdp, "ns_type = simple\n"); // neighbor search type, must be simple for pbc=no
+
+ if (VanDerWaalsCutoffRadius < 0) {
+ vdwCutoff = 1.0;
+ nonbonded_function = 2;
+ } else {
+ vdwCutoff = VanDerWaalsCutoffRadius;
+ fprintf(mdp, "coulombtype = User\n");
+ fprintf(mdp, "vdwtype = User\n");
+ nonbonded_function = 1;
+ }
+
// rlist, rcoulomb and rvdw must be equal when ns_type = simple
- fprintf(mdp, "rlist = %f\n", VanDerWaalsCutoffRadius); // short range neighbor list cutoff distance
- fprintf(mdp, "rcoulomb = %f\n", VanDerWaalsCutoffRadius); // coulomb function cutoff distance
- fprintf(mdp, "rvdw = %f\n", VanDerWaalsCutoffRadius); // vdw cutoff distance
+ fprintf(mdp, "rlist = %f\n", vdwCutoff); // short range neighbor list cutoff distance
+ fprintf(mdp, "rcoulomb = %f\n", vdwCutoff); // coulomb function cutoff distance
+ fprintf(mdp, "rvdw = %f\n", vdwCutoff); // vdw cutoff distance
+
fprintf(mdp, "epsilon_r = %f\n", DielectricConstant);
fprintf(mdp, "freezegrps = Anchor\n"); // which group of atoms to hold fixed
fprintf(mdp, "freezedim = Y Y Y\n"); // fix in all three dimensions
@@ -335,7 +360,7 @@ printGromacsToplogy(char *basename, struct part *p)
fprintf(top, "[ defaults ]\n");
fprintf(top, "; nbfunc comb-rule gen-pairs fudgeLJ fudgeQQ\n");
- fprintf(top, " 2 1 no 1.0 1.0\n");
+ fprintf(top, " %d 1 no 1.0 1.0\n", nonbonded_function);
fprintf(top, "\n");
fprintf(top, "[ atomtypes ]\n");
diff --git a/sim/src/sim-params.txt b/sim/src/sim-params.txt
deleted file mode 100755
index 9a8b9530d..000000000
--- a/sim/src/sim-params.txt
+++ /dev/null
@@ -1,498 +0,0 @@
-#
-# Copyright 2007 Nanorex, Inc. See LICENSE file for details.
-# $Id$
-#
-
-# This file should be placed in your ~/Nanorex directory. It is read
-# by the simulator before each simulation or minimization run. You
-# should be able to edit and save it between runs and see the new
-# results in later runs.
-
-# The element, stretch, and bend lines define new force field
-# parameters which override or extend the force field compiled into
-# the simulator.
-
-# Angle values can be entered in either degrees or radians. The units
-# line lets you specify which. You can switch between the two as often
-# as you like. The default is:
-#
-#units radians
-
-units degrees
-
-# format for element lines
-#
-# Z (int) number of protons, or atomType index
-# grp (int) group number in periodic table (not currently used)
-# groups 9-22 are lanthanides
-# groups 8-31 are transition metals
-# per (int) period in periodic table (not currently used)
-# sym (string) abbreviated symbol name (one-three characters)
-# sym values are used in stretch and bend records
-# name (string) full name, for printing
-# mass (double) in yg (yoctograms, or 1e-24 g)
-# rvdW (double) van der Waals radius, in 1e-10 m or angstroms or 0.1 nm
-# evdW (double) van der Waals stiffness, in zJ (zepto Joules, or milli atto Joules, or 1e-21 J)
-# NOTE: specifing an evdW value < .1 will cause the value to be calculated based on number of protons
-# rcov (double) covalent radius in pm (1e-12 m)
-# used to generate unspecified bond parameters
-# chrg (double) charge in mulitples of proton charge
-#
-# Z grp per par sym name mass rvdW evdW bnds rcov chrg virt
-
-element 997 0 0 All PAM5 All-PAM5-Pseudo-Atoms 0.0 0.0 0.0 0 0 0 0
-element 996 0 0 PAM5 P5S PAM5-Sugars 0.0 0.0 0.0 0 0 0 0
-element 995 0 0 PAM5 P5P PAM5-Phosphates 0.0 0.0 0.0 0 0 0 0
-element 994 0 0 PAM5 P5G PAM5-Major-Grooves 0.0 0.0 0.0 0 0 0 0
-element 993 0 0 PAM5 P5V PAM5-Virtual-Atoms 0.0 0.0 0.0 0 0 0 0
-element 992 0 0 PAM5 P5d PAM5-depricated 0.0 0.0 0.0 0 0 0 0
-element 991 0 0 All PAM3 All-PAM3-Pseudo-Atoms 0.0 0.0 0.0 0 0 0 0
-
-element 200 0 0 P5d Ax5 DNA-Pseudo-Axis 167.0 0.0 0.0 4 100 0 0 700
-element 201 0 0 P5S Ss5 DNA-Pseudo-Sugar 167.0 0.0 0.0 3 170 0 0 800
-element 202 0 0 P5P Pl5 DNA-Pseudo-Phosphate 167.0 0.0 0.0 2 170 0 0 900
-element 203 0 0 P5d Sj5 DNA-Pseudo-Sugar-Junction 167.0 0.0 0.0 3 170 0 0 810
-element 204 0 0 P5d Ae5 DNA-Pseudo-Axis-End 167.0 0.0 0.0 1 100 0 0 701
-element 205 0 0 P5d Pe5 DNA-Pseudo-Phosphate-End 167.0 0.0 0.0 1 170 0 0 901
-element 206 0 0 P5d Sh5 DNA-Pseudo-Sugar-End 167.0 0.0 0.0 1 170 0 0 902
-element 207 0 0 P5d Hp5 DNA-Pseudo-Hairpin 167.0 0.0 0.0 2 100 0 0 820
-element 208 0 0 P5G Gv5 DNA-Pseudo-Groove 167.0 0.0 0.0 2 100 0 0 820
-element 209 0 0 P5G Gr5 DNA-Pseudo-Groove-End 167.0 0.0 0.0 2 100 0 0 820
-
-element 220 0 0 P5V vDa1 virtual-DNA-planeA-num1 0.0 0.0 0.0 1 100 0 1
-element 221 0 0 P5V vDa2 virtual-DNA-planeA-num2 0.0 0.0 0.0 1 100 0 1
-element 222 0 0 P5V vDa3 virtual-DNA-planeA-num3 0.0 0.0 0.0 1 100 0 1
-element 223 0 0 P5V vDa4 virtual-DNA-planeA-num4 0.0 0.0 0.0 1 100 0 1
-element 224 0 0 P5V vDa5 virtual-DNA-planeA-num5 0.0 0.0 0.0 1 100 0 1
-element 225 0 0 P5V vDa6 virtual-DNA-planeA-num6 0.0 0.0 0.0 1 100 0 1
-element 226 0 0 P5V vDa7 virtual-DNA-planeA-num7 0.0 0.0 0.0 1 100 0 1
-element 227 0 0 P5V vDa8 virtual-DNA-planeA-num8 0.0 0.0 0.0 1 100 0 1
-
-element 230 0 0 P5V vDb1 virtual-DNA-planeB-num1 0.0 0.0 0.0 1 100 0 1
-element 231 0 0 P5V vDb2 virtual-DNA-planeB-num2 0.0 0.0 0.0 1 100 0 1
-element 232 0 0 P5V vDb3 virtual-DNA-planeB-num3 0.0 0.0 0.0 1 100 0 1
-element 233 0 0 P5V vDb4 virtual-DNA-planeB-num4 0.0 0.0 0.0 1 100 0 1
-element 234 0 0 P5V vDb5 virtual-DNA-planeB-num5 0.0 0.0 0.0 1 100 0 1
-element 235 0 0 P5V vDb6 virtual-DNA-planeB-num6 0.0 0.0 0.0 1 100 0 1
-element 236 0 0 P5V vDb7 virtual-DNA-planeB-num7 0.0 0.0 0.0 1 100 0 1
-element 237 0 0 P5V vDb8 virtual-DNA-planeB-num8 0.0 0.0 0.0 1 100 0 1
-
-element 240 0 0 P5V vDn virtual-DNA-non-bonded 0.0 0.0 0.0 0 100 0 1
-
-element 300 0 0 PAM3 Ax3 PAM3-Axis 167.0 0.0 0.0 4 100 0 0 700
-element 301 0 0 PAM3 Ss3 PAM3-Sugar 167.0 0.0 0.0 3 170 0 0 800
-element 302 0 0 PAM3 Pl3 PAM3-Phosphate-Link 167.0 3.6 10.0 2 170 -1 0 900
-element 303 0 0 PAM3 Sj3 PAM3-Sugar-Junction 167.0 0.0 10.0 3 170 0 0 810
-element 304 0 0 PAM3 Ae3 PAM3-Axis-End 167.0 0.0 0.0 1 100 0 0 701
-element 305 0 0 PAM3 Se3 PAM3-Sugar-End 167.0 3.6 10.0 1 170 -2 0 901
-element 306 0 0 PAM3 Sh3 PAM3-Sugar-Hydroxyl 167.0 0.0 0.0 1 170 0 0 902
-element 307 0 0 PAM3 Hp3 PAM3-Hairpin 167.0 0.0 0.0 2 100 0 0 820
-
-# format for vdw lines
-#
-# rvdW (double) van der Waals radius in pm or 1e-12 m
-# evdW (double) van der Waals energy in zJ or 1e-21 J
-# cutoffRadiusStart (double) start of smooth transition in pm
-# cutoffRadiusEnd (double) end of smooth transition in pm
-# name (string) symbol-v-symbol
-# The atomType (number of protons) of the first symbol must be <= the second.
-#
-# The vdw potential is multiplied by a smooth transition function
-# between cutoffRadiusStart and cutoffRadiusEnd. Beyond
-# cutoffRadiusEnd the vdw potential is identically zero. If
-# cutoffRadiusEnd < cutoffRadiusStart, this transition is disabled,
-# and the potential is shifted so that it is zero at cutoffRadiusEnd.
-# If cutoffRadiusStart < 0, it is set to rvdW. If cutoffRadiusEnd <
-# 0, it is set to rvdW * VanDerWaalsCutoffFactor (specified by
-# --vdw-cutoff-factor). Setting cutoffRadiusEnd to rvdW, and
-# cutoffRadiusStart to any larger value selects only the repulsive
-# interaction.
-#
-# rvdW evdW start end name
-
-vdw 200.0 10.0 100.0 7.2 vDn-v-vDn
-
-vdw 7.2 10.0 100.0 7.2 Pl3-v-Pl3
-vdw 7.2 10.0 100.0 7.2 Pl3-v-Se3
-vdw 7.2 10.0 100.0 7.2 Se3-v-Se3
-
-# format for stretch lines
-#
-# ks (double) in N/m
-# r0 (double) equilibrium distance, in pm, or 1e-12 m
-# de (double) in aJ, or 1e-18 J
-# beta (double) in 1e10 m^-1
-# set to sqrt(ks / (2.0 * de)) / 10.0 if value here is less than zero
-# inflectionR (double) r value in pm where d^2(Lippincott(r)) / dr^2 == 0
-# inflectionR is end of interpolation table during minimization
-# set to r0*1.5 if value here is less than zero
-# qual (int) quality of parameter (use of a parameter with quality < 5 produces a warning)
-# quad (int) flag, non-zero if this stretch should be quadratic instead of Lippincott/Morse
-# bondName (string) symbol-bondOrder-symbol
-# bondOrders are: (1, a, g, 2, 3) a is aromatic, g is graphitic
-# The atomType (number of protons) of the first symbol must be <= the second.
-#
-# ks r0 de beta inflectionR qual quad bondName
-
-stretch 4.00 318.00 1.0000 -1 -1 9 1 Ax5-1-Ax5
-stretch 50.00 676.00 1.0000 -1 -1 9 1 Ax5-1-Ss5
-stretch 50.00 676.00 1.0000 -1 -1 9 1 Ax5-1-Sj5
-stretch 4.00 364.00 1.0000 -1 -1 9 1 Ss5-1-Pl5
-stretch 4.00 400.00 1.0000 -1 -1 9 1 Pl5-1-Sj5
-stretch 4.00 180.00 1.0000 -1 -1 9 1 H-1-Ax5
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Ss5
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Pl5
-stretch 4.00 180.00 1.0000 -1 -1 9 1 Ax5-1-Ae5
-stretch 4.00 200.00 1.0000 -1 -1 9 1 Ss5-1-Sh5
-stretch 4.00 364.00 1.0000 -1 -1 9 1 Ss5-1-Pe5
-stretch 4.00 357.00 1.0000 -1 -1 9 1 Pl5-1-Hp5
-stretch 4.00 357.00 1.0000 -1 -1 9 1 Pe5-1-Hp5
-stretch 4.00 200.00 1.0000 -1 -1 9 1 Sh5-1-Hp5
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Hp5
-
-stretch 50.00 1239.60 1.0000 -1 -1 9 1 Ss5-1-Ss5
-stretch 50.00 1064.70 1.0000 -1 -1 9 1 Gv5-1-Ss5
-stretch 50.00 1064.70 1.0000 -1 -1 9 1 Gr5-1-Ss5
-stretch 0.00 300.00 1.0000 -1 -1 9 1 Gv5-1-Gv5
-stretch 0.00 300.00 1.0000 -1 -1 9 1 Gv5-1-Gr5
-
-
-stretch 4.00 318.00 1.0000 -1 -1 9 1 Ax3-1-Ax3
-stretch 4.00 318.00 1.0000 -1 -1 9 1 Ax3-1-Ae3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ax3-1-Ss3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ax3-1-Sj3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ax3-1-Se3
-stretch 4.00 318.00 1.0000 -1 -1 9 1 Ae3-1-Ax3
-stretch 4.00 318.00 1.0000 -1 -1 9 1 Ae3-1-Ae3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ae3-1-Ss3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ae3-1-Sj3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ae3-1-Se3
-stretch 4.00 400.00 1.0000 -1 -1 9 1 Pl3-1-Sj3
-stretch 4.00 180.00 1.0000 -1 -1 9 1 H-1-Ax3
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Ss3
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Pl3
-stretch 4.00 200.00 1.0000 -1 -1 9 1 Ss3-1-Sh3
-stretch 4.00 357.00 1.0000 -1 -1 9 1 Se3-1-Hp3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Se3-1-Ae3
-stretch 4.00 200.00 1.0000 -1 -1 9 1 Sh3-1-Hp3
-stretch 4.00 200.00 1.0000 -1 -1 9 1 H-1-Hp3
-stretch 4.00 625.00 1.0000 -1 -1 9 1 Ss3-1-Ss3
-stretch 4.00 625.00 1.0000 -1 -1 9 1 Ss3-1-Sj3
-stretch 4.00 625.00 1.0000 -1 -1 9 1 Se3-1-Ss3
-stretch 4.00 625.00 1.0000 -1 -1 9 1 Ss3-1-Se3
-stretch 50.00 870.00 1.0000 -1 -1 9 1 Ss3-1-Ae3
-stretch 4.00 625.00 1.0000 -1 -1 9 1 Se3-1-Sj3
-stretch 4.00 670.00 1.0000 -1 -1 9 1 Sj3-1-Sj3
-
-# format for bend lines
-#
-# ktheta (double) in aJ / rad^2 (1e-18 J/rad^2)
-# theta0 (double) in radians
-# qual (int) quality of parameter (use of a parameter with quality < 5 produces a warning)
-# name (string) symbol-bondOrder-symbol.hybridization-bondOrder-symbol
-# bondOrders are: (1, a, g, 2, 3) a is aromatic, g is graphitic
-# atoms in group 3 have a default hybridization of sp2
-# other atoms have a default hybridization of sp3
-# an info line in the mmp file can change the hybridization
-# possible values are: (sp, sp2, sp2_g, sp3, sp3d)
-# sp2_g is graphitic, sp3d is not supported yet
-#
-# ktheta theta0 qual bondName
-
-# 180 degree along Axis
-bend 0.18 180.000 9 Ax5-1-Ax5.sp3-1-Ax5
-#bend 0.18 180.000 9 H-1-Ax5.sp3-1-Ax5 #duplicate, H is sugar
-#bend 0.18 180.000 9 H-1-Ax5.sp3-1-Ae5 #duplicate, H is sugar
-bend 0.18 180.000 9 Ax5-1-Ax5.sp3-1-Ae5
-bend 0.18 180.000 9 Ae5-1-Ax5.sp3-1-Ae5
-
-# 90 degree Axis to Sugar
-bend 1.0 90.000 9 Ax5-1-Ax5.sp3-1-Ss5
-bend 1.0 90.000 9 Ax5-1-Ax5.sp3-1-Sj5
-#bend 1.0 90.000 9 H-1-Ax5.sp3-1-Ss5 #duplicate, H is sugar
-bend 1.0 90.000 9 Ss5-1-Ax5.sp3-1-Ae5
-bend 1.0 90.000 9 H-1-Ax5.sp3-1-Ax5
-bend 1.0 90.000 9 H-1-Ax5.sp3-1-Ae5
-bend 1.0 90.000 9 H-1-Ax5.sp3-1-H
-
-# 133 degree minor groove
-bend 1.0 133.000 9 Ss5-1-Ax5.sp3-1-Ss5
-bend 1.0 133.000 9 Ss5-1-Ax5.sp3-1-Sj5
-bend 1.0 133.000 9 Sj5-1-Ax5.sp3-1-Sj5
-bend 1.0 133.000 9 H-1-Ax5.sp3-1-Ss5
-bend 1.0 133.000 9 H-1-Ax5.sp3-1-Sj5
-
-# 121 degree Axis Sugar Phosphate
-bend 0.04 121.000 9 Ax5-1-Ss5.sp3-1-Pl5
-bend 0.04 121.000 9 Ax5-1-Ss5.sp3-1-Pe5
-bend 0.04 121.000 9 Ax5-1-Ss5.sp3-1-Sh5
-bend 0.04 121.000 9 H-1-Ss5.sp3-1-Ax5
-
-# 127 degree Phosphate Sugar Phosphate
-bend 0.04 127.000 9 Pl5-1-Ss5.sp3-1-Pl5
-bend 0.04 127.000 9 Pl5-1-Ss5.sp3-1-Pe5
-bend 0.04 127.000 9 Pl5-1-Ss5.sp3-1-Sh5
-bend 0.04 127.000 9 Pe5-1-Ss5.sp3-1-Pe5
-bend 0.04 127.000 9 Pe5-1-Ss5.sp3-1-Sh5
-bend 0.04 127.000 9 Sh5-1-Ss5.sp3-1-Sh5
-bend 0.04 127.000 9 H-1-Ss5.sp3-1-Pl5
-bend 0.04 127.000 9 H-1-Ss5.sp3-1-Pe5
-bend 0.04 127.000 9 H-1-Ss5.sp3-1-Sh5
-bend 0.04 127.000 9 H-1-Ss5.sp3-1-H
-
-# 127 degree Phosphate Hairpin Phosphate
-bend 0.04 127.000 9 Pl5-1-Hp5.sp3-1-Pl5
-bend 0.04 127.000 9 Pl5-1-Hp5.sp3-1-Pe5
-bend 0.04 127.000 9 Pl5-1-Hp5.sp3-1-Sh5
-bend 0.04 127.000 9 Pe5-1-Hp5.sp3-1-Pe5
-bend 0.04 127.000 9 Pe5-1-Hp5.sp3-1-Sh5
-bend 0.04 127.000 9 Sh5-1-Hp5.sp3-1-Sh5
-bend 0.04 127.000 9 H-1-Hp5.sp3-1-Pl5
-bend 0.04 127.000 9 H-1-Hp5.sp3-1-Pe5
-bend 0.04 127.000 9 H-1-Hp5.sp3-1-Sh5
-bend 0.04 127.000 9 H-1-Hp5.sp3-1-H
-
-# 115 degree Axis JunctionSugar Phosphate
-bend 0.04 115.000 9 Ax5-1-Sj5.sp3-1-Pl5
-bend 0.04 115.000 9 Ax5-1-Sj5.sp3-1-Pe5
-bend 0.04 115.000 9 Ax5-1-Sj5.sp3-1-Sh5
-bend 0.04 115.000 9 H-1-Sj5.sp3-1-Ax5
-
-# 110 degree Phosphate JunctionSugar Phosphate
-bend 0.04 110.000 9 Pl5-1-Sj5.sp3-1-Pl5
-bend 0.04 110.000 9 Pl5-1-Sj5.sp3-1-Pe5
-bend 0.04 110.000 9 H-1-Sj5.sp3-1-Pl5
-bend 0.04 110.000 9 H-1-Sj5.sp3-1-H
-bend 0.04 110.000 9 H-1-Sj5.sp3-1-Pe5
-bend 0.04 110.000 9 Pe5-1-Sj5.sp3-1-Pe5
-
-# 127 degree Phosphate JunctionSugar end
-bend 0.04 127.000 9 Pl5-1-Sj5.sp3-1-Sh5
-bend 0.04 127.000 9 Pe5-1-Sj5.sp3-1-Sh5
-bend 0.04 127.000 9 Sh5-1-Sj5.sp3-1-Sh5
-bend 0.04 127.000 9 H-1-Sj5.sp3-1-Sh5
-
-# 92.5 degree Sugar Phosphate Sugar
-bend 0.04 92.500 9 Ss5-1-Pl5.sp3-1-Ss5
-bend 0.04 92.500 9 Ss5-1-Pl5.sp3-1-Sh5
-bend 0.04 92.500 9 Ss5-1-Pl5.sp3-1-Hp5
-bend 0.04 92.500 9 Sh5-1-Pl5.sp3-1-Sh5
-bend 0.04 92.500 9 Sh5-1-Pl5.sp3-1-Hp5
-bend 0.04 92.500 9 Hp5-1-Pl5.sp3-1-Hp5
-bend 0.04 92.500 9 H-1-Pl5.sp3-1-Ss5
-bend 0.04 92.500 9 H-1-Pl5.sp3-1-Sh5
-bend 0.04 92.500 9 H-1-Pl5.sp3-1-Hp5
-bend 0.04 92.500 9 H-1-Pl5.sp3-1-H
-
-# 92.5 degree Sugar Phosphate JunctionSugar
-bend 0.04 92.500 9 Ss5-1-Pl5.sp3-1-Sj5
-bend 0.04 92.500 9 Sj5-1-Pl5.sp3-1-Sh5
-bend 0.04 92.500 9 Sj5-1-Pl5.sp3-1-Hp5
-bend 0.04 92.500 9 H-1-Pl5.sp3-1-Sj5
-
-# 115.8 degree JunctionSugar Phosphate JunctionSugar
-bend 0.04 115.800 9 Sj5-1-Pl5.sp3-1-Sj5
-
-# PAM3 Bend Parameters ####################################3
-
-# 180 degree along Axis
-bend 0.18 180.000 9 Ax3-1-Ax3.sp3-1-Ax3
-#bend 0.18 180.000 9 H-1-Ax3.sp3-1-Ax3 #duplicate, H is sugar
-#bend 0.18 180.000 9 H-1-Ax3.sp3-1-Ae3 #duplicate, H is sugar
-bend 0.18 180.000 9 Ax3-1-Ax3.sp3-1-Ae3
-bend 0.18 180.000 9 Ae3-1-Ax3.sp3-1-Ae3
-
-# 90 degree Axis to Sugar
-bend 1.0 90.000 9 Ax3-1-Ax3.sp3-1-Ss3
-bend 1.0 90.000 9 Ax3-1-Ax3.sp3-1-Sj3
-bend 1.0 90.000 9 Ax3-1-Ax3.sp3-1-Se3
-bend 1.0 90.000 9 Ax3-1-Ae3.sp3-1-Ss3
-bend 1.0 90.000 9 Ax3-1-Ae3.sp3-1-Sj3
-bend 1.0 90.000 9 Ax3-1-Ae3.sp3-1-Se3
-bend 1.0 90.000 9 Ss3-1-Ax3.sp3-1-Ae3
-bend 1.0 90.000 9 Sj3-1-Ax3.sp3-1-Ae3
-bend 1.0 90.000 9 Ss3-1-Ae3.sp3-1-Ae3
-bend 1.0 90.000 9 Sj3-1-Ae3.sp3-1-Ae3
-bend 1.0 90.000 9 Ae3-1-Ax3.sp3-1-Se3
-bend 1.0 90.000 9 Ae3-1-Ae3.sp3-1-Se3
-#bend 1.0 90.000 9 H-1-Ax3.sp3-1-Ss3 #duplicate, H is sugar
-#bend 1.0 90.000 9 H-1-Ax3.sp3-1-Sj3 #duplicate, H is sugar
-#bend 1.0 90.000 9 H-1-Ax3.sp3-1-Se3 #duplicate, H is sugar
-bend 1.0 90.000 9 H-1-Ax3.sp3-1-Ax3
-bend 1.0 90.000 9 H-1-Ax3.sp3-1-Ae3
-bend 1.0 90.000 9 H-1-Ax3.sp3-1-H
-#bend 1.0 90.000 9 H-1-Ae3.sp3-1-Ss3 #duplicate, H is sugar
-#bend 1.0 90.000 9 H-1-Ae3.sp3-1-Sj3 #duplicate, H is sugar
-#bend 1.0 90.000 9 H-1-Ae3.sp3-1-Se3 #duplicate, H is sugar
-bend 1.0 90.000 9 H-1-Ae3.sp3-1-Ax3
-bend 1.0 90.000 9 H-1-Ae3.sp3-1-Ae3
-bend 1.0 90.000 9 H-1-Ae3.sp3-1-H
-
-# 133 degree minor groove
-bend 1.0 133.000 9 Ss3-1-Ax3.sp3-1-Ss3
-bend 1.0 133.000 9 Ss3-1-Ax3.sp3-1-Sj3
-bend 1.0 133.000 9 Ss3-1-Ax3.sp3-1-Se3
-bend 1.0 133.000 9 Sj3-1-Ax3.sp3-1-Sj3
-bend 1.0 133.000 9 H-1-Ax3.sp3-1-Ss3
-bend 1.0 133.000 9 H-1-Ax3.sp3-1-Sj3
-bend 1.0 133.000 9 H-1-Ax3.sp3-1-Se3
-bend 1.0 133.000 9 Ss3-1-Ae3.sp3-1-Ss3
-bend 1.0 133.000 9 Ss3-1-Ae3.sp3-1-Sj3
-bend 1.0 133.000 9 Ss3-1-Ae3.sp3-1-Se3
-bend 1.0 133.000 9 Sj3-1-Ae3.sp3-1-Sj3
-bend 1.0 133.000 9 H-1-Ae3.sp3-1-Ss3
-bend 1.0 133.000 9 H-1-Ae3.sp3-1-Sj3
-bend 1.0 133.000 9 H-1-Ae3.sp3-1-Se3
-
-# 74.58 degree Axis Sugar Sugar
-bend 0.04 74.580 9 Ax3-1-Ss3.sp3-1-Ss3
-bend 0.04 74.580 9 Ax3-1-Ss3.sp3-1-Se3
-bend 0.04 74.580 9 Ax3-1-Ss3.sp3-1-Sh3
-bend 0.04 74.580 9 H-1-Ss3.sp3-1-Ax3
-
-# 74.58 degree Axis-end Sugar Sugar
-bend 0.04 74.580 9 Ss3-1-Se3.sp3-1-Ae3
-bend 0.04 74.580 9 Ss3-1-Ss3.sp3-1-Ae3
-bend 0.04 74.580 9 Ae3-1-Ss3.sp3-1-Sh3
-bend 0.04 74.580 9 Ae3-1-Ss3.sp3-1-Se3
-bend 0.04 74.580 9 H-1-Ss3.sp3-1-Ae3
-
-# 108 degree for Axis JunctionSugar JunctionSugar
-bend 0.04 108.000 9 Ax3-1-Sj3.sp3-1-Sj3
-bend 0.04 108.000 9 Ae3-1-Sj3.sp3-1-Sj3
-
-# 149 degree Sugar Sugar Sugar
-bend 0.04 149.000 9 Ss3-1-Ss3.sp3-1-Ss3
-bend 0.04 149.000 9 Ss3-1-Ss3.sp3-1-Sj3
-bend 0.04 149.000 9 Ss3-1-Ss3.sp3-1-Se3
-bend 0.04 149.000 9 Ss3-1-Ss3.sp3-1-Sh3
-bend 0.04 149.000 9 Se3-1-Ss3.sp3-1-Se3
-bend 0.04 149.000 9 Se3-1-Ss3.sp3-1-Sh3
-bend 0.04 149.000 9 Sh3-1-Ss3.sp3-1-Sh3
-bend 0.04 149.000 9 H-1-Ss3.sp3-1-Ss3
-bend 0.04 149.000 9 H-1-Ss3.sp3-1-Sj3
-bend 0.04 149.000 9 H-1-Ss3.sp3-1-Se3
-bend 0.04 149.000 9 H-1-Ss3.sp3-1-Sh3
-bend 0.04 149.000 9 H-1-Ss3.sp3-1-H
-
-# 149 degree for Sugar JunctionSugar JunctionSugar
-bend 0.04 149.000 9 Ss3-1-Sj3.sp3-1-Sj3
-
-# 74.58 degree Axis JunctionSugar Sugar
-bend 0.04 74.580 9 Ax3-1-Sj3.sp3-1-Ss3
-bend 0.04 74.580 9 Ax3-1-Sj3.sp3-1-Se3
-bend 0.04 74.580 9 Ax3-1-Sj3.sp3-1-Sh3
-bend 0.04 74.580 9 H-1-Sj3.sp3-1-Ax3
-
-# 74.58 degree Axis-end JunctionSugar Sugar
-bend 0.04 74.580 9 Ae3-1-Sj3.sp3-1-Ss3
-bend 0.04 74.580 9 Ae3-1-Sj3.sp3-1-Se3
-bend 0.04 74.580 9 Ae3-1-Sj3.sp3-1-Sh3
-bend 0.04 74.580 9 H-1-Sj3.sp3-1-Ae3
-
-# 150 degree Sugar JunctionSugar Sugar
-bend 0.04 150.000 9 Ss3-1-Sj3.sp3-1-Ss3
-bend 0.04 150.000 9 H-1-Sj3.sp3-1-H
-
-# 150 degree Sugar JunctionSugar end (CHECK/FIX ANGLE)
-bend 0.04 150.000 9 Ss3-1-Sj3.sp3-1-Se3
-bend 0.04 150.000 9 Ss3-1-Sj3.sp3-1-Sh3
-bend 0.04 150.000 9 H-1-Sj3.sp3-1-Se3
-bend 0.04 150.000 9 H-1-Sj3.sp3-1-Sh3
-
-# 115.8 degree JunctionSugar Phosphate-link JunctionSugar
-bend 0.04 115.800 9 Sj3-1-Pl3.sp3-1-Sj3
-
-# 127 degree Sugar Hairpin Sugar (CHECK/FIX ANGLE)
-bend 0.04 127.000 9 Se3-1-Hp3.sp3-1-Se3
-bend 0.04 127.000 9 Se3-1-Hp3.sp3-1-Sh3
-bend 0.04 127.000 9 Sh3-1-Hp3.sp3-1-Sh3
-bend 0.04 127.000 9 H-1-Hp3.sp3-1-Se3
-bend 0.04 127.000 9 H-1-Hp3.sp3-1-Sh3
-bend 0.04 127.000 9 H-1-Hp3.sp3-1-H
-
-# parameters for pattern match routines
-
-pattern PAM5:Ax-Ax-Ss_low_ktheta 1.0
-pattern PAM5:Ax-Ax-Ss_low_theta0 85.000
-
-pattern PAM5:Ax-Ax-Ss_high_ktheta 1.0
-pattern PAM5:Ax-Ax-Ss_high_theta0 95.000
-
-
-# For the PAM5-Stack pattern, two base pair planes are defined, each by
-# a pair of basis vectors from an Ax to an Ss pseudo-atom. Since the
-# double helix can be viewed from either end (180 degree rotational
-# symmetry), each Ss is similar to the one diagonally opposite it,
-# across the minor groove. Between the two stacked base pairs, the
-# minor groove rotates, so that one pair of similar Ss pseudo-atoms
-# will always be farther apart than the other. The farther apart pair
-# we will call P, with the closer pair called Q.
-
-# One base pair is called A, the other B. Each plane contains a set
-# of numbered virtual interaction sites, so vDa1 is the first site in
-# plane A. The location of each site is defined as a linear
-# combination of the two basis vectors for that plane, with the basis
-# vectors labeled P and Q, corrosponding to the Ss at the tip of that
-# vector (the Ax is the tail for both).
-
-pattern PAM5-Stack:vDa1-p 0.011
-pattern PAM5-Stack:vDa1-q 0.012
-
-pattern PAM5-Stack:vDb1-p 0.111
-pattern PAM5-Stack:vDb1-q 0.112
-
-pattern PAM5-Stack:vDa2-p 0.021
-pattern PAM5-Stack:vDa2-q 0.022
-
-pattern PAM5-Stack:vDb2-p 0.121
-pattern PAM5-Stack:vDb2-q 0.122
-
-pattern PAM5-Stack:vDa3-p 0.031
-pattern PAM5-Stack:vDa3-q 0.032
-
-pattern PAM5-Stack:vDb3-p 0.131
-pattern PAM5-Stack:vDb3-q 0.132
-
-pattern PAM5-Stack:vDa4-p 0.041
-pattern PAM5-Stack:vDa4-q 0.042
-
-pattern PAM5-Stack:vDb4-p 0.141
-pattern PAM5-Stack:vDb4-q 0.142
-
-pattern PAM5-Stack:vDa5-p 0.051
-pattern PAM5-Stack:vDa5-q 0.052
-
-pattern PAM5-Stack:vDb5-p 0.151
-pattern PAM5-Stack:vDb5-q 0.152
-
-pattern PAM5-Stack:vDa6-p 0.061
-pattern PAM5-Stack:vDa6-q 0.062
-
-pattern PAM5-Stack:vDb6-p 0.161
-pattern PAM5-Stack:vDb6-q 0.162
-
-pattern PAM5-Stack:vDa7-p 0.071
-pattern PAM5-Stack:vDa7-q 0.072
-
-pattern PAM5-Stack:vDb7-p 0.171
-pattern PAM5-Stack:vDb7-q 0.172
-
-pattern PAM5-Stack:vDa8-p 0.081
-pattern PAM5-Stack:vDa8-q 0.082
-
-pattern PAM5-Stack:vDb8-p 0.181
-pattern PAM5-Stack:vDb8-q 0.182
-
-pattern PAM5-Stack:vDn-pq 0.250
-
-# ks r0 de beta inflectionR qual quad bondName
-
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa1-1-vDb1
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa2-1-vDb2
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa3-1-vDb3
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa4-1-vDb4
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa5-1-vDb5
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa6-1-vDb6
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa7-1-vDb7
-stretch 1.00 300.00 1.0000 -1 -1 9 1 vDa8-1-vDb8
diff --git a/sim/src/sim.pyx b/sim/src/sim.pyx
index 0574fe7b4..d3f212019 100755
--- a/sim/src/sim.pyx
+++ b/sim/src/sim.pyx
@@ -60,13 +60,13 @@ cdef extern from "simhelp.c":
double Dmass
double Temperature
# end of globals.c stuff
- char *errString
setWriteTraceCallbackFunc(PyObject)
setFrameCallbackFunc(PyObject)
getFrame_c()
- initsimhelp()
+ pyrexInitBondTable()
void dumpPart()
+ void reinit_globals()
everythingElse()
everythingDone()
cdef char *structCompareHelp()
@@ -74,7 +74,6 @@ cdef extern from "simhelp.c":
void strcpy(char *, char *) #bruce 051230 guess
void reinitSimGlobals(PyObject)
- verifySimObject(PyObject)
specialExceptionIs(PyObject)
#void dynamicsMovie_start()
@@ -95,7 +94,7 @@ class SimulatorInterrupted(Exception):
specialExceptionIs(SimulatorInterrupted)
-cdef class BaseSimulator:
+cdef class _Simulator:
"""Pyrex permits access to doc strings"""
# cdef double *data
@@ -108,7 +107,6 @@ cdef class BaseSimulator:
# except for the issue of the globals not being reset to their initial values.
def __getattr__(self, char *key):
- verifySimObject(self)
if key.startswith('_'):
# important optimization (when Python asks for __xxx__) [bruce 060102]
raise AttributeError, key
@@ -163,7 +161,12 @@ cdef class BaseSimulator:
# probably it would, but this is better anyway
return ""
return BaseFileName
- elif strcmp(key, "OutFileName") == 0:
+ elif strcmp(key, "InputFileName") == 0:
+ if InputFileName == NULL:
+ # should we raise an AttributeError here?
+ return ""
+ return InputFileName
+ elif strcmp(key, "OutputFileName") == 0:
if OutputFileName == NULL:
# should we raise an AttributeError here?
return ""
@@ -200,7 +203,6 @@ cdef class BaseSimulator:
raise AttributeError, key
def __setattr__(self, char *key, value):
- verifySimObject(self)
if strcmp(key, "debug_flags") == 0:
global debug_flags
debug_flags = value
@@ -270,7 +272,10 @@ cdef class BaseSimulator:
elif strcmp(key, "baseFilename") == 0:
global BaseFileName
BaseFileName = value
- elif strcmp(key, "OutFileName") == 0:
+ elif strcmp(key, "InputFileName") == 0:
+ global InputFileName
+ InputFileName = value
+ elif strcmp(key, "OutputFileName") == 0:
global OutputFileName
OutputFileName = value
elif strcmp(key, "TraceFileName") == 0:
@@ -308,7 +313,6 @@ cdef class BaseSimulator:
# and reraise that exception or some other one from this method
#bruce 060103
- verifySimObject(self)
setFrameCallbackFunc(frame_callback)
setWriteTraceCallbackFunc(trace_callback)
srand(0)
@@ -320,96 +324,81 @@ cdef class BaseSimulator:
return
def structCompare(self):
- verifySimObject(self)
r = structCompare()
if r:
raise Exception, r
-class Minimize(BaseSimulator):
- def __init__(self, fname):
- global InputFileName
- reinitSimGlobals(self)
- self.ToMinimize = 1
- self.DumpAsText = 1
- self.PrintFrameNums = 0
- InputFileName = fname
- initsimhelp()
-
-class Dynamics(BaseSimulator): #bruce 060101 changed superclass from Minimize to BaseSimulator
- def __init__(self, fname):
- global InputFileName
- reinitSimGlobals(self)
- self.ToMinimize = 0
- self.DumpAsText = 0
- self.PrintFrameNums = 0
- InputFileName = fname
- initsimhelp()
-
-def setErrorString(str):
- errString = str
-
-def getEquilibriumDistanceForBond(element1, element2, order):
- # element1 and element2 are python ints
- # order is a python string
- cdef int int_el1, int_el2
- cdef char *c_order
- int_el1 = element1
- int_el2 = element2
- c_order = order
- # initializeBondTable should not require a tracefile, so can be called
- # at any time. It must have been called before either parsing an mmp
- # file, or calling getBondEquilibriumDistance(). It checks to see if
- # it's been called already, so it's cheap if that's the case. It
- # shouldn't affect the saved warning flags in any way. Warnings are
- # only printed when bond information is retrieved, and
- # getBondEquilibriumDistance() avoids the warning code.
- initializeBondTable()
- return getBondEquilibriumDistance(int_el1, int_el2, c_order[0])
-
-#####################################################
-# Per-frame callbacks to Python, wware 060101
-
-def getFrame():
- frm = getFrame_c()
- num_atoms = len(frm) / (3 * 8)
- array = Numeric.fromstring(frm, Numeric.Float64)
- return Numeric.resize(array, [num_atoms, 3])
-
-# # # # # # # # # # # # # # # # # #
+ def reinitGlobals(self):
+ reinit_globals()
+
+ def getEquilibriumDistanceForBond(self, element1, element2, order):
+ # element1 and element2 are python ints
+ # order is a python string
+ cdef int int_el1, int_el2
+ cdef char *c_order
+ int_el1 = element1
+ int_el2 = element2
+ c_order = order
+ # initializeBondTable should not require a tracefile, so can be called
+ # at any time. It must have been called before either parsing an mmp
+ # file, or calling getBondEquilibriumDistance(). It checks to see if
+ # it's been called already, so it's cheap if that's the case. It
+ # shouldn't affect the saved warning flags in any way. Warnings are
+ # only printed when bond information is retrieved, and
+ # getBondEquilibriumDistance() avoids the warning code.
+ pyrexInitBondTable()
+ return getBondEquilibriumDistance(int_el1, int_el2, c_order[0])
+
+ def getFrame(self):
+ frm = getFrame_c()
+ num_atoms = len(frm) / (3 * 8)
+ array = Numeric.fromstring(frm, Numeric.Float64)
+ return Numeric.resize(array, [num_atoms, 3])
+
+_theSimulator = None
+
+def theSimulator():
+ global _theSimulator
+ if (_theSimulator is None):
+ _theSimulator = _Simulator()
+ return _theSimulator
+
+#####################################################################################
+# Test code below this point
# conventional globals for callback -- they don't have to be used
-frameNumber = 0
-frameFreq = 1
+_frameNumber = 0
+_frameFreq = 1
-callbackCounter = 0
+_callbackCounter = 0
-def myCallback(last_frame):
- global frameNumber
- frameNumber = frameNumber + 1
- if (frameNumber % frameFreq) == 0:
- #print "frame %d:" % frameNumber, getFrame()
- global callbackCounter
- callbackCounter = callbackCounter + 1
+def _myCallback(last_frame):
+ global _frameNumber
+ _frameNumber = _frameNumber + 1
+ if (_frameNumber % _frameFreq) == 0:
+ #print "frame %d:" % _frameNumber, getFrame()
+ global _callbackCounter
+ _callbackCounter = _callbackCounter + 1
#bruce 060101 made testsetup a function so it only happens when asked for,
# not on every import and sim run (for example, runSim.py doesn't want it)
-def testsetup(freq=1):
+def _testsetup(freq=1):
"conventional setup for test functions; returns frame_callback argument for .go method"
- global frameNumber, frameFreq, callbackCounter
- callbackCounter = 0
- frameNumber = 0
- frameFreq = max(1, freq)
- return myCallback
-
-tracefile = [ ]
-
-def tracecallback(str):
- global tracefile
- tracefile.append(str)
-def badcallback(str):
+ global _frameNumber, _frameFreq, _callbackCounter
+ _callbackCounter = 0
+ _frameNumber = 0
+ _frameFreq = max(1, freq)
+ return _myCallback
+
+_tracefile = [ ]
+
+def _tracecallback(str):
+ global _tracefile
+ _tracefile.append(str)
+def _badcallback(str):
raise RuntimeError, "This is a bad callback"
-def badcallback2():
+def _badcallback2():
"This callback should really take an argument"
pass
@@ -429,45 +418,68 @@ def isFileAscii(filename):
class Tests(unittest.TestCase):
def setUp(self):
- global tracefile
- tracefile = [ ]
+ global _tracefile
+ _tracefile = [ ]
def test_getEquilibriumDistance(self):
# try C-C single bond; prints 154.88
assert (getEquilibriumDistanceForBond(6, 6, '1') - 154.88) ** 2 < 0.1
def test_framecallback(self):
- func = testsetup(2)
- m = Minimize("tests/minimize/test_h2.mmp")
+ func = _testsetup(2)
+ m = theSimulator()
+
+ m.reinitGlobals()
+ m.InputFileName = "tests/minimize/test_h2.mmp"
+ m.OutputFileName = "tests/minimize/test_h2.xyz"
+ m.ToMinimize = 1
+ m.DumpAsText = 1
+ m.OutputFormat = 0
+
m.go(frame_callback=func)
- assert callbackCounter == 3, "Callback counter is %d, not 3" %(callbackCounter)
+ assert _callbackCounter == 3, "Callback counter is %d, not 3" %(_callbackCounter)
def test_frameAndTraceCallback(self):
- func = testsetup(10)
- d = Dynamics("tests/rigid_organics/test_C6H10.mmp")
- d.go(frame_callback=func, trace_callback=tracecallback)
- assert callbackCounter == 10
+ func = _testsetup(10)
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/rigid_organics/test_C6H10.mmp"
+ d.OutputFileName = "tests/rigid_organics/test_C6H10.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
+
+ d.go(frame_callback=func, trace_callback=_tracecallback)
+ assert _callbackCounter == 10
def test_traceCallbackWithMotor(self):
- d = Dynamics("tests/dynamics/test_0001.mmp")
- d.go(trace_callback=tracecallback)
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/dynamics/test_0001.mmp"
+ d.OutputFileName = "tests/dynamics/test_0001.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
+
+ d.go(trace_callback=_tracecallback)
# Make sure there is motor information being printed
- assert len(tracefile[-5].split()) == 3, \
- "Motor info not appearing in trace file:" + tracefile[18]
+ assert len(_tracefile[-5].split()) == 3, \
+ "Motor info not appearing in trace file:" + _tracefile[18]
def test_dpbFileShouldBeBinary(self):
- d = Dynamics("tests/dynamics/test_0001.mmp")
- d.go()
- # Make sure that the DPB file is really binary
- assert not isFileAscii("tests/dynamics/test_0001.dpb")
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/dynamics/test_0001.mmp"
+ d.OutputFileName = "tests/dynamics/test_0001.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
- def test_dpbFileShouldBeBinaryAfterMinimize(self):
- # bruce 060103 added this; it presently fails, but I hope to fix it in same commit
- m = Minimize("tests/minimize/test_h2.mmp")
- m.go()
- d = Dynamics("tests/dynamics/test_0001.mmp")
d.go()
- # Make sure that the DPB file is really binary, even after Minimize is run
+ # Make sure that the DPB file is really binary
assert not isFileAscii("tests/dynamics/test_0001.dpb")
## def test_dynamicsStepStuff(self):
@@ -487,37 +499,52 @@ class Tests(unittest.TestCase):
def test_badCallback1(self):
try:
- d = Dynamics("tests/dynamics/test_0001.mmp")
- d.go(trace_callback=badcallback)
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/dynamics/test_0001.mmp"
+ d.OutputFileName = "tests/dynamics/test_0001.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
+
+ d.go(trace_callback=_badcallback)
assert False, "This test should have failed"
except RuntimeError, e:
assert e.args[0] == "This is a bad callback"
def test_badCallback2(self):
try:
- d = Dynamics("tests/dynamics/test_0001.mmp")
- d.go(trace_callback=badcallback2)
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/dynamics/test_0001.mmp"
+ d.OutputFileName = "tests/dynamics/test_0001.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
+
+ d.go(trace_callback=_badcallback2)
assert False, "This test should have failed"
except TypeError:
pass
def test_badCallback3(self):
try:
- d = Dynamics("tests/dynamics/test_0001.mmp")
+ d = theSimulator()
+
+ d.reinitGlobals()
+ d.InputFileName = "tests/dynamics/test_0001.mmp"
+ d.OutputFileName = "tests/dynamics/test_0001.dpb"
+ d.ToMinimize = 0
+ d.DumpAsText = 0
+ d.OutputFormat = 1
+
d.go(trace_callback=42)
assert False, "This test should have failed"
except RuntimeError, e:
assert e.args[0] == "callback is not callable"
- def test_callWrongSimulatorObject(self):
- try:
- m = Minimize("tests/dynamics/test_0001.mmp")
- d = Dynamics("tests/dynamics/test_0001.mmp")
- m.go(trace_callback=42)
- assert False, "This test should have failed"
- except AssertionError, e:
- assert e.args[0] == "not the most recent simulator object"
-
#
# make pyx && python -c "import sim; sim.test()"
#
diff --git a/sim/src/simhelp.c b/sim/src/simhelp.c
index b51963bf2..a1442b475 100755
--- a/sim/src/simhelp.c
+++ b/sim/src/simhelp.c
@@ -47,8 +47,6 @@ static struct xyz *pos;
static char buf[1024];
static int callback_exception = 0;
-static void *mostRecentSimObject = NULL;
-
// Python exception stuff, wware 010609
char *py_exc_str = NULL;
static char py_exc_strbuf[1024];
@@ -151,27 +149,6 @@ finish_python_call(PyObject *retval)
return retval;
}
-static void
-reinitSimGlobals(PyObject *sim)
-{
- reinit_globals();
- mostRecentSimObject = sim;
-}
-
-static PyObject *
-verifySimObject(PyObject *sim)
-{
- start_python_call();
- if (sim != mostRecentSimObject) {
- raiseExceptionIfNoneEarlier(PyExc_AssertionError,
- "not the most recent simulator object");
- WHERE_ARE_WE();
- return NULL;
- }
- WHERE_ARE_WE();
- return finish_python_call(Py_None);
-}
-
static PyObject *writeTraceCallbackFunc = NULL;
static PyObject *frameCallbackFunc = NULL;
@@ -328,12 +305,8 @@ getFrame_c(void)
return finish_python_call(retval);
}
-/*
- * A good goal would be to eliminate all the filename-twiddling in this
- * function, and only set up the bond tables.
- */
static PyObject *
-initsimhelp(void) // WARNING: this duplicates some code from simulator.c
+pyrexInitBondTable(void)
{
#ifdef WWDEBUG
debug_flags |= D_PYREX_SIM;
@@ -341,26 +314,8 @@ initsimhelp(void) // WARNING: this duplicates some code from simulator.c
start_python_call();
- if (DumpAsText) {
- OutputFormat = 0;
- } else {
- // bruce 060103 part of bugfix for Dynamics output format after Minimize
- // (to complete the fix it would be necessary for every change by sim.pyx of either
- // OutputFormat or DumpAsText to make sure the other one changed to fit,
- // either at the time of the change or before the next .go method
- // (or if changed during that method, before their next use by any C code);
- // this is not needed by the present client code, so I'll put it off for now
- // and hope we can more extensively clean up this option later.)
- OutputFormat = 1; // sim.pyx only tries to support "old" dpb format for now
- }
- InputFileName = copy_string(InputFileName);
- OutputFileName = replaceExtension(InputFileName, DumpAsText ? "xyz" : "dpb");
-
- // bruce 060101 moved the rest of this function into the start of everythingElse
- // since it depends on parameters set by the client code after this init method runs,
- // but then had to move initializeBondTable back here to fix a bug (since mmp reading
- // depends on it)
initializeBondTable();
+
return finish_python_call(Py_None);
}
@@ -380,8 +335,6 @@ everythingElse(void) // WARNING: this duplicates some code from simulator.c
// wware 060109 python exception handling
start_python_call();
- // bruce 060101 moved this section here, from the end of initsimhelp,
- // since it depends on parameters set by the client code after that init method runs
if (TraceFileName != NULL) {
TraceFile = fopen(TraceFileName, "w");
@@ -418,8 +371,6 @@ everythingElse(void) // WARNING: this duplicates some code from simulator.c
// ##e should print options set before run, but it's too early to do that in this code
if (IterPerFrame <= 0) IterPerFrame = 1;
- // initializeBondTable(); // this had to be done in initsimhelp instead [bruce 060101]
- // end of section moved by bruce 060101
constrainGlobals();
traceHeader(part);
diff --git a/sim/src/simulator.c b/sim/src/simulator.c
index dee529b89..0df5208c4 100755
--- a/sim/src/simulator.c
+++ b/sim/src/simulator.c
@@ -95,8 +95,7 @@ usage(void)
specify IDKey\n\
-K<int>, --key-record-interval=<int>\n\
number of delta frames between key frames\n\
- -r, --repress-frame-numbers\n\
- repress the printing of frame numbers\n\
+ -r report frame numbers\n\
-o<string>, --output-file=<string>\n\
output file name (otherwise same as input)\n\
-q<string>, --trace-file=<string>\n\
@@ -202,7 +201,6 @@ static const struct option option_vec[] = {
{ "output-format-2", no_argument, NULL, 'N' },
{ "id-key", required_argument, NULL, 'I' },
{ "key-record-interval", required_argument, NULL, 'K' },
- { "repress-frame-numbers", no_argument, NULL, 'r' },
{ "debug", required_argument, NULL, 'D' },
{ "output-file", required_argument, NULL, 'o' },
{ "trace-file", required_argument, NULL, 'q' },
@@ -363,7 +361,7 @@ main(int argc, char **argv)
KeyRecordInterval = atoi(optarg);
break;
case 'r':
- PrintFrameNums = 0;
+ PrintFrameNums = 1;
break;
case 'D':
n = atoi(optarg);
diff --git a/sim/src/tests.py b/sim/src/tests.py
index 4931d5643..d9fc0b456 100755
--- a/sim/src/tests.py
+++ b/sim/src/tests.py
@@ -927,11 +927,19 @@ class PyrexTest(TimedTest):
pass
def run(self):
- import sim
lac = LengthAngleComparison(self.base + ".mmp")
- s = sim.Minimize(self.base + ".mmp")
+ import sim
+ s = sim.theSimulator()
+ s.reinitGlobals()
+ inputfile = self.base + ".mmp"
+ outputfile = self.base + ".xyz"
+ s.InputFileName = inputfile
+ s.OutputFileName = outputfile
+ s.ToMinimize = 1
+ s.DumpAsText = 1
+ s.OutputFormat = 0
s.Temperature = 300
- s.go()
+ s.go(frame_callback=None, trace_callback=None)
lac.compare(self.base + ".xyz", self.base + ".xyzcmp",
LENGTH_TOLERANCE, ANGLE_TOLERANCE)
@@ -1120,7 +1128,6 @@ RANKED_BY_RUNTIME = [
'test_reordering_jigs_or_chunks_03_thermo_rmotor_anchor_stat_reordering_4',
'test_reordering_jigs_or_chunks_05_thermo_lmotor_anchor_measurement_jigs_reordering_3',
'test_reordering_jigs_or_chunks_04_thermo_lmotor_anchor_stat_reordering_2',
- 'test_callWrongSimulatorObject',
'test_motors_030_rotarymotor_and_linear_motor_attached_to_same_atoms',
'test_floppy_organics_C4H8',
'test_reordering_jigs_or_chunks_03_thermo_rmotor_anchor_stat_reordering_6',
@@ -1198,7 +1205,6 @@ RANKED_BY_RUNTIME = [
'test_jigs_to_several_atoms_006_anchors_to_100_atoms',
'test_motors_005_linearmotor_negative_force_and_positive_stiffness',
'test_heteroatom_organics_Al_ADAM_C3v',
- 'test_dpbFileShouldBeBinaryAfterMinimize',
'test_heteroatom_organics_ADAMframe_AlH_Cs',
'test_minimize_0012',
'test_jigs_to_several_atoms_004_linearmotor_to_100_atoms',
@@ -1330,15 +1336,6 @@ try:
finally:
try: TimedTest.finish(self)
except EarlyTermination: pass
- def test_dpbFileShouldBeBinaryAfterMinimize(self):
- self.methodname = "test_dpbFileShouldBeBinaryAfterMinimize"
- try: TimedTest.start(self)
- except EarlyTermination: return
- try:
- sim.Tests.test_dpbFileShouldBeBinaryAfterMinimize(self)
- finally:
- try: TimedTest.finish(self)
- except EarlyTermination: pass
def test_badCallback1(self):
self.methodname = "test_badCallback1"
try: TimedTest.start(self)
@@ -1366,15 +1363,6 @@ try:
finally:
try: TimedTest.finish(self)
except EarlyTermination: pass
- def test_callWrongSimulatorObject(self):
- self.methodname = "test_callWrongSimulatorObject"
- try: TimedTest.start(self)
- except EarlyTermination: return
- try:
- sim.Tests.test_callWrongSimulatorObject(self)
- finally:
- try: TimedTest.finish(self)
- except EarlyTermination: pass
baseClass = PyrexUnitTests
except ImportError:
@@ -1716,7 +1704,14 @@ class Tests(baseClass):
class Foo(PyrexTest):
def run(self):
import sim
- s = sim.Dynamics("tests/dynamics/test_0002.mmp")
+ s = sim.theSimulator()
+
+ s.reinitGlobals()
+ s.InputFileName = "tests/dynamics/test_0002.mmp"
+ s.OutputFileName = "tests/dynamics/test_0002.dpb"
+ s.ToMinimize = 0
+ s.DumpAsText = 0
+ s.OutputFormat = 1
s.NumFrames = 100
s.PrintFrameNums = 0
s.IterPerFrame = 10