* [http://article.gmane.org/gmane.science.nmr.relax.scm/17611 The M61 model]
* [http://article.gmane.org/gmane.science.nmr.relax.scm/17724 The M61 skew model]
=== The relax_disp.select_model user function front end ===
The next step is to add the model, its description, the equations for the analytic models, and all references to the relax_disp.select_model user function front end. When the relaxation dispersion chapter of the relax [[manual]] is created (this will be the docs/latex/relax_disp.tex file), then the same description should be added there as well. ==== Reference commitcommits ==== * [http: //article.gmane.org/gmane.science.nmr.relax.scm/17612 The M61 model]* [http://article.gmane.org/gmane.science.nmr.relax.scm/1761217725 The M61 skew model]
The next step is to add the model, its description, the equations for the analytic models, and all references to the relax_disp.select_model user function front end. When the relaxation dispersion chapter of the relax [[manual]] is created (this will be the docs/latex/relax_disp.tex file), then the same description should be added there as well.
=== The relax library ===
Reference commit: http://article.gmane.org/gmane.science.nmr.relax.scm/17615
Now the dispersion function needs to be added to the relax library (in the lib.relax_disp package). This should be designed as a simple Python function which takes the dispersion parameters and experimental variables, and calculates the R2eff/R1rho values. The module can contain auxiliary functions for the calculation. Some auxiliary functions, if not specific to relaxation dispersion, may be better placed in other locations within the relax library.
In the reference example, the M61 model code was copied from the LM63 module and modified appropriately.
==== Reference commits ====
* [http://article.gmane.org/gmane.science.nmr.relax.scm/17615 The M61 model]
=== The target function ===
Reference commits:The target function is used in optimisation and is a class method which takes as a single argument the parameter vector. This list is changed by the minimisation algorithm during optimisation. The target function should then return a single floating point number - the chi-squared value.
http://articleAgain in this example, the code for the M61 is copied from the LM63 model and then modified.gmane.org/gmane.science.nmr.relax.scm/17616http://article.gmane.org/gmane.science.nmr.relax.scm/17660http://article.gmane.org/gmane.science.nmr.relax.scm/17661
The target function is used in optimisation and is a class methodwhich takes as a single argument the parameter vector. This list ischanged by the minimisation algorithm during optimisation. The targetfunction should then return a single floating point number - thechi-squared value.==== Reference commits ====
Again in this example, the code for the * [http://article.gmane.org/gmane.science.nmr.relax.scm/17616]* [http://article.gmane.org/gmane.science.nmr.relax.scm/17660]* [http://article.gmane.org/gmane.science.nmr.relax.scm/17661]* [http://article.gmane.org/gmane.science.nmr.relax.scm/17730 The M61 is copied from the LM63skew model and then modified.]
=== Adding support for the parameters ===
Reference commit: This is needed to enable the model. http://article.gmane.org/gmane.science.nmr.relaxThis example is for the CR72 model implementation as the parameters required for the M61 model match those of the preexisting LM63 model.scm/17573
This is needed to enable the model==== Reference commits ==== * [http://article.gmane.org/gmane.science.nmr.relax. This example is for the scm/17573 The CR72model implementation as the parameters required for the M61 modelmatch those of the preexisting LM63 model.]
=== The relax_disp.select_model back end ===
Reference commit: http://articleNow the back end of the relax_disp.gmaneselect_model user function for the model can be added.org/gmane.science.nmr.relax This involved identifying the model and constructing the parameter list.scm/17622
Now the back end of the relax_disp==== Reference commits ==== * [http://article.gmane.org/gmane.science.nmr.select_model user function for themodel can be addedrelax. This involved identifying the scm/17622 The M61 model andconstructing the parameter list.]
=== The test suite ===
Reference commits:This step is normally performed as step number 1. This is the most important part that makes sure that the code not only works now, but will continue working for the entire lifetime of the relax project.
http:The idea is that synthetic data (here for example as Sparky peak lists) is created for the model and added to the test suite directory test_suite/shared_data/article.gmane.org/gmane.science.nmr.relax.scm/17647http://article.gmane.org/gmane.science.nmr.relax.scm/17648http://article.gmane.org/gmane.science.nmr.relax.scm/17649http://article.gmane.orgdispersion/gmane.science.nmr. This is then used in a system test to check that the code in relaxcan reproduce the data.scm/17662http://article.gmane.org/gmane.science.nmr. It is very important that the code added to the relax.scm/17663library is not used to create the synthetic data!
This step is normally performed as step number 1. This is the mostimportant part that makes sure that the code not only works now, butwill continue working for the entire lifetime of the relax project.==== Reference commits ====
The idea is that synthetic data (here for example as Sparky peak* [http://article.gmane.org/gmane.science.nmr.relax.scm/17647]lists) is created for the model and added to the test suite directory* [http://article.gmane.org/gmane.science.nmr.relax.scm/17648]test_suite* [http:/shared_data/dispersionarticle.gmane.org/gmane. This is then used in a systemscience.nmr.relax.scm/17649]test to check that the code in * [http://article.gmane.org/gmane.science.nmr.relax can reproduce the data. It isscm/17662]very important that the code added to the * [http://article.gmane.org/gmane.science.nmr.relax library is not used tocreate the synthetic data!.scm/17663]
=== Comparing to other software ===
It can happen that a bug present in the lib.dispersion package code isalso replicated in the synthetic data. This is not uncommon. Therefore it is very useful to use other software with the test datafrom step 7 to see if the original parameters can be found. A goodexample can be seen in the test_suite/shared_data/dispersion/Hansenwhich contains Dr. Flemming Hansen's CPMG data (see the README file)and the results from different programs including NESSY, relax,CPMGFit, and ShereKhan. The comparison is in the file'software_comparison'.
Once the relax code is able to find identical or better results thanthe dispersion softwares, then the values found in the test suiteoptimisation can be locked in. The assertEqual() andassertAlmostEqual() methods can be used to only allow the test to passwhen the correct values are found.
=== Debugging ===
This step should not require an explanation. It goes hand-in-handwith steps 7) and 8).
For the model to be accessible via the GUI, it must be added to the Disp_model_list_cpmg or Disp_model_list_r1rho model list classes (at the bottom of the module). The model variable should be added to the models list, and the list of parameters added to the params list.
== See also ==
[[Category:Tutorials]]
[[Category:Relaxation_dispersion]]