Index: /trunk/packages/vizservers/pymolproxy/Makefile.in
===================================================================
--- /trunk/packages/vizservers/pymolproxy/Makefile.in	(revision 1969)
+++ /trunk/packages/vizservers/pymolproxy/Makefile.in	(revision 1970)
@@ -30,4 +30,5 @@
 OBJS		= pymolproxy.o
 LIBS		= $(TCL_LIB_SPEC)
+
 SCRIPTS		= $(srcdir)/scripts/box.py
 
@@ -50,5 +51,5 @@
 	$(MKDIR_P) -m 0755 $(libdir)/pymol/rappture
 	for i in $(SCRIPTS) ; do \
-	    $(INSTALL) -m 555 $$i $(libdir)/pymol/rappture; \
+	    $(INSTALL) -m 0555 $$i $(libdir)/pymol/rappture; \
 	done
 
Index: /trunk/packages/vizservers/pymolproxy/pymolproxy.c
===================================================================
--- /trunk/packages/vizservers/pymolproxy/pymolproxy.c	(revision 1969)
+++ /trunk/packages/vizservers/pymolproxy/pymolproxy.c	(revision 1970)
@@ -96,5 +96,5 @@
 
 static FILE *flog;
-static int debug = FALSE;
+static int debug = TRUE;
 static FILE *scriptFile;
 static int savescript = FALSE;
@@ -149,6 +149,6 @@
 					 * are in the front of the list. */
 
-    int serverInput, serverOutput, serverError;	 /* Server file descriptors. */
-    int clientInput, clientOutput;	/* Client file descriptors. */
+    int sin, sout, serr;		/* Server file descriptors. */
+    int cin, cout;			/* Client file descriptors. */
     ReadBuffer client;			/* Read buffer for client input. */
     ReadBuffer server;			/* Read buffer for server output. */
@@ -651,5 +651,5 @@
     /* Write the command out to the server. */
     length = strlen(buffer);
