Sunday, October 28, 2007

Kirk Marat on Spinworks

I came across this blog while browsing the web. I am the author of the reviewed software and just want to make a few comments, describe the reasons why some things were done the way they were done the way they were, and describe where the software is headed.

First of all, let me say that I very much appreciate the comments. I find that when people tell me what they don't like about the software that this is the most important feedback for making improvements.

Regarding polynomial baseline correction: All poylnomials curve to one end or the other. Most NMR spectra require only very low order correction or, at least for proton spectra, have more curvature at the right end. I have only encountered a very few cases where I have had to reverse the spectrum, correct the baseline, and then restore the original orientation. So few cases, in fact that I haven't been motivated to have a polynomial option that has increasing curvature at the left. SpinWorks 3 will have a cubic spline baseline correction as well as a polynomial. For spectra withe severe baseline curvature I tend to use backwards linear prediction. For baseline offset, adjust first point multiplier.

>> "No other NMR program asks such a thing." Actually, the interactive polynomial baseline correction in UXNMR/XwinNMR requires exactly the same operation. Not sure about TopSpin.

The parameters for simulation were split into three dialogs for one main reason: The number and labelling of the couplings depends on the definition of the spin system (including symmetry and multiplicity) in the chemical shift dialog. If shifts and couplings were in the same dialog, the labelling and number of the coupling constant boxes would have to be updated with each edit of a shift. The current coupling dialogs look at the spin system definition and dynamically generate the proper number and labelling of the boxes. I guess the J and D coupling boxes could be combined, however.

I actually asked users whether they wanted automatic update of a simulated spectrum after editing the spin system parameters. The almost unanamous verdict was no! Most found the calculation delays at the closing of the dialogs annoying, especially for bigger spin systems. This was in the days of slower computers, however. I will consider adding an option for autoupdate of simulated spectra.

I was surprised at the finding of crashes during 2D processing. 2.5.5 is generally pretty stable at general 2D processing. Can the reviewer send me a description of the problem and some sample data?

Yes, the automaic phase corection sucks! Automatic phase correction is actually quite difficult and I just haven't had time to get a come up with a really good algorithm yet. The problem is generally with sparse digitization and baseline offsets and curvature. I have also noticed that neither the Bruker nor the Varian autophase routines work perfectly either although, from what I have observed, Bruker's seems to work a bit better than Varian's.

The "initialization error" seen with SpinWorks 3 simply means that release 2 of the .NET framework is not installed. This is an easy download and install from MS, and is also included on the SpinWorks ftp site. The install program for the latest SpinWorks 3 beta actually tests for .NET 2 at install time, and stops the installation until it is loaded. I have switched from Installshield to the Windows Installer for the installation. .NET is the future of MS software and should, in theory, produre a platform independent program. Any OS that supports .NET should run the software. There has been some initial, if not complete, success running SpinWorks 3 under mono on Linux. Unfortunately, the .NET level in mono is not quite up to the MS version yet.

In the initial MFC version, the tools provided for a "Single Document Interface" or a "Multiple Document Interface". Although it would be possible to use the MDI for NMR spectra (MestRC does) it is complicated because NMR spectra, especially 2D spectra are MUCH more complicated objects than the "documents" envisioned by the MFC designers at Microsoft. Microsoft has abondoned the "document/view" SDI/MDI ideas used in MFC. They are no longer supported in .NET I will be adding "multiple workspaces" to SpinWorks 3.

"If you need to simulate a spin system, consider also gNMR (abandon-ware)." I happen to know the author of gNMR, and he and his students are now using SpinWorks for much of their routine NMR processing.

Cheers
-Kirk

Tuesday, October 16, 2007

10-Q

Many times I have written about the price of NMR software, but rarely reporting the figures. At the cost of becoming boring (and of making the happiness of Ryan), I want to add another post in the vein. Yesterday I stumbled upon an old document of no value: a Quarterly report of Accelrys to the SEC of 1998. It's old to the point of becoming misleading. There you can find the prices in yen for the Japanese market in 1996 and the equivalent in dollars. I am reporting the latter only. They are unbelievable:
  • Felix-ND: $ 30,000
  • Felix-Assign (additional module): $ 30,000
  • Felix-Model (another module): $ 15,000
  • NMR Compass: $ 25,000
  • NMR-Pipe: $ 30,000
  • NMR Refine Complete (requires Insight and Discover): $ 60,000
  • NMR Structure Determination (requires QUANTA): $ 23,000
