Changes

Jump to navigation Jump to search

Tutorial for adding relaxation dispersion models to relax

94 bytes added, 17:11, 18 November 2015
β†’β€ŽThe relax library: Improved formatting using parameter templates and <code> tags.
== The relax library ==
Now the dispersion function needs to be added to the relax library (in the <code>lib.relax_disp </code> 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. Remember to add all new modules to the <code>lib.relax_disp.__init__ </code> package <code>__all__ </code> list.
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 <code>lib/dispersion </code> to get an idea of the design used.
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 for where they are not defined or where the software implementation can no longer handle certain values. For example try <code>cosh(1000) </code> in Python.
=== Reference commits ===
* The [[M61]] model at [http://article.gmane.org/gmane.science.nmr.relax.scm/17615 r19859]
* 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]
 
== Comparing to other software ==
Trusted, Bureaucrats
4,223

edits

Navigation menu