-    nWritten = write(proxyPtr->serverInput, buffer, length);
+    nWritten = write(proxyPtr->sin, buffer, length);
     if (nWritten != length) {
 	trace("short write to pymol (wrote=%d, should have been %d)",
@@ -1837,10 +1837,10 @@
         
 static int 
-ProxyInit(int c_in, int c_out, char *const *argv)
+ProxyInit(int cin, int cout, char *const *argv)
 {
     int status, result = 0;
-    int serverIn[2];
-    int serverOut[2];
-    int serverErr[2];
+    int sin[2];
+    int sout[2];
+    int serr[2];
     Tcl_Interp *interp;
     int child;
@@ -1851,18 +1851,18 @@
      * each for the applications's: stdin, stdout, and stderr  */
 
-    if (pipe(serverIn) == -1)
+    if (pipe(sin) == -1)
         return -1;
 
-    if (pipe(serverOut) == -1) {
-        close(serverIn[0]);
-        close(serverIn[1]);
+    if (pipe(sout) == -1) {
+        close(sin[0]);
+        close(sin[1]);
         return -1;
     }
 
-    if (pipe(serverErr) == -1) {
-        close(serverIn[0]);
-        close(serverIn[1]);
-        close(serverOut[0]);
-        close(serverOut[1]);
+    if (pipe(serr) == -1) {
+        close(sin[0]);
+        close(sin[1]);
+        close(sout[0]);
+        close(sout[1]);
         return -1;
     }
@@ -1889,7 +1889,7 @@
         /* Redirect stdin, stdout, and stderr to pipes before execing */ 
 
-        dup2(serverIn[0], 0);  // stdin
-        dup2(serverOut[1],1);  // stdout
-        dup2(serverErr[1],2);  // stderr
+        dup2(sin[0], 0);  // stdin
+        dup2(sout[1],1);  // stdout
+        dup2(serr[1],2);  // stderr
         
 	/* Close all other descriptors  */        
@@ -1905,16 +1905,16 @@
 
     /* close opposite end of pipe, these now belong to the child process  */
-    close(serverIn[0]);
-    close(serverOut[1]);
-    close(serverErr[1]);
+    close(sin[0]);
+    close(sout[1]);
+    close(serr[1]);
 
     signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE (e.g. nanoscale terminates)*/
 
     memset(&proxy, 0, sizeof(PymolProxy));
-    proxy.serverInput  = serverIn[1];
-    proxy.serverOutput = serverOut[0];
-    proxy.serverError = serverErr[0];
-    proxy.clientInput  = c_in;
-    proxy.clientOutput = c_out;
+    proxy.sin  = sin[1];
+    proxy.sout = sout[0];
+    proxy.serr = serr[0];
+    proxy.cin  = cin;
+    proxy.cout = cout;
     proxy.flags = CAN_UPDATE;
     proxy.frame = 1;
@@ -1958,9 +1958,9 @@
     PollForEvents(&proxy);
 
-    close(proxy.clientOutput);
-    close(proxy.serverOutput);
-    close(proxy.serverError);
-    close(proxy.clientInput);
-    close(proxy.serverInput);
+    close(proxy.cout);
+    close(proxy.sout);
+    close(proxy.serr);
+    close(proxy.cin);
+    close(proxy.sin);
 
     status = waitpid(child, &result, WNOHANG);
@@ -2025,18 +2025,18 @@
     int flags;
 
-    flags = fcntl(proxyPtr->clientInput, F_GETFL);
-    fcntl(proxyPtr->clientInput, F_SETFL, flags|O_NONBLOCK);
-
-    pollResults[0].fd = proxyPtr->clientOutput;
-    pollResults[1].fd = proxyPtr->serverOutput;
-    pollResults[2].fd = proxyPtr->serverError;
+    flags = fcntl(proxyPtr->cin, F_GETFL);
+    fcntl(proxyPtr->cin, F_SETFL, flags|O_NONBLOCK);
+
+    pollResults[0].fd = proxyPtr->cout;
+    pollResults[1].fd = proxyPtr->sout;
+    pollResults[2].fd = proxyPtr->serr;
     pollResults[0].events = pollResults[1].events = 
 	pollResults[2].events = POLLIN;
 
-    pollResults[3].fd = proxyPtr->clientInput;
+    pollResults[3].fd = proxyPtr->cin;
     pollResults[3].events = POLLOUT;
 
-    InitBuffer(&proxyPtr->client, proxyPtr->clientOutput);
-    InitBuffer(&proxyPtr->server, proxyPtr->serverOutput);
+    InitBuffer(&proxyPtr->client, proxyPtr->cout);
+    InitBuffer(&proxyPtr->server, proxyPtr->sout);
 
     Tcl_DStringInit(&clientCmds);
@@ -2180,2 +2180,3 @@
     return;
 }
+
Index: /trunk/packages/vizservers/pymolproxy/scripts/box.py
===================================================================
--- /trunk/packages/vizservers/pymolproxy/scripts/box.py	(revision 1970)
+++ /trunk/packages/vizservers/pymolproxy/scripts/box.py	(revision 1970)
@@ -0,0 +1,25 @@
+#
+# box.py -- create a Compiled Graphics Object for a unit cell box
+
+from pymol.cgo import *
+from pymol import cmd
+
+# Arguments: 
+#   lv: List of vertices; each vertex is a [x,y,z] list
+#   lw: Line width
+#    r: Red component of box color
+#    g: Green component of box color
+#    b: Blue component of box color
+# name: Name of box, which can be used with other PyMOL commands
+def draw_box(lv, lw=2.0, r=0.5, g=0.5, b=0.5, name='unitcell'):
+   box = [LINEWIDTH, lw, BEGIN, LINES, COLOR, r, g, b]
+   for v in lv:
+      box.append(VERTEX)
+      box.append(v[0])
+      box.append(v[1])
+      box.append(v[2])
+   box.append(END)
+   cmd.load_cgo(box, name)
+
+# Extend the PyMOL interpeter with the new "draw_box" command
+cmd.extend("draw_box", draw_box)