All the notes within parenthesis mean that you need to spend another amount of money before you can use that product. Don't forget that the value of the dollar has decreased a lot since then! I want to know who bought at those prices and, most of all, I want to hear from them if they would do it again today.
They can't, anyway. There are no NMR products in the present listing of Accelrys. A curio: Joachim Sauer (Angela Merkel's husband) worked at the company. It looks like a spy-story, involving the STASI and the CIA. Read it here in English. The same news can be found in other languages on the web.

Monday, October 08, 2007

GAMMA


Good News. Gamma is still alive. There is no formal support, no official web site. There is a team of long-time users still working on the code, to keep GAMMA compatible with the recent versions of the gcc compiler and to finish the Python bindings. Let's hope for the better. Being Open Source is not a warranty of immortality, but it helps. I am not adding the details here, just because it's unofficial. Mainly I wanted to correct my recent article on this topic.

Saturday, October 06, 2007

It's Your Turn


Fabiano deserves to be more popular, at least in his country. Which one? Both...
(clicking the title you'll hear a song that has nothing to share with the photo)

Friday, October 05, 2007

Bonne lecture!


If you speak French, GNU/Linux is your OS, work in the field of natural product chemistry and use GIFA, I'd bet you already know this scientist. He has written Logic for Structure Determination", a free program to "find all possible molecular structures of an organic compound that are compatible with its spectroscopic data" that runs on all platforms.
Jean-Marc Nuzillard recently invented an automatic method to extract J values from 1D spectra. See: É. Prost et al., C. R. Chimie 9 (2006). The program implementing this method is called AUJ and is also freely available.
Jean-Marc also pioneered the P2P-QM field with the text-book Introduction à la Résonance Magnétique Nucléaire des Liquides that leads you from ignorance to the understanding of today's NMR in 200 pages. If 6 pages are the maximum you can digest, you find simplified introductions of that length too.
All of this and much more following this link.

Thursday, October 04, 2007

P2P-QM

The introduction of my last post was too difficult for some readers. They went lost crossing the Hilbert space. I know: the subject is intimidating, the vocabulary is scaring. Don't be discouraged! If you are really determined to conquer the Hilbert space, there's a musician that can help you. I don't mean the famous pianist from Zuerich (the space we are talking about is not over the Alps). Nor I mean the unknown drummer from Santiago (though he has certainly seen thousands of pilgrims since his childhood). Our man is the guitarist from Saskatoon. He has developed an unorthodox approach to Quantum Mechanics, that we can tag as the peer-to-peer way or, according to his own words: "If I Can Understand This So Can You". He still makes extensive use of math formulae, because his purpose is to acquaint you with them, but the title of the web site is explicit: Practical NMR Spectroscopy for the Rest of Us".
It appears, from the index, that four lessons have not been written yet. I can understand why: it takes an incredible amount of time to finish a web page with all those symbols and drawings. What is available is already impressive. If you like it, send your feedback to Keith Brown, or just write "thank you".
There's more! He has also written a piece of software: the Product Operator Calculator, which is an alternative way to simulate NMR experiment. Nice effort, but I advise you to consider POMA too. The latter requires Mathematica. You'll read that you can use the Mathematica player instead, which you can download for free from Wolfram. It's a bulk download and DOES NOT WORK! I have mentioned these calculators just because software is the theme of my blog. Personally I use the solitaire. It's much easier to download too.

Wednesday, October 03, 2007

Gratis

There are two ways to simulate an NMR spectrum. I call them the direct method and the indirect method. With the latter, you build the Hamiltonian of the system, in the absence of pulses and relaxation. After diagonalization you have the eigenvalues and the eigenvectors. From them you can easily calculate the frequencies and the probabilities, respectively, of all transitions. (For the probabilities you also need the operator F-, which is easy to build). Now you can create a 1D ideal spectrum, approximating the effect of relaxation with a more or less arbitrary line width. This method is quite popular in liquid NMR. Systems with up to 10 spins are commonly handled. Each additional nucleus slows down the calculation by, roughly, an order of magnitude. Approximate methods have been developed to decompose larger systems.
To simulate multi-pulse experiments you need what I call the direct method. The role of the eigenfunctions is now taken by the density operator, the role of the Hamiltonian is taken by a propagator (which is an exponential form of the Hamiltonian) and F- is still used, in the end, to compute the FID. The difference is that each pulse, each delay, each decoupling, etc... requires a different propagator. The density operator contains the information about the system at each moment. Up to this point, the calculations are performed into the Hilbert space. It's a space where each dimension corresponds to an energetic level. If you want to put relaxation and chemical exchange into the picture the Hilbert space is not enough. You need the Liouville space, where each dimension corresponds to a transition (line). Consider, for example, a system of 3 protons. It has 8 different levels (2x2x2=8). The Hamiltonian is a 8x8 matrix (whose largest block is only 3x3, however). The number of transitions is 15 (1x3+3x3+3x1=15). The density operator is a vector of 15 elements in the Liouville space. A superoperator acting on it is a 15x15 matrix.
I have tried to simplify things as much as possible. The bottom line is that the simulation of complex experiments is computationally demanding. It is popular in the NMR of solids and almost ignored in liquid NMR. This becomes a practical problem if you simply want to simulate a COSY. I am giving some URLs for this case at the bottom. There are many more alternatives for the simulation of solid-state NMR. In theory you can use the same programs to simulate any kind of NMR experiment. In practice I don't know anybody who is using them to simulate the spectra of solutions. There are a lot of programs to choose among. As it always happens when there is academic competition, everything is free, well documented and well supported. When only one program survives, you can bet it goes commercial. The list of good news goes on. The main programs are amply described in the scientific literature and, in some cases, you can read the articles on the web without paying. There is so much information that I am useless. You can continue your exploration from the article on SPINEVOLUTION. Being it the latest arrival, its introduction covers the state of the art.

SPINEVOLUTION (Veshtort & Griffin)
Available for Windows, Linux, Mac OS X (PPC or Intel). Receives all the input from a text file and exports the output into another text file. There is no graphic interface. The current version (3.2) "expires on September 1, 2008 (by that date, another version with a later or no expiration date will be available)".
download page
article (also manual)

SIMPSON (Bak, Rasmussen & Nielsen)
Available for Windows and Linux (it's unclear which versions of Mac OS X are supported). Open source, GNU public license. Written in C, receives input through a Tcl input file. "In order to form a self-standing simulation environment, the SIMPSON simulation package contains a collection of productivity tools SIMPLOT, SIMFID, and SIMDPS".
web site
article (also manual)
forum

DMFIT (Dominique Massiot)
A Windows program that "enables fitting of solid state (and liquid) NMR spectra, including 1D and 2D datasets"."This program is an evolution of the Winfit program developed with Bruker".
web site
article

BLOCHLIB (Bo Blanton)
Open Source (GNU). The web site says nothing, but once you download and open the tar, you find everything: the documentation, the examples, the source code and the instructions to compile it (requires gcc, already present into Linux and Mac OS X; use cygwin to compile on Windows).
"BlochLib is an expression template library of generic data structures and algorithms to perform large scale nuclear magnetic resonance classical and quantum mechanical spin simulations, with many I/O capabilities, and integrated numerical routines".
sourceforge
abstract
web site of the author

QSIM (Helgstrand & Allard)
Windows program, but part of it (called HME) is distributed as source code and can be recompiled. "QSim has a graphically user interface for design of pulse sequences, simulation and processing. QSim is easy to use but still flexible enough for more advanced users...QSim is typically used for pulse sequence design and testing. QSim is also an ideal tool when teaching NMR."
web site
abstract
1st poster
2nd poster

GAMMA (Smith & Levante)
This was the best package, but unfortunately it has been superseded by the new alternatives and has (almost) disappeared. My preference went to it because (1) is general in scope, with no particular stress on solids; (2) is accompanied by very easy tutorials. It's not a program, but a library of C++ objects to build your programs with. It has been criticized because requires programming skills. This is a silly observation. If you already know NMR and have no experience in programming you can learn GAMMA in one day. Can you read (let alone learn) the manual of a popular program (e.g.: PhotoShop; e.g.: OpenOffice) in the same amount of time? I doubt it!
mirror at ETH
abstract

WSOLIDS1 (Klaus Eichele)
Simulates a limited number of solid experiments. Requires Windows (that's what the initial W means). Provides graphical output and can save the results in Win-NMR format.
web site

NMR Spectrometer Simulator (Pascal Pirotte)
This one simulates the spectrometer, a specific model, not the spectra. Written in LabView and in French, it's the equivalent of a Flight Simulator.
download page

[Didactical Software] (Harold Bell)
A collection of easy-to-use programs that simulate NMR of liquids. Each program is devoted to a single experiment (single pulse, APT, DEPT, J-spectroscopy, etc... Require Windows, but you can taste them with your web browser. Written in Visual Basic.
web site

Virtual NMR Spectrometer (David Fushman)
"A computer program for efficient simulation of modern NMR experiments", is devoted to NMR of solutions. Requires Matlab 5 or higher. It's only available for beta-testing. "The Virtual NMR Spectrometer is designed as a useful tool for developing new NMR experiments and for tuning and adjusting the experimental setup for existing ones prior to running costly NMR experiments, in order to reduce the setup time on a real spectrometer. It will also be a useful aid for learning the general principles of magnetic resonance and contemporary innovations in NMR pulse sequence design."
web site
abstract

ODIN (Jochimsen & von Mengershausen)
"The software focuses mainly on NMR imaging, but can also be used with limitations for spectroscopic experiments." Open-source, platform-independent. "All common steps, from compiling your sequence to plotting or simulating it, can be performed within a graphical user interface".
web site
article

Tuesday, October 02, 2007

Passionate


The blog where the picture comes from is called "Creating Passionate Users" and is packed with funny diagrams. I don't agree, but I dig them! Features are good. What matters is: the features that you need often must be exposed; the features you need less often must be hidden and invisible (like an application before you open it). Ideally, the program itself should expose the hidden features when they become useful.

Boundaries

Four months ago an hardware-related article appeared on Stan's blog. It's problematic to create a permanent link, because of the peculiar way which Stan organizes his blog in. If I get it right, this will become the working link in 2008. Why am I citing an article on hardware instead of reviewing a piece of software? Because there will be no boundaries tomorrow. You need to read the whole article, but here is an appetizer:
The development of digital electronics is nowadays almost identical to software development: circuits are designed by geek's sitting at PC workstations, pre-tested using simulator programs, uploaded into re-programmable hardware, and debugged using virtual instruments (scopes and logic analyzers) embedded into the same chip. During the whole process, the engineer never gets up from his/her chair, much less uses a solder iron. Laboratories crammed with carpentry, wires, flat cables, connectors, adaptors, power supplies, soldering stations, and old-fashioned scopes are to a large extent a matter of the past.
The described situation already applies to other fields, but not to NMR. The reason why NMR is so slow to evolve is very simple: we don't buy a new spectrometer every week. If we are rich enough, we change it after 10 years. If we are not so lucky, we can keep it forever! The market is restricted to very few makers, and there's even the risk it becomes a monopoly. The picture described by Stan (and there is no doubt it will materialize in the next decade) is quite different: many labs will be able to assemble a spectrometer by themselves. The assertion that a whole spectrometer can be substituted by a piece of software is an exaggeration. The magnet, the probe, the (pre-)amplifiers cannot be removed (at least in high-resolution NMR), and they account for more than the half of the final price of a spectrometer. They can however be recovered from old instruments. Disregarding this case, if we are free to order the single components from different vendors, instead of being tied to a single manufacturer, their price is going to drop.
The cost-reduction, though important, is not the most exciting thing about SoCs (Systems on Chip). You really have to read that article...