Page 1 of 2

AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Tue Jul 11, 2017 11:40 pm
by iliak
Hi,

I'm trying to simulate a simple V(iv) spectrum and including AStrain parameter makes the simulation crush. The simulation runs correctly when the AStrain line is commented out. Same error confirmed with version 5.1.11

Thanks for your help.

% ---- sample code ---

%% the spin system
Sys1.S = 1/2; %S=1/2
Sys1.g = [1.976 1.934]; %perp and parallel g
Sys1.Nucs = '51V'; %I=7/2
Sys1.A = [69 185]*2.8; %perp and parallel in MHz
Sys1.AStrain = [6 6 4];
Sys1.lw = 3; %linewidth broadening mT
Sys1.weight = 1;

%% The experimental setup

Exp.mwFreq = 9.275016; %GHz
Exp.Range = [200 500];

%% Run the simulation

pepper({Sys1},Exp);

% --- end of code ---

Error encountered:
Array dimensions must match for binary array op.

Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\resfields.p>resfields (line
715)

Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\pepper.p>pepper (line 608)

Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\pepper.p>pepper (line 127)

Error in bug_report_071117 (line 23)
pepper({Sys1},Exp);

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Wed Jul 12, 2017 8:16 am
by Stefan Stoll
This runs without problems on my computer, both with 5.1.9 and 5.1.11. Try to add a clear before the first line.

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Wed Jul 12, 2017 9:44 pm
by iliak
Hi Stefan,

Thanks for looking into it. I added "clear all" before the script, but it did not help. We have the same error on two different machines - the other one runs the 5.1.11; easyspininfo does not give any conflicts:

==================================================================
Release: 5.1.9 (2017-01-12)
Expiry date: 31-Dec-2017
Folder: D:\Dropbox\MATLAB Extensions\easyspin-5.1.9\easyspin
MATLAB version: 8.0.0.783 (R2012b)
Platform: Microsoft Windows [Version 10.0.15063]
mex-files: mexw64, ok
System date: 12-Jul-2017 21:40:35
Temp dir: C:\Users\Ilia\AppData\Local\Temp\
==================================================================

The problem seems to be specific for AStrain any other strains do not cause the crush.

Is there any other info I could provide to help troubleshoot it.

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Wed Jul 12, 2017 10:20 pm
by Stefan Stoll
Run the simulation with Opt.Verbosity = 2 and post the log from the command window.

Also, post the results of which -all pepper and which -all resfields.

Lastly, try Sys.AStrain = [6 4] to match the 2-element structure of the A field. Or try Sys.A = [69 69 185]*2.8 with Sys.AStrain = [6 6 4].

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Wed Jul 12, 2017 11:22 pm
by iliak
Hi,

I did try all two and three parameter permutations for Sys.A and Sys.AStrain - all give the same error.

Here is the log: (hope it helps)

=begin=pepper=====12-Jul-2017 23:13:57=================
log level 2
-general-----------------------------------------------
system with 2 spin(s) and 16 states
widths for Gaussian strains given
field sweep, mw frequency 9.275016 GHz
frequency 9.27502 GHz, field range [200 500] mT, 1024 points
harmonic 1, mode
no temperature
-orientations------------------------------------------
powder sample (randomly oriented centers)
automatic determination of symmetry group and frame
Dinfh, non-tilted frame
region: a quarter of a meridian
19 orientations (19 knots)
-resonances--------------------------------------------
method: field sweep, adaptive segmentation (state space)
-entering resfields*----------------------------------
microwave polarization mode: linear
mode angles: k tilt 90 deg, polarization angle 90 deg
- Preparations
using full matrices
full treatment of all nuclei
## maximum splitting at zero field: 1.85395 GHz
no looping transitions possible
- Transition pre-selection
selection threshold 0.0001
## (selection threshold 0.0001, 3 knots)
31 transitions pre-selected
- Broadenings
using strains
Error using +
Array dimensions must match for binary array op.

Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\resfields.p>resfields
(line 715)


Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\pepper.p>pepper (line 608)


Error in D:\Dropbox\MATLAB
Extensions\easyspin-5.1.9\easyspin\pepper.p>pepper (line 127)


Error in bug_report_071117 (line 24)
pepper({Sys1},Exp,Opt);


------------------------------------

>> which -all pepper
D:\Dropbox\MATLAB Extensions\easyspin-5.1.9\easyspin\pepper.p
D:\Dropbox\MATLAB Extensions\easyspin-5.1.9\easyspin\pepper.m % Shadowed

------------------------------------
>> which -all resfields
D:\Dropbox\MATLAB Extensions\easyspin-5.1.9\easyspin\resfields.p
D:\Dropbox\MATLAB Extensions\easyspin-5.1.9\easyspin\resfields.m % Shadowed

----------------------------------

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Wed Jul 12, 2017 11:28 pm
by iliak
Just found out.

