Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility and tutorial fixes #57

Open
wants to merge 279 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
279 commits
Select commit Hold shift + click to select a range
9e7827b
added spinw.horace
tsdev Oct 11, 2017
02941ca
Merge branch 'master' into horace-dev
tsdev Oct 11, 2017
f197738
Merge branch 'master' into horace-dev
tsdev Oct 11, 2017
146b98a
moved class definition into folder
tsdev Oct 11, 2017
0e582eb
removing twins from spinw.spinwavefast
tsdev Oct 11, 2017
c6a158f
allocate memory for Sperp in spinwavefast
tsdev Oct 11, 2017
9ce7fb6
Merge pull request #1 from tsdev/master
Oct 12, 2017
6c0474c
Merge remote-tracking branch 'tsdev/master'
wardsimon Nov 28, 2017
92a4e15
Merge pull request #4 from tsdev/master
Nov 28, 2017
6ade43b
Merge remote-tracking branch 'origin/master'
wardsimon Nov 28, 2017
cdb05a1
Created @swpref class
wardsimon Nov 29, 2017
7041dc2
Added static properties
wardsimon Nov 30, 2017
8d3883f
Added documentation to @swpref
wardsimon Nov 30, 2017
2273034
Merge pull request #5 from simonward86/PrefClass
Nov 30, 2017
e955054
Merge remote-tracking branch 'tsdev/master'
wardsimon Nov 30, 2017
04faf7b
Pref class (#53)
Nov 30, 2017
68a9831
cosmetic changes
tsdev Dec 1, 2017
74e52d0
Merge remote-tracking branch 'tsdev/swpref2'
wardsimon Dec 1, 2017
e438d22
More cosmetic changes
wardsimon Dec 1, 2017
baca1b0
Fix recursion error
wardsimon Dec 1, 2017
deb6529
Merge remote-tracking branch 'tsdev/master'
wardsimon Dec 1, 2017
d46839a
remove Contents
wardsimon Dec 1, 2017
249824a
Updated tutorials and bug fixes
wardsimon Jan 15, 2018
b5cc5ce
Fix < R2017a compatability issue
wardsimon Jan 16, 2018
fe55b6d
Merge branch 'master' into master
Jan 16, 2018
2bd2655
Merge pull request #1 from simonward86/master
Jan 16, 2018
0075d1c
Change to SpinwOrg
wardsimon Jan 16, 2018
8b36eaf
Changing mex finding....
wardsimon Jan 17, 2018
ad79171
Fixed < R2017a path error
wardsimon Jan 17, 2018
85191b9
Merge branch 'mex_test'
wardsimon Jan 17, 2018
73ba736
Update usemex logic
wardsimon Jan 17, 2018
e4edafb
Test build hooks
wardsimon Mar 6, 2018
eba4c98
Webhooks part2
wardsimon Mar 8, 2018
ac1f7aa
Add build badges
wardsimon Mar 8, 2018
9cfdb61
Make readme nice
wardsimon Mar 8, 2018
86f0a63
Fix tutorial 8
wardsimon Jul 5, 2018
d663888
Merge remote-tracking branch 'SpinW/master'
wardsimon Jul 5, 2018
b856da2
Update README
Jul 5, 2018
2aeb57f
New Functionality tests
wardsimon Jul 10, 2018
a588154
Egrid generation fix (for twins)
wardsimon Aug 27, 2018
b594b68
Fix tutorials (all except those with online content)
wardsimon Oct 15, 2018
b7fb224
Fix Tutorials (including online content)
wardsimon Oct 29, 2018
e9cf96e
Testcase bugfix
wardsimon Oct 29, 2018
50810ac
More test fixes
wardsimon Oct 30, 2018
d6a61b0
Remove testing to own repo
wardsimon Oct 30, 2018
18b9f3b
Fix deployment integration
wardsimon Oct 31, 2018
cde5fd6
Update README
Nov 7, 2018
d1f04fb
Update README.md
Nov 7, 2018
02c1d81
Add support for Model repo
wardsimon Nov 8, 2018
979088a
Fix Error Messages in case of failure (sw_model)
wardsimon Nov 9, 2018
aee1086
Update README.md
Nov 9, 2018
254515d
Merge remote-tracking branch 'origin/master'
wardsimon Nov 9, 2018
a5d3409
Update tutorials to Models repo
wardsimon Nov 13, 2018
7f0c2ef
Fix typo in tutorial 35
wardsimon Nov 14, 2018
fc05062
Update README.md
Nov 14, 2018
e75b13c
Fixed typos and missing check in addatom
mducle Jan 16, 2019
d843e9c
Merge pull request #5 from mducle/addatom_fix
Jan 16, 2019
31dada9
Remove warnings for optmagk
Jan 16, 2019
d9e096e
Modify sw_version information
Jan 16, 2019
888c18b
Change doc reference string
Jan 16, 2019
dc52627
Merge branch 'master' into horace-dev
mducle Jan 18, 2019
aa035b7
Small fixes for typos; rename files
mducle Jan 18, 2019
4a28be4
Modified eig_omp.cpp to handle single-precision floats too (Horace us…
mducle Jan 20, 2019
79c9406
Modified chol_omp.cpp to handle singles
mducle Jan 20, 2019
5d94149
Cleanup code, updated spinwavefast
mducle Jan 20, 2019
2abd95a
Cleanup. Added Linux mex. Removed horace_disp.m
mducle Jan 22, 2019
6f9838a
Merge pull request #6 from mducle/horace-dev
Jan 22, 2019
7b0e3dc
More fixes for symbolic
Jan 22, 2019
6012cc3
Fixed bugs in eig_omp again (stupid pointers!)
mducle Jan 23, 2019
3d24fea
Added damped harmonic (bcc-Fe) and coord transform (pcsmo) to horace_sqw
mducle Jan 23, 2019
2cba061
Added linux compiled eig_omp.mexa64
mducle Jan 23, 2019
c33a842
Merge pull request #7 from mducle/horace-dev
Jan 23, 2019
15a3ae1
Updated sw_release to ignore git files
mducle Jan 23, 2019
e415ac1
Update before pre-release
Jan 25, 2019
f3978e7
Merge pull request #14 from SpinW/master
Jan 28, 2019
f63ddb4
Fix sw_plotspec
Jan 28, 2019
c02ff27
Merge branch 'plotbug' into development
Jan 31, 2019
79718cf
Latest compiled mex files (OSX)
Feb 1, 2019
62308ee
Fix readme link
wardsimon Feb 1, 2019
72f0f39
Merge branch 'master' into development
wardsimon Mar 11, 2019
b98dabf
Fix addaniso for atom types
Mar 16, 2019
e03581a
Merge remote-tracking branch 'origin/development' into development
wardsimon Mar 18, 2019
8049e08
Fix addg.m for atom types
wardsimon Mar 18, 2019
cf6f130
sw_plotspec lengend change
wardsimon Mar 22, 2019
6e7c882
Fix for tooltip hit.
wardsimon Apr 3, 2019
e53eeea
Jenkins file test 1
Apr 4, 2019
ae1c36d
Merge pull request #24 from SpinW/development
Apr 4, 2019
2f27fff
Documentation and mex fallback
wardsimon Apr 24, 2019
4cac1a6
Fixed sw_update
wardsimon Apr 24, 2019
fccdfd2
Text fixes for V3.1
wardsimon Apr 25, 2019
b85966d
README update
Apr 25, 2019
a33d6c5
Update DOI for v3.1
Apr 25, 2019
fb5aac6
Bug fix for sw_update
wardsimon Apr 29, 2019
af6b705
Merge remote-tracking branch 'origin/master'
wardsimon Apr 29, 2019
688a8aa
AB fix for newline fn introduced in Matlab 2016b
mducle Jun 10, 2019
43153c5
Merge pull request #30 from mducle/markdown_matlab2017a_bugfix
Jun 11, 2019
79644e0
Minor documentation fix.
Fellow-baka Jul 2, 2019
89b3de0
Add back eigshuffle for spinwavefast
wardsimon Jul 19, 2019
c6f5704
Merge pull request #31 from Fellow-baka/patch-1
Jul 29, 2019
a637878
Fixed a bug in handling incommensurate structs in spinwavefast
mducle Aug 20, 2019
0540446
Delete functionSignatures.json
Sep 4, 2019
48e23af
Merge pull request #33 from mducle/spinwavefast_incomm_bug
Sep 4, 2019
0233d7e
#36: Fix sw_readspec to read arb number of modes
mducle Apr 6, 2020
cfd16c7
#36: Add option to penalize imag modes in fitspec
mducle Apr 6, 2020
2483de8
Fix format Vsave for twins (mat2cell)
mducle Aug 3, 2020
93c3c4d
Merge pull request #44 from mducle/vsave_twin
wardsimon Aug 6, 2020
cbee996
Merge pull request #37 from mducle/36_fitspec_fixes
wardsimon Aug 6, 2020
1d37369
Update README.md
wardsimon Aug 6, 2020
16b10e2
Update README [ci skip]
wardsimon Mar 15, 2021
e86204b
Update README.md
wardsimon Mar 15, 2021
2ba2f49
Update README.md
wardsimon Mar 30, 2021
3137099
Fix bug in CIF xyz reader
mducle Jul 4, 2021
679a87a
Part-revert a6378783 in spinwavefast incommensurate
mducle Jul 15, 2021
e015286
Update README.md
wardsimon May 5, 2022
329dfa0
Merge development branch (#80)
rebeccafair May 11, 2022
97b6220
Port CI from SpinW4 (#81)
rebeccafair May 11, 2022
ca28eeb
Add unit tests for spinw creation (#84)
rebeccafair May 17, 2022
d6fffc9
Add CHANGELOG.rst (#86)
rebeccafair May 25, 2022
fd55c23
More additions to spinw.m tests (#88)
rebeccafair Jun 8, 2022
aeb4fdc
Add unit tests for addX methods of spinw class (#85)
RichardWaiteSTFC Jun 27, 2022
674dd30
Add unit tests for gencoupling (#89)
RichardWaiteSTFC Jul 1, 2022
70a6a81
Test spinwave.m (#92)
rebeccafair Jul 18, 2022
98ae5c7
Add tests for field (#100)
rebeccafair Aug 8, 2022
66ac715
Add test for genlattice (#99)
RichardWaiteSTFC Aug 16, 2022
4d02dbd
Test genmagstr (#97)
rebeccafair Aug 17, 2022
9e8a1ff
Swap order of actual and expected value args in super class verify_xx…
RichardWaiteSTFC Aug 18, 2022
37e2ac7
Update checkout, codecov, and upload-artifacts in actions (#112)
rebeccafair Oct 28, 2022
f2fcb71
Add unit tests optmagsteep (#108)
RichardWaiteSTFC Nov 2, 2022
91cc80a
Test optmagk (#111)
rebeccafair Nov 15, 2022
fcc5e19
Add symbolic system test based on NiPS3 (#113)
mducle Nov 15, 2022
1c9c2bb
Update readme to reflect the github action (#114)
granrothge Nov 21, 2022
e1995a9
Update actions versions (Node.js 12 deprecation) (#116)
RichardWaiteSTFC Nov 28, 2022
6375d51
Add unit tests intmatrix (#110)
RichardWaiteSTFC Nov 28, 2022
dd1f956
Add performance test for supercell calc BiFeO3
RichardWaiteSTFC Nov 28, 2022
08843f3
Add performance test for FM chain with large number qpts
RichardWaiteSTFC Dec 5, 2022
8277072
Fix BiFeO3 spinewave calc for hermit=1 (handle imag evalues)
RichardWaiteSTFC Dec 6, 2022
86b5fb2
Add spinw version to save directory of profile results
RichardWaiteSTFC Dec 6, 2022
8fa2e9a
Do not do hermit=1 calc for BiFeO3 supercell
RichardWaiteSTFC Dec 7, 2022
bfbd175
Add mex preference/setting to profile result directory name
RichardWaiteSTFC Dec 8, 2022
c9011d9
Add optmagstr tests (#117)
rebeccafair Dec 8, 2022
2341834
Add system test for supercell and incommensurate spinwave calc consis…
RichardWaiteSTFC Dec 8, 2022
9e42590
Loop over mex true/false in tests
RichardWaiteSTFC Dec 9, 2022
b0e60e3
Add option to run profile script without profile and add tic/toc
RichardWaiteSTFC Jan 10, 2023
9e1a1a0
Add performance test runner script
RichardWaiteSTFC Jan 12, 2023
bf992d9
Add test to explicitly check rotc can be an inversion (#122)
RichardWaiteSTFC Jan 19, 2023
67de88e
Remove git checkout from script runner
RichardWaiteSTFC Jan 19, 2023
7e25821
Save profile results to directory named with short commit sha
RichardWaiteSTFC Jan 19, 2023
70a7aeb
Write tic/toc timings to file (not stdout)
RichardWaiteSTFC Jan 19, 2023
99c8ec6
Run sripts with profile on and off
RichardWaiteSTFC Jan 19, 2023
98dac56
Add do_profile to filename of tic toc timings
RichardWaiteSTFC Jan 24, 2023
3bae6a3
Don't write ASCiI summary if no results
RichardWaiteSTFC Jan 25, 2023
00d766a
Add input to run tests multiple times
RichardWaiteSTFC Jan 25, 2023
0e3abfb
Add helper func to avg. times and write to file
RichardWaiteSTFC Jan 29, 2023
e78f47e
Only use hermit=true for mex enabled in incom. calc in BiFeO3 test
RichardWaiteSTFC Jan 30, 2023
62bfbf0
Make sure profiler off if not profiling
RichardWaiteSTFC Jan 31, 2023
96e635c
Use different nqpt in FMchain test on linux
RichardWaiteSTFC Jan 31, 2023
c17f4b6
Fix bugs in regex searching for files on linux
RichardWaiteSTFC Feb 3, 2023
9c85e13
Only profile FMchain in not on linux (set nqpts back to 1e7)
RichardWaiteSTFC Feb 3, 2023
1d1d4eb
Replace writelines function with fprintf
RichardWaiteSTFC Feb 6, 2023
c189abd
Use fixed width in format string for test name
RichardWaiteSTFC Feb 7, 2023
c5e297c
Add release note for spinwave speedup
RichardWaiteSTFC Feb 7, 2023
6560586
Better formatting of column names in avg. tic/toc files
RichardWaiteSTFC Feb 8, 2023
36b1978
Add is_daaas function to utilities and use in FMchain script
RichardWaiteSTFC Feb 10, 2023
35fccdd
Merge pull request #124 from SpinW/74_performance_for_spinwave
RichardWaiteSTFC Feb 14, 2023
fc33872
Only retrieve pref in sw_timeit if no tid set
RichardWaiteSTFC Feb 13, 2023
ce94dc1
Pre-allocate memory for Sab array
RichardWaiteSTFC Feb 13, 2023
9c71313
Merge pull request #125 from SpinW/123_replace_mmat_with_mtimesx_if_mex
RichardWaiteSTFC Feb 21, 2023
bc043d9
Fix out-of-memory error in mmat
mducle Mar 24, 2023
fe11c16
Add mmat unit test; address review comments
mducle Mar 24, 2023
692683e
Add mex to spinwave unit tests (#129)
RichardWaiteSTFC Mar 30, 2023
0b6b28e
Double needed mem limit in mmat and add note
mducle Mar 31, 2023
688ecbc
Remove mock return value namespace collision
mducle Mar 31, 2023
8f4eecf
Merge pull request #133 from SpinW/refactor_mmat
RichardWaiteSTFC Apr 3, 2023
4ede5fa
Improve tests (#138)
mducle Apr 18, 2023
80d30ff
PySpinW implementation (#143)
wardsimon May 17, 2023
415d143
Add pyspinw system test (#142)
RichardWaiteSTFC Jun 12, 2023
df2a40d
New release v32 (#144)
mducle Jun 12, 2023
12b0b45
Correct equations for q-range in sw_instrument (#134)
mducle Jun 27, 2023
92551aa
Fix sw_issymspec to recognise powder spectra (#146)
mducle Jun 27, 2023
49880bc
Test sw_egrid (#130)
rebeccafair Jul 6, 2023
d9752ca
a function to put out MDH files
granrothge Aug 24, 2023
a6c707a
add needed function
granrothge Aug 31, 2023
df28fb6
moved read_struct to inside sw_spec2MDHisto.m
granrothge Sep 1, 2023
a7e84c3
added code to overwrite existing file
granrothge Sep 1, 2023
720147b
added more description to the help files
granrothge Sep 1, 2023
d5aed00
updated struct reader
granrothge Sep 5, 2023
1e4618d
updated to handle off axis directions
granrothge Sep 6, 2023
a586024
slight editing to comments
granrothge Sep 6, 2023
32cb8b7
add a prototype test script
granrothge Sep 6, 2023
99adabc
added more tests
granrothge Sep 8, 2023
e238e26
streamlined tests
granrothge Sep 11, 2023
ea5ea33
Merge pull request #149 from granrothge/MDH_writer
RichardWaiteSTFC Sep 12, 2023
65c49a3
Fix syntax error reported by user #151
mducle Nov 1, 2023
b0ee48d
Force R2023a in gh-actions build_wheel (R2023b just released)
mducle Nov 1, 2023
6835ab2
Add release note
RichardWaiteSTFC Dec 6, 2023
735d30a
Merge pull request #153 from SpinW/151_fourier_sublat_bug
RichardWaiteSTFC Dec 7, 2023
950ad3b
Add vispy plotting of crystal structure to pyspinw (#161)
RichardWaiteSTFC Jan 17, 2024
ce8dd43
Updates to multidimensional histo writer (#166)
granrothge Feb 29, 2024
f11cf75
Add new mex to run inner loop of spinwave.m in parallel (#163)
mducle Apr 9, 2024
0c2f294
Add energy resolution option when binning eigenvalues onto grid in sw…
RichardWaiteSTFC Apr 15, 2024
74422b7
swloop mex (part II) (#173)
mducle Apr 15, 2024
3384ffa
Copy eigenvalues from `D` to `omega` when hermit=false and no mex
RichardWaiteSTFC May 2, 2024
5b5f4c2
Move copy of eigvals from D to omega inside hermit false branch
RichardWaiteSTFC May 3, 2024
4bb01e3
Add test to assert omega found with hermit=false & mex=false
RichardWaiteSTFC May 3, 2024
2b98670
Fix CI
mducle Apr 25, 2024
c046e97
Merge pull request #182 from SpinW/181_fix_fastmode_hermit_false_bug_…
RichardWaiteSTFC May 3, 2024
3e8b492
Minor Bugfixes (#180)
mducle May 20, 2024
3705737
Class interface to fit powder spectra (#174)
RichardWaiteSTFC May 20, 2024
3b929c4
Bug fixes for sw_fitpowder (#189)
RichardWaiteSTFC May 29, 2024
89c63fa
RELEASE PySpinW v4 (#190)
mducle May 31, 2024
1b52407
sw_fitpower improvements (#191)
RichardWaiteSTFC Jul 12, 2024
0c12cb1
Add function to ndbase to estimate hessian using cost-function
RichardWaiteSTFC Jul 24, 2024
51295a5
Add unit test
RichardWaiteSTFC Aug 1, 2024
7a1b9dc
Allow negative absolute steps
RichardWaiteSTFC Aug 1, 2024
f9b4a76
Update tolerances
RichardWaiteSTFC Aug 1, 2024
01ca8fe
Add option to vary only some parameters (e.g. if any fixed)
RichardWaiteSTFC Aug 1, 2024
d933df3
Add options to set cost func tolerance and number iterations
RichardWaiteSTFC Aug 1, 2024
074a8d4
Optionally output cost function value at parameters passed
RichardWaiteSTFC Aug 1, 2024
bc5fb9e
Add method to sw_fitpowder to estimate parameter errors
RichardWaiteSTFC Aug 1, 2024
f8a65ba
Add test for powder class parameter error estimation
RichardWaiteSTFC Aug 2, 2024
5a39203
Use arguments block rather than varargin
RichardWaiteSTFC Aug 14, 2024
2cbaeb3
Clarifications and typos in docs strings
RichardWaiteSTFC Aug 14, 2024
13bfc5d
Add max step to warning and undo last step doubling if unsuccessful
RichardWaiteSTFC Aug 14, 2024
006571a
Output optional struct, update test and powder fitting method
RichardWaiteSTFC Aug 14, 2024
479e28f
Output errors same length as parameters vector in powder fitting
RichardWaiteSTFC Aug 14, 2024
6bc1b64
Merge pull request #198 from SpinW/estimate_fit_parameter_uncertainties
RichardWaiteSTFC Aug 15, 2024
d859b68
Add powder fitting tutorial (#199)
RichardWaiteSTFC Aug 16, 2024
e41f848
Release workflow update (#202)
mducle Sep 6, 2024
b41a233
Add unit test for ndbase.simplex optimiser
RichardWaiteSTFC Sep 10, 2024
5d41c84
Make class to eval cost function and transform bound parameters
RichardWaiteSTFC Sep 11, 2024
3037248
Support fixing parameters
RichardWaiteSTFC Sep 12, 2024
a59b2a5
Call new class in ndbase.simplex
RichardWaiteSTFC Sep 12, 2024
0ce5c39
Fix bug for fixed params and add unit test
RichardWaiteSTFC Sep 12, 2024
7f7163c
Add unit test for all params fixed in minimiser
RichardWaiteSTFC Sep 16, 2024
732fed5
Tidy up simplex and fix bug with all params fixed
RichardWaiteSTFC Sep 16, 2024
b481405
Add unit test for function string
RichardWaiteSTFC Sep 16, 2024
2e1d995
Add support for char function in wrapper class
RichardWaiteSTFC Sep 16, 2024
cb6f318
Correct wrapper doc string
RichardWaiteSTFC Sep 16, 2024
f70d22c
Rename wrapper class
RichardWaiteSTFC Sep 16, 2024
297c341
Add unit test for cost function wrapper
RichardWaiteSTFC Sep 16, 2024
ae1500d
Fix formatting in simplex
RichardWaiteSTFC Sep 16, 2024
897d8a0
Fix fitspec test - MaxIter=1 returns initial parameter
RichardWaiteSTFC Sep 23, 2024
a8f91d1
Calc unweighted residuals if no/invalid errors in data struct
RichardWaiteSTFC Sep 23, 2024
42ac713
Update docstrings with MINUIT and lmfit references and info
RichardWaiteSTFC Oct 18, 2024
edf304b
Fix path in build_pyspinw.yml causing test failure
RichardWaiteSTFC Oct 18, 2024
0d60de2
Add tolerance used as constant property
RichardWaiteSTFC Oct 18, 2024
a7a4772
Add option to pass vector of fixed params to wrapper and add tests
RichardWaiteSTFC Oct 18, 2024
f8497bc
Avoid calling @(p) p for unbound parameters
RichardWaiteSTFC Oct 18, 2024
f60fc5c
Allow any non-finite value to indicate no bound
RichardWaiteSTFC Oct 24, 2024
73f604a
Merge pull request #204 from SpinW/implment_bounds_in_ndbase_minimisers
RichardWaiteSTFC Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions +sw_tests/+performance_tests/BiFeO3.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function BiFeO3()
% setup
bfo = spinw;
bfo.genlattice('lat_const', [5.58 5.58 13.86], 'angled', [90 90 120], ...
'sym', 'R 3 c');
bfo.addatom('r', [0 0 0.2212], 'S', 2.5, 'label', 'MFe3');
bfo.gencoupling('maxDistance', 20)
bfo.addmatrix('label', 'J1', 'value', 0.69029);
bfo.addmatrix('label', 'J2', 'value', 0.2)
bfo.addcoupling('mat', 'J1', 'bond', 1)
bfo.addcoupling('mat', 'J2', 'bond', 2)
bfo.addmatrix('label', 'D', 'value', [1 -1 0]*0.185)
bfo.addcoupling('mat', 'D', 'bond', 2)
bfo.optmagk('kbase', [1; 1; 0], 'seed', 1);
bfo.optmagsteep('random',false,'TolX', 1e-12);

% test parameters
% add omega tol for imag eigenvalues (ignored if hermit=0)
spinwave_args_common = {{[-1/2 0 0], [0 0 0], [1/2 1/2 0], 30}, ...
'sortMode', false, 'hermit', 0, ...
'omega_tol', 0.05};
egrid_args = {'component','Sperp','Evect',0:0.1:5, 'imagChk', 0};
inst_args = {'dE',0.1};

% do a spin wave calculation for incommensurate case ([nExt=[1,1,1])
% and commensurate nExt=0.01 - which corresponds to a supercell of
% [11 11 1]
for do_supercell = 0:1
if do_supercell
nExt = 0.01;
bfo.genmagstr('nExt', nExt)
mexs = 1; % requires ~100GB RAM with no mex
else
nExt = [1,1,1];
mexs = 0:1;
end
for mex = mexs
swpref.setpref('usemex', logical(mex))
if mex && ~do_supercell
hermits = 0:1;
else
% chol throws error as matrix is not positive-definite
hermits = 0;
end
for hermit = hermits
for optmem = 0:5:10
spinwave_args = [spinwave_args_common, ...
'hermit', hermit, 'optmem', optmem];
test_name = [mfilename(), '_mex_', ...
num2str(swpref.getpref('usemex').val), ...
'_nExt_', regexprep(num2str(nExt), ' +', '_'), ...
'_hermit_', num2str(hermit), ...
'_optmem_', num2str(optmem)];
sw_tests.utilities.profile_spinwave(test_name, bfo, ...
spinwave_args,...
egrid_args, ...
inst_args, ...
0:1);
end
end
end
end



end
45 changes: 45 additions & 0 deletions +sw_tests/+performance_tests/FMchain.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function FMchain()
% setup
FMchain = spinw;
FMchain.genlattice('lat_const',[3 8 8],'angled',[90 90 90])
FMchain.addatom('r', [0 0 0],'S', 1,'label','MCu1')
FMchain.gencoupling('maxDistance',7)
FMchain.addmatrix('value',-eye(3),'label','Ja')
FMchain.addcoupling('mat','Ja','bond',1);
FMchain.genmagstr('mode','direct', 'k',[0 0 0], ...
'n',[1 0 0],'S',[0; 1; 0]);


% test parameters
if sw_tests.utilities.is_daaas()
do_profiles = 0; % for some reason profile takes > 12 hrs on IDAaaS
else
do_profiles = 0:1;
end
spinwave_args_common = {{[0 0 0], [1 0 0], 1e7}, ...
'sortMode', false};
egrid_args = {'component','Sperp','Evect',0:0.1:5};
inst_args = {'dE',0.1};

for mex = 0:1
swpref.setpref('usemex', logical(mex))
for hermit = 0:1
for optmem = 0:5:10
spinwave_args = [spinwave_args_common, ...
'hermit', hermit, 'optmem', optmem];
test_name = [mfilename() '_mex_', ...
num2str(swpref.getpref('usemex').val), ...
'_hermit_', num2str(hermit), ...
'_optmem_' num2str(optmem)];
sw_tests.utilities.profile_spinwave(test_name, FMchain, ...
spinwave_args, ...
egrid_args, ...
inst_args, ...
do_profiles);
end
end
end



end
233 changes: 233 additions & 0 deletions +sw_tests/+system_tests/systemtest_spinwave.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
classdef systemtest_spinwave < matlab.unittest.TestCase
% Base class for all systems test of spinwave.m based on tutorials

properties
generate_reference_data = false;
reference_data = [];
reference_data_dir = fullfile('.', 'test_data', 'system_tests');
relToll = 0.01;
absToll = 1e-6;
swobj = [];
cleanup_warnings = {};
end

methods (TestClassSetup)
function get_reference_data(testCase)
if isempty(testCase.reference_data_file)
return
end
fname = fullfile(testCase.reference_data_dir, testCase.reference_data_file);
if ~exist(testCase.reference_data_dir, 'dir')
mkdir(testCase.reference_data_dir);
end
if ~exist(fname, 'file') || testCase.generate_reference_data
testCase.generate_reference_data = true;
tmp = []; save(fname, 'tmp');
warning('Generating reference data');
else
testCase.reference_data = load(fname);
end
end
function disable_mex_setup(testCase)
swpref.setpref('usemex', false);
end
end

methods (TestClassTeardown)
function save_reference_data(testCase)
if testCase.generate_reference_data
fname = fullfile(testCase.reference_data_dir, testCase.reference_data_file);
ref_dat = load(fname);
ref_dat = rmfield(ref_dat, 'tmp');
save(fname, '-struct', 'ref_dat');
end
end
function disable_mex_teardown(testCase)
swpref.setpref('usemex', false);
end
end

methods (Static)
function out = get_hash(obj)
% Calculates a hash for an object or struct using undocumented built-ins
% Based on DataHash (https://uk.mathworks.com/matlabcentral/fileexchange/31272-datahash)
Engine = java.security.MessageDigest.getInstance('MD5');
Engine.update(getByteStreamFromArray(obj));
out = typecast(Engine.digest, 'uint8');
end
function out = sanitize_data(in_dat)
if isstruct(in_dat)
out = sanitize_struct(in_dat);
elseif iscell(in_dat)
out = sanitize_cell(in_dat);
elseif isnumeric(in_dat)
out = sanitize(in_dat);
else
out = in_dat;
end
end
end

methods
function out = approxMatrix(testCase, actual, expected, frac_not_match)
% Checks if two arrays are approximately the same with most entries equal but a fraction not
if iscell(actual)
out = actual;
for ii = 1:numel(actual)
out{ii} = testCase.approxMatrix(actual{ii}, expected{ii}, frac_not_match);
end
else
diff = abs(actual - expected);
rel_diff = diff ./ expected;
if (numel(find((diff > testCase.absToll) & (rel_diff > testCase.relToll))) / numel(actual)) < frac_not_match
out = expected;
else
out = actual;
end
end
end
function [actual, expected] = verify_eigval_sort(testCase, actual, expected, nested)
if nargin < 4
nested = 0;
end
if iscell(actual)
for ii = 1:numel(actual)
[actual{ii}, expected{ii}] = testCase.verify_eigval_sort(actual{ii}, expected{ii}, nested);
end
else
% Checks if actual and expected eigenvalues match, otherwise try a different sorting
import matlab.unittest.constraints.*
theseBounds = RelativeTolerance(testCase.relToll) | AbsoluteTolerance(testCase.absToll);
comparator = IsEqualTo(expected, 'Within', theseBounds);
if ~comparator.satisfiedBy(actual)
if nested > 1
actual = sort(abs(actual));
expected = sort(abs(expected));
else
actual = sort(actual, 'ComparisonMethod', 'real');
expected = sort(expected, 'ComparisonMethod', 'real');
end
if nested < 2
[actual, expected] = testCase.verify_eigval_sort(actual, expected, nested + 1);
end
end
end
end
function fieldname = get_fieldname(testCase, pars)
if isempty(pars)
fieldname = 'data';
elseif ischar(pars)
fieldname = pars;
else
fieldname = ['d' reshape(dec2hex(testCase.get_hash(pars)),1,[])];
end
end
function save_test_data(testCase, data, pars)
filename = fullfile(testCase.reference_data_dir, testCase.reference_data_file);
tmpstr.(testCase.get_fieldname(pars)) = data;
save(filename, '-append', '-struct', 'tmpstr');
end
function verify_test_data(testCase, test_data, ref_data)
import matlab.unittest.constraints.IsEqualTo
import matlab.unittest.constraints.RelativeTolerance
import matlab.unittest.constraints.AbsoluteTolerance
theseBounds = RelativeTolerance(testCase.relToll) | AbsoluteTolerance(testCase.absToll);
test_data = testCase.sanitize_data(test_data);
ref_data = testCase.sanitize_data(ref_data);
testCase.verifyThat(test_data, IsEqualTo(ref_data, 'Within', theseBounds));
end
function generate_or_verify(testCase, spec, pars, extrafields, approxSab, tolSab)
if nargin < 5
approxSab = false;
elseif nargin == 5
tolSab = 0.05;
end
if testCase.generate_reference_data
data.input = struct(testCase.swobj);
data.spec = {spec.omega spec.Sab};
if isfield(spec, 'swConv'); data.spec = [data.spec {spec.swConv}]; end
if isfield(spec, 'swInt'); data.spec = [data.spec {spec.swInt}]; end
if nargin > 3
extras = fieldnames(extrafields);
for ii = 1:numel(extras)
data.(extras{ii}) = extrafields.(extras{ii});
end
end
testCase.save_test_data(data, pars);
else
ref_data = testCase.reference_data.(testCase.get_fieldname(pars));
test_data.input = struct(testCase.swobj);
[spec.omega, ref_data.spec{1}] = testCase.verify_eigval_sort(spec.omega, ref_data.spec{1});
test_data.spec = {spec.omega spec.Sab};
if isfield(spec, 'swConv'); test_data.spec = [test_data.spec {spec.swConv}]; end
if isfield(spec, 'swInt'); test_data.spec = [test_data.spec {spec.swInt}]; end
if nargin > 3
extras = fieldnames(extrafields);
for ii = 1:numel(extras)
test_data.(extras{ii}) = extrafields.(extras{ii});
end
end
if any(approxSab)
% For the Sab or Sabp tensor, just check that a fraction of entries match
test_data.spec{2} = testCase.approxMatrix(spec.Sab, ref_data.spec{2}, tolSab);
if numel(test_data.spec) == 4
test_data.spec{4} = testCase.approxMatrix(spec.swInt, ref_data.spec{4}, tolSab);
end
if isfield(test_data, 'Sabp')
test_data.Sabp = testCase.approxMatrix(test_data.Sabp, ref_data.Sabp, tolSab);
end
if isfield(test_data, 'V')
test_data.V = testCase.approxMatrix(test_data.V, ref_data.V, tolSab);
end
end
testCase.verify_test_data(test_data, ref_data);
end
end
function generate_or_verify_generic(testCase, data, fieldname)
if testCase.generate_reference_data
testCase.save_test_data(data, fieldname);
else
testCase.verify_test_data(data, testCase.reference_data.(fieldname));
end
end
function disable_warnings(testCase, varargin)
testCase.cleanup_warnings = [testCase.cleanup_warnings, ...
{onCleanup(@(c) cellfun(@(c) warning('on', c), varargin))}];
cellfun(@(c) warning('off', c), varargin);
end
end

end

function out = sanitize(array)
out = array;
out(abs(out) > 1e8) = 0;
end

function sanitized = sanitize_struct(in_dat)
fnam = fieldnames(in_dat);
for ii = 1:numel(fnam)
if isnumeric(in_dat.(fnam{ii}))
sanitized.(fnam{ii}) = sanitize(in_dat.(fnam{ii}));
elseif isstruct(in_dat.(fnam{ii}))
sanitized.(fnam{ii}) = sanitize_struct(in_dat.(fnam{ii}));
elseif iscell(in_dat.(fnam{ii}))
sanitized.(fnam{ii}) = sanitize_cell(in_dat.(fnam{ii}));
else
sanitized.(fnam{ii}) = in_dat.(fnam{ii});
end
end
end

function sanitized = sanitize_cell(in_dat)
sanitized = in_dat;
for ii = 1:numel(in_dat)
if isnumeric(in_dat{ii})
sanitized{ii} = sanitize(in_dat{ii});
elseif isstruct(in_dat{ii})
sanitized{ii} = sanitize_struct(in_dat{ii});
elseif iscell(in_dat{ii})
sanitized{ii} = sanitize_cell(in_dat{ii});
end
end
end
Loading