Difference between revisions of "Optimcon.m"

From Spinach Documentation Wiki
Jump to: navigation, search
Line 1: Line 1:
−
This is the function that updates the spin_system object with optimal control information. Syntax:
+
{{DISPLAYTITLE:optimcon.m}} __NOTOC__
 +
Updates the spin_system object with optimal control information.
 +
 
 +
==Syntax==
 +
 
 +
    spin_system=optimcon([[spin_system]],[[control]])
 +
 
 +
==Arguments==
 +
 
 +
    [[spin_system]]  - primary Spinach data structure,
 +
                    created by [[create.m]] and updated
 +
                    by [[basis.m]] functions
 +
 
 +
    [[control]]      - control data structure described
 +
                    in detail in the [[Optimal_control_module|online manual]]
 +
 
 +
==Outputs==
 +
 
 +
    [[spin_system]]  - updated Spinach data structure
 +
 
 +
==Examples==
 +
See the examples given in examples/optimal_control directory. A fairly typical control parameter structure appears below.
 +
 
 +
    % Define control parameters
 +
    control.drifts={{H}};                          % Drift
 +
    control.operators={LxH,LyH,LxC,LyC,LxF,LyF};    % Controls
 +
    control.rho_init={rho_init};                    % Starting state
 +
    control.rho_targ={rho_targ};                    % Destination state
 +
    control.pwr_levels=2*pi*1e3;                    % Pulse power
 +
    control.pulse_dur=10e-3;                        % Pulse duration
 +
    control.pulse_nsteps=50;                        % Time points
 +
    control.penalties={'SNS'};                      % Penalty
 +
    control.p_weights=100;                          % Penalty weight
 +
    control.method='newton';                        % Optimisation method
 +
    control.tol_g=1e-5;                            % Termination tolerance
 +
    control.freeze=zeros(6,50);                    % Freeze mask
 
   
 
   
−
          spin_system=optimcon(spin_system,[[control]])
+
    % Plots during optimisation
 +
    control.plotting={'correlation_order','local_each_spin','xy_controls'};
 +
 
 +
==Notes==
 +
The plotting should be switched off for large production calculations - optimal control diagnostic plots are computationally expensive.
 +
 
 +
==See also==
 +
[[grape.m]], [[ensemble.m]], [[fminnewton.m]]
 +
 
  
−
where [[control]] is a data structure containing information about optimal control settings. See the [[optimal_control_module|optimal control settings]] section of the online manual for information on preparing [[control]] structures.
+
''Version 2.4, authors: [[Ilya Kuprov]], [[David Goodwin]]''

Revision as of 16:36, 29 July 2019

Updates the spin_system object with optimal control information.

Syntax

    spin_system=optimcon(spin_system,control)

Arguments

    spin_system  - primary Spinach data structure,
                   created by create.m and updated
                   by basis.m functions
    control      - control data structure described 
                   in detail in the online manual

Outputs

    spin_system  - updated Spinach data structure

Examples

See the examples given in examples/optimal_control directory. A fairly typical control parameter structure appears below.

    % Define control parameters
    control.drifts=Template:H;                           % Drift
    control.operators={LxH,LyH,LxC,LyC,LxF,LyF};    % Controls
    control.rho_init={rho_init};                    % Starting state
    control.rho_targ={rho_targ};                    % Destination state
    control.pwr_levels=2*pi*1e3;                    % Pulse power
    control.pulse_dur=10e-3;                        % Pulse duration
    control.pulse_nsteps=50;                        % Time points
    control.penalties={'SNS'};                      % Penalty
    control.p_weights=100;                          % Penalty weight
    control.method='newton';                        % Optimisation method
    control.tol_g=1e-5;                             % Termination tolerance
    control.freeze=zeros(6,50);                     % Freeze mask

    % Plots during optimisation
    control.plotting={'correlation_order','local_each_spin','xy_controls'};

Notes

The plotting should be switched off for large production calculations - optimal control diagnostic plots are computationally expensive.

See also

grape.m, ensemble.m, fminnewton.m


Version 2.4, authors: Ilya Kuprov, David Goodwin