Spin Dynamics Forum
Spinach support => Simulations => Topic started by: faq_user on May 16, 2012, 01:51:01 PM
I am using it a lot and have integrated it with my own Matlab code to simulate spectra for metabolomics.
In general the simulations are very fast, which is one of the primary reasons I like to use your code over my own, much slower, density matrix-based code.
However, occasionally I encounter a spin-system that takes much longer to simulate. The reason clearly has to do with how strongly coupled the spin-system under investigation is. I have attached two examples. Both use 7 spins, but differ in the amount of strong coupling. The weak system simulates in 4 seconds, whereas the strong system takes 40 seconds! Am I doing something stupid or is this difference inherent to the spinach algorithm?
I know that in my own density-matrix-based code only the number of spins determines the calculation time, not the scalar couplings. But of course in that program the calculation becomes impossibly slow for more than 7-8 spins.
Please let me know if there is anything I can do to speed up the calculation.
You are right – Spinach adapts to the dynamics that it finds in the system. The IK-2 basis is built in such a way as to ensure that the simulation is accurate with minimum computational cost, and if there are more couplings, there is more complicated dynamics to account for and so the matrices get bigger.
You can see it from the matrix dimension – the weakly coupled one gets down to 390x390 matrices, whereas the strongly coupled one needs 792x792 matrices.
Do you have any equivalent spins in that system? It might speed things up by a lot if you declare the equivalent spins to Spinach.
Thanks for the explanation.
Unfortunately, some of the spin systems that I work with are like the one in the example, so there is nothing I can really do to speed that up.
If there are equivalent spins I do include that, which definitely helps.
On a related note, are there any ‘modules’ available (or are you planning those for the future) that allow the simulation of adiabatic pulses (B1 and phase modulation) and the simulation of RF pulses during magnetic field gradients? My field is in vivo NMR and those combinations are used all the time. I know I can approximate the adiabatic pulse with a series of hard pulses, but that gets cumbersome quickly.
Shaped pulses are available (see the NMR examples directory). I can code up specific pulses for you if you send me a link to the description.
Gradients can only be done numerically at the moment (i.e. by just repeating the simulation for each slice). Is that good enough?
Thanks, the repeated simulation for the gradients is how I do it now.
I did not see the shaped pulse example earlier.
That is wonderful, with this example I can set up my own pulses.
Thank you for all your help.