AMMRL: OleNMR TopSpin and retrospective

From: Robert Hanson <hansonr_at_stolaf.edu>
Date: Mon, 22 Aug 2016 09:18:47 -0500

This flurry of messages to AMMRL from me was associated with my (finally
getting around to) upgrading our OleNMR system to TopSpin from XWIN-NMR. I
had fairly dreaded that for two years just because of the challenge of
getting my head around this again after 13 years of pain-free
near-zero-maintenance operation.

For the record....

It took six full working days to complete the conversion, helped by some
critical tips from Clemens Anklin, I was able to make my way once again
through the most abhorrent computer programming language I have ever had
occasion to work with (TCL) and get the job done. Really, I have nothing
but good things to say about Bruker and their TCL programmers. The code is
open and customizable. Only 9 IconNMR TCL files were involved, in almost
every case just involving one or added lines connecting with my own TCL
code.

The OleNMR system (http://chemapps.stolaf.edu/nmr) taps into the IconNMR
TCL code, replacing the queuing algorithm and listening in on inter-module
communications so that it can display machine status in JavaScript form. It
authenticates our users using St. Olaf IDs and ties them to IconNMR
"teams". It allows remote semi-permanent binding of autosampler slots to
specific user groups, experiment/parameter job set up and submission,
instrument monitoring, manipulation of spectra (though not phasing, which
thanks to Bruker's exceptional stability has actually never been needed)
using JSpecView, data retrieval in JDX and Bruker ZIP format, generation of
PDF files, and remote helium level checking (see
https://chemapps.stolaf.edu/nmr/helium).

I know much of this may sound passe these days, but I'm not so sure. OleNMR
is really well tuned to novice users working independently. Certainly in
2003 it was unheard of and not at all clear that it could work.

Here are a few of the issues I had and their solutions:

- remote job submission

This was taken care of in 2003 and uses the prog/tmp directory to submit
remote job files that look like this:

# Job 10006 submitted by OleNMR-S 8/22/2016 8:55:36 AM
#UID hansonr
#: Mon Aug 22 2016 08:55:13 GMT-0500 (Central Standard Time) by hansonr in
group chem-synthesis-a-Team1
USER chem-synthesis-a-Team1
HOLDER 47
#
NAME Aug22-2016
EXPNO 1000610
SOLVENT CDCl3
EXPERIMENT PROTON
#PARAMETERS NS=16;
#PRIORITY normal

Notice how by inserting comments, I can later check this file for user
identification, parameter setting and permissions/limits checks, and
queuing priority.

- controlling the autosampler queue and getting monitoring information:

No real problem. This just involved a replacement of the queue-processing
method in Bruker's Driver_Util.tcl and insertion of about 10 lines of TCL
code in a variety of key communications points in the IconNMR TCL codebase.
The queuing business was all taken care of 13 years ago and is actually
kind of slick. The TopSpin TCL code was close enough to XWIN-NMR code that
this was just a matter of finding all the points where I tapped into
Bruker's XWIN-NMR TCL code and doing the same in TopSpin. (This time I took
better notes!) There were two or three places where I had rewritten a bit
of the Bruker TCL code covering automation-fail logic. (For example, for
us, spin failure must trigger an automation abort, since in my experience
that's a maintenance-required situation that could snowball.)

- issuing TopSpin commands from within Visual Basic:

This was the hardest challenge, taking me over a day to figure out, and I'm
not 100% sure I'm there yet. Under XWIN-NMR I was creating simple MS-DOS
cmd files that could run autoplot directly, but they did not work under
TopSpin. Issuing *topspin -e **sendgui *was suggested, but that did not
work in my case because it starts up a completely independent instance of
TopSpin that fails if you have a single-user license. The solution I found
was to use prog/bin/sendgui.cmd, which asynchronously generates what looks
to me to be the equivalent of a Bruker TCL [CPR_exec] command. The only
problem is that what I really need is [CPR_exec_wait]. It's used for
running the TopSpin commands *re*, *autoplot*, *tojdx*, and *tozip*. My
trick for the "wait" is just a hack -- an old old trick of inserting

  ping 1.1.1.1 -n 1 -w 1000

in an MS-DOS batch file to wait a second. I have not tested this on a busy
instrument.While it's tuning, for example.

Q: Is there a "CPR_exec_wait" option for sendgui?

ps: the TopSpin 2.1 documentation fails to mention that the *tozip* command
requires three parameters, not two:



*tozip -d <zip file name>*not



* tozip <zip file name>*which is especially odd since the error message
reported is "number of arguments is not 4". Go figure! That slowed me down
longer than I care to admit. (Thank you to the writer -- probably on this
list -- of a web page I cannot find at this moment that happened to mention
that.)

- communicating with the outside world:

Fortunately, I took care of this 13 years ago. This is done using two VB6
programs -- one a specialized web server that I designed back in 2001
called DDESERVE, and one the OleNMR-S server, which does everything from
creating IconNMR accounts and permissions for users to generating
portfolios and layouts for autoplot. Anyway, there was nothing particular
needed there other than changing the way it generated the MS-DOS cmd files
involved in PDF, JDX, and ZIP creation.

These machines run behind our firewall, so there's a bit of PHP code also
on a third machine that allows users to access the instrument only after
third-party authentication from off campus.

- managing multiple instruments:

Probably half my time was spent expanding the OleNMR code to allow for
multiple instruments. Though we only have one, this was needed because we
wanted to be able to do a 2-minute switch back and forth between TopSpin
and XWIN-NMR in case I ran into problems or our TopSpin host fails at some
point. In addition, the two boxes are now both running, so one can log into
the OleNMR/XWIN-NMR page for processing of old data still.

We're hoping to do a hardware upgrade in about a year so we can move on to
TopSpin 3.x. You'll probably hear from me again when that happens, but I
don't expect that to be particularly difficult. (Right, Clemens???)

If anyone is interested in seeing the actual TCL code involved, let me
know. There might be something there someone could use. I don't know.

Bob Hanson

-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
Received on Mon Aug 22 2016 - 04:19:09 MST

This archive was generated by hypermail 2.4.0 : Mon Jun 19 2023 - 18:43:16 MST