Changes

Jump to navigation Jump to search

Tutorial for adding relaxation dispersion models to relax

9 bytes removed, 13:35, 10 October 2013
Rearranged the sections of the tutorial.
= Introduction =
See the [https://mail.gna.org/public/relax-devel/2013-06/msg00016.html mail archive] for the original post.
The tutorial will follow the example of the addition of the models already present within relax, pointing to the relevant commits for reference. To see the commit message and the code changes in colour, click on the links found within these commit messages. The models in the reference commits sections are in reverse chronological order and therefore the top links will be the most recent and relevant.
 
== The test suite ==
* The [[TP02]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18256 r20500] [http://article.gmane.org/gmane.science.nmr.relax.scm/18293 r20538] [http://article.gmane.org/gmane.science.nmr.relax.scm/18295 r20541] [http://article.gmane.org/gmane.science.nmr.relax.scm/18297 r20537]
* The [[M61]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17647 r19891] [http://article.gmane.org/gmane.science.nmr.relax.scm/17648 r19892] [http://article.gmane.org/gmane.science.nmr.relax.scm/17649 r19893] [http://article.gmane.org/gmane.science.nmr.relax.scm/17662 r19906] [http://article.gmane.org/gmane.science.nmr.relax.scm/17663 r19907]
 
== Adding the model to the list ==
* The [[M61]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17611 r19855]
* The [[No Rex]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17592 r19836]
 
== The relax_disp.select_model user function front end ==
* The [[CR72]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17568 r19812]
== The relax library ==
== The relax_disp.select_model back end == Now the dispersion back end of the relax_disp.select_model user function needs to for the model can be added to the relax library (in the lib.relax_disp package). This should be designed as a simple Python function which takes involved identifying the dispersion parameters and experimental variables, model 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 constructing the relax libraryparameter list=== Reference commits ===
* The relaxation dispersion functions in the library currently take as an argument a data structure for the back[[NS R1rho 2-calculated R2effsite]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18482 r20726]* The [[TP02]] model at [http://article.gmane.org/R1rho values and populate this structuregmane.science.nmr.relax.scm/18249 r20493]* The [[DPL94]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17758 r20002]* The [[M61 skew]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17732 r19976]* The [[M61]] model at [http://article.gmane.org/gmane.science.nmr. This design is not essential if the target function, described in the next point, handles the library function appropriatelyrelax. Just look scm/17622 r19866]* The [[No Rex]] model at the files in lib[http://article.gmane.org/dispersion to get an idea of the design usedgmane.science.nmr.relax.scm/17592 r19836]
The dispersion code in the relax library must be robust. This involves identifying parameter values or combinations which would cause failures in the mathematical operations (numerical issues not present in the mathematics must be considered). Note that parameter values of 0 are common within a grid search. It should be decided if the R2eff/R1rho value should be set to zero, to another value, or to something large (e.g. 1e100). For example:
Divisions - always catch zeros in the denominator with if statements, even if you believe that this will never be encountered. Square roots - make sure that the value inside is always > 0. Trigonometric functions - these should be tested == Adding support for where they are not defined or where the software implementation can no longer handle certain values. For example try cosh(1000) in Python.parameters ==
In This is needed to enable the reference model. This example, is for the CR72 model implementation as the parameters required for the M61 model code was copied from match those of the preexisting LM63 module and modified appropriatelymodel.
=== Reference commits ===
* The [[NS R1rho 2-site]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18479 r20723]* The [[TP02]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18241 r20486] [http://article.gmane.org/gmane.science.nmr.relax.scm/18246 r20490] [http://article.gmane.org/gmane.science.nmr.relax.scm/18280 r20524]* The [[DPL94]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17756 r20000]* The [[M61 skew]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17729 r19973]* The [[M61CR72]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17615 r1985917573 r19817]* The [[CR72]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17570 r19814] [http://article.gmane.org/gmane.science.nmr.relax.scm/17572 r19816] [http://article.gmane.org/gmane.science.nmr.relax.scm/17575 r19819] [http://article.gmane.org/gmane.science.nmr.relax.scm/17589 r19833]
== The target function ==
* The [[CR72]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17571 r19815]
== Adding support for the parameters ==
This is needed == The relax library == Now the dispersion function needs to be added to enable the modelrelax library (in the lib.relax_disp package). This example is for the CR72 model implementation should be designed as a simple Python function which takes the dispersion parameters required and experimental variables, and calculates the R2eff/R1rho values. The module can contain auxiliary functions for the M61 model match those of calculation. Some auxiliary functions, if not specific to relaxation dispersion, may be better placed in other locations within the preexisting LM63 modelrelax library.
=== Reference commits ===The relaxation dispersion functions in the library currently take as an argument a data structure for the back-calculated R2eff/R1rho values and populate this structure. This design is not essential if the target function, described in the next point, handles the library function appropriately. Just look at the files in lib/dispersion to get an idea of the design used.
* The [[CR72]] model at [http://articledispersion code in the relax library must be robust. This involves identifying parameter values or combinations which would cause failures in the mathematical operations (numerical issues not present in the mathematics must be considered).gmane Note that parameter values of 0 are common within a grid search.org It should be decided if the R2eff/gmaneR1rho value should be set to zero, to another value, or to something large (e.scienceg.nmr1e100).relax.scm/17573 r19817] For example:
== The relax_dispDivisions - always catch zeros in the denominator with if statements, even if you believe that this will never be encountered. Square roots - make sure that the value inside is always > 0. Trigonometric functions - these should be tested for where they are not defined or where the software implementation can no longer handle certain values. For example try cosh(1000) in Python.select_model back end ==
Now In the back end of the relax_disp.select_model user function for reference example, the M61 model can be added. This involved identifying code was copied from the model LM63 module and constructing the parameter listmodified appropriately.
=== Reference commits ===
* The [[NS R1rho 2-site]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18482 r2072618479 r20723]* The [[TP02]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/18249 r2049318241 r20486] [http://article.gmane.org/gmane.science.nmr.relax.scm/18246 r20490] [http://article.gmane.org/gmane.science.nmr.relax.scm/18280 r20524]* The [[DPL94]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17758 r2000217756 r20000]* The [[M61 skew]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17732 r1997617729 r19973]* The [[M61]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17622 r1986617615 r19859]* The [[No RexCR72]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17592 r1983617570 r19814][http://article.gmane.org/gmane.science.nmr.relax.scm/17572 r19816] [http://article.gmane.org/gmane.science.nmr.relax.scm/17575 r19819] [http://article.gmane.org/gmane.science.nmr.relax.scm/17589 r19833] 
== Comparing to other software ==
Trusted, Bureaucrats
4,223

edits

Navigation menu