Running simulation on the distributed computation framework

This example demonstates running a simple optimization with OPTESIM on the distribute computation framework. This demo is similar to demo one except that it uses "@powderAveragerDistributed" for "global_ese_routine". Below is the source file Demo2.m, followed by explanations:

0001 global global_opt_model global_spectra ...
0002     global_bvecs DistEseManager
0003 
0004 % Load Experimental Data
0005 filter_options.filter_range = 150:600;
0006 filter_options.data_range = 10:600;
0007 filter_options.var_range = 500:600;
0008 
0009 spectrum = filterRaw( 'n14_demo.mat', ...
0010     0.3030, filter_options );
0011 
0012 global_spectra = {spectrum};
0013 
0014 % Setup system model and register Variables
0015 optmodel = eseOptModel({'N14'},'1');
0016 
0017 optmodel.nuclei{1}.type = 'tensor';
0018 
0019 optmodel = registerOptModelVariable(optmodel, ...
0020             'Axx', 1, 1, -10, 10, ...
0021             'Ayy', 1, 2, -10, 10, ...
0022             'Azz', 1, 3, -10, 10);
0023 
0024 optmodel = registerOptModelVariable(optmodel, ...
0025             'eeqQ', 1, 4, -10, 10, ...
0026             'eta', 1, 5, 0, 1);
0027                                           
0028 optmodel = registerOptModelVariable(optmodel, ...
0029             'QEuler1', 1, 6, -360, 360, ...
0030             'QEuler2', 1, 7, -360, 360, ...
0031             'QEuler3', 1, 8, -360, 360);
0032 
0033 global_opt_model = optmodel;
0034 
0035 % Setup poweder average method
0036 % and field vectors for averaging
0037 global_ese_routine = @powderAveragerDistributed;
0038 global_bvecs = gensphrser(4);
0039 
0040 % Setup node manager for use
0041 % in powderAveragerDistributed.m
0042 DistEseManager = ...
0043     java.rmi.Naming.lookup('//##IP##/eseman');
0044 
0045 % Parameter Optimization
0046 x = [2.291, 2.165, 1.645, 1.736, 0.599, 52.69, 8.32, 13.03];
0047 options = optimset('OutputFcn', @esePlot, 'Display','iter');
0048 [ x_new, fval ] = fminsearch(@eseOptObjective, x, options);
0049 
0050 % Estimate optimal parameter uncertainties
0051 bounds = eseOptCftInterval(x_new, fval, 0.99);
0052 
0053 % Generate a report
0054 eseReport(x_new,fval,bounds);
Line 0017

Indicates that we want to use the rhombic shf parameters, so that we use "Axx", "Ayy", "Azz", instead of "Aiso" and "r".

Line 0037

Indicates that we want to use the distributed computation framework.

Line 0042-0043

Specify the node manager, change "##IP##" to your own node manager's IP or hostname.