adding a non-zero Sys.gStrain and still leaving Sys.AStrain allows the program to proceed. below if the log from such successful run. Setting Sys.gStrain = [0 0] causes the program to crush as if no Sys,gStrain was specified.

begin=pepper=====12-Jul-2017 23:25:08=================
log level 2
-general-----------------------------------------------
system with 2 spin(s) and 16 states
widths for Gaussian strains given
field sweep, mw frequency 9.275016 GHz
frequency 9.27502 GHz, field range [200 500] mT, 1024 points
harmonic 1, mode
no temperature
-orientations------------------------------------------
powder sample (randomly oriented centers)
automatic determination of symmetry group and frame
Dinfh, non-tilted frame
region: a quarter of a meridian
19 orientations (19 knots)
-resonances--------------------------------------------
method: field sweep, adaptive segmentation (state space)
-entering resfields*----------------------------------
microwave polarization mode: linear
mode angles: k tilt 90 deg, polarization angle 90 deg
- Preparations
using full matrices
full treatment of all nuclei
## maximum splitting at zero field: 1.85395 GHz
no looping transitions possible
- Transition pre-selection
selection threshold 0.0001
## (selection threshold 0.0001, 3 knots)
31 transitions pre-selected
- Broadenings
using strains
g strain present
## using g/A strain
- Resonance data: computing positions, intensities, strain widths, gradients
## modelling accuracy 0.019 MHz, max slope 13.8675 MHz/mT
1/19 orientations, remaining time unknown
segmentation finished, 6 segments
2/19 orientations, remaining time 00:00:1.1
segmentation finished, 6 segments
3/19 orientations, remaining time 00:00:0.8
segmentation finished, 6 segments
4/19 orientations, remaining time 00:00:0.5
segmentation finished, 6 segments
5/19 orientations, remaining time 00:00:0.5
segmentation finished, 6 segments
6/19 orientations, remaining time 00:00:0.4
segmentation finished, 6 segments
7/19 orientations, remaining time 00:00:0.3
segmentation finished, 6 segments
8/19 orientations, remaining time 00:00:0.3
segmentation finished, 6 segments
9/19 orientations, remaining time 00:00:0.3
segmentation finished, 6 segments
10/19 orientations, remaining time 00:00:0.3
segmentation finished, 8 segments
11/19 orientations, remaining time 00:00:0.2
segmentation finished, 8 segments
12/19 orientations, remaining time 00:00:0.2
segmentation finished, 8 segments
13/19 orientations, remaining time 00:00:0.2
segmentation finished, 8 segments
14/19 orientations, remaining time 00:00:0.2
segmentation finished, 8 segments
15/19 orientations, remaining time 00:00:0.1
segmentation finished, 8 segments
16/19 orientations, remaining time 00:00:0.1
segmentation finished, 8 segments
17/19 orientations, remaining time 00:00:0.1
segmentation finished, 8 segments
18/19 orientations, remaining time 00:00:0.1
segmentation finished, 8 segments
19/19 orientations, remaining time 00:00:0.0
segmentation finished, 8 segments
## 31 resonances total from 31 level pairs
## all resonances above relative intensity threshold 0.000100
## 31 resonances left
## 31 transitions fully in range
31 significant transitions with resonances in range
## diags 153 resonances 589 oris 19
## diags/field 0.2598 diags/ori 8.053 fields/ori 31
## Hamiltonian rediagonalised for 0 resonances (0.000%)
## minimum state stability encountered 2.000000
## resonances min 275.402 mT, max 409.371 mT
## amplitudes min 0, max 0.883091
## widths min 0.0294824 mT, max 0.932587 mT
## gradients min 0, max 50.1991
-exiting resfields*-----------------------------------
-absorption spectrum construction----------------------
summation, axial case
interpolation (factor 4, method G3/L3/L3)
spectrum array size: 1x1024 (summed)
total 72 segments, 31 transitions
Smoothness: overall 14.8, worst 0.08917
(<0.5: probably bad, 0.5-3: ok, >3: overdone)
-final-------------------------------------------------
harmonic 1: using differentiation
cpu time 0h0m1.046s
=end=pepper=======12-Jul-2017 23:25:09=================

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Thu Jul 13, 2017 7:57 am
by Stefan Stoll
This must be related to the older Matlab version you are using. Can you run your script without gStrain with 5.1.11 and post the log?

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Thu Jul 13, 2017 1:58 pm
by Stefan Stoll
No need to run this anymore, we found the reason for the bug. It happens with older Matlab versions. We will publish a version with a fix. Thanks for reporting!

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Thu Jul 13, 2017 2:55 pm
by Stefan Stoll
This is now fixed in 5.1.12.

Re: AStrain not working in pepper? (5.1.9 - 5.1.11)

Posted: Thu Jul 13, 2017 9:44 pm
by iliak
Great!

Thanks so much for the very speedy response!!!

I'm curios: what has changed between MATLAB versions that caused this?