- Give a unique ID number for your new function. You can add it to the end of the function list if you want: #define AMIDE_PH 29
- define your function using c-code math (for example) case AMIDE_PH: b = pow(10.0,-x); c = a[1] * pow(10.0,-14) / b; d = a[2] * b; e = a[3]; f = c + d + e; *fx = 1.0 / (1.0 + f * a[0]); break;
Add initialization entry for your new function in c. This includes the names you wish to give the parameters. For example: /* Amide pH Depedence */ fitLabel[AMIDE_PH] = "Amide pH dependence"; fitNote[AMIDE_PH] = "Notes: 1 / (1 + kex * T1)"; fitParmNum[AMIDE_PH] = 4; fitParmStr[AMIDE_PH][0] = "T1.......:"; fitParmStr[AMIDE_PH][1] = "kOH......:"; fitParmStr[AMIDE_PH][2] = "kH.......:"; fitParmStr[AMIDE_PH][3] = "kH2O.....:";
Add entry to get_fit_func procedure. For Example: if (0 == strcmp("AMIDE_PH", aStr)) { return(AMIDE_PH); }
Once your new function is working, proceed to the tcl code to update the user interface.
cp fastcrvfit ../../bin/fastcrvfit
- Decide which group the function fits into (standard, common-nmr, or user-submitted) and add the key to the list. For example: set xcv(function,common-nmr) { T1_RELAX T2_RELAX R2_DIMER R2X_DIMER PH_TITR \ XY1 XY2 GAUSS DISP AMIDE_PH SUM_LOREN } - Create a function description section (see other examples in the file) set key AMIDE_PH set myFunc($key,name) "Amide pH dependence" set myFunc($key,note) "Amide pH dependence" set myFunc($key,parms) "T1 kOH kH kH2O" - Define the function using tcl math if { $id == $myFunc(AMIDE_PH) } { set b [expr pow(10,-$x)] set c [expr $panvar(parms,1) * pow(10,-14) / $b] set d [expr $panvar(parms,2) * $b] set e $panvar(parms,3) set f [expr $c + $d + $e] return [expr 1.0 / (1.0 + $f * $panvar(parms,0))] }
- update version of xcrvfit so users know this is a new version. set xcv(VERSION) "v4.x.x"
- mkdir AMIDE_PH - create an input dataset - create the test.run file for easy testing, see examples. - type "test.run". Make sure your new function is working in the gui.
Once fully tested, we now create an xcrvfit module for sharing. Contact the author that you have a new function you wish to include in the public distribution of xcrvfit.
- update README file for new version - cd docs, edit index.html - update version - add new function description for web pages
- edit pack-compile and decide which executables we will build. I have a solaris, mac osx and linux box. Run the script. - Run pack-final. This script makes a tar file of everything that xcrvfit needs and installation script.
rm latest ln -s html-v4.0.12 latest vi index.html