├── .gitignore ├── Contents.m ├── README.md ├── dat_files ├── atom.dat ├── color.dat ├── formfactor.dat ├── icons.mat ├── isotope.dat ├── magion.dat ├── symmetry.dat └── xrayion.dat ├── dev ├── @spinw │ ├── corespec.m │ ├── couplingtable.m │ ├── fitpow.m │ ├── fourier2.m │ ├── gencouplingold.m │ ├── intmatrix1.m │ ├── meanfield.m │ ├── phonon.m │ ├── phononsym.m │ ├── scga.m │ ├── scga3.m │ ├── structfact2.m │ ├── structfact3.m │ └── tisza.m ├── doctest2.m ├── git.m ├── sw_animate.m ├── sw_counter.m ├── sw_finddim.m ├── sw_finddim2.m ├── sw_finddim3.m ├── sw_idata.m ├── sw_initialize.m ├── sw_intsf.m ├── sw_notify.m ├── sw_orbital.m ├── sw_phonopy.m ├── sw_plotcell.m ├── sw_plotsf.m ├── sw_quadell.m ├── sw_release.m ├── sw_spinmotion.m └── sw_t2g.m ├── docs ├── docgenerator │ ├── docgen.m │ ├── sw_convdef.m │ ├── sw_convhelp.m │ ├── sw_example.m │ ├── sw_genhelp.m │ └── sw_rmspace.m ├── resources │ ├── file.pdf │ └── spinw_cheatsheet.png └── source │ ├── 01_features.md │ ├── 02_introduction.md │ ├── 03_crystal.md │ ├── 04_magstr.md │ ├── 05_hamiltonian.md │ ├── 06_symmetry.md │ ├── 07_spinwave.md │ ├── 08_spec.md │ ├── 09_symbolic.md │ ├── 10_onemorething.md │ ├── 11_contribute.md │ └── index.md ├── external ├── bsxfunsym.m ├── changem.m ├── chol_omp │ ├── chol_omp.cpp │ ├── chol_omp.m │ ├── chol_omp.mexa64 │ ├── chol_omp.mexmaci64 │ └── chol_omp.mexw64 ├── clipboardimage.m ├── colormap │ ├── cm_fireprint.m │ ├── cm_inferno.m │ ├── cm_magma.m │ ├── cm_plasma.m │ ├── cm_tasty.m │ ├── cm_viridis.m │ └── license.txt ├── eig_omp │ ├── eig_omp.cpp │ ├── eig_omp.m │ ├── eig_omp.mexa64 │ ├── eig_omp.mexmaci64 │ └── eig_omp.mexw64 ├── eigorth.m ├── err2str.m ├── findmax.m ├── findmin.m ├── findval.m ├── fprintf0.m ├── gcdv.m ├── gobjects0.m ├── grabxy.m ├── iindex.m ├── invfast.m ├── ksearch.m ├── makecolormap.m ├── mdiagonal.m ├── mmat.m ├── mtimesx │ ├── mtimesx.c │ ├── mtimesx.m │ ├── mtimesx.mexa64 │ ├── mtimesx.mexmaci64 │ ├── mtimesx.mexw64 │ ├── mtimesx_RealTimesReal.c │ └── mtimesx_license.txt ├── munkres.m ├── pmat.m ├── rdir │ ├── license.txt │ └── rdir.m ├── sortmode.m ├── strjoin0.m ├── strjoin_license.txt ├── strsplit0.m ├── strsplit_license.txt ├── strword.m ├── sumargs.m ├── sumn.m ├── sumsym.m ├── sw_cbrewer.m ├── sw_fminsearchbnd.m ├── symbol.m ├── tensordot.m ├── tensordotWM.m ├── uiopen.m └── yaml │ ├── README │ ├── YAML.m │ └── java │ ├── LICENSE-2.0.txt │ ├── snakeyaml-1.18.jar │ └── snakeyaml-1.9.jar ├── install_spinw.m ├── license.txt ├── spinw3_logo.png ├── spinw3_logo_square.png ├── spinw_logo.png ├── swfiles ├── +ndbase │ ├── Contents.m │ ├── corrphon.m │ ├── cplot.m │ ├── getdata.m │ ├── histn.m │ ├── lm.m │ ├── lm2.m │ ├── lm3.m │ ├── pso.m │ ├── simplex.m │ ├── source.m │ └── spaghetti.m ├── +swfunc │ ├── Contents.m │ ├── gauss.m │ ├── gaussfwhm.m │ ├── lorfwhm.m │ ├── pvoigt.m │ └── voigtfwhm.m ├── +swplot │ ├── Contents.m │ ├── activefigure.m │ ├── add.m │ ├── arrow.m │ ├── base.m │ ├── circle.m │ ├── clear.m │ ├── close.m │ ├── color.m │ ├── cylinder.m │ ├── delete.m │ ├── ellipsoid.m │ ├── export.m │ ├── figure.m │ ├── findobj.m │ ├── getdata.m │ ├── icomesh.m │ ├── ishg.m │ ├── legend.m │ ├── line.m │ ├── logo.m │ ├── mouse.m │ ├── patchfacefcn.m │ ├── plot.m │ ├── plotatom.m │ ├── plotbase.m │ ├── plotbond.m │ ├── plotcell.m │ ├── plotchem.m │ ├── plotion.m │ ├── plotmag.m │ ├── polyhedron.m │ ├── raytriangle.m │ ├── setrangegui.m │ ├── subfigure.m │ ├── subplot.m │ ├── text.m │ ├── tooltip.m │ ├── tooltipcallback.m │ ├── tooltipstring.m │ ├── transform.m │ ├── translate.m │ ├── view.m │ └── zoom.m ├── +swsym │ ├── Contents.m │ ├── add.m │ ├── bond.m │ ├── generator.m │ ├── genreduce.m │ ├── isop.m │ ├── operator.m │ ├── oporder.m │ ├── point.m │ ├── position.m │ └── str.m ├── @cif │ ├── cif.m │ └── importcif.m ├── @spinw │ ├── abc.m │ ├── addaniso.m │ ├── addatom.m │ ├── addcoupling.m │ ├── addg.m │ ├── addmatrix.m │ ├── addtwin.m │ ├── anneal.m │ ├── annealloop.m │ ├── atom.m │ ├── basisvector.m │ ├── copy.m │ ├── disp.m │ ├── energy.m │ ├── export.m │ ├── field.m │ ├── fitspec.m │ ├── formula.m │ ├── fourier.m │ ├── fouriersym.m │ ├── gencoupling.m │ ├── genlattice.m │ ├── genmagstr.m │ ├── getmatrix.m │ ├── horace.m │ ├── intmatrix.m │ ├── magstr.m │ ├── magtable.m │ ├── matom.m │ ├── matparser.m │ ├── moment.m │ ├── newcell.m │ ├── nosym.m │ ├── notwin.m │ ├── optmagk.m │ ├── optmagsteep.m │ ├── optmagstr.m │ ├── plot.m │ ├── powspec.m │ ├── private │ │ ├── datastruct.m │ │ └── initfield.m │ ├── quickham.m │ ├── rl.m │ ├── setmatrix.m │ ├── setunit.m │ ├── spinw.m │ ├── spinwave.m │ ├── spinwavesym.m │ ├── struct.m │ ├── structfact.m │ ├── symbolic.m │ ├── symmetry.m │ ├── symop.m │ ├── table.m │ ├── temperature.m │ ├── twinq.m │ ├── unitcell.m │ ├── validate.m │ └── version.m ├── @swpref │ ├── export.m │ ├── import.m │ ├── private │ │ └── datastruct.m │ └── swpref.m ├── Contents.m ├── functionSignatures.json ├── gm_planar.m ├── gm_planard.m ├── gm_spherical3d.m ├── gm_spherical3dd.m ├── sw_atomdata.m ├── sw_basismat.m ├── sw_bonddim.m ├── sw_bose.m ├── sw_cartesian.m ├── sw_cff.m ├── sw_converter.m ├── sw_econtract.m ├── sw_egrid.m ├── sw_extendlattice.m ├── sw_filelist.m ├── sw_freemem.m ├── sw_fstat.m ├── sw_fsub.m ├── sw_import.m ├── sw_instrument.m ├── sw_magdomain.m ├── sw_markdown.m ├── sw_mattype.m ├── sw_mex.m ├── sw_mff.m ├── sw_mirror.m ├── sw_model.m ├── sw_multicolor.m ├── sw_nb.m ├── sw_neutron.m ├── sw_nvect.m ├── sw_omegasum.m ├── sw_parstr.m ├── sw_plotspec.m ├── sw_qgrid.m ├── sw_qscan.m ├── sw_readparam.m ├── sw_readspec.m ├── sw_readtable.m ├── sw_res.m ├── sw_resconv.m ├── sw_rootdir.m ├── sw_rot.m ├── sw_rotmat.m ├── sw_rotmatd.m ├── sw_timeit.m ├── sw_tofres.m ├── sw_uniquetol.m ├── sw_update.m ├── sw_version.m ├── sw_xray.m ├── swdoc.m ├── swhelp.m └── usefull │ ├── sw_always.m │ ├── sw_createpcr.m │ ├── sw_sub1.m │ └── sw_surf.m ├── test ├── fourier_test.m ├── scga_test.m ├── scga_test_kag.m ├── sw_genatpos2.m ├── sw_symtest.m ├── sw_test.m ├── sw_test_sw1.m ├── sw_test_sw2.m ├── sw_test_sym1.m ├── sw_test_sym2.m └── sw_test_sym3.m └── tutorials ├── help ├── Atomdat.m ├── Atomdat │ ├── Atomdat.txt │ └── gen_Atomdat.html ├── Bond.m ├── Bond │ ├── Bond.txt │ └── gen_Bond.html ├── Coordinatesystem.m ├── Coordinatesystem │ ├── Coordinatesystem.txt │ └── gen_Coordinatesystem.html ├── Documentation.m ├── Documentation │ ├── Documentation.txt │ └── gen_Documentation.html ├── Exchangecoupling.m ├── Exchangecoupling │ ├── Exchangecoupling.txt │ ├── gen_Exchangecoupling.html │ └── gen_Exchangecoupling_01.png ├── GenerateFigures.m ├── Iondat.m ├── Iondat │ ├── Iondat.txt │ └── gen_Iondat.html ├── Keywords.m ├── Keywords │ ├── Keywords.txt │ └── gen_Keywords.html ├── Powderspectrum.m ├── Swclass.m ├── Swclass │ ├── Swclass.txt │ ├── export_fig_out.png │ ├── fig1.png │ ├── fig_test1.png │ ├── gen_Swclass.html │ ├── gen_Swclass_01.png │ └── painter.png ├── Swproperties.m ├── Swproperties │ ├── Swproperties.txt │ └── gen_Swproperties.html ├── gendoc_PSI.m ├── links.txt ├── links_save.txt ├── noCode.xsl └── swclass1.png ├── publish ├── LuVO3_fitted_modes.txt ├── publish_PSI.m ├── tutorial1.m ├── tutorial1 │ ├── tutorial1.html │ ├── tutorial1.png │ ├── tutorial1.txt │ ├── tutorial1_01.png │ ├── tutorial1_02.png │ ├── tutorial1_03.png │ ├── tutorial1_04.png │ └── tutorial1_05.png ├── tutorial10.m ├── tutorial10 │ ├── tutorial10.html │ ├── tutorial10.png │ ├── tutorial10.txt │ ├── tutorial10_01.png │ ├── tutorial10_02.png │ ├── tutorial10_03.png │ └── tutorial10_04.png ├── tutorial11.m ├── tutorial11 │ ├── tutorial11.html │ ├── tutorial11.png │ ├── tutorial11.txt │ ├── tutorial11_01.png │ └── tutorial11_02.png ├── tutorial12.m ├── tutorial12 │ ├── tutorial12.html │ ├── tutorial12.png │ ├── tutorial12.txt │ ├── tutorial12_01.png │ ├── tutorial12_02.png │ ├── tutorial12_03.png │ ├── tutorial12_04.png │ ├── tutorial12_05.png │ ├── tutorial12_06.png │ └── tutorial12_07.png ├── tutorial13.m ├── tutorial13 │ ├── tutorial13.html │ ├── tutorial13.png │ ├── tutorial13.txt │ ├── tutorial13_01.png │ ├── tutorial13_02.png │ ├── tutorial13_03.png │ ├── tutorial13_04.png │ └── tutorial13_05.png ├── tutorial14.m ├── tutorial14 │ ├── tutorial14.html │ ├── tutorial14.png │ ├── tutorial14.txt │ ├── tutorial14_01.png │ ├── tutorial14_02.png │ └── tutorial14_03.png ├── tutorial15.m ├── tutorial15 │ ├── tutorial15.html │ ├── tutorial15.png │ ├── tutorial15.txt │ ├── tutorial15_01.png │ ├── tutorial15_02.png │ ├── tutorial15_03.png │ ├── tutorial15_04.png │ └── tutorial15_05.png ├── tutorial16.m ├── tutorial16 │ ├── tutorial16.html │ ├── tutorial16.png │ ├── tutorial16.txt │ ├── tutorial16_01.png │ ├── tutorial16_02.png │ ├── tutorial16_03.png │ ├── tutorial16_04.png │ ├── tutorial16_05.png │ ├── tutorial16_06.png │ ├── tutorial16_07.png │ ├── tutorial16_08.png │ ├── tutorial16_09.png │ ├── tutorial16_10.png │ └── tutorial16_11.png ├── tutorial17.m ├── tutorial17 │ ├── tutorial17.html │ └── tutorial17.txt ├── tutorial18.m ├── tutorial18 │ ├── tutorial18.html │ ├── tutorial18.png │ ├── tutorial18.txt │ ├── tutorial18_01.png │ ├── tutorial18_02.png │ ├── tutorial18_03.png │ ├── tutorial18_04.png │ └── tutorial18_05.png ├── tutorial19.m ├── tutorial19 │ ├── tutorial19.html │ ├── tutorial19.png │ ├── tutorial19.txt │ ├── tutorial19_01.png │ ├── tutorial19_02.png │ ├── tutorial19_03.png │ ├── tutorial19_04.png │ └── tutorial19_05.png ├── tutorial2.m ├── tutorial2 │ ├── tutorial2.html │ ├── tutorial2.png │ ├── tutorial2.txt │ ├── tutorial2_01.png │ ├── tutorial2_02.png │ ├── tutorial2_03.png │ └── tutorial2_04.png ├── tutorial20.m ├── tutorial20 │ ├── tutorial20.html │ ├── tutorial20.png │ ├── tutorial20.txt │ ├── tutorial20_01.png │ ├── tutorial20_02.png │ ├── tutorial20_03.png │ └── tutorial20_04.png ├── tutorial21.m ├── tutorial21 │ ├── tutorial21.html │ ├── tutorial21.png │ ├── tutorial21.txt │ ├── tutorial21_01.png │ ├── tutorial21_02.png │ ├── tutorial21_03.png │ └── tutorial21_04.png ├── tutorial22 │ ├── tutorial22.html │ └── tutorial22.txt ├── tutorial23 │ ├── tutorial23.html │ └── tutorial23.txt ├── tutorial26 │ ├── tutorial26.html │ └── tutorial26.txt ├── tutorial28 │ ├── tutorial28.html │ ├── tutorial28.png │ ├── tutorial28.txt │ ├── tutorial28_01.png │ ├── tutorial28_02.png │ ├── tutorial28_03.png │ └── tutorial28_04.png ├── tutorial29 │ ├── tutorial29.html │ └── tutorial29.txt ├── tutorial3.m ├── tutorial3 │ ├── tutorial3.html │ ├── tutorial3.png │ ├── tutorial3.txt │ ├── tutorial3_01.png │ ├── tutorial3_02.png │ ├── tutorial3_03.png │ ├── tutorial3_04.png │ └── tutorial3_05.png ├── tutorial30.m ├── tutorial30 │ ├── tutorial30.html │ ├── tutorial30.png │ ├── tutorial30.txt │ ├── tutorial30_01.png │ ├── tutorial30_02.png │ ├── tutorial30_03.png │ ├── tutorial30_04.png │ ├── tutorial30_05.png │ ├── tutorial30_06.png │ ├── tutorial30_07.png │ └── tutorial30_08.png ├── tutorial31.m ├── tutorial31 │ ├── tutorial31.html │ ├── tutorial31.png │ ├── tutorial31.txt │ ├── tutorial31_01.png │ ├── tutorial31_02.png │ ├── tutorial31_03.png │ ├── tutorial31_04.png │ ├── tutorial31_05.png │ ├── tutorial31_06.png │ ├── tutorial31_07.png │ ├── tutorial31_08.png │ ├── tutorial31_09.png │ ├── tutorial31_10.png │ ├── tutorial31_11.png │ └── tutorial31_12.png ├── tutorial32.m ├── tutorial32 │ ├── tutorial32.html │ ├── tutorial32.png │ ├── tutorial32.txt │ ├── tutorial32_01.png │ ├── tutorial32_02.png │ ├── tutorial32_03.png │ ├── tutorial32_04.png │ ├── tutorial32_05.png │ ├── tutorial32_06.png │ └── tutorial32_07.png ├── tutorial33.m ├── tutorial33 │ ├── tutorial33.html │ ├── tutorial33.png │ ├── tutorial33.txt │ ├── tutorial33_01.png │ ├── tutorial33_02.png │ └── tutorial33_03.png ├── tutorial34.m ├── tutorial34 │ ├── tutorial34.html │ ├── tutorial34.png │ ├── tutorial34.txt │ ├── tutorial34_01.png │ ├── tutorial34_02.png │ └── tutorial34_03.png ├── tutorial35.m ├── tutorial35 │ ├── tutorial35.html │ ├── tutorial35.png │ ├── tutorial35.txt │ ├── tutorial35_01.png │ ├── tutorial35_02.png │ ├── tutorial35_03.png │ ├── tutorial35_04.png │ └── tutorial35_05.png ├── tutorial36.m ├── tutorial37.m ├── tutorial38.m ├── tutorial38 │ ├── tutorial38.html │ ├── tutorial38.png │ ├── tutorial38.txt │ ├── tutorial38_01.png │ ├── tutorial38_02.png │ ├── tutorial38_03.png │ └── tutorial38_04.png ├── tutorial4.m ├── tutorial4 │ ├── tutorial4.html │ ├── tutorial4.png │ ├── tutorial4.txt │ ├── tutorial4_01.png │ ├── tutorial4_02.png │ ├── tutorial4_03.png │ └── tutorial4_04.png ├── tutorial5.m ├── tutorial5 │ ├── tutorial5.html │ ├── tutorial5.png │ ├── tutorial5.txt │ ├── tutorial5_01.png │ ├── tutorial5_02.png │ ├── tutorial5_03.png │ ├── tutorial5_04.png │ └── tutorial5_05.png ├── tutorial6.m ├── tutorial6 │ ├── tutorial6.html │ ├── tutorial6.png │ ├── tutorial6.txt │ ├── tutorial6_01.png │ ├── tutorial6_02.png │ ├── tutorial6_03.png │ ├── tutorial6_04.png │ └── tutorial6_05.png ├── tutorial7.m ├── tutorial7 │ ├── tutorial7.html │ ├── tutorial7.png │ ├── tutorial7.txt │ ├── tutorial7_01.png │ ├── tutorial7_02.png │ ├── tutorial7_03.png │ ├── tutorial7_04.png │ └── tutorial7_05.png ├── tutorial8.m ├── tutorial8 │ ├── tutorial8.html │ ├── tutorial8.png │ ├── tutorial8.txt │ ├── tutorial8_01.png │ ├── tutorial8_02.png │ ├── tutorial8_03.png │ ├── tutorial8_04.png │ ├── tutorial8_05.png │ ├── tutorial8_06.png │ ├── tutorial8_07.png │ └── tutorial8_08.png ├── tutorial9.m ├── tutorial9 │ ├── tutorial9.html │ ├── tutorial9.png │ ├── tutorial9.txt │ ├── tutorial9_01.png │ ├── tutorial9_02.png │ ├── tutorial9_03.png │ ├── tutorial9_04.png │ └── tutorial9_05.png └── tutorials.txt └── tutorial ├── Ba3NbFe3Si2O14_chirality.m ├── CuV2O7.m ├── LuMnO3.cif ├── LuMnO3_spectrum.m ├── YIG.m ├── alpha-Cu2V2O7.cif ├── aniso_rotation.m ├── anneal_tutorial.m ├── ca2ruo4.m ├── damping_example.m ├── fit_example.m ├── helical_chain_infield.m ├── inpurity.m ├── tutorial22.m ├── tutorial23.m ├── tutorial26.m ├── tutorial28.m └── tutorial29.m /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.mat 3 | !icons.mat 4 | 5 | .DS_Store 6 | 7 | *.m~ 8 | 9 | docs/_site/ 10 | docs/.sass-cache/ 11 | .jekyll-metadata 12 | _pdf 13 | 14 | *.sublime-workspace -------------------------------------------------------------------------------- /Contents.m: -------------------------------------------------------------------------------- 1 | % SpinW 2 | % Version 4.0 (unreleased) 29-Nov-2017 3 | % 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![DOI](https://zenodo.org/badge/33274418.svg)](https://zenodo.org/badge/latestdoi/33274418) [![Twitter Follow](https://img.shields.io/twitter/follow/spinw4.svg?style=social&label=Follow)](https://twitter.com/intent/user?screen_name=spinw4) [![Github All Releases](https://img.shields.io/github/downloads/tsdev/spinw/total.svg)](https://github.com/tsdev/spinw/releases) 2 | 3 | 4 | 5 | 6 | **SpinW** (*spin-double-u*) is a Matlab library that can optimize magnetic structures using mean field theory and calculate spin wave dispersion and spin-spin correlation function for complex crystal and magnetic structures. For details check http://www.psi.ch/spinw. 7 | 8 | Keep up to date on announcements and more by following [@spinw4](https://twitter.com/intent/user?screen_name=spinw4) on Twitter. 9 | 10 | # Documentation 11 | * experimental and under construction, the address can change in the future 12 | * documentation of the master branch 13 | * use `swdoc`/`swhelp` instead of the Matlab built-in `doc`/`help` functions to get help on SpinW 14 | * can be also accessed from the browser: https://tsdev.github.io/spinwdoc/ 15 | -------------------------------------------------------------------------------- /dat_files/icons.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/dat_files/icons.mat -------------------------------------------------------------------------------- /dev/doctest2.m: -------------------------------------------------------------------------------- 1 | function doctest2() 2 | % Summary line. 3 | % 4 | % :code:`[b1, b2] = doctest2(a,b)` 5 | % 6 | % Extended description of function. 7 | % 8 | % Parameters 9 | % ---------- 10 | % a1: 11 | % Description of arg1. 12 | % a2: 13 | % Description of arg2. 14 | % 15 | % Returns 16 | % ------- 17 | % b1: 18 | % Description of return value. 19 | % b2: 20 | % Other output. 21 | % 22 | % Examples 23 | % -------- 24 | % This will calculate the spectrum:: 25 | % 26 | % doctest(1,2); 27 | % 28 | 29 | 1+1; -------------------------------------------------------------------------------- /dev/sw_counter.m: -------------------------------------------------------------------------------- 1 | function sw_counter(reset, text) 2 | % prints the number of function calls 3 | % 4 | % ### Syntax 5 | % 6 | % `sw_counter` 7 | % 8 | % `sw_counter(reset, text)` 9 | % 10 | % ### Description 11 | % 12 | % `sw_counter(reset, text)` prints the number of calls to this function. 13 | % 14 | % ### Input Arguments 15 | % 16 | % `reset` 17 | % : If `true` the counter is reset to zero. 18 | % 19 | % `text` 20 | % : Sets the text to print before the number, default value is `'The number 21 | % of function calls:'`. 22 | % 23 | 24 | persistent cnt 25 | 26 | if nargin == 0 27 | reset = 0; 28 | end 29 | 30 | if reset 31 | cnt = 0; 32 | else 33 | if isempty(cnt) 34 | cnt = 0; 35 | end 36 | cnt = cnt + 1; 37 | end 38 | 39 | if nargin < 2 40 | text = 'The number of function calls:'; 41 | end 42 | 43 | nT = numel(text); 44 | bb = repmat('\b',[1 nT+7]); 45 | 46 | if cnt == 0 47 | fprintf(['\n' text '%6d\n'],cnt); 48 | else 49 | fprintf([bb text '%6d\n'],cnt); 50 | end 51 | 52 | end -------------------------------------------------------------------------------- /dev/sw_initialize.m: -------------------------------------------------------------------------------- 1 | function sw_initialize() 2 | % initializes spinw by removing user entries from the symmetry.dat file 3 | % 4 | % SW_INITIALIZE() 5 | % 6 | % See also SPINW. 7 | % 8 | 9 | %cd(sw_rootdir); 10 | %m2html('mfiles','swfiles','htmldir','doc') 11 | %builddocsearchdb([sw_rootdir 'doc']); 12 | 13 | % clear symmetry.dat file 14 | symPath = [sw_rootdir 'dat_files' filesep 'symmetry.dat']; 15 | % Count the number of lines 16 | fid = fopen(symPath); 17 | fidNew = fopen([symPath '0'],'w'); 18 | 19 | 20 | if fid == -1 21 | error('spinw:sw_gensym:FileNotFound',['Symmetry definition file not found: '... 22 | regexprep(symPath,'\' , '\\\') '!']); 23 | end 24 | 25 | nLines = 1; 26 | % number of space group operators in symmetry.dat 27 | nOp = 231; 28 | 29 | while (~feof(fid)) && (nLines <= nOp) 30 | line = fgetl(fid); 31 | if nLines < nOp 32 | fprintf(fidNew,[line '\n']); 33 | else 34 | fprintf(fidNew,line); 35 | end 36 | nLines = nLines + 1; 37 | end 38 | fclose(fid); 39 | fclose(fidNew); 40 | 41 | % copy file 42 | delete(symPath); 43 | copyfile([symPath '0'],symPath); 44 | delete([symPath '0']); 45 | 46 | end -------------------------------------------------------------------------------- /dev/sw_notify.m: -------------------------------------------------------------------------------- 1 | function sw_notify(varargin) 2 | % sends notification in OSX 3 | % 4 | % SW_NOTIFY(message) 5 | % 6 | % SW_NOTIFY('option1',value1, ...) 7 | % 8 | % 9 | % The function can be used to show a notification when a calculation is 10 | % finished. Note that the notification only shows up if Matlab is not 11 | % the active window. 12 | % 13 | % Install terminal-notifier: 14 | % Using Ruby, you can install it through RubyGems: 15 | % $ [sudo] gem install terminal-notifier 16 | % You can also install it via Homebrew: 17 | % $ brew install terminal-notifier 18 | % 19 | % Options: 20 | % 21 | 22 | 23 | if ~ismac 24 | warning('sw_notify:WrongOS','The function only works in OSX!') 25 | return 26 | end 27 | 28 | path0 = ''; 29 | 30 | if nargin == 1 31 | param.message = varargin{1}; 32 | param.path = path0; 33 | param.group = 'spinw'; 34 | param.subtitle = 'SpinW'; 35 | param.sound = 'ping'; 36 | else 37 | inpForm.fname = {'message' 'path' 'group' 'subtitle' 'sound'}; 38 | inpForm.defval = {'Done!' path0 'spinw' 'SpinW' 'ping' }; 39 | inpForm.size = {[1 -1] [1 -2] [1 -3] [1 -4] [1 -5] }; 40 | inpForm.soft = {false true false false false }; 41 | 42 | param = sw_readparam(inpForm, varargin{:}); 43 | end 44 | 45 | cmd = [param.path 'terminal-notifier -message "' param.message '" -group "' param.group... 46 | '" -title "MATLAB" -sender com.mathworks.matlab -subtitle ' param.subtitle... 47 | ' -sound ' param.sound]; 48 | 49 | % execute bash_profile 50 | [~,~] = system(['source ~/.bash_profile && ' cmd]); 51 | 52 | end -------------------------------------------------------------------------------- /dev/sw_plotcell.m: -------------------------------------------------------------------------------- 1 | function varargout = sw_plotcell(dat,xLab,yLab,tLab,aRange,sc,depth) 2 | % plots cell structure with circles 3 | % 4 | % SW_PLOTCELL(dat,xLab,yLab,tLab,aRange,sc,depth) 5 | % 6 | 7 | if nargin<7 8 | depth = 0; 9 | end 10 | 11 | nDat = numel(dat.x); 12 | zMax = -inf; 13 | 14 | % find maximum data value 15 | for ii = 1:nDat 16 | zMax = max([abs(real(dat.z{ii}(:))); zMax]); 17 | end 18 | 19 | if nargin>4 20 | xMin = aRange(1); 21 | xMax = aRange(2); 22 | yMin = aRange(3); 23 | yMax = aRange(4); 24 | else 25 | xMin = min(dat.x)-max(diff(dat.x)); 26 | xMax = max(dat.x)+max(diff(dat.x)); 27 | yMin = inf; 28 | yMax = -inf; 29 | 30 | % find x and y range 31 | for ii = 1:nDat 32 | yMin = min([abs(real(dat.y{ii}(:))); yMin]); 33 | yMax = max([abs(real(dat.y{ii}(:))); yMax]); 34 | end 35 | end 36 | 37 | % radius of circles 38 | C = sw_circle([0 0 0]',[0 0 1]',1,300); 39 | 40 | if nargin<6 41 | sc = 0.02; 42 | rx = (xMax-xMin)*sc; 43 | ry = (yMax-yMin)*sc; 44 | 45 | Cx = C(1,:)*rx/zMax; 46 | Cy = C(2,:)*ry/zMax; 47 | elseif numel(sc)==1 48 | rx = (xMax-xMin)*sc; 49 | ry = (yMax-yMin)*sc; 50 | 51 | Cx = C(1,:)*rx/zMax; 52 | Cy = C(2,:)*ry/zMax; 53 | 54 | else 55 | Cx = C(1,:)*sc(1); 56 | Cy = C(2,:)*sc(2); 57 | 58 | end 59 | 60 | % draw circles 61 | for ii = 1:nDat 62 | for jj = 1:numel(dat.y{ii}) 63 | r = dat.z{ii}(jj); 64 | p(ii,jj) = patch(dat.x(ii)+Cx*r,dat.y{ii}(jj)+Cy*r,Cx*0+depth,'k'); 65 | hold on 66 | end 67 | end 68 | 69 | dy = (yMax-yMin)/20; 70 | axis([xMin xMax yMin-dy yMax+dy]); 71 | 72 | if nargin>1 73 | xlabel(xLab) 74 | end 75 | if nargin>2 76 | ylabel(yLab) 77 | end 78 | if nargin>3 79 | title(tLab) 80 | end 81 | 82 | if nargout > 0 83 | varargout{1} = p; 84 | end 85 | 86 | end -------------------------------------------------------------------------------- /docs/docgenerator/docgen.m: -------------------------------------------------------------------------------- 1 | %% setup help generator options 2 | 3 | swPath = {'swfiles/@spinw' 'swfiles' 'swfiles/+swplot' 'swfiles/@swpref' 'swfiles/+swsym' 'swfiles/+swfunc' 'swfiles/+ndbase'}; 4 | swr = sw_rootdir; 5 | swPath = cellfun(@(C)[swr C],swPath,'UniformOutput',false); 6 | swver = sw_version; 7 | outPath = '~/spinwdoc_git'; 8 | docPath = '~/spinw_git/docs'; 9 | upload = true; 10 | recalc = true; 11 | 12 | %% generate help 13 | 14 | %fun0 = {'swfiles' 'spinw' 'gm_planard' 'sw_version'}; 15 | %fun0 = {'swfiles' 'sw_egrid'}; 16 | fun0 = cell(1,0); 17 | 18 | clc 19 | doctree = sw_genhelp('sourcepath',swPath,'outpath',outPath,'docpath',docPath,'fun',fun0,'verstr',swver,'recalc',recalc,'upload',upload); 20 | 21 | 22 | %% get all help 23 | 24 | content = [doctree.content]; 25 | allhelp = {content.text}; 26 | isCont = [content.isContents]; 27 | 28 | for ii = 1:numel(allhelp) 29 | allhelp{ii} = cellfun(@(C)[C newline],allhelp{ii},'UniformOutput',false); 30 | allhelp{ii} = [allhelp{ii}{:}]; 31 | end 32 | 33 | %% generate all links 34 | 35 | pLink = cellfun(@(C)C.permalink,{content.frontmatter},'UniformOutput',false); 36 | fun = {content.fun}; 37 | 38 | %% replace function names with links 39 | 40 | for ii = 1:numel(pLink) 41 | allhelp = regexprep(allhelp,fun{ii},['[' fun{ii} '](' pLink{ii} ')']); 42 | end 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/docgenerator/sw_convdef.m: -------------------------------------------------------------------------------- 1 | function text0 = sw_convdef(text0,idx,foredit) 2 | % convert list into MD definitions 3 | 4 | if nargin<2 5 | idx = 2; 6 | end 7 | 8 | if nargin<3 9 | foredit = true; 10 | end 11 | 12 | % convert arguments and options into definitions 13 | %text0 = sec([sec.idx] == ii).text; 14 | % lines of definition 15 | defIdx = cellfun(@(C)~isempty(C) && C(1)~=' ' ,text0); 16 | %spaceIdx = cellfun(@(C)find(C==' ',1),text0(defIdx)); 17 | [spaceIdx, spaceEnd] = regexp(text0(defIdx),'\s+','once'); 18 | spaceEnd = round(mean(cell2mat(spaceEnd))); 19 | text0 = [text0;cell(1,numel(text0))]; 20 | fdefIdx = find(defIdx); 21 | for jj = 1:numel(fdefIdx) 22 | text0{2,fdefIdx(jj)} = [':' text0{1,fdefIdx(jj)}(spaceEnd:end)]; 23 | if idx == 3 24 | textTemp = [ '`''' text0{1,fdefIdx(jj)}(1:(spaceIdx{jj}-1)) '''`']; 25 | else 26 | textTemp = [ '`' text0{1,fdefIdx(jj)}(1:(spaceIdx{jj}-1)) '`']; 27 | end 28 | 29 | if foredit 30 | text0{1,fdefIdx(jj)} = [newline '% ' textTemp]; 31 | else 32 | text0{1,fdefIdx(jj)} = [newline textTemp]; 33 | end 34 | end 35 | text0(1,~defIdx) = cellfun(@(C)[' ' C(spaceEnd:end)],text0(1,~defIdx),'UniformOutput',false); 36 | text0 = text0(cellfun(@(C)~isempty(C),text0(:))); 37 | 38 | end -------------------------------------------------------------------------------- /docs/docgenerator/sw_rmspace.m: -------------------------------------------------------------------------------- 1 | function str = sw_rmspace(str) 2 | % remove leading spaces from a cell of strings 3 | 4 | % remove empty lines 5 | str(cellfun(@(C)isempty(C),str)) = []; 6 | % lines that begin with space 7 | 8 | if all(cellfun(@(C)isempty(C),regexp(str,'^\S','once'))) 9 | sIdx = cellfun(@(C)C(1)==' ' && any(C~=' '),str); 10 | % minimum space 11 | nSpace = min(cellfun(@(C)find(diff(C==' '),1,'first'),str(sIdx))); 12 | % remove leading spaces 13 | str(sIdx) = cellfun(@(C)C(nSpace+1:end),str(sIdx),'UniformOutput',false); 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /docs/resources/file.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/docs/resources/file.pdf -------------------------------------------------------------------------------- /docs/resources/spinw_cheatsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/docs/resources/spinw_cheatsheet.png -------------------------------------------------------------------------------- /docs/source/04_magstr.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Magnetic structure 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: magstr.html 6 | summary: Representation of magnetic structures and optimization 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | ## Complex magnetic representation 12 | 13 | If the expectation value of the spin operator is non-zero ($\langle \mathbf{S}\rangle\neq 0$) the spin vectors will make a pattern that can be mathematically best described by its Fourier transform. A concise description of this topic can be found in the article [A. Wills: Magnetic structures and their determination using group theory](https://doi.org/10.1051/jp4:2001906). 14 | 15 | To define a magnetic structure first we need to find the correct magnetic unit cell. Although in symmetry analysis of magnetic structures the magnetic and the crystallographic unit cells are identical, in SpinW no symmetry analysis of magnetic structures is not possible. SpinW will analyze magnetic structures based on the classical energy of a given spin Hamiltonian. It is also possible in SpinW to define a magnetic supercell, that is the multiples of the crystallographic unit cell. This can help sometimes to optimize the spin wave calculation and gives more flexibility to test new models without changing the crystal structure. The magnetic structure is stored in the [spinw.mag_str] property of the SpinW class with the `nExt` subfield (`int32` type) storing the size of the magnetic supercell in units of the crystallographic unit cell. By default the magnetic supercell is identical to the crystallographic one which is given by `nExt=[1 1 1]`. 16 | 17 | Once we defined the magnetic unit cell, the magnetic structure is given by a complex spin vector on each magnetic site and a propagation vector. The real spin vector at a given site $i$ in the $l$th unit cell is given by 18 | 19 | 20 | 21 | 22 | ## Magnetic lattice 23 | 24 | ## Single-k representation 25 | -------------------------------------------------------------------------------- /docs/source/05_hamiltonian.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Spin Hamiltonian 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: hamiltonian.html 6 | summary: Definition of the complete spin Hamiltonian 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | ## General spin Hamiltonian 12 | ## Bonds 13 | ## General matrices 14 | ## Single ion properties 15 | ## Tensors 16 | ## Classical ground state -------------------------------------------------------------------------------- /docs/source/06_symmetry.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Symmetry and tensors 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: symmetry.html 6 | summary: Representation of space groups and coordinate systems 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | 12 | ## Symmetry operators 13 | ## Space groups 14 | 15 | -------------------------------------------------------------------------------- /docs/source/07_spinwave.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Solvers 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: spinwave.html 6 | summary: Solvers to calculate spin-spin correlation function 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | * linear spin wave solver 12 | * spin-spin correlation function 13 | * powder spectrum -------------------------------------------------------------------------------- /docs/source/08_spec.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Correlation function post processing and fitting 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: spec.html 6 | summary: Post processing the spin-spin correlation function 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | 12 | * cross section calculation 13 | * resolution convolution 14 | * fitting spin wave spectrum -------------------------------------------------------------------------------- /docs/source/09_symbolic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Symbolic calculation 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: symbolic.html 6 | summary: Symbolic spin wave calculation mode 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | * defining a symbolic model 12 | * analytical solution to the ground state 13 | * solving and analysing spin wave spectrum -------------------------------------------------------------------------------- /docs/source/10_onemorething.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Usefull functions in neutron/x-ray scattering 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: onemorething.html 6 | summary: List of usefull functions that are not directly connected to SpinW 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | * converters 12 | * etc. -------------------------------------------------------------------------------- /docs/source/11_contribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to contribute and discuss 3 | keywords: docs 4 | sidebar: sw_sidebar 5 | permalink: contribute.html 6 | summary: 7 | folder: documentation 8 | mathjax: true 9 | --- 10 | 11 | ## Help 12 | ## Online help 13 | ## How to contribute 14 | 15 | 16 | {% include links.html %} 17 | -------------------------------------------------------------------------------- /docs/source/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Documentation for SpinW 3 | keywords: homepage 4 | sidebar: sw_sidebar 5 | permalink: index.html 6 | summary: 7 | mathjax: true 8 | --- 9 | 10 | This is the **official documentation** of SpinW. The documentation contains the general description of the code (under the "Documentation" menu) and the function reference for all SpinW classes, packages and function. 11 | 12 | SpinW is a Matlab library that can define spin Hamiltonians including general quadratic exchange interactions, single ion anistropy and external magnetic field, applying space group symmetries and solve the resulting equation of motion. 13 | 14 | SpinW constist of a [spinw](spinw) class, that stores all parameters of the spin Hamiltonian as a set of properties and has several methods to prepare the Hamiltonian and calculate the spin-spin correlation function. 15 | 16 | The [swfiles](swfiles) folder contains additional function that can be used to post-process the calculated spin-spin correlation function, e.g. calculating cross section or convoluting instrumental resolution. 17 | 18 | The [swplot](swplot) package contains functions that can visualize the spin Hamiltonian as 3D plot including bonds, magnetic moments and exchange interactions. 19 | 20 | The [swpref](swpref) package stores persistent preferences, [swsym](swsym) package manipulates space group operators and [swfunc](swfunc) package contains spectral peak shape functions. 21 | 22 | **Feel free to ask questions & requests!** 23 | 24 | 25 | {% include links.html %} -------------------------------------------------------------------------------- /external/bsxfunsym.m: -------------------------------------------------------------------------------- 1 | function C = bsxfunsym(op,A,B) 2 | % C = BSXFUNSYM(@op,A,B) extends the bsxfun to sym class variables, for any 3 | % other input type it calls the standrd bsxfun function. 4 | % 5 | % See also sym, syms. 6 | % 7 | 8 | if ~isa(A,'sym') && ~isa(B,'sym') 9 | C = bsxfun(op,A,B); 10 | return 11 | elseif ~isa(B,'sym') 12 | B = sym(B); 13 | elseif ~isa(A,'sym') 14 | A = sym(A); 15 | end 16 | 17 | nA = ndims(A); 18 | nB = ndims(B); 19 | 20 | nD = max(nA,nB); 21 | 22 | sA = ones(1,nD); 23 | sB = ones(1,nD); 24 | 25 | sA(1:nA) = size(A); 26 | sB(1:nB) = size(B); 27 | 28 | if ~all(sA) || ~all(sB) 29 | C = A; 30 | else 31 | % repeat dimensions of A where B is non-one, A is one 32 | rA = (sA==1) & (sB~=1); 33 | rB = (sB==1) & (sA~=1); 34 | 35 | sA(~rB) = 1; 36 | sB(~rA) = 1; 37 | 38 | C = op(repmat(A,sB),repmat(B,sA)); 39 | end 40 | 41 | end -------------------------------------------------------------------------------- /external/changem.m: -------------------------------------------------------------------------------- 1 | function A = changem(A,newval,oldval) 2 | % vectorized version of changem 3 | % 4 | % B = CHANGEM(A,newval,oldval) 5 | % 6 | % The function changes the old values in A to the new values pair wise. 7 | % 8 | 9 | [idx1, idx2] = ismember(A,oldval); 10 | A(idx1) = newval(idx2(idx1)); 11 | 12 | end -------------------------------------------------------------------------------- /external/chol_omp/chol_omp.m: -------------------------------------------------------------------------------- 1 | % calculates the Cholesky factorisation of a stack of matrices 2 | % 3 | % R = CHOL_OMP(M); - Errors if M not positive definite. 4 | % [R,P] = CHOL_OMP(M); - No error, R is PxP. 5 | % L = CHOL_OMP(M,'lower'); 6 | % [L,P] = CHOL_OMP(M,'lower'); 7 | % 8 | % The code uses Lapack calls and OpenMP to speed up the calculation. Unlike 9 | % the matlab built-in this mex does not handle sparse matrices. 10 | % 11 | % Input: 12 | % 13 | % M Matrix with dimensions of [N N L], M=R'*R=L*L' 14 | % 15 | % Options: 16 | % 17 | % tol Tolerance, if the input is not positive definite, the tol value 18 | % will be added to each NxN matrix diagonal. 19 | % Colpa The output is redefined: 20 | % [K2,invK] = CHOL_OMP(M,'Colpa'); 21 | % where K2 = (R*gComm*R') Hermitian matrix with 22 | % gComm = [1...1,-1...1] is the commutator and invK = inv(R). 23 | % 24 | % 25 | % Note this function does not check for symmetry. Also note that we do not 26 | % truncate the output matrix if the input is not positive definite, unlike 27 | % the built-in. i.e. R or L is always of size (N x N) not (P x P). 28 | % 29 | % This is a MEX-file for MATLAB. 30 | % 31 | % Original Author: M. D. Le [duc.le@stfc.ac.uk] 32 | 33 | -------------------------------------------------------------------------------- /external/chol_omp/chol_omp.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/chol_omp/chol_omp.mexa64 -------------------------------------------------------------------------------- /external/chol_omp/chol_omp.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/chol_omp/chol_omp.mexmaci64 -------------------------------------------------------------------------------- /external/chol_omp/chol_omp.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/chol_omp/chol_omp.mexw64 -------------------------------------------------------------------------------- /external/clipboardimage.m: -------------------------------------------------------------------------------- 1 | function rgbData = clipboardimage() 2 | % returns the RGB image from clipboard 3 | % 4 | % rgbData = CLIPBOARDIMAGE() 5 | % 6 | % The function at the moment works with print screen images on OXS and 7 | % Windows. 8 | % 9 | % Output: 10 | % 11 | % rgbData Matrix with dimensions W x H x 3, containing the RGB values 12 | % from the clipboard. Empty matrix if the clipboard doesn't 13 | % contain image data. 14 | % 15 | % Example: 16 | % 17 | % figure 18 | % imshow(clipboardimage) 19 | % 20 | 21 | % Based on code from Saurabh Kumar, saurabhkumar_@rediffmailcom 22 | % 23 | 24 | tKit = java.awt.Toolkit.getDefaultToolkit(); 25 | % get clipboard handle 26 | cbrd = tKit.getSystemClipboard(); 27 | reqObj = java.lang.Object; 28 | img = cbrd.getContents(reqObj); 29 | Dflavor = img.getTransferDataFlavors(); 30 | imgDfvr = java.awt.datatransfer.DataFlavor.imageFlavor; 31 | 32 | % only import if the clipboard stores image data 33 | if Dflavor(1).equals(imgDfvr) 34 | % got image 35 | jImage = img.getTransferData(java.awt.datatransfer.DataFlavor.imageFlavor); 36 | % dimensions of the image 37 | imSize = [jImage.getHeight jImage.getWidth]; 38 | % convert the javs image to Matlab matrix 39 | cmykDat = double(permute(reshape(typecast(jImage.getData.getDataStorage, 'uint8'), 4, imSize(2), imSize(1)),[3 2 1]))/255; 40 | % convert CMYK to RGB the transposed image 41 | rgbData = bsxfun(@times,cmykDat(:,:,[3 2 1]),cmykDat(:,:,4)); 42 | else 43 | % return empty matrix if there is no image 44 | rgbData = []; 45 | end -------------------------------------------------------------------------------- /external/colormap/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Ander Biguri 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /external/eig_omp/eig_omp.m: -------------------------------------------------------------------------------- 1 | % Diagonalises a stack of matrices 2 | % 3 | % [V, D] = EIG_OMP(H,'orth','sort') 4 | % 5 | % The code uses Lapack calls and OpenMP to speed up the calculation. 6 | % 7 | % Input: 8 | % 9 | % H Matrix with dimensions [N N L]. 10 | % 11 | % Options: 12 | % 13 | % orth Orthogonalize the eigenvectors in case of degenerate eigenvalues 14 | % for non-Hermitian matrices (for Hermitian matrices the eigenvectors 15 | % are always orthogonal). 16 | % sort Sort the eigenvalues in increasing order (and sort the 17 | % corresponding eigenvectors as well). 18 | % 19 | % Output: 20 | % 21 | % V Matrix with dimesions [N N L], contains the eigenvectors for each 22 | % NxN matrix in columns. 23 | % D Matrix with dimensions [N L], each column contain the corresponding 24 | % eigenvalues. 25 | % 26 | % This is a MEX-file for MATLAB. 27 | % 28 | % In addition the the mexFunction, the following subsidiary functions are 29 | % defined: 30 | % 31 | % void fliplr() - Flips matrix by columns 32 | % void quicksort() - Quicksort algorithm, returns indices 33 | % void sort() - Sort and permutes eigenvalue/vectors 34 | % void orth() - Orthogonalises degenerate eigenvecs 35 | % 36 | % Original Author: M. D. Le [duc.le@stfc.ac.uk] 37 | -------------------------------------------------------------------------------- /external/eig_omp/eig_omp.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/eig_omp/eig_omp.mexa64 -------------------------------------------------------------------------------- /external/eig_omp/eig_omp.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/eig_omp/eig_omp.mexmaci64 -------------------------------------------------------------------------------- /external/eig_omp/eig_omp.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/eig_omp/eig_omp.mexw64 -------------------------------------------------------------------------------- /external/findmax.m: -------------------------------------------------------------------------------- 1 | function varargout = findmax(X,varargin) 2 | % find the maximum valued element in a vector 3 | % 4 | % I = FINDMAX(X,val) 5 | % I = FINDMAX(X,val,k) 6 | % I = FINDMAX(X,val,k,direction) 7 | % 8 | % [row,col] = FINDMAX(___) 9 | % [row,col,v] = FINDMAX(___) 10 | % 11 | % It has the same parameters and output as find(). 12 | % 13 | % See also find. 14 | 15 | switch nargout 16 | case 0 17 | varargout{1} = find(X==max(X),varargin{:}); 18 | case 1 19 | varargout{1} = find(X==max(X),varargin{:}); 20 | case 2 21 | [varargout{1},varargout{2}] = find(X==max(X),varargin{:}); 22 | case 3 23 | [row,col] = find(X==max(X),varargin{:}); 24 | 25 | varargout{1} = row; 26 | varargout{2} = col; 27 | varargout{3} = X(sub2ind(size(X),row,col)); 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /external/findmin.m: -------------------------------------------------------------------------------- 1 | function varargout = findmin(X,varargin) 2 | % find the minimum valued element in a vector 3 | % 4 | % I = FINDMIN(X,val) 5 | % I = FINDMIN(X,val,k) 6 | % I = FINDMIN(X,val,k,direction) 7 | % 8 | % [row,col] = FINDMIN(___) 9 | % [row,col,v] = FINDMIN(___) 10 | % 11 | % It has the same parameters and output as find(). 12 | % 13 | % See also find. 14 | 15 | switch nargout 16 | case 0 17 | varargout{1} = find(X==min(X),varargin{:}); 18 | case 1 19 | varargout{1} = find(X==min(X),varargin{:}); 20 | case 2 21 | [varargout{1},varargout{2}] = find(X==min(X),varargin{:}); 22 | case 3 23 | [row,col] = find(X==min(X),varargin{:}); 24 | 25 | varargout{1} = row; 26 | varargout{2} = col; 27 | varargout{3} = X(sub2ind(size(X),row,col)); 28 | end 29 | 30 | end -------------------------------------------------------------------------------- /external/findval.m: -------------------------------------------------------------------------------- 1 | function varargout = findval(X,val,varargin) 2 | % find the an element in a vector that is closest to a given value 3 | % 4 | % I = FINDVAL(X,val) 5 | % I = FINDVAL(X,val,k) 6 | % I = FINDVAL(X,val,k,direction) 7 | % 8 | % [row,col] = FINDVAL(___) 9 | % [row,col,v] = FINDVAL(___) 10 | % 11 | % It has the same parameters and output as find() plus the extra val value. 12 | % 13 | % See also find. 14 | 15 | switch nargout 16 | case 0 17 | varargout{1} = find(abs(X-val)==min(abs(X-val)),varargin{:}); 18 | case 1 19 | varargout{1} = find(abs(X-val)==min(abs(X-val)),varargin{:}); 20 | case 2 21 | [varargout{1},varargout{2}] = find(abs(X-val)==min(abs(X-val)),varargin{:}); 22 | case 3 23 | [row,col] = find(abs(X-val)==min(abs(X-val)),varargin{:}); 24 | 25 | varargout{1} = row; 26 | varargout{2} = col; 27 | varargout{3} = X(sub2ind(size(X),row,col)); 28 | end 29 | 30 | end -------------------------------------------------------------------------------- /external/fprintf0.m: -------------------------------------------------------------------------------- 1 | function fprintf0(fid,varargin) 2 | % same as fprintf, expect if fid is zero, will not produce output. 3 | 4 | if fid~=0 5 | fprintf(fid,varargin{:}); 6 | end 7 | 8 | end -------------------------------------------------------------------------------- /external/gcdv.m: -------------------------------------------------------------------------------- 1 | function g = gcdv(v) 2 | % calculates the greates common divisor of a set of numbers 3 | % 4 | % G = VECGCD(V) 5 | % 6 | % is the greatest common divisor of the elements of the integer vector V. V 7 | % must be a row or a column vector of integers. We define gcd([]) = 1 and 8 | % gcd([0 0 ... 0]) = 0. 9 | % 10 | 11 | [r,c] = size(v); 12 | if (r>1) && (c>1) 13 | error('v must be a row or a column vector'); 14 | end 15 | 16 | % vecgcd([]) = 1 17 | if isempty(v) 18 | g = 1; 19 | return 20 | end 21 | 22 | % vecgcd([0 0 ... 0]) = 0 23 | if all(v==0) 24 | g = 0; 25 | return 26 | end 27 | 28 | 29 | % I want a to work with a row vector 30 | if c==1 31 | v = v'; 32 | end 33 | 34 | % remove the zeros and sort 35 | v = v(v>0); 36 | v = sort(abs(v),2,'descend'); 37 | 38 | i = 1; 39 | j = length(v); 40 | while i < j 41 | x = mod(v(i), v(j)); 42 | x = min([x, v(j) - x]); 43 | % x|v(i), x|v(j), g|x 44 | % and x is smaller than min[v] 45 | 46 | i = i + 1; % "remove" v(i) 47 | if x > 0 % if x > 0 append it to v 48 | j = j + 1; 49 | v = [v, x]; %#ok 50 | end 51 | end 52 | 53 | % x = v(i) 54 | % x divides v(1), v(2) , ..., v(end) 55 | % g|x 56 | % hence g = x. 57 | 58 | g = v(i); 59 | 60 | end -------------------------------------------------------------------------------- /external/gobjects0.m: -------------------------------------------------------------------------------- 1 | function out = gobjects(varargin) 2 | % use double insted of graphics handle class for Matlab prior 8.1 3 | 4 | if verLessThan('matlab','8.1') 5 | out = zeros(varargin{:}); 6 | else 7 | out = gobjects(varargin{:}); 8 | end 9 | 10 | end -------------------------------------------------------------------------------- /external/iindex.m: -------------------------------------------------------------------------------- 1 | function x = iindex(x,varargin) 2 | % inline indexing using parenthesis or braces 3 | 4 | switch varargin{1} 5 | case '()' 6 | x = x(varargin{2:end}); 7 | case '{}' 8 | x = x{varargin{2:end}}; 9 | otherwise 10 | end 11 | 12 | end -------------------------------------------------------------------------------- /external/makecolormap.m: -------------------------------------------------------------------------------- 1 | function cMap = makecolormap(varargin) 2 | %% MAKECOLORMAP makes smoothly varying colormaps 3 | % a = makeColorMap(beginColor, middleColor, endColor, numSteps); 4 | % a = makeColorMap(beginColor, endColor, numSteps); 5 | % a = makeColorMap(beginColor, middleColor, endColor); 6 | % a = makeColorMap(beginColor, endColor); 7 | % 8 | % all colors are specified as RGB triples 9 | % numSteps is a scalar saying howmany points are in the colormap 10 | % 11 | % Examples: 12 | % 13 | % peaks; 14 | % a = makeColorMap([1 0 0],[1 1 1],[0 0 1],40); 15 | % colormap(a) 16 | % colorbar 17 | % 18 | % peaks; 19 | % a = makeColorMap([1 0 0],[0 0 1],40); 20 | % colormap(a) 21 | % colorbar 22 | % 23 | % peaks; 24 | % a = makeColorMap([1 0 0],[1 1 1],[0 0 1]); 25 | % colormap(a) 26 | % colorbar 27 | % 28 | % peaks; 29 | % a = makeColorMap([1 0 0],[0 0 1]); 30 | % colormap(a) 31 | % colorbar 32 | % 33 | % Reference: 34 | % A. Light & P.J. Bartlein, "The End of the Rainbow? Color Schemes for 35 | % Improved Data Graphics," Eos,Vol. 85, No. 40, 5 October 2004. 36 | % http://geography.uoregon.edu/datagraphics/EOS/Light&Bartlein_EOS2004.pdf 37 | % 38 | 39 | defaultNum = 128; 40 | 41 | sz = cellfun('prodofsize',varargin); 42 | 43 | constraits = vertcat(varargin{sz == 3}); 44 | steps = [varargin{sz == 1}]; 45 | 46 | numcstr = size(constraits,1); 47 | numsteps = numel(steps); 48 | 49 | if numsteps < 1 50 | steps = round(diff(linspace(1,defaultNum+1,numcstr))); 51 | elseif numsteps == 1 52 | steps = round(diff(linspace(1,steps+1,numcstr))); 53 | elseif numsteps > numcstr-1 54 | steps = steps(1:numcstr-1); 55 | elseif numcstr-1 ~= numsteps 56 | steps = round(diff(linspace(1,defaultNum+1,numcstr))); 57 | end 58 | 59 | steps(1:end-1) = steps(1:end-1)+1; 60 | 61 | cMap = []; 62 | for k=1:numcstr-1 63 | cMap = [cMap(1:end-1,:); interpMap(constraits(k,:), constraits(k+1,:), steps(k))]; 64 | end 65 | 66 | end 67 | 68 | function cMap = interpMap(colorStart, colorEnd, n) 69 | cMap = zeros(n,3); 70 | for i = 1:3 71 | cMap(:,i) = linspace(colorStart(i), colorEnd(i), n); 72 | end 73 | end -------------------------------------------------------------------------------- /external/mdiagonal.m: -------------------------------------------------------------------------------- 1 | function A = mdiag(A,dim) 2 | % Returns the diagonal elements along two selected dimensions. 3 | % 4 | % Input: 5 | % A Multidimensional input array. 6 | % dim Contains two number, that selects two dimensions. 7 | % 8 | % The diagonal is the diagonal of every A(... dim(1)...dim(2)...) matrix. 9 | % The result is contracted along dim(2). 10 | % 11 | % The default value for dim is dim = [1 2]. 12 | % 13 | % Examples: 14 | % For 2D matrices mmat is identical to the Matlab built-in diag: 15 | % A = [1 2; 3 4]; 16 | % C = mdiag(A) 17 | % 18 | % C will be [1;4]. 19 | % 20 | % For multidimensional arrays: 21 | % A = repmat([1 2; 3 4],[1 1 3]); 22 | % B = mdiag(A,[1 2]) 23 | % B will be an array with dimensions of 2x3: [1 1 1;4 4 4]. 24 | % 25 | 26 | if nargin == 0 27 | help mdiag; 28 | return; 29 | end 30 | 31 | if (nargin < 2) 32 | dim = [1 2]; 33 | end 34 | 35 | if numel(dim)~=2 36 | error('mdiag:WrongInput','dim has to be a two element array!'); 37 | end 38 | 39 | 40 | nD = ndims(A); 41 | 42 | permIdx = [dim find(~ismember(1:nD,dim))]; 43 | 44 | A = permute(A,permIdx); 45 | sA = size(A); 46 | 47 | B = repmat(eye(sA(1:2)),[1 1 sA(3:end)]); 48 | 49 | A = sum(A.*B,2); 50 | 51 | % permute back 52 | permIdx2 = 1:nD; 53 | permIdx2(permIdx) = permIdx2; 54 | permIdx2 = [permIdx2 permIdx2(dim(2))]; 55 | permIdx2(dim(2)) = []; 56 | 57 | A = permute(A,permIdx2); 58 | 59 | end -------------------------------------------------------------------------------- /external/mtimesx/mtimesx.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/mtimesx/mtimesx.c -------------------------------------------------------------------------------- /external/mtimesx/mtimesx.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/mtimesx/mtimesx.m -------------------------------------------------------------------------------- /external/mtimesx/mtimesx.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/mtimesx/mtimesx.mexa64 -------------------------------------------------------------------------------- /external/mtimesx/mtimesx.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/mtimesx/mtimesx.mexmaci64 -------------------------------------------------------------------------------- /external/mtimesx/mtimesx.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/mtimesx/mtimesx.mexw64 -------------------------------------------------------------------------------- /external/mtimesx/mtimesx_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, James Tursa 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /external/pmat.m: -------------------------------------------------------------------------------- 1 | function Mpad = pmat(M,dims,pVal) 2 | % pads matrix to the required dimensions with a given value 3 | % 4 | % Mpad = PMAT(M,dims,{pVal}) 5 | % 6 | % The output M is padded with zeros or the value given by pVal. If dims 7 | % define a smaller dimension than the input matrix, the matrix gets cutted. 8 | % 9 | % Input: 10 | % 11 | % M Input matrix with arbitrary dimensions. 12 | % dims Row vector, gives the dimensions of the output matrix. 13 | % pVal Value that is used for padding, default is 0. 14 | % 15 | % Output: 16 | % 17 | % Mpad Output matrix with the padded values. 18 | % 19 | 20 | % create empty matrix with the padded value 21 | Mpad = zeros([dims 1])+pVal; 22 | 23 | % dimensions of the input matrix 24 | dimi = size(M); 25 | if numel(dimi)> str = strjoin({'this','is','a','cell','array'}) 19 | % str = 20 | % this is a cell array 21 | % 22 | % >> str = strjoin([1,2,2],'_') 23 | % str = 24 | % 1_2_2 25 | % 26 | % >> str = strjoin({1,2,2,'string'},'\t') 27 | % str = 28 | % 1 2 2 string 29 | % 30 | % Default separator modified by S.T. 30.07.2014 31 | % 32 | 33 | if nargin < 2 34 | separator = ' '; 35 | end 36 | 37 | assert(ischar(separator), 'Invalid separator input: %s', class(separator)); 38 | separator = strrep(separator, '%', '%%'); 39 | 40 | output = ''; 41 | if ~isempty(input) 42 | if ischar(input) 43 | input = cellstr(input); 44 | end 45 | if isnumeric(input) || islogical(input) 46 | output = [repmat(sprintf(['%.15g', separator], input(1:end-1)), ... 47 | 1, ~isscalar(input)), ... 48 | sprintf('%.15g', input(end))]; 49 | elseif iscellstr(input) 50 | output = [repmat(sprintf(['%s', separator], input{1:end-1}), ... 51 | 1, ~isscalar(input)), ... 52 | sprintf('%s', input{end})]; 53 | elseif iscell(input) 54 | output = strjoin(cellfun(@(x)strjoin(x, separator), input, ... 55 | 'UniformOutput', false), ... 56 | separator); 57 | else 58 | error('strjoin:invalidInput', 'Unsupported input: %s', class(input)); 59 | end 60 | end 61 | end -------------------------------------------------------------------------------- /external/strjoin_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Kota Yamaguchi 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /external/strsplit_license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, Dahua Lin 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /external/strword.m: -------------------------------------------------------------------------------- 1 | function out = strword(str, idx, last) 2 | % extract words separated by whitespace from string 3 | % 4 | % out = strword(str, idx, {last}) 5 | % 6 | % Input: 7 | % 8 | % str String input. 9 | % idx indexes of the words to be extracted. 10 | % last If true, the last word is given if idx contains an element 11 | % larger than the word count, if flase an empty string. 12 | % Default is false. 13 | % 14 | % Output: 15 | % 16 | % out Cell contains the extracted words in the order idx is give. 17 | % 18 | % Example: 19 | % 20 | % strword(' one two three four',[4 1]) 21 | % the output will be: {'four' 'one'}. 22 | % 23 | 24 | if nargin < 3 25 | last = false; 26 | end 27 | 28 | str = strsplit(str); 29 | wordIdx = find(cellfun(@numel,str)); 30 | 31 | out = cell(1,numel(idx)); 32 | 33 | for ii = 1:numel(idx) 34 | 35 | if wordIdx(end) < idx(ii) 36 | if last 37 | out{ii} = str{wordIdx(end)}; 38 | else 39 | out{ii} = ''; 40 | end 41 | else 42 | idxSel = idx(ii); 43 | out{ii} = str{wordIdx(idxSel)}; 44 | end 45 | 46 | end 47 | 48 | end 49 | -------------------------------------------------------------------------------- /external/sumargs.m: -------------------------------------------------------------------------------- 1 | function S = sumargs(varargin) 2 | % sums up all arguments 3 | 4 | S = varargin{1}; 5 | 6 | for ii = 2:nargin 7 | S = S + varargin{ii}; 8 | end 9 | 10 | end -------------------------------------------------------------------------------- /external/sumn.m: -------------------------------------------------------------------------------- 1 | function A = sumn(A,dim, varargin) 2 | % sum of array elements along multiple dimensions 3 | % 4 | % S = SUMN(A,dim,...) 5 | % 6 | % Works the same way as the Matlab built-in sum() function, but it can do 7 | % summation along multiple dimensions with a single call. 8 | % 9 | % See also SUM. 10 | % 11 | 12 | if nargin == 0 13 | help sumn 14 | return 15 | end 16 | 17 | if nargin == 1 18 | % sum along the first non-singleton dimension 19 | dim = find(size(A)>1,1,'first'); 20 | end 21 | 22 | % loop over all summed dimensions 23 | for ii = 1:numel(dim) 24 | A = sum(A,dim(ii),varargin{:}); 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /external/sumsym.m: -------------------------------------------------------------------------------- 1 | function sumA = sumsym(A,varargin) 2 | % sums up matrices containing symbolic variables 3 | % 4 | % sumA = SUMSYM(A,dim) 5 | % 6 | % The function sums up matrices containing symbolic variables in arbitrary 7 | % dimensions, for any other input type it calls the standard sum function. 8 | % 9 | % See also sym, syms. 10 | % 11 | 12 | if ~isa(A,'sym') 13 | sumA = sum(A,varargin{:}); 14 | return 15 | end 16 | 17 | if nargin > 1 18 | dim = varargin{1}; 19 | else 20 | dim = find(size(A)>1,1,'first'); 21 | if isempty(dim) 22 | sumA = A; 23 | return 24 | end 25 | end 26 | 27 | nSum = size(A,dim); 28 | 29 | nA = ndims(A); 30 | dimA = 1:nA; 31 | dimA(1) = dim; 32 | dimA(dim) = 1; 33 | 34 | A = permute(A,dimA); 35 | sA = size(A); 36 | 37 | sA(1) = 1; 38 | 39 | 40 | sumA = A(1,:); 41 | 42 | if nSum > 1 43 | for ii = 2:nSum 44 | sumA = sumA + A(ii,:); 45 | end 46 | end 47 | 48 | sumA = reshape(sumA,sA); 49 | 50 | sumA = permute(sumA,dimA); 51 | 52 | end -------------------------------------------------------------------------------- /external/yaml/README: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | Matlab YAML library 5 | 6 | This package contains Matlab class to serialize/decode matlab object in 7 | yaml format. The software uses SnakeYAML java class to convert yaml to 8 | java object and then translates it into Matlab object. 9 | 10 | 11 | Kota Yamaguchi 2011 12 | 13 | 14 | Usage 15 | ----- 16 | 17 | Make sure YAML.m is in your matlab path. 18 | 19 | To serialize matlab object: 20 | 21 | >> X = struct('matrix', rand(3,4), 'char', 'hello'); 22 | >> S = YAML.dump(X); 23 | >> disp(S); 24 | matrix: 25 | - [0.9571669482429456, 0.14188633862721534] 26 | - [0.4853756487228412, 0.421761282626275] 27 | - [0.8002804688888001, 0.9157355251890671] 28 | char: hello 29 | 30 | To decode yaml string: 31 | 32 | >> X = YAML.load(S); 33 | >> disp(X) 34 | matrix: [3x2 double] 35 | char: 'hello' 36 | 37 | 38 | Limitation 39 | ---------- 40 | * Currently the software doesn't support N-D array. 41 | * Due to the multiple ways to represent an array in Matlab (i.e., numeric 42 | array, cell array, or struct array), it is not possible to represent 43 | everything in compatible format. The software converts cell array of 44 | numbers or struct to numeric array or struct array when possible. 45 | 46 | License 47 | ------- 48 | You may redistribute this software under BSD license. You must follow 49 | Apache license 2.0 to redistribute snakeyaml attached under java/ 50 | directory. 51 | 52 | 53 | See also 54 | -------- 55 | snakeyaml: http://code.google.com/p/snakeyaml/ 56 | yamlmatlab: http://code.google.com/p/yamlmatlab/ 57 | -------------------------------------------------------------------------------- /external/yaml/java/snakeyaml-1.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/yaml/java/snakeyaml-1.18.jar -------------------------------------------------------------------------------- /external/yaml/java/snakeyaml-1.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/external/yaml/java/snakeyaml-1.9.jar -------------------------------------------------------------------------------- /spinw3_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/spinw3_logo.png -------------------------------------------------------------------------------- /spinw3_logo_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/spinw3_logo_square.png -------------------------------------------------------------------------------- /spinw_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/spinw_logo.png -------------------------------------------------------------------------------- /swfiles/+ndbase/Contents.m: -------------------------------------------------------------------------------- 1 | % package for basic data analysis 2 | % 3 | % The library contains fundamental building blocks for a future data 4 | % analysis library. 5 | % 6 | % ### Files 7 | % ndbase.histn 8 | % ndbase.lm 9 | % ndbase.pso 10 | % ndbase.simplex 11 | % ndbase.source 12 | -------------------------------------------------------------------------------- /swfiles/+ndbase/corrphon.m: -------------------------------------------------------------------------------- 1 | function d2ddat = corrphon(d2ddat, varargin) 2 | % subtract incoherent phonons from magnetic data in d2d object 3 | % 4 | % NDBASE.CORRPHON(d2d,'option1',value1,...) 5 | % 6 | % Options: 7 | % 8 | % qphon Q-range where the phonon background is to be fitted in 9 | % units of A^-1. Recommended range is above 4 A^-1, where the 10 | % magnetic signal is negligible due to the form factor. It is 11 | % also possible to given an upper value. For no upper limit, 12 | % use inf. Default value is [4 5]. 13 | % 14 | 15 | inpForm.fname = {'qphon'}; 16 | inpForm.defval = {[4 5] }; 17 | inpForm.size = {[1 2] }; 18 | 19 | param = sw_readparam(inpForm, varargin{:}); 20 | 21 | if ~isa(d2ddat,'d2d') 22 | error('corrphon:WrongInput','The given data is not d2d type!') 23 | end 24 | 25 | % convert data, x-axis in A^-1 units 26 | dat = ndbase.getdata(d2ddat,'binType','center','axUnit','A-1'); 27 | 28 | % data to fit 29 | sigFit = dat.sig(dat.ax{1}>param.qphon(1) & dat.ax{1} 1 43 | error('Mixing constant has to be within the [0 1] range!') 44 | end 45 | 46 | if wG < 0 || wL < 0 47 | error('The width of Lorentzian and Gaussian has to be positive!') 48 | end 49 | 50 | yV = func.gaussfwhm(x,[1 x0 wG]); 51 | yL = func.lorfwhm(x,[1 x0 wL]); 52 | y = A*(mu*yL + (1-mu)*yV); 53 | 54 | end -------------------------------------------------------------------------------- /swfiles/+swplot/base.m: -------------------------------------------------------------------------------- 1 | function varargout = base(varargin) 2 | % sets the basis vectors of an swplot figure 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.base(BV)` 7 | % 8 | % `swplot.base(obj)` 9 | % 10 | % `BV = swplot.base` 11 | % 12 | % ### Description 13 | % 14 | % `swplot.base(BV)` sets the basis vector for an swplot figure. The basis 15 | % vectors can be used to define a non-orthogonal coordinate system for 16 | % graphic objects. 17 | % 18 | % `swplot.base(obj)` sets the basis vectors to the lattice units of a given 19 | % [spinw] object `obj`. 20 | % 21 | % `BV = swplot.base` returns the basis vectors stored in the swplot figure. 22 | % 23 | % 24 | % ### Input Arguments 25 | % 26 | % `BV` 27 | % : Either a $[3\times 3]$ matrix of the new basis vectors or a [spinw] 28 | % object where the new basis vectors will be the lattice 29 | % units and the basis vectors are generated via [spinw.basisvector]. 30 | % 31 | % `hFigure` 32 | % : Handle of the [swplot] figure. Default is the active 33 | % figure. 34 | % 35 | % ### See Also 36 | % 37 | % [swplot.plot] 38 | % 39 | 40 | BV = []; 41 | hFigure = []; 42 | 43 | switch nargin 44 | case 0 45 | case 1 46 | if numel(varargin{1})~=1 || isa(varargin{1},'spinw') 47 | BV = varargin{1}; 48 | else 49 | hFigure = varargin{1}; 50 | end 51 | case 2 52 | if numel(varargin{2})~=1 || isa(varargin{2},'spinw') 53 | varargin = varargin([2 1]); 54 | end 55 | BV = varargin{1}; 56 | hFigure = varargin{2}; 57 | otherwise 58 | error('base:WrongInput','Too many input arguments!') 59 | end 60 | 61 | if isempty(hFigure) 62 | % find active figure 63 | hFigure = swplot.activefigure; 64 | end 65 | 66 | if isa(BV,'spinw') 67 | % get lattice from spinw object 68 | BV = BV.basisvector; 69 | end 70 | 71 | if ~isempty(BV) 72 | setappdata(hFigure,'base',BV); 73 | end 74 | 75 | if isempty(BV) || nargout > 0 76 | varargout{1} = getappdata(hFigure,'base'); 77 | end 78 | 79 | end -------------------------------------------------------------------------------- /swfiles/+swplot/clear.m: -------------------------------------------------------------------------------- 1 | function clear(varargin) 2 | % clears swplot figure 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.clear` 7 | % 8 | % `swplot.clear(hFigure)` 9 | % 10 | % ### Description 11 | % 12 | % `swplot.clear` clears the active swplot figure. 13 | % 14 | % `swplot.clear(hFigure)` clears the swplot figure correspondign to 15 | % `hFigure` handle 16 | % 17 | % ### See Also 18 | % 19 | % [swplot.figure] 20 | % 21 | 22 | swplot.delete(varargin{:},0) 23 | 24 | end -------------------------------------------------------------------------------- /swfiles/+swplot/close.m: -------------------------------------------------------------------------------- 1 | function close(varargin) 2 | % closes swplot figure 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.close` 7 | % 8 | % `swplot.close('all')` 9 | % 10 | % `swplot.close(hFigure)` 11 | % 12 | % ### Description 13 | % 14 | % `swplot.close` closes the active swplot figure. 15 | % 16 | % `swplot.close('all')` closes all swplot figure. 17 | % 18 | % `swplot.close(hFigure)` closes the swplot figure corresponding to 19 | % `hFigure` handle. 20 | % 21 | % ### See Also 22 | % 23 | % [swplot.figure] 24 | % 25 | 26 | pref = swpref; 27 | 28 | 29 | if nargin == 0 30 | % check if there is any swplot figure 31 | activeTag = pref.tag; 32 | inactiveTag = ['inactive_' activeTag]; 33 | if isempty([findobj('tag',activeTag) findobj('tag',inactiveTag)]) 34 | % nothing to close 35 | return 36 | end 37 | 38 | hFigure = swplot.activefigure; 39 | else 40 | if strcmp('all',varargin{1}) 41 | hFigure = []; 42 | else 43 | hFigure = varargin{1}; 44 | end 45 | end 46 | 47 | if ~isempty(hFigure) 48 | close(hFigure); 49 | else 50 | % close all swplot figure 51 | activeTag = pref.tag; 52 | % tag for inactive figures 53 | inactiveTag = ['inactive_' activeTag]; 54 | 55 | % find and close all swplot figures 56 | close(findobj('tag',activeTag)); 57 | close(findobj('tag',inactiveTag)); 58 | end 59 | 60 | end -------------------------------------------------------------------------------- /swfiles/+swplot/getdata.m: -------------------------------------------------------------------------------- 1 | function data = getdata(varargin) 2 | % gets the data stored in an swplot figure 3 | % 4 | % ### Syntax 5 | % 6 | % `data = swplot.getdata` 7 | % 8 | % `data = swplot.getdata(hFigure)` 9 | % 10 | % `data = swplot.getdata(field)` 11 | % 12 | % ### Description 13 | % 14 | % `data = swplot.getdata` gets all the object data stored in the active 15 | % swplot figure. 16 | % 17 | % `data = swplot.getdata(hFigure)` get all object data stored in the swplot 18 | % figure identified by the `hFigure` handle. 19 | % 20 | % `data = swplot.getdata(field)` loads only the given field of the data 21 | % structure. 22 | % 23 | % ### Examples 24 | % 25 | % This example shows how the data of all objects on a 3D SpinW plot can be 26 | % retrieved. 27 | % 28 | % ``` 29 | % >>model = sw_model('triAF',1) 30 | % >>plot(model) 31 | % >>swplot.getdata>> 32 | % ``` 33 | % 34 | % ### Input Arguments 35 | % 36 | % `hFigure` 37 | % : Handle of the swplot figure, default value is the active figure. 38 | % 39 | % `field` 40 | % : String, determines the requested field name. If omitted, all 41 | % stored fields are returned. 42 | % 43 | % ### See Also 44 | % 45 | % [matlab.getappdata] 46 | % 47 | 48 | if nargin == 0 49 | hFigure = swplot.activefigure; 50 | arg = {hFigure}; 51 | elseif nargin == 1 && ischar(varargin{1}) 52 | hFigure = swplot.activefigure; 53 | arg = {hFigure varargin{1}}; 54 | elseif nargin == 1 55 | arg = {gcf varargin{1}}; 56 | else 57 | arg = varargin; 58 | end 59 | 60 | data = getappdata(arg{:}); 61 | 62 | end -------------------------------------------------------------------------------- /swfiles/+swplot/ishg.m: -------------------------------------------------------------------------------- 1 | function ishg = ishg(hFigure) 2 | % does the swplot figure uses hgtransform 3 | % 4 | % ### Syntax 5 | % 6 | % `ishg = swplot.ishg` 7 | % 8 | % `ishg = swplot.ishg(hFigure)` 9 | % 10 | % ### Description 11 | % 12 | % `ishg = swplot.ishg` `true` if the active swplot figure uses 13 | % [matlab.hgtransfrom], otherwise `false`. 14 | % 15 | % `ishg = swplot.ishg(hFigure)` applies to the swplot figure referenced by 16 | % the `hFigure` handle. 17 | % 18 | % ### See Also 19 | % 20 | % [swplot.figure] 21 | % 22 | 23 | if nargin == 0 24 | hFigure = swplot.activefigure; 25 | end 26 | 27 | ishg = true(1,numel(hFigure)); 28 | 29 | for ii = 1:numel(hFigure) 30 | ishg(ii) = ~isempty(getappdata(hFigure(ii),'h')); 31 | end 32 | 33 | end -------------------------------------------------------------------------------- /swfiles/+swplot/subplot.m: -------------------------------------------------------------------------------- 1 | function varargout = subplot(varargin) 2 | % create subplots with variable gaps between axes 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.subplot(m,n,p,space)` 7 | % 8 | % `swplot.subplot([m,n,p],space)` 9 | % 10 | % ### Description 11 | % 12 | % `swplot.subplot(m,n,p,space)` is equivalent to the [matlab.subplot] 13 | % command, except that the space between axes can be controlled. 14 | % 15 | % ### Input Arguments 16 | % 17 | % `m,n,p` 18 | % : Three integer that defines subplot, for details see the 19 | % built-in [matlab.subplot] command. 20 | % 21 | % `space` 22 | % : Vector with elements: `[margin hgap vgap]`, where: 23 | % * `margin` Top and right margin at the figure edge. 24 | % * `hgap` Left margin and horizontal gap between axes. 25 | % * `vgap` Bottom margin and vertical gap between axes. 26 | % 27 | % ### See Also 28 | % 29 | % [matlab.subplot] 30 | % 31 | 32 | if nargin==3 || nargin == 1 33 | space = [0 0 0]; 34 | else 35 | space = varargin{end}; 36 | end 37 | 38 | if nargin<3 39 | m = varargin{1}(1); 40 | n = varargin{1}(2); 41 | p = varargin{1}(3); 42 | else 43 | m = varargin{1}; 44 | n = varargin{2}; 45 | p = varargin{3}; 46 | end 47 | 48 | if p>m*n || p<0 49 | error('subplot:WrongInput','Subpanel index is out of range!') 50 | end 51 | 52 | % space = [margin hgap vgap] 53 | margin = space(1); 54 | hgap = space(2); 55 | vgap = space(3); 56 | 57 | posi = [mod(p-1,n) floor((p-1)/n)]; 58 | 59 | w = ((1-margin-hgap)-(n-1)*hgap)/n; 60 | h = ((1-margin-vgap)-(m-1)*vgap)/m; 61 | 62 | pos = [hgap+posi(1)*(hgap+w) 1-(margin+(posi(2)+1)*h+posi(2)*vgap) w h]; 63 | 64 | varargout{:} = subplot('Position',pos); 65 | 66 | end -------------------------------------------------------------------------------- /swfiles/+swplot/text.m: -------------------------------------------------------------------------------- 1 | function hText = text(varargin) 2 | % creates text at a 3D position 3 | % 4 | % ### Syntax 5 | % 6 | % `hText = swplot.text(r, string)` 7 | % 8 | % `hText = swplot.text(r, string, fontSize)` 9 | % 10 | % `hText = swplot.text(handle, ...)` 11 | % 12 | % ### Description 13 | % 14 | % `hText = swplot.text(r, string)` creates single or multiple text in 3D 15 | % space. 16 | % 17 | % `hPatch = swplot.text(handle, ...)` adds the generated text object to a 18 | % given axis referenced by `handle`. 19 | % 20 | % ### Input Arguments 21 | % 22 | % `handle` 23 | % : Handle of an axis object, default value is [matlab.gca]. 24 | % 25 | % `r` 26 | % : Coordinate of the center of the text for a single text or 27 | % matrix with dimensions $[3\times n_{obj}]$ for multiple text. 28 | % 29 | % `string` 30 | % : String that contains the text or cell of strings when multiple 31 | % text is drawn. 32 | % 33 | % `fontSize` 34 | % : Font size in pt, default value is stored in `swpref.getpref('fontsize')`. 35 | % 36 | % ### See Also 37 | % 38 | % [matlab.text] 39 | % 40 | 41 | if nargin == 0 42 | swhelp swplot.text 43 | return 44 | end 45 | 46 | fontSize = []; 47 | pref = swpref; 48 | 49 | if numel(varargin{1}) == 1 50 | % first input figure handle 51 | hAxis = varargin{1}; 52 | r = varargin{2}; 53 | string = varargin{3}; 54 | if nargin>3 55 | fontSize = varargin{4}; 56 | end 57 | else 58 | hAxis = gca; 59 | r = varargin{1}; 60 | string = varargin{2}; 61 | if nargin>3 62 | fontSize = varargin{3}; 63 | end 64 | end 65 | 66 | if numel(r) == 3 67 | r = r(:); 68 | end 69 | 70 | nText = size(r,2); 71 | 72 | if ~iscell(string) 73 | string = {string}; 74 | end 75 | 76 | if isempty(fontSize) 77 | fontSize = pref.fontsize; 78 | end 79 | 80 | hText = gobjects(1,nText); 81 | 82 | for ii = 1:nText 83 | hText(ii) = text(r(1,ii),r(2,ii),r(3,ii),string{ii},'Parent',hAxis,'FontSize',fontSize,'Color','k',... 84 | 'VerticalAlignment','middle','HorizontalAlignment','center','Tag','text'); 85 | end 86 | 87 | end -------------------------------------------------------------------------------- /swfiles/+swplot/translate.m: -------------------------------------------------------------------------------- 1 | function translate(mode, hFigure) 2 | % translates objects on swplot figure 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.translate(mode)` 7 | % 8 | % `swplot.translate(mode, hFigure)` 9 | % 10 | % ### Description 11 | % 12 | % `swplot.translate(mode)` translates the objects of an active swplot 13 | % figure, where the coordinate system is defined by the plane of the figure 14 | % with horizontal $x$-axis, vertical $y$-axis and out-of-plane $z$-axis. 15 | % 16 | % `swplot.translate(mode, hFigure)` acts on the figure referenced by the 17 | % `hFigure` handle. 18 | % 19 | % ### Input Arguments 20 | % 21 | % `mode` 22 | % : Either a vector with three numbers that determine the translation 23 | % vector in the figure plane coordinate system, or `'auto'` that 24 | % centers figure to the middle of the objects. Default value is `'auto'`. 25 | % 26 | % `hFigure` 27 | % : Handle of the swplot figure, default value is the active figure. 28 | % 29 | % ### See Also 30 | % 31 | % [swplot.zoom] 32 | % 33 | 34 | if nargin == 0 35 | mode = 'auto'; 36 | end 37 | 38 | if nargin < 2 39 | % find active figure 40 | hFigure = swplot.activefigure; 41 | end 42 | 43 | if isnumeric(mode) 44 | T = swplot.transform(hFigure); 45 | %T(1:3,4) = mode(:); 46 | T(1:3,4) = T(1:3,1:3)\mode(:); 47 | swplot.transform(T,hFigure); 48 | elseif strcmpi(mode,'auto') 49 | % find outer positions of objects 50 | obj = getappdata(hFigure,'objects'); 51 | % position in lu 52 | pos = cat(3,obj(:).position); 53 | center = mean([min(pos(:,1,:),[],3) max(pos(:,1,:),[],3)],2); 54 | if any(isnan(center)) 55 | return 56 | end 57 | 58 | % translate in xyz units 59 | if swplot.ishg(hFigure) 60 | T = swplot.transform(hFigure); 61 | else 62 | T = eye(4); 63 | end 64 | T(1:3,4) = -swplot.base(hFigure)*center; 65 | swplot.transform(T,hFigure); 66 | 67 | else 68 | error('translate:WrongInput','Wrong zoom mode!'); 69 | end 70 | 71 | end -------------------------------------------------------------------------------- /swfiles/+swplot/zoom.m: -------------------------------------------------------------------------------- 1 | function zoom(mode, hFigure) 2 | % zooms to objects 3 | % 4 | % ### Syntax 5 | % 6 | % `swplot.zoom(mode)` 7 | % 8 | % `swplot.zoom(mode, hFigure)` 9 | % 10 | % ### Description 11 | % 12 | % `swplot.zoom(mode)` controls the zoom (angle of view of the virtual 13 | % camera) level on the active [swplot] figure. 14 | % 15 | % `swplot.zoom(mode, hFigure)` controls the zoom on the swplot figure 16 | % referenced by the `hFigure` handle. 17 | % 18 | % ### Input Arguments 19 | % 20 | % `mode` 21 | % : Either a number determining the relative zoom value, or `'auto'` 22 | % that zooms to fit every object into the figure. 23 | % 24 | % `hFigure` 25 | % : Handle of the swplot figure, default value is the active swplot figure. 26 | % 27 | % ### See Also 28 | % 29 | % [swplot.figure] 30 | % 31 | 32 | if nargin == 0 33 | mode = 'auto'; 34 | end 35 | 36 | if nargin < 2 37 | % find active figure 38 | hFigure = swplot.activefigure; 39 | end 40 | 41 | hAxis = getappdata(hFigure,'axis'); 42 | 43 | if isnumeric(mode) 44 | 45 | set(hAxis,'CameraViewAngle',get(hAxis,'CameraViewAngle')/mode); 46 | 47 | elseif strcmpi(mode,'auto') 48 | 49 | % find outer positions of objects 50 | obj = getappdata(hFigure,'objects'); 51 | % position in lu 52 | if ~isempty(obj) 53 | pos = cat(3,obj(:).position); 54 | size = diff([min(pos(:,1,:),[],3) max(pos(:,1,:),[],3)],[],2); 55 | size = max(swplot.base(hFigure)*size); 56 | 57 | if size>0 58 | % view angle 59 | angle = atand(size/norm(get(hAxis,'CameraPosition'))); 60 | 61 | set(hAxis,'CameraViewAngleMode','auto'); 62 | %set(hAxis,'CameraViewAngle',6*get(hAxis,'CameraViewAngle')); 63 | set(hAxis,'CameraViewAngle',1.5*angle); 64 | end 65 | end 66 | else 67 | error('zoom:WrongInput','Wrong zoom mode!'); 68 | end 69 | 70 | end -------------------------------------------------------------------------------- /swfiles/+swsym/Contents.m: -------------------------------------------------------------------------------- 1 | % package to handle symmetry operations 2 | % 3 | % This package deals with symmetry operators of crystallographic space 4 | % groups. It can read the standard space group definitions stored in 5 | % [symmetry.dat], generate all symmmetry elements, determine all symmetry 6 | % equivalent positions, etc. 7 | % 8 | % All symmetry operators `symOp` are defined by a matrix with dimensions of 9 | % $[3\times 4\times n_{op}]$, where `symOp(1:3,1:3,:)` stores the $[3\times 10 | % 3]$ rotation matrices while the `symOp(1:3,4,:)` holds the corresponding 11 | % translation vectors. 12 | % 13 | % ### Files 14 | % 15 | % swsym.add 16 | % swsym.bond 17 | % swsym.generator 18 | % swsym.genreduce 19 | % swsym.isop 20 | % swsym.operator 21 | % swsym.oporder 22 | % swsym.point 23 | % swsym.position 24 | % swsym.str 25 | -------------------------------------------------------------------------------- /swfiles/+swsym/isop.m: -------------------------------------------------------------------------------- 1 | function result = isop(symOp) 2 | % determines if a matrix is symmetry operator 3 | % 4 | % ### Syntax 5 | % 6 | % `result = swsym.isop(op)` 7 | % 8 | % ### Description 9 | % 10 | % `result = swsym.isop(op)` determines whether the given matrix has 11 | % dimensions that is compatible with the size requirements of space group 12 | % operators. The given `op` matrix has to have dimensions of $[3\times 13 | % 4\times n_{op}]$. The function returns `true` only if the input has these 14 | % dimensions. 15 | % 16 | % ### See Also 17 | % 18 | % [swsym.generator] \| [swsym.operator] 19 | % 20 | 21 | if nargin == 0 22 | swhelp swsym.isop 23 | return 24 | end 25 | 26 | if size(symOp,1) == 3 && size(symOp,2) == 4 27 | result = true; 28 | else 29 | result = false; 30 | end 31 | 32 | end -------------------------------------------------------------------------------- /swfiles/+swsym/oporder.m: -------------------------------------------------------------------------------- 1 | function N = oporder(symOp) 2 | % determine the order of the symmetry operator 3 | % 4 | % ### Syntax 5 | % 6 | % `N = swsym.oporder(symOp)` 7 | % 8 | % ### Description 9 | % 10 | % `N = swsym.oporder(symOp)` determines the order of the `symOp` symmetry 11 | % operator, where `symOp(:,1:3)` is a rotation matrix and `symOp(:,4)` is a 12 | % translation. The value of 10 is returned if the matrix is not a valid 13 | % crystallographic symmetry operator. 14 | % 15 | % ### Examples 16 | % 17 | % Raising any operator to the calculated order will alway return identity: 18 | % 19 | % ``` 20 | % >>O = swsym.generator('y,z,x')>> 21 | % >>R = O(:,1:3)^swsym.oporder(O)>> 22 | % ``` 23 | % 24 | % ### Input Arguments 25 | % 26 | % `symOp` 27 | % : Symmetry operator in a matrix with dimensions of $[3\times 4]$. 28 | % 29 | % ### Output Arguments 30 | % 31 | % `N` 32 | % : Integer, the order of the operator. 33 | % 34 | % ### See Also 35 | % 36 | % [swsym.generator] \| [sw_basismat] 37 | % 38 | 39 | if nargin == 0 40 | swhelp swsym.oporder 41 | return 42 | end 43 | 44 | N = 1; 45 | RN = symOp(:,1:3); 46 | TN = round(symOp(:,4)*12); 47 | 48 | while (norm(RN-eye(3))>10*eps || norm(TN)) && (N<10) 49 | RN = symOp(:,1:3)*RN; 50 | TN = mod(round(symOp(:,1:3)*TN+symOp(:,4)),12); 51 | N = N + 1; 52 | end 53 | 54 | end -------------------------------------------------------------------------------- /swfiles/+swsym/point.m: -------------------------------------------------------------------------------- 1 | function pOp = point(symOp, r) 2 | % determines local point group symmetry in a space group 3 | % 4 | % ### Syntax 5 | % 6 | % `pOp = swsym.point(symOp, r)` 7 | % 8 | % ### Description 9 | % 10 | % `pOp = swsym.point(symOp, r)` determines the point group symmetry at a 11 | % given position in the unit cell in a given space group. It returns all the 12 | % rotation matrices of the point group. 13 | % 14 | % ### Input Arguments 15 | % 16 | % `symOp` 17 | % : Symmetry operators of the space group stored in a matrix 18 | % with dimensions of $[3\times 4\times n_{op}]$. 19 | % 20 | % `r` 21 | % : Column vector with 3 elements, position in the unit cell. 22 | % 23 | % ### Output Arguments 24 | % 25 | % `pOp` 26 | % : Point group operators in a matrix with dimensions of $[3\times 3\times 27 | % n_{op}]$, the operators act on the relative atomic positions. To 28 | % convert these rotation operators to Cartesian coordinate system, use: 29 | % 30 | % ``` 31 | % R = BV*pOp(:,:,i)*inv(BV) 32 | % ``` 33 | % where `BV` is the matrix of lattice basis vectors, see 34 | % [spinw.basisvector]. 35 | % 36 | % ### See Also 37 | % 38 | % [swsym.generator] \| [swsym.operator] \| [swsym.position] 39 | % 40 | 41 | if nargin == 0 42 | swhelp swsym.point 43 | return 44 | end 45 | 46 | [~,~,info] = swsym.position(symOp,r); 47 | % point group operators are the ones that does NOT move the atom 48 | pOp = symOp(:,1:3,~info.ismoved{1}); 49 | 50 | end -------------------------------------------------------------------------------- /swfiles/@spinw/abc.m: -------------------------------------------------------------------------------- 1 | function abc = abc(obj,ind) 2 | % returns lattice parameters and angles 3 | % 4 | % ### Syntax 5 | % 6 | % `latvect = abc(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `latvect = abc(obj)` extracts the lattice vectors and angles from a 11 | % [spinw] object. 12 | % 13 | % ### Input Arguments 14 | % 15 | % `obj` 16 | % : [spinw] object. 17 | % 18 | % ### Output Arguments 19 | % 20 | % `latVect` 21 | % : Vector with elements `[a, b, c, \\alpha, \\beta, \\gamma]`, 22 | % contains the lattice parameters and angles by default in \\ang and 23 | % degree units respectively (see [spinw.unit] for details). 24 | % 25 | % ### See Also 26 | % 27 | % [spinw.horace] 28 | % 29 | 30 | abc = [obj.lattice.lat_const obj.lattice.angle*180/pi]; 31 | 32 | if nargin>1 33 | abc = abc(ind); 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /swfiles/@spinw/copy.m: -------------------------------------------------------------------------------- 1 | function objC = copy(obj) 2 | % clones spinw object 3 | % 4 | % ### Syntax 5 | % 6 | % `newObj = copy(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `newObj = copy(obj)` clones a SpinW object with all of its internal data. 11 | % The `newObj` will be independent of the original `obj`. Since the [spinw] 12 | % is a handle class, this command should be used to duplicate an object 13 | % instead of the `=` operator. Using the `=` operator does not create a new 14 | % object, but only a pointer that points to the original object: 15 | % ``` 16 | % obj2 = obj 17 | % ``` 18 | % Changing `obj` after the above command will also change `obj2`. 19 | % 20 | % ### Examples 21 | % 22 | % In this example $J_{1a}$ is a matrix with 1 in the diagonal, while 23 | % $J_{1b}$ has 3.1415 in the diagonal. If `cryst` is changed, `cryst1` will 24 | % be changed as well and viece versa, since they point to the 25 | % same object. However `cryst2` is independent of `cryst`: 26 | % 27 | % ``` 28 | % >>cryst = spinw 29 | % >>cryst.addmatrix('label','J1','value',3.1415) 30 | % >>cryst1 = cryst 31 | % >>cryst2 = cryst.copy 32 | % >>cryst.addmatrix('label','J1','value',1) 33 | % >>J1a = cryst1.matrix.mat>> 34 | % >>J1b = cryst2.matrix.mat>> 35 | % ``` 36 | % 37 | % ### Input Arguments 38 | % 39 | % `obj` 40 | % : [spinw] object. 41 | % 42 | % ### Output Arguments 43 | % 44 | % `newObj` 45 | % : New [spinw] object that contains all the data of `obj`. 46 | % 47 | % ### See Also 48 | % 49 | % [spinw] \| [spinw.struct] 50 | % 51 | 52 | objS = struct(obj); 53 | objC = spinw(objS); 54 | 55 | % copy the private properties 56 | objC.propl = event.proplistener.empty; 57 | objC.sym = obj.sym; 58 | objC.symb = obj.symb; 59 | objC.ver = obj.ver; 60 | 61 | % add new listeners to the new object 62 | if ~isempty(obj.cache.matom) 63 | % add listener to lattice and unit_cell fields 64 | objC.addlistenermulti(1); 65 | end 66 | 67 | if ~isempty(obj.cache.symop) 68 | % add listener to lattice, unit_cell and coupling fields 69 | objC.addlistenermulti(2); 70 | end 71 | 72 | end -------------------------------------------------------------------------------- /swfiles/@spinw/field.m: -------------------------------------------------------------------------------- 1 | function varargout = field(obj,varargin) 2 | % get/set magnetic field value 3 | % 4 | % ### Syntax 5 | % 6 | % `field(obj,B)` 7 | % `B = field(obj)` 8 | % 9 | % ### Description 10 | % 11 | % `field(obj,B)` sets the magnetic field stored in `obj.single_ion.field` 12 | % to `B`, where `B` is a $[1\times 3]$ vector. 13 | % 14 | % `B = field(obj)` returns the current value of the magnetic field value 15 | % stored in `obj`. 16 | % 17 | % ### See Also 18 | % 19 | % [spinw] \| [spinw.temperature] \| [spinw.single_ion] 20 | % 21 | 22 | if nargin == 1 23 | varargout{1} = obj.single_ion.field; 24 | elseif nargin == 2 25 | B = varargin{1}; 26 | if numel(B) == 3 27 | if obj.symbolic 28 | if isa(B,'sym') 29 | obj.single_ion.field = B(:)'; 30 | else 31 | obj.single_ion.field = B(:)'*sym('B','real'); 32 | end 33 | else 34 | obj.single_ion.field = B(:)'; 35 | end 36 | else 37 | error('spinw:magfield:ArraySize','Input magnetic field has to be a 3 element vector!'); 38 | end 39 | if nargout > 0 40 | varargout{1} = obj; 41 | end 42 | end 43 | 44 | end -------------------------------------------------------------------------------- /swfiles/@spinw/matom.m: -------------------------------------------------------------------------------- 1 | function mAtomList = matom(obj) 2 | % generates magnetic lattice 3 | % 4 | % ### Syntax 5 | % 6 | % `mAtomList = matom(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `mAtomList = matom(obj)` is the same as [spinw.atom], but only lists the 11 | % magnetic atoms, which have non-zero spin. Also this function stores the 12 | % generated list in [spinw.cache]. 13 | % 14 | % ### Output Arguments 15 | % 16 | % `mAtomList` 17 | % : structure with the following fields: 18 | % * `r` Position of the magnetic atoms in a matrix with dimensions of 19 | % $[3\times n_{magAtom}]$. 20 | % * `idx` Index in the symmetry inequivalent atom list [spinw.unit_cell] 21 | % stored in a row vector with $n_{magAtom}]$ number of elements. 22 | % * `S` Spin of the magnetic atoms stored in a row vectorwith 23 | % $n_{magAtom}]$ number of elements. 24 | % 25 | % ### See Also 26 | % 27 | % [spinw.atom] 28 | % 29 | 30 | if isempty(obj.cache.matom) 31 | atomList = obj.atom; 32 | 33 | mAtomList.r = atomList.r(:,atomList.mag==1); 34 | mAtomList.idx = atomList.idx(:,atomList.mag==1); 35 | mAtomList.S = obj.unit_cell.S(mAtomList.idx); 36 | 37 | obj.cache.matom = mAtomList; 38 | 39 | % add listener to lattice and unit_cell fields 40 | obj.addlistenermulti(1); 41 | else 42 | mAtomList = obj.cache.matom; 43 | end 44 | 45 | end -------------------------------------------------------------------------------- /swfiles/@spinw/nosym.m: -------------------------------------------------------------------------------- 1 | function nosym(obj, varargin) 2 | % reduces symmetry to P0 3 | % 4 | % ### Syntax 5 | % 6 | % `nosym(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `nosym(obj)` reduces the crystal symmetry to $P0$ but keeps all symmetry 11 | % generated atoms, that become all symmetry inequivalent. The function can 12 | % be used to test different types of symmetry breaking terms in the spin 13 | % Hamiltonian. 14 | % 15 | % ### Examples 16 | % 17 | % The example generates an FCC cell using explicit translations. After 18 | % applying the `spinw.nosym` function, the `cryst.unit_cell.r` contains the 19 | % four generated atomic positions, that are not symmetry equivalent any 20 | % more. 21 | % 22 | % ``` 23 | % >>symOp = 'x+1/2,y+1/2,z;x+1/2,y,z+1/2;x,y+1/2,z+1/2' 24 | % >>cryst = spinw 25 | % >>cryst.genlattice('lat_const',[8 8 8],'sym',symOp,'label','FCC') 26 | % >>cryst.addatom('r',[0 0 0],'label','Atom1') 27 | % >>cryst.unit_cell.r>> 28 | % >>cryst.nosym 29 | % >>cryst.unit_cell.r>> 30 | % ``` 31 | % 32 | % ### Input Arguments 33 | % 34 | % `obj` 35 | % : [spinw] object. 36 | % 37 | % ### Output Arguments 38 | % 39 | % The `obj` input will have `obj.lattice.sym` field equal to zero and the 40 | % [obj.unit_cell] field will contain all the generated atomic positions. 41 | % 42 | % ### See Also 43 | % 44 | % [spinw] \| [spinw.newcell] 45 | % 46 | 47 | % TODO keep bonds when removing symmetry 48 | 49 | obj.newcell('bvect',{[1 0 0] [0 1 0] [0 0 1]}); 50 | obj.lattice.sym = zeros(3,4,0); 51 | obj.sym = false; 52 | 53 | end -------------------------------------------------------------------------------- /swfiles/@spinw/notwin.m: -------------------------------------------------------------------------------- 1 | function varargout = notwin(obj) 2 | % removes all twins 3 | % 4 | % ### Syntax 5 | % 6 | % `notwin(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `notwin(obj)` removes any crystallographic twin added using the 11 | % [spinw.addtwin] function. 12 | % 13 | % ### See Also 14 | % 15 | % [spinw.addtwin] 16 | % 17 | 18 | obj.twin.vol = 1; 19 | obj.twin.rotc = eye(3); 20 | 21 | if nargout >0 22 | varargout{1} = obj; 23 | end 24 | 25 | end -------------------------------------------------------------------------------- /swfiles/@spinw/private/initfield.m: -------------------------------------------------------------------------------- 1 | function obj = initfield(obj, varargin) 2 | % initializes all subfields of the obj structure to the default values 3 | % 4 | % SPINW.INITFIELD(objS, {field}) 5 | % 6 | % Input: 7 | % 8 | % objS Structure to initialize. 9 | % field String or cell of strings that contains specific fields to 10 | % initialize. 11 | % 12 | 13 | datstruct = datastruct(); 14 | mainfield = datstruct.mainfield; 15 | subfield = datstruct.subfield; 16 | defval = datstruct.defval; 17 | 18 | selector = true(1,numel(mainfield)); 19 | 20 | if nargin>1 21 | selector = ismember(mainfield,varargin{1}); 22 | end 23 | 24 | 25 | %for ii = 1:numel(mainfield) 26 | for ii = find(selector) 27 | for jj = 1:size(subfield,2) 28 | if ~isempty(subfield{ii,jj}) 29 | if ~isfield(obj,mainfield{ii}) || ~isfield(eval(['obj.' mainfield{ii}]),subfield{ii,jj}) 30 | obj.(mainfield{ii}).(subfield{ii,jj}) = defval{ii,jj}; 31 | end 32 | end 33 | end 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /swfiles/@spinw/quickham.m: -------------------------------------------------------------------------------- 1 | function quickham(obj,J) 2 | % quickly generate magnetic Hamiltonian 3 | % 4 | % ### Syntax 5 | % 6 | % `quickham(obj,J)` 7 | % 8 | % ### Description 9 | % 10 | % `quickham(obj,J)` generates the bonds from the predefined crystal 11 | % structure and assigns exchange values to bonds such as `J(1)` to first 12 | % neighbor, `J(2)` for second neighbor etc. The command will erase all 13 | % previous bonds, anisotropy, g-tensor and matrix definitions. Even if 14 | % `J(idx) == 0`, the corresponding bond and matrix will be created. 15 | % 16 | % 17 | % ### Input Arguments 18 | % 19 | % `obj` 20 | % : [spinw] object. 21 | % 22 | % `J` 23 | % : Vector that contains the Heisenberg exchange values. `J(1)` for 24 | % first neighbor bonds, etc. 25 | % 26 | % ### See Also 27 | % 28 | % [spinw.gencoupling] \| [spinw.addcoupling] \| [spinw.matrix] \| 29 | % [spinw.addmatrix] 30 | % 31 | 32 | dMax = 8; 33 | nMax = 0; 34 | nJ = numel(J); 35 | 36 | idx = 1; 37 | % generate the necessary bonds and avoid infinite loop 38 | while nMax < nJ && idx < 12 39 | obj.gencoupling('maxDistance',dMax,'fid',0); 40 | dMax = dMax+8; 41 | % maximum bond index 42 | nMax = obj.coupling.idx(end); 43 | idx = idx+1; 44 | end 45 | 46 | if nMax < nJ 47 | warning('The necessary bond length is too long (d>100 A), not all Js will be assigned!'); 48 | J = J(1:nMax); 49 | end 50 | 51 | % clear matrix definitions 52 | obj.matrix.mat = zeros(3,3,0); 53 | obj.matrix.color = int32(zeros(3,0)); 54 | obj.matrix.label = cell(1,0); 55 | 56 | nDigit = floor(log10(nJ))+1; 57 | 58 | for ii = 1:numel(J) 59 | % assign non-zero matrices to bonds 60 | matLabel = num2str(ii,num2str(nDigit,'J%%0%dd')); 61 | obj.addmatrix('label',matLabel,'value',J(ii)) 62 | obj.addcoupling('mat',matLabel,'bond',ii) 63 | end 64 | 65 | 66 | end -------------------------------------------------------------------------------- /swfiles/@spinw/rl.m: -------------------------------------------------------------------------------- 1 | function rlVect = rl(obj, norm) 2 | % generates reciprocal lattice vectors 3 | % 4 | % ### Syntax 5 | % 6 | % `rlVec = rl(obj, {norm})` 7 | % 8 | % ### Description 9 | % 10 | % `rlVec = rl(obj, {norm})` returns the lattice vectors of the reciprocal 11 | % lattice in a $[3\times 3]$ matrix, with the $a^*$, $b^*$ and $c^*$ vectors 12 | % stored in **rows**. 13 | % 14 | % 15 | % ### Examples 16 | % 17 | % To convert from reciprocal lattice unit to \\ang$^{-1}$ ($xyz$ 18 | % Cartesian coordinate system) use: (`Q_rlu` is a row vector with 3 19 | % elements): 20 | % 21 | % ``` 22 | % Q_xyz = Q_rlu * rlVect 23 | % ``` 24 | % 25 | % ### Input Arguments 26 | % 27 | % `obj` 28 | % : [spinw] object. 29 | % 30 | % `norm` 31 | % : If `true`, the basis vectors are normalized to 1. Default values is 32 | % `false`, optional. 33 | % 34 | % ### Output Arguments 35 | % 36 | % `rlVec` 37 | % : Stores the three basis vectors in the rows of matrix with dimensions of 38 | % $[3\times 3]$. 39 | % 40 | % ### See Also 41 | % 42 | % [spinw] \| [spinw.abc] \| [spinw.basisvector] 43 | % 44 | 45 | rlVect = 2*pi*inv(obj.basisvector); %#ok 46 | 47 | if nargin == 1 48 | norm = false; 49 | end 50 | 51 | if norm 52 | rlVect = bsxfun(@rdivide,rlVect,sqrt(sum(rlVect.^2,2))); 53 | end 54 | 55 | end -------------------------------------------------------------------------------- /swfiles/@spinw/setunit.m: -------------------------------------------------------------------------------- 1 | function setunit(obj, varargin) 2 | % sets the physical units 3 | % 4 | % ### Syntax 5 | % 6 | % `setunit(obj,Name,Value)` 7 | % 8 | % ### Description 9 | % 10 | % `setunit(obj,Name,Value)` sets the physical units of the Hamiltonian. 11 | % This includes the magnetic field, exchange interaction, length and 12 | % temperature. 13 | % 14 | % ### Input Arguments 15 | % 16 | % `obj` 17 | % : [spinw] object. 18 | % 19 | % ### Name-Value Pair Arguments 20 | % 21 | % `'mode'` 22 | % : Type of unit system, defined by one of the following strings: 23 | % * `'AmeVTK'` Typical units used in neutron/x-ray scattering: 24 | % [\\ang, meV, Tesla and Kelvin] 25 | % * `'1'` No units, all conversion factors are set to 1. 26 | % 27 | % ### See Also 28 | % 29 | % [spinw.unit] 30 | % 31 | 32 | inpForm.fname = {'mode' }; 33 | inpForm.defval = {'AmeVTK'}; 34 | inpForm.size = {[1 -1] }; 35 | 36 | param = sw_readparam(inpForm, varargin{:}); 37 | 38 | switch param.mode 39 | case 'AmeVTK' 40 | k_B = 0.086173324; % Boltzmann constant: k_B [meV/K] 41 | mu_B = 0.057883818066; % Bohr magneton: mu_B [meV/T] 42 | e = 1.602176565e-19; % electron charge: e [C] 43 | mu0 = 4*pi*10*e; % vacuum permeability: mu0 [T^2*A^3/meV] 44 | 45 | obj.unit.kB = k_B; 46 | obj.unit.muB = mu_B; 47 | obj.unit.mu0 = mu0; 48 | obj.unit.label = {char(197) 'meV' 'T' 'K'}; 49 | case '1' 50 | obj.unit.kB = 1; 51 | obj.unit.muB = 1; 52 | obj.unit.mu0 = 1; 53 | obj.unit.label = {'' '' '' ''}; 54 | otherwise 55 | error('spinw:setunit:WrongInput','The given ''mode'' option is invalid!') 56 | end 57 | 58 | end -------------------------------------------------------------------------------- /swfiles/@spinw/struct.m: -------------------------------------------------------------------------------- 1 | function objS = struct(obj) 2 | % converts properties into struct 3 | % 4 | % ### Syntax 5 | % 6 | % `objS = struct(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `objS = struct(obj)` converts all public properties of `obj` and saves 11 | % them into `objS` struct. 12 | % 13 | % ### See Also 14 | % 15 | % [spinw] \| [spinw.copy] 16 | % 17 | 18 | objS = struct; 19 | fNames = fieldnames(obj); 20 | for ii = 1:length(fNames) 21 | objS.(fNames{ii}) = obj.(fNames{ii}); 22 | end 23 | 24 | end % struct 25 | -------------------------------------------------------------------------------- /swfiles/@spinw/symmetry.m: -------------------------------------------------------------------------------- 1 | function sym = symmetry(obj) 2 | % returns whether symmetry is defined 3 | % 4 | % ### Syntax 5 | % 6 | % `sym = symmetry(obj)` 7 | % 8 | % ### Description 9 | % 10 | % `sym = symmetry(obj)` returns `true` if equivalent couplings are 11 | % generated based on the crystal space group and all matrices (interaction, 12 | % anisotropy and g-tensor) are transformed according to the symmetry 13 | % operators. If `false`, equivalent couplings are generated based on bond 14 | % length, equivalent matrices won't be transformed (all identical). 15 | % 16 | % To switch between the two behaviour use [spinw.gencoupling] with the 17 | % `forceNoSym` parameter set to `true`. To remove all symmetry operators 18 | % use [spinw.nosym]. 19 | % 20 | % ### See Also 21 | % 22 | % [spinw] \| [spinw.nosym] \| [spinw.gencoupling] 23 | % 24 | 25 | sym = obj.sym; 26 | 27 | end -------------------------------------------------------------------------------- /swfiles/@spinw/temperature.m: -------------------------------------------------------------------------------- 1 | function varargout = temperature(obj,varargin) 2 | % get/set temperature 3 | % 4 | % ### Syntax 5 | % 6 | % `temperature(obj, T)` 7 | % 8 | % `T = temperature(obj)` 9 | % 10 | % ### Description 11 | % 12 | % `temperature(obj, T)` sets the temperature stored in `obj` to `T`, where 13 | % `T` is scalar. The units of temerature is determined by the 14 | % `spinw.unit.kB` value, default unit is Kelvin. 15 | % 16 | % `T = temperature(obj)` returns the current temperature value stored in 17 | % `obj`. 18 | % 19 | 20 | if nargin == 1 21 | varargout{1} = obj.single_ion.T; 22 | elseif nargin == 2 23 | T = varargin{1}; 24 | if numel(T) == 1 25 | obj.single_ion.T = T; 26 | else 27 | error('spinw:temperature:ArraySize','Input temperature has to be scalar!'); 28 | end 29 | if nargout > 0 30 | varargout{1} = obj; 31 | end 32 | end 33 | 34 | end -------------------------------------------------------------------------------- /swfiles/@spinw/twinq.m: -------------------------------------------------------------------------------- 1 | function [Qtwin, rotQout] = twinq(obj, Q0) 2 | % calculates equivalent Q point in twins 3 | % 4 | % ### Syntax 5 | % 6 | % `[qTwin, rotQ] = twinq(obj, {Q0})` 7 | % 8 | % ### Description 9 | % 10 | % `[qTwin, rotQ] = twinq(obj, {q0})` calculates the $Q$ values in the twin 11 | % coordinate systems, in rlu. It also returns the rotation matrices, that 12 | % transforms the $Q$ point from the original lattice to the selected twin 13 | % rlu coordinate system. 14 | % 15 | % ### Examples 16 | % 17 | % This example Calculates the $[1,0,0]$ and $[1,1,0]$ Bragg reflections 18 | % equivalent positions in the twins. 19 | % 20 | % ``` 21 | % Q1 = [1 0 0; 1 1 0]; 22 | % Q2 = cryst.twinq(Q1'); 23 | % ``` 24 | % 25 | % ### Input Arguments 26 | % 27 | % `Q0` 28 | % : $Q$ values in the original crystal in rlu sotred in a matrix with 29 | % dimensions of $[3\times n_Q]$, optional. 30 | % 31 | % ### Output Arguments 32 | % 33 | % `Qtwin` 34 | % : $Q$ values in the twin oordinate system in a cell element for 35 | % each twin. 36 | % 37 | % `rotQ` 38 | % : Rotation matrices with dimensions of $[3\times 3\times n_{twin}]$. 39 | % 40 | % ### See Also 41 | % 42 | % [spinw] \| [spinw.addtwin] 43 | % 44 | % *[rlu]: Reciprocal Lattice Unit 45 | % 46 | 47 | if nargin == 1 48 | swhelp spinw.twinq 49 | return 50 | end 51 | 52 | 53 | % basis vectors 54 | bv = obj.basisvector; 55 | 56 | nTwin = size(obj.twin.vol,2); 57 | 58 | % rotation matrices, output only if requested 59 | rotQ = zeros(3,3,nTwin); 60 | for ii = 1:nTwin 61 | %rotQ(:,:,ii) = inv(bv)*obj.twin.rotc(:,:,ii)*bv; %#ok 62 | rotQ(:,:,ii) = bv\obj.twin.rotc(:,:,ii)*bv; 63 | end 64 | if nargout>1 65 | rotQout = rotQ; 66 | end 67 | 68 | % rotate Q points if given as input 69 | Qtwin = cell(1,nTwin); 70 | if nargin>1 71 | for ii = 1:nTwin 72 | Qtwin{ii} = (Q0'*rotQ(:,:,ii))'; 73 | end 74 | else 75 | Qtwin = {}; 76 | end 77 | 78 | end -------------------------------------------------------------------------------- /swfiles/@spinw/unitcell.m: -------------------------------------------------------------------------------- 1 | function unit_cell_info = unitcell(obj, idx) 2 | % returns unit cell data 3 | % 4 | % ### Syntax 5 | % 6 | % `cellInfo = unitcell(obj, idx)` 7 | % 8 | % ### Description 9 | % 10 | % `cellInfo = unitcell(obj, idx)` returns information on symmetry 11 | % inequivalent atoms and allowing to subselect certain atoms using the 12 | % `idx` index vector. 13 | % 14 | % ### Examples 15 | % 16 | % The example keeps only the first and third symmetry inequivalent atoms in 17 | % `cryst` object. 18 | % ``` 19 | % cryst.unit_cell = unitcell(cryst,[1 3]); 20 | % ``` 21 | % The example keeps only the atoms with labels `'O'` (Oxygen) atoms in 22 | % `cryst` object. 23 | % ``` 24 | % cryst.unit_cell = unitcell(cryst,'O'); 25 | % ``` 26 | % 27 | % ### Input Arguments 28 | % 29 | % `obj` 30 | % : [spinw] object. 31 | % 32 | % `idx` 33 | % : Selects certain atoms. If undefined `unit_cell(obj)` or 34 | % `obj.unit_cell` returns information on all atoms. The selection 35 | % can be also done according to the atom labels, in this case 36 | % either a string of the label or cell of strings for several 37 | % labels can be given. 38 | % 39 | % ### Output Arguments 40 | % 41 | % `cellInfo` 42 | % : Structure that contains all the fields of [spinw.unit_cell]. 43 | % 44 | % ### See Also 45 | % 46 | % [spinw.addtwin] \| [spinw.twinq] \| [spinw.unit_cell] 47 | % 48 | 49 | if nargin == 1 50 | idx = 1:numel(obj.unit_cell.S); 51 | else 52 | 53 | % identify atoms by their labels 54 | if ischar(idx) 55 | idx = {idx}; 56 | end 57 | 58 | if iscell(idx) 59 | newIdx = []; 60 | for ii = 1:numel(idx) 61 | newIdx = [newIdx find(cellfun(@isempty,strfind(obj.unit_cell.label,idx{ii}))==false)]; %#ok 62 | end 63 | idx = newIdx; 64 | end 65 | 66 | end 67 | 68 | % copy all fields 69 | %fName = {'r' 'S' 'label' 'color' 'ox' 'occ' 'b' 'ff' 'A' 'Z' 'biso'}; 70 | fName = fieldnames(obj.unit_cell); 71 | for ii = 1:numel(fName) 72 | unit_cell_info.(fName{ii}) = obj.unit_cell.(fName{ii})(:,idx); 73 | end 74 | unit_cell_info.ff = obj.unit_cell.ff(:,:,idx); 75 | 76 | end -------------------------------------------------------------------------------- /swfiles/@spinw/version.m: -------------------------------------------------------------------------------- 1 | function verInfo = version(obj) 2 | % returns the version of SpinW 3 | % 4 | % ### Syntax 5 | % 6 | % `verInfo = version(obj)` 7 | % 8 | 9 | verInfo = obj.ver; 10 | 11 | end -------------------------------------------------------------------------------- /swfiles/@swpref/export.m: -------------------------------------------------------------------------------- 1 | function success = export(obj,location) 2 | % saves swpref object into a file 3 | % 4 | % ### Syntax 5 | % 6 | % `success = export(obj,location)` 7 | % 8 | % `success = export(obj)` 9 | % 10 | % ### Description 11 | % 12 | % `success = export(obj,location)` writes the preferences given in `obj` to 13 | % a file location given by `location`. The file is in a basic `.json` 14 | % format. 15 | % 16 | % `success = export(obj)` writes the preferences given in `obj` to 17 | % the users home folder as `swprefs.json`. The file is in a basic `.json` 18 | % format. 19 | % 20 | % ### See Also 21 | % 22 | % [swpref.import] 23 | % 24 | 25 | props = obj.props; 26 | 27 | if nargin == 1 28 | location = [userpath filesep 'swprefs.json']; 29 | end 30 | 31 | 32 | f = fopen(location,'w'); 33 | if f < 0 34 | % error 35 | error('swpref:export:FileBlocked','Cannot write to file %s.',location); 36 | end 37 | fprintf(f, '{\n'); 38 | for i = 1:length(props) 39 | name = props(i).Name; 40 | value = obj.(name); 41 | if ~isstruct(value) 42 | if isnumeric(value) 43 | if i == length(props) 44 | fprintf(f, '\t''%s'': %f\n',name,value); 45 | else 46 | fprintf(f, '\t''%s'': %f,\n',name,value); 47 | end 48 | elseif ischar(value) 49 | if i == length(props) 50 | fprintf(f, '\t''%s'': ''%s''\n',name,value); 51 | else 52 | fprintf(f, '\t''%s'': ''%s'',\n',name,value); 53 | end 54 | elseif isa(value,'function_handle') 55 | if i == length(props) 56 | fprintf(f, '\t''%s'': ''@%s''\n',name,func2str(value)); 57 | else 58 | fprintf(f, '\t''%s'': ''@%s'',\n',name,func2str(value)); 59 | end 60 | end 61 | else 62 | end 63 | end 64 | fprintf(f, '}\n'); 65 | success = fclose(f); 66 | 67 | end -------------------------------------------------------------------------------- /swfiles/@swpref/import.m: -------------------------------------------------------------------------------- 1 | function import(obj,location) 2 | % imports swpref object from file 3 | % 4 | % ### Syntax 5 | % 6 | % 7 | % `obj = import(obj)` 8 | % 9 | % `obj = import(obj,location)` 10 | % 11 | % ### Description 12 | % 13 | % `obj = import(obj)` loads the preferences given in by the file 14 | % `swprefs.json` in the users home folder. It sets the preferences and 15 | % returns a new preference object. 16 | % 17 | % `obj = import(obj,location)` loads the preferences given in by the file 18 | % specified by `location`, sets the preferences and returns a new 19 | % preference object. 20 | % 21 | % ### See Also 22 | % 23 | % [swpref.export] 24 | % 25 | 26 | if nargin == 1 27 | location = [userpath filesep 'swprefs.json']; 28 | end 29 | 30 | if ~exist(location,'file') 31 | error('spref:ReadError','Can not find the preference file\n%s',location) 32 | end 33 | 34 | f = fopen(location,'r'); 35 | c = onCleanup(@() feval(@fclose,f)); 36 | [~] = fgetl(f); 37 | 38 | while ~feof(f) 39 | line = fgetl(f); 40 | if strcmp(line,'}') 41 | break 42 | end 43 | name_val = textscan(line,'%s'); 44 | name = name_val{1}{1}(2:end-2); 45 | value = name_val{1}{2}; 46 | if strcmp(value(end),',') 47 | value = value(1:end-1); 48 | end 49 | if strcmp(value(end),'''') 50 | % We have a str or fn 51 | value = value(2:end-1); % Strip off the ' 52 | if strcmp(value(1),'@') 53 | value = str2func(value(2:end)); 54 | end 55 | else 56 | % We have a numeric 57 | value = str2double(value); 58 | end 59 | obj.(name) = value; 60 | end 61 | 62 | end -------------------------------------------------------------------------------- /swfiles/functionSignatures.json: -------------------------------------------------------------------------------- 1 | { 2 | "spinw": 3 | { 4 | "inputs": 5 | [ 6 | {"name":"filename", "kind":"optional", "type":[["filepath"], ["char"]]} 7 | ] 8 | }, 9 | "spinwave": 10 | { 11 | "inputs": 12 | [ 13 | {"name": "obj","kind": "required","type": "spinw"}, 14 | {"name": "formFact","kind": "namevalue","type": "char"} 15 | ] 16 | }, 17 | "genmagstr": 18 | { 19 | "inputs": 20 | [ 21 | {"name": "obj","kind": "required","type": "spinw"}, 22 | {"name": "mode","kind": "namevalue","type": "choices={'random','direct','tile','helical','rotate','func','fourier'}"}, 23 | {"name": "phi","kind": "namevalue","type": ["numeric" "scalar"]}, 24 | {"name": "phid","kind": "namevalue","type": ["numeric" "scalar"]}, 25 | {"name": "nExt","kind": "namevalue","type": "numeric"}, 26 | {"name": "k","kind": "namevalue","type": "double"}, 27 | {"name": "phi","kind": "namevalue","type": "double"}, 28 | {"name": "n","kind": "namevalue","type": "double"}, 29 | {"name": "S","kind": "namevalue","type": "double"}, 30 | {"name": "unitS","kind": "namevalue","type": "choices={'xyz','lu'}"}, 31 | {"name": "epsilon","kind": "namevalue","type": "double"}, 32 | {"name": "func","kind": "namevalue","type": "function_handle"}, 33 | {"name": "x0","kind": "namevalue","type": "double"}, 34 | {"name": "norm","kind": "namevalue","type": [["logical"],["double"],["int32"]]}, 35 | {"name": "x0","kind": "namevalue","type": "double"} 36 | ] 37 | }, 38 | "swdoc": 39 | { 40 | "inputs": 41 | [ 42 | {"name":"name", "kind":"optional", "type":"identifier=variable,function,localfunction,package,classdef"} 43 | ] 44 | }, 45 | "swdoc": 46 | { 47 | "inputs": 48 | [ 49 | {"name":"filename", "kind":"optional", "type":"filepath"} 50 | ] 51 | } 52 | } -------------------------------------------------------------------------------- /swfiles/gm_planard.m: -------------------------------------------------------------------------------- 1 | function [M, k, n, name, pname, limit] = gm_planard(M0, x) 2 | % planar magnetic structure constraint function 3 | % 4 | % ### Syntax 5 | % 6 | % `[m, k, n, name, pname, limit] = gm_planard(m0, x) ` 7 | % 8 | % ### Description 9 | % 10 | % Same function as [gm_planar], except that the input angles are all in 11 | % degree. 12 | % 13 | % 14 | % ### See Also 15 | % 16 | % [gm_planar] 17 | % 18 | 19 | if nargin == 0 20 | swhelp gm_planard 21 | return 22 | end 23 | 24 | 25 | if nargout <= 3 26 | 27 | nMagExt = (length(x)-5); 28 | x = x(:)'; 29 | M0 = M0(:)'; 30 | % Magnetic ordering wave vector in the crystallographic unit cell! 31 | k = x(end+(-4:-2)); 32 | % Normal to the spin rotation plane. 33 | nTheta = x(end-1)*pi/180; 34 | nPhi = x(end)*pi/180; 35 | n = [sin(nTheta)*[cos(nPhi) sin(nPhi)] cos(nTheta)]; 36 | % Angles in the spin plane. 37 | phi = x(1:nMagExt)*pi/180; 38 | 39 | [u, v] = sw_cartesian(n'); 40 | 41 | if numel(M0)==1 42 | M = (u*cos(phi) + v*sin(phi))*M0; 43 | else 44 | % Check that the number of magnetic atoms is right 45 | if length(phi)~=length(M0) 46 | error('gm_planar:NumberOfMoments','The number of fitting parameters doesn''t produce the right number of moments!'); 47 | end 48 | % Magnetic moments in orthogonal coordinate sysyem. 49 | M = bsxfun(@times,u*cos(phi) + v*sin(phi),M0); 50 | end 51 | else 52 | nMagExt = size(M0,2); 53 | % provide the limits for the parameters 54 | name = '2D planar structure'; 55 | % parameter names 56 | pname = {}; 57 | for ii = 1:nMagExt 58 | pname = [pname {sprintf('Phi%d_deg',ii)}]; %#ok 59 | end 60 | pname = [pname {'kx_rlu' 'ky_rlu' 'kz_rlu' 'nTheta_deg' 'nPhi_deg'}]; 61 | % limits on input parameters 62 | limit = [zeros(1,nMagExt+5); [360*ones(1, nMagExt) 1 1 1 180 360]]; 63 | % garbage 64 | M = []; k = []; n = []; 65 | end 66 | 67 | end -------------------------------------------------------------------------------- /swfiles/sw_bose.m: -------------------------------------------------------------------------------- 1 | function C = sw_bose(oldT,newT,E) 2 | % coefficient for boson correlation functions 3 | % 4 | % ### Syntax 5 | % 6 | % `c = sw_bose(oldt,newt,e)` 7 | % 8 | % ### Description 9 | % 10 | % `c = sw_bose(oldt,newt,e)` calculates the temperature dependent 11 | % coefficient for boson correlation functions. 12 | % 13 | % ### Input Arguments 14 | % 15 | % `oldT` 16 | % : Original temperature in Kelvin. 17 | % 18 | % `newT` 19 | % : New temperature in Kelvin. 20 | % 21 | % `E` 22 | % : Energy in meV, positive is the particle creation side (neutron 23 | % energy loss side in a scattering experiment). 24 | % 25 | % ### Output Arguments 26 | % 27 | % `C` 28 | % : Correction coefficients that multiplies the correlation 29 | % function. If any of the input is a vector, `C` will be also a 30 | % vector with the same dimensions. 31 | % 32 | 33 | if nargin == 0 34 | swhelp sw_bose 35 | return 36 | end 37 | 38 | kB = 0.086173324; % Boltzmann constant: k_B [meV/K] 39 | 40 | % Bose factor for the original temperature 41 | oldN = 1./(exp(abs(E)/(kB*oldT))-1) + double(E>=0); 42 | oldN(isinf(oldN)) = 1; 43 | % Bose factor for the new temperature 44 | newN = 1./(exp(abs(E)/(kB*newT))-1) + double(E>=0); 45 | newN(isinf(newN)) = 1; 46 | % conversion factor 47 | C = newN./oldN; 48 | 49 | end 50 | -------------------------------------------------------------------------------- /swfiles/sw_cartesian.m: -------------------------------------------------------------------------------- 1 | function [vyOut, vzOut, vxOut] = sw_cartesian(n) 2 | % creates a right handed Cartesian coordinate system 3 | % 4 | % ### Syntax 5 | % 6 | % `[vy, vz, vx] = sw_cartesian(n)` 7 | % 8 | % `V = sw_cartesian(n)` 9 | % 10 | % ### Description 11 | % 12 | % `[vy, vz, vx] = sw_cartesian(n)` creates an $(x,y,z)$ right handed 13 | % Cartesian coordinate system with $v_x$, $v_y$ and $v_z$ defining the 14 | % basis vectors. 15 | % 16 | % `V = sw_cartesian(n)` the generated basis vectors are stored in the `V` 17 | % matrix: `V = [vx vy vz]` as column vectors. 18 | % 19 | % ### Input Arguments 20 | % 21 | % `n` 22 | % : Either a 3 element row/column vector or a $[3\times 3]$ matrix with 23 | % columns defining 3 vectors. 24 | % 25 | % ### Output Arguments 26 | % 27 | % `vy,vz,vx` 28 | % : Vectors defining the right handed coordinate system. They are 29 | % either column of row vectors depending on the shape of the 30 | % input `n`. 31 | % 32 | 33 | if nargin == 0 34 | swhelp sw_cartesian 35 | return 36 | end 37 | 38 | % Shape of original vector. 39 | if numel(n) == 3 40 | nShape = size(n); 41 | n = n(:); 42 | 43 | z = [0; 0;-1]; 44 | y = [0;-1; 0]; 45 | 46 | if any(cross(n,z)) 47 | vy = cross(n,z); 48 | else 49 | vy = cross(n,y); 50 | end 51 | vz = cross(n,vy); 52 | 53 | elseif all(size(n) == [3 3]) 54 | if det(n) == 0 55 | error('sw_cartesian:WrongInput','The input vectors are not linearly independent!') 56 | end 57 | 58 | nShape = [3 1]; 59 | vz = cross(n(:,1),n(:,2)); 60 | vy = cross(vz,n(:,1)); 61 | n = n(:,1); 62 | 63 | else 64 | error('sw_cartesian:WrongInput','Wrong size of n!') 65 | end 66 | 67 | 68 | if nargout == 1 69 | % return a matrix 70 | vyOut = [n/norm(n) vy/norm(vy) vz/norm(vz)]; 71 | else 72 | % conserve the shape of the input vector. 73 | vyOut = reshape(vy/norm(vy),nShape); 74 | vzOut = reshape(vz/norm(vz),nShape); 75 | vxOut = reshape(n/norm(n),nShape); 76 | 77 | end 78 | 79 | end -------------------------------------------------------------------------------- /swfiles/sw_freemem.m: -------------------------------------------------------------------------------- 1 | function mem = sw_freemem 2 | % calculates the available memory 3 | % 4 | % ### Syntax 5 | % 6 | % `mem = sw_freemem` 7 | % 8 | % ### Description 9 | % 10 | % `mem = sw_freemem` determines the available free memory (RAM). If the 11 | % function cannot determine the size of the free memory, it returns zero. 12 | % The function is compatible with Linux, macOS and Windows. 13 | % 14 | % ### Output Arguments 15 | % 16 | % `mem` 17 | % : Size of free memory in bytes. 18 | % 19 | 20 | mem = 0; 21 | 22 | try %#ok 23 | if ispc 24 | memStr = memory; 25 | mem = memStr.MemAvailableAllArrays; 26 | elseif ismac 27 | [~,memStr] = unix('vm_stat | grep free'); 28 | mem = sscanf(memStr(14:end),'%f')*4096; 29 | elseif isunix 30 | % get the buffer/cache size 31 | [~, memStr] = unix('free -b | grep ''-'''); 32 | 33 | if isempty(memStr) 34 | % there is no buffer/cache, just get the 'Mem' calues 35 | [~, memStr] = unix('free -b | grep ''Mem'''); 36 | [~, mem_free] = strtok(memStr); 37 | mem = sscanf(mem_free,'%f'); 38 | mem = mem(3); 39 | else 40 | [~, mem_free] = strtok(memStr(20:end)); 41 | mem = str2double(mem_free); 42 | end 43 | end 44 | end 45 | 46 | end -------------------------------------------------------------------------------- /swfiles/sw_fsub.m: -------------------------------------------------------------------------------- 1 | function cGraph = sw_fsub(conn, ~) 2 | % simple graph vertex coloring 3 | % 4 | % ### Syntax 5 | % 6 | % `cgraph = sw_fsub(conn, next)` 7 | % 8 | % ### Description 9 | % 10 | % `cgraph = sw_fsub(conn, next)` creates a simple graph vertex coloring, 11 | % determines non-connected sublattices for Monte-Carlo calculation. 12 | % 13 | % ### Input Arguments 14 | % 15 | % `conn` 16 | % : Contains edge indices which are connected 17 | % `conn(1,idx)-->conn(2,idx)` stored in a matrix with dimensions of $[2times n_{conn}]$. 18 | % 19 | % `nExt` 20 | % : Size of the magnetic supercell in a row vector with 3 integers. 21 | % 22 | % ### Output Arguments 23 | % 24 | % `cGraph` 25 | % : Vector, that assigns every magnetic moment to a sublattice. 26 | % 27 | % ### See Also 28 | % 29 | % [spinw.anneal] 30 | % 31 | 32 | if nargin == 0 33 | swhelp sw_fsub 34 | return 35 | end 36 | 37 | nEdge = max(max(conn)); 38 | cGraph = zeros(1,nEdge); 39 | 40 | for ii = 1:nEdge 41 | idx = [conn(2,conn(1,:)==ii) conn(1,conn(2,:)==ii)]; 42 | 43 | cNeigh = cGraph(idx); 44 | cIdx = 1; 45 | while any(cNeigh==cIdx) 46 | cIdx = cIdx + 1; 47 | end 48 | cGraph(ii) = cIdx; 49 | end 50 | 51 | end -------------------------------------------------------------------------------- /swfiles/sw_mirror.m: -------------------------------------------------------------------------------- 1 | function [V, mirM] = sw_mirror(n, V) 2 | % mirrors a 3D vector 3 | % 4 | % ### Syntax 5 | % 6 | % `[~, M] = sw_mirror(n)` 7 | % 8 | % `[Vp, M] = sw_mirror(n,V)` 9 | % 10 | % ### Description 11 | % 12 | % [~, M] = sw_mirror(n) generates the transformation matrix corresponding 13 | % to a mirror plane perpendicular to `n`. 14 | % 15 | % `[Vp, M] = sw_mirror(n,V)` mirrors the vectors in `V`. 16 | % 17 | % To mirror any column vector use the following: 18 | % 19 | % ``` 20 | % Vp = M * V 21 | % ``` 22 | % 23 | % To apply mirror plane operation on tensors ($3\times 3$ matrices) use the 24 | % following command: 25 | % 26 | % ``` 27 | % Ap = M * A * M' 28 | % ``` 29 | % 30 | % ### Input Arguments 31 | % 32 | % `n` 33 | % : 3D Row vector, normal to the mirror plane. 34 | % 35 | % `V` 36 | % : Matrix of 3D vectors, dimensions are $[3\times N]$. 37 | % 38 | % ### Output Arguments 39 | % 40 | % `Vp` 41 | % : Mirrored vectors in a matrix with dimensions of $[3\times N]$. 42 | % 43 | % `mirM` 44 | % : Matrix of the mirror transformation, dimensions are $[3\times 3]$. 45 | % 46 | % ### See Also 47 | % 48 | % [sw_rot] 49 | % 50 | 51 | if nargin==0 52 | swhelp sw_mirror 53 | return 54 | end 55 | 56 | n = n(:)/norm(n); 57 | % orthogonal vectors to n 58 | [u, v] = sw_cartesian(n); 59 | 60 | mirM = [u v n]*diag([1 1 -1])*[u v n]'; 61 | 62 | if nargin > 2 63 | V = mirM*V; 64 | else 65 | V = []; 66 | end 67 | 68 | end -------------------------------------------------------------------------------- /swfiles/sw_rootdir.m: -------------------------------------------------------------------------------- 1 | function rootdir = sw_rootdir 2 | % path to the SpinW folder 3 | % 4 | % ### Syntax 5 | % 6 | % `rootdir = sw_rootdir` 7 | % 8 | % ### Description 9 | % 10 | % `rootdir = sw_rootdir` returns the parent folder of the `swfiles` folder. 11 | % 12 | % ### See Also 13 | % 14 | % [spinw] 15 | % 16 | 17 | rootdir = mfilename('fullpath'); 18 | idx = strfind(rootdir,filesep); 19 | rootdir = rootdir(1:idx(end-1)); 20 | 21 | end -------------------------------------------------------------------------------- /swfiles/sw_rotmat.m: -------------------------------------------------------------------------------- 1 | function rotM = sw_rotmat(rotAxis, rotAngle) 2 | % generates 3D rotation matrix 3 | % 4 | % ### Syntax 5 | % 6 | % `R = sw_rotmat(rotAxis,rotAngle)` 7 | % 8 | % ### Description 9 | % 10 | % `R = sw_rotmat(rotAxis,rotAngle)` produces the `R` rotation matrix that 11 | % rotates any vector around the given `rotAxis` rotation axis by `rotAngle` 12 | % angle in radian. Positive rotation is the right-hand direction around the 13 | % rotation axis and using the following rotation formula: 14 | % ``` 15 | % VR = R*V 16 | % ``` 17 | % 18 | % To rotate tensors ($3\times 3$ matrices) use the following formula: 19 | % ``` 20 | % Mp = R * M * R'; 21 | % ``` 22 | % 23 | % ### Input Arguments 24 | % 25 | % `rotAxis` 26 | % : Axis of rotation, stored in a row vector with 3 elements. 27 | % 28 | % `rotAngle` 29 | % : Angle of rotation in radian, can be also a row vector with $n_{ang}$ 30 | % number of elements. 31 | % 32 | % ### Output Arguments 33 | % 34 | % `R` 35 | % : Rotation matrix with dimensions of $[3\times 3]$ if a single rotation 36 | % angle is given. If `rotAngle` is a vector, `R` will contain a 37 | % rotation matrix for each angle, it's dimensions are $[3\times 3\times 38 | % n_{ang}]$. 39 | % 40 | % ### See Also 41 | % 42 | % [sw_rot] \| [sw_mirror] 43 | % 44 | 45 | if nargin==0 46 | swhelp sw_rotmat 47 | return 48 | end 49 | 50 | [~, rotM] = sw_rot(rotAxis,rotAngle); 51 | 52 | end -------------------------------------------------------------------------------- /swfiles/sw_rotmatd.m: -------------------------------------------------------------------------------- 1 | function rotM = sw_rotmatd(rotAxis, rotAngle) 2 | % generates 3D rotation matrix 3 | % 4 | % ### Syntax 5 | % 6 | % `R = sw_rotmatd(rotAxis,rotAngle)` 7 | % 8 | % ### Description 9 | % 10 | % `R = sw_rotmatd(rotAxis,rotAngle)` produces the `R` rotation matrix, for 11 | % identically to [sw_rotmat], except that here the unit of `rotAngle` is 12 | % \\deg. 13 | % 14 | % ### See Also 15 | % 16 | % [sw_rotmat] \| [sw_rot] 17 | % 18 | 19 | if nargin==0 20 | swhelp sw_rotmatd 21 | return 22 | end 23 | 24 | [~, rotM] = sw_rot(rotAxis,rotAngle*pi/180); 25 | 26 | end -------------------------------------------------------------------------------- /swfiles/sw_uniquetol.m: -------------------------------------------------------------------------------- 1 | function [unique, firstIdx] = sw_uniquetol(M,tol) 2 | % returns the unique column vectors within tolerance 3 | % 4 | % ### Syntax 5 | % 6 | % `[Mu, firstIdx] = sw_uniquetol(M,tol)` 7 | % 8 | % ### Description 9 | % 10 | % `[Mu, firstIdx] = sw_uniquetol(m,tol)` returns unique column vectors 11 | % within the given `tol` tolerance. Two column vectors are considered 12 | % unequal, if the distance between them is larger than the tolerance 13 | % ($\delta$): 14 | % 15 | % $\sqrt{\sum_i (V_i-U_i)^2} < \delta$ 16 | % 17 | % ### Input Arguments 18 | % 19 | % `M` 20 | % : Matrix that contains column vectors. 21 | % 22 | % `tol` 23 | % : Distance tolerance, default value is $10^{-5}$. 24 | % 25 | % ### Output Arguments 26 | % 27 | % `Mu` 28 | % : Matrix that contains the unique column vectors. 29 | % 30 | % `firstIdx` 31 | % : Indices pointing to the first occurence of the unique element. 32 | % 33 | % This function is similar to the Matlab built-in 34 | % `unique(M,'rows','first')`, but with controllable tolerance. 35 | % 36 | % ### See Also 37 | % 38 | % [unique](https://ch.mathworks.com/help/matlab/ref/unique.html) 39 | % 40 | 41 | if nargin == 0 42 | swhelp sw_uniquetol 43 | return 44 | end 45 | 46 | if nargin < 2 47 | tol = 1e-5; 48 | end 49 | 50 | unique = M*0; 51 | tol2 = tol(1)^2; 52 | 53 | if nargout < 2 54 | idx = 1; 55 | while ~isempty(M) 56 | unique(:,idx) = M(:,1); 57 | idxSame = sum(bsxfunsym(@minus,M,unique(:,idx)).^2,1) < tol2; 58 | M(:,idxSame) = []; 59 | idx = idx + 1; 60 | end 61 | 62 | else 63 | idx = 1; 64 | % storing the indices in M 65 | idxM = 1:size(M,2); 66 | firstIdx = zeros(1,size(M,2)); 67 | 68 | while ~isempty(M) 69 | unique(:,idx) = M(:,1); 70 | firstIdx(idx) = idxM(1); 71 | idxSame = sum(bsxfun(@minus,M,unique(:,idx)).^2,1) < tol2; 72 | M(:,idxSame) = []; 73 | idxM(idxSame) = []; 74 | 75 | idx = idx + 1; 76 | end 77 | firstIdx = firstIdx(1:(idx-1)); 78 | end 79 | unique = unique(:,1:(idx-1)); 80 | 81 | end -------------------------------------------------------------------------------- /swfiles/swhelp.m: -------------------------------------------------------------------------------- 1 | function varargout = swhelp(funName0) 2 | % outputs the SpinW help 3 | % 4 | % ### Syntax 5 | % 6 | % `swhelp(funName)` 7 | % 8 | % ### Description 9 | % 10 | % `swhelp(funName)` shows the help on the given function name, 11 | % method, property name. Works the same way as the Matlab built-in 12 | % [matlab.help] command. 13 | % 14 | % ### See Also 15 | % 16 | % [swdoc], [matlab.help] 17 | % 18 | 19 | helpStr = help(funName0); 20 | % remove the --- method --- part 21 | helpStr = regexprep(helpStr,'---[^\n]+?---\n\s*?\n',''); 22 | newLine = char(10); %#ok 23 | 24 | % if there is a ### Methods section convert all into links 25 | mIdx1 = regexp(helpStr,'### Methods','once'); 26 | if ~isempty(mIdx1) 27 | mIdx2 = regexp(helpStr,' ### '); 28 | mIdx2 = mIdx2(find(mIdx2>mIdx1,1)); 29 | 30 | % replace links 31 | %helpStr = [helpStr(1:mIdx1-1) regexprep(helpStr(mIdx1:mIdx2),['(' funName0 '\.\w+?)(\s+)'],'\[$1\] ${strtrim(iindex(strsplit(help($1),char(10)),''{}'',1))}$2') helpStr(mIdx2+1:end)]; 32 | helpStr = [helpStr(1:mIdx1-1) regexprep(helpStr(mIdx1:mIdx2),['[ ]+(' funName0 '\.\w+?)\n'],' \* \[$1\] ${strtrim(iindex(strsplit(help($1),char(10)),''{}'',1))}\n') helpStr(mIdx2+1:end)]; 33 | end 34 | 35 | % remove reference page thingy 36 | helpStr = regexprep(helpStr,'Reference page in Doc Center\n[\s\w]+?\n',''); 37 | 38 | helpStr = [repmat('_',1,75) newline '`' funName0 '` ' helpStr]; 39 | 40 | % convert from SpinW MarkDown to output that can be printed in the Command Window 41 | helpStr = sw_markdown(helpStr); 42 | 43 | % cut trailing space 44 | helpStr = regexprep(helpStr,'\s*$',''); 45 | 46 | helpStr = [helpStr newLine repmat('_',1,75)]; 47 | 48 | 49 | if nargout == 0 50 | % print the help 51 | disp(helpStr); 52 | else 53 | varargout{1} = helpStr; 54 | end 55 | 56 | end -------------------------------------------------------------------------------- /swfiles/usefull/sw_always.m: -------------------------------------------------------------------------------- 1 | function out = sw_always(inp) 2 | % converts symbolic logical expressions into logical expressions 3 | % 4 | % out = SW_ALWAYS(inp) 5 | % 6 | % Use carefully, for undecided results return false without warning! 7 | % 8 | % Input: 9 | % 10 | % inp Any symbolic/logical or numeric type matrix. 11 | % 12 | % Output: 13 | % 14 | % out Logical output with the same dimensions as the input. 15 | % 16 | 17 | if isa(inp,'sym') 18 | out = isAlways(inp,'Unknown','false'); 19 | else 20 | out = logical(inp); 21 | end 22 | 23 | end -------------------------------------------------------------------------------- /swfiles/usefull/sw_createpcr.m: -------------------------------------------------------------------------------- 1 | function sw_createpcr(path, pcrFile, perm) 2 | % SW_CREATEPCR(path, pcrFile, perm) creates the structural part of a pcr 3 | % file from a .cif file. 4 | % 5 | % This function will create the atomic positions from a .cif file. 6 | % pcr file is the control file for FullProf Rietveld refinement software. 7 | % 8 | % perm Permutation of the (x,y,z) coordinates. 9 | % 10 | 11 | if nargin == 0 12 | swhelp sw_createpcr 13 | return 14 | end 15 | 16 | if nargin < 3 17 | perm = 1:3; 18 | end 19 | 20 | swdat = sw(path); 21 | cifdat = cif(path); 22 | 23 | mult = cifdat.('atom_site_symmetry_multiplicity'); 24 | mult = mult/max(mult); 25 | 26 | 27 | fid = fopen(pcrFile,'w'); 28 | fprintf(fid,'!Atom Typ X Y Z Biso Occ In Fin N_t Spc /Codes\n'); 29 | 30 | nAtom = size(swdat.unit_cell.r,2); 31 | 32 | uc = swdat.unit_cell; 33 | 34 | idx = 1; 35 | for ii = 1:nAtom 36 | if (ii>1) && strcmp(uc.label{ii},uc.label{ii-1}) 37 | idx = idx + 1; 38 | else 39 | idx = 1; 40 | end 41 | 42 | if numel(uc.label{ii})>1 43 | fprintf(fid,'%s%d',uc.label{ii},idx); 44 | fprintf(fid,' %s ',uc.label{ii}); 45 | else 46 | fprintf(fid,'%s%d',uc.label{ii},idx); 47 | fprintf(fid,' %s ',uc.label{ii}); 48 | 49 | end 50 | 51 | fprintf(fid,'%9.5f%9.5f%9.5f%9.5f%9.5f%4d%4d%4d%4d\n',uc.r(perm,ii)',0,mult(ii),[0 0 0 0]); 52 | fprintf(fid,' 0.00 0.00 0.00 0.00 0.00\n'); 53 | end 54 | 55 | fclose(fid); 56 | 57 | end -------------------------------------------------------------------------------- /swfiles/usefull/sw_sub1.m: -------------------------------------------------------------------------------- 1 | function out = sw_sub1(inp, varargin) 2 | % converts symbolic variables into double by substituting 1 for every symbol 3 | % 4 | % out = SW_SUB1(inp, num) 5 | % 6 | % Input: 7 | % 8 | % inp Any symbolic/double type matrix. 9 | % num Can be scalar or vector with the number of elements equal to the 10 | % number of symbolic variables in inp. If it is 'rand', random values 11 | % will be assigned to each symbolic variable in inp. 12 | % 13 | % Output: 14 | % 15 | % out Double type output with the same dimensions as the input. 16 | % 17 | % See also SW_ALWAYS. 18 | % 19 | 20 | if nargin == 0 21 | swhelp sw_sub1 22 | return 23 | end 24 | 25 | if nargin == 1 26 | dnum = 1; 27 | else 28 | dnum = varargin{1}; 29 | end 30 | 31 | if isa(inp,'sym') 32 | 33 | symVar = symvar(inp); 34 | 35 | if strcmp(dnum,'rand') 36 | dnum = rand(1,numel(symVar)); 37 | end 38 | 39 | if ~isempty(symVar) 40 | out = double(subs(inp,symVar,dnum.*ones(1,numel(symVar)))); 41 | else 42 | out = double(inp); 43 | end 44 | else 45 | out = inp; 46 | end 47 | 48 | end -------------------------------------------------------------------------------- /test/fourier_test.m: -------------------------------------------------------------------------------- 1 | %% kagome lattice 2 | 3 | kag = spinw; 4 | kag.genlattice('lat_const',[6 6 4],'angled',[90 90 120]) 5 | kag.addatom('r',[1/2 0 0],'S',1) 6 | kag.addatom('r',[1/2 1/2 0],'S',1) 7 | kag.addatom('r',[0 1/2 0],'S',1) 8 | 9 | %kag.newcell('bvect',{[2 0 0] [0 1 0] [0 0 1]}) 10 | kag.quickham(1) 11 | %plot(kag) 12 | 13 | %% calculate fourier transformation 14 | 15 | for ii = 1:10:100 16 | Q = reshape(sw_qgrid('bin',{[0 0.01 2] [0 0.01 2] [1 ii]}),3,[]); 17 | tic; 18 | F2 = kag.fourier(Q,'isomode','auto'); 19 | t1(ii) = toc; 20 | end 21 | 22 | -------------------------------------------------------------------------------- /test/scga_test_kag.m: -------------------------------------------------------------------------------- 1 | %% kagome lattice 2 | 3 | kag = spinw; 4 | kag.genlattice('lat_const',[6 6 4],'angled',[90 90 120]) 5 | kag.addatom('r',[1/2 0 0],'S',1) 6 | kag.addatom('r',[1/2 1/2 0],'S',1) 7 | kag.addatom('r',[0 1/2 0],'S',1) 8 | 9 | %kag.newcell('bvect',{[2 0 0] [0 1 0] [0 0 1]}) 10 | kag.quickham(1) 11 | %plot(kag) 12 | 13 | %% eig 14 | 15 | Q = sw_qgrid('bin',{[0 0.05 2] [0 0.05 2]}); 16 | 17 | chi = kag.fourier(reshape(Q,3,[])); 18 | 19 | ft = squeeze(chi.ft(1,1,:,:,:)); 20 | 21 | clear om 22 | for ii = 1:size(ft,3) 23 | om(:,ii) = eig(ft(:,:,ii)); 24 | end 25 | 26 | nMode = size(om,1); 27 | sQ = num2cell(size(Q)); 28 | om = reshape(om',sQ{2:end},nMode); 29 | 30 | clf 31 | for ii = 1:nMode 32 | surf(squeeze(Q(1,:,:)),squeeze(Q(2,:,:)),om(:,:,ii)); 33 | hold on 34 | end 35 | %% scga method determine lambda 36 | 37 | kag.setunit('mode','1') 38 | T = 10.^linspace(-2,2,41); 39 | Q = sw_qgrid('bin',{[0 0.05 2] [0 0.05 2]}); 40 | spec = kag.scga(Q,'T',T,'plot',true,'nInt',1e4); 41 | 42 | figure 43 | semilogx(spec.T,spec.lambda,'o-') 44 | 45 | %% scga method diffuse scattering 46 | 47 | kag.setunit('mode','1') 48 | T = 1; 49 | Q = sw_qgrid('bin',{[0 0.05 4] [0 0.05 4]}); 50 | spec = kag.scga2(Q,'T',T,'plot',true,'nInt',1e4); 51 | 52 | 53 | %% 54 | figure 55 | hSurf = surf(squeeze(Q(1,:,:,:)),squeeze(Q(2,:,:,:)),spec.Sab); 56 | hSurf.EdgeAlpha = 0; 57 | view(2) 58 | hold on 59 | contour3(squeeze(Q(1,:,:,:)),squeeze(Q(2,:,:,:)),spec.Sab,0:0.05:2,'color','k'); 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /test/sw_symtest.m: -------------------------------------------------------------------------------- 1 | %% test symmetry string generator 2 | good = false(1,230); 3 | 4 | for ii = 1:230 5 | [R,T,~,strSym0] = sw_gensym(ii); 6 | strSym0 = strtrim(strSym0); 7 | 8 | strSym = sw_gensymstr(R,T); 9 | 10 | % check equality 11 | if numel(strSym0) == numel(strSym) 12 | good(ii) = all(strSym0==strSym); 13 | end 14 | 15 | end 16 | 17 | if ~all(good) 18 | error('Symmetry string generator test failed!') 19 | end 20 | 21 | %% test generator function 22 | 23 | good = false(1,230); 24 | 25 | for ii = 1:230 26 | [Rg,Tg] = sw_gensym(ii); 27 | [R,T] = sw_gencoord(ii); 28 | [R0, T0] = sw_symgetgen(R,T); 29 | % check that the number of generators are smaller or equal 30 | good(ii) = size(Rg,3) >= size(R0,3); 31 | 32 | end 33 | 34 | [R1,T1] = sw_gencoord({R0 T0}); 35 | [R2,T2] = sw_gencoord({Rg(:,:,[1 3 4]) Tg(:,[1 3 4])}); 36 | 37 | if ~all(good) 38 | error('Symmetry generator calculator test failed!') 39 | end 40 | 41 | % %% 42 | % 43 | % Rs =[reshape(R,9,[]); T]; 44 | % R1s=[reshape(R1,9,[]);T1]; 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /test/sw_test.m: -------------------------------------------------------------------------------- 1 | function errMsg = sw_test(varargin) 2 | % testing of sw functions 3 | % errMsg = sw_test('Option1,' Value1, ...) 4 | % 5 | % Options: 6 | % 7 | % fid Identifier where the text output goes. 8 | % 0 No output. 9 | % 1 Output onto the Command Window. 10 | % fid Output into file, opened with: fid = fopen(path) 11 | % tol Tolerance on the agreement of different calculated matrices, 12 | % default is 1e-5. 13 | % 14 | % Output: 15 | % 16 | % errMsg Cell, that contains all the error messages for every test 17 | % function. 18 | % 19 | 20 | currDir = cd; 21 | cd(sw_rootdir); 22 | 23 | % switch off warnings 24 | warnLevel = warning; 25 | warning('off','all'); 26 | 27 | inpForm.fname = {'fid' 'tol' }; 28 | inpForm.defval = {-1 1e-5 }; 29 | inpForm.size = {[1 1] [1 1] }; 30 | 31 | param = sw_readparam(inpForm, varargin{:}); 32 | pref = swpref; 33 | 34 | if param.fid == -1 35 | param.fid = pref.fid; 36 | else 37 | fid = param.fid; 38 | end 39 | 40 | Res = []; 41 | errMsg = {}; 42 | 43 | allTestPath = dir([sw_rootdir 'test' filesep 'sw_test_*.m']); 44 | allTestPath = {allTestPath.name}; 45 | 46 | for ii = 1:numel(allTestPath) 47 | [Res(ii), errMsg{ii}] = eval([allTestPath{ii}(1:end-2) '(param.tol)']); %#ok 48 | end 49 | 50 | minRes = min(Res(Res>0)); 51 | if isempty(minRes) 52 | minRes = 0; 53 | end 54 | 55 | switch minRes 56 | case 0 57 | % no error 58 | fprintf(fid,'All test ran succesfull!\n'); 59 | case 1 60 | % error message 61 | fprintf(fid,'The code throw an error message!\n'); 62 | case 2 63 | % wrong result 64 | fprintf(fid,'Some of the numerical results were wrong!\n'); 65 | otherwise 66 | fprintf(fid,'Unkown error code!\n'); 67 | end 68 | 69 | errMsg = [allTestPath; errMsg]; 70 | 71 | % clear symmetry.dat file from newly added entries 72 | sw_initialize; 73 | 74 | % change back to the current directory 75 | cd(currDir); 76 | 77 | % switch on warnings 78 | warning(warnLevel); 79 | 80 | end -------------------------------------------------------------------------------- /test/sw_test_sym2.m: -------------------------------------------------------------------------------- 1 | function [Res, errMsg] = sw_test_sym2(tol) 2 | 3 | % no error 4 | Res = 0; 5 | errMsg = []; 6 | 7 | try 8 | %% RUN BY HAND 9 | mnco3 = sw; 10 | mnco3.genlattice('lat_const',[4.773 4.773 16.642],'angle',[90 90 120]*pi/180,'sym','R -3 c'); 11 | %mnco3.genlattice('lat_const',[4.773 4.773 16.642],'angle',[90 90 120]*pi/180,'sym',167); 12 | 13 | mnco3.addatom('label',{'Mn'},'r',[0 0 0]','S',1,'color',[0;0;255]); 14 | mnco3.addatom('label',{'C'},'r', [0 0 1/4]','S',0,'color',[128;128;128]); 15 | mnco3.addatom('label',{'O'},'r', [0.2695 0 1/4]','S',0,'color',[255;0;0]); 16 | 17 | mnco3.gencoupling('maxdistance',10); 18 | mnco3.addmatrix('label',{'J1'},'color',[255;0;0]); 19 | mnco3.addmatrix('label',{'J2'},'color',[0;255;0]); 20 | mnco3.addmatrix('label',{'J3'},'color',[0;0;255]); 21 | 22 | mnco3.addcoupling('J1',1); 23 | mnco3.addcoupling('J2',1); 24 | %mnco3.addcoupling('J3',3); 25 | 26 | mnco3.setmatrix('label','J1','pref',{[1 0 0]}); 27 | mnco3.setmatrix('label','J2','pref',{[0 1 0]}); 28 | 29 | hFig = plot(mnco3,'range',[2 2 1],'pNonMagAtom',false); 30 | %% 31 | close(hFig); 32 | 33 | catch errMsg 34 | % code throws error 35 | Res = 1; 36 | return; 37 | end 38 | 39 | end -------------------------------------------------------------------------------- /tutorials/help/Atomdat.m: -------------------------------------------------------------------------------- 1 | %% Atom.dat 2 | % The atom.dat file contains information about different elements/isotopes, 3 | % where each row defines an element/isotope. The meaning of the columns are 4 | % the following: 5 | % 6 | % * *Name* of element, string. These labels can be used in the 7 | % sw.unit_cell.label field to assign different atoms to crystallographic 8 | % positions. 9 | % * *Radius* in Angstrom, double. This gives the atomic radius for 10 | % plotting. 11 | % * *Color* RGB code, 3 integer. This gives the color for plottig the atom. 12 | % * *Mass*, double. The mass of the element/isotope for unit cell mass 13 | % calculation. 14 | % * *Long name*, string. Long name of the element/isotope. 15 | % 16 | % See also ion.dat. -------------------------------------------------------------------------------- /tutorials/help/Atomdat/Atomdat.txt: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 |

Atom.dat

The atom.dat file contains information about different elements/isotopes, where each row defines an element/isotope. The meaning of the columns are the following:

  • Name of element, string. These labels can be used in the [[SwpropertiesEN#2][sw.unit_cell]].label field to assign different atoms to crystallographic positions.
  • Radius in Angstrom, double. This gives the atomic radius for plotting.
  • Color RGB code, 3 integer. This gives the color for plottig the atom.
  • Mass, double. The mass of the element/isotope for unit cell mass calculation.
  • Long name, string. Long name of the element/isotope.
17 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /tutorials/help/Bond.m: -------------------------------------------------------------------------------- 1 | %% Bond 2 | % Bonds are vectors connecting two magnetic ion. 3 | % 4 | %% Definition 5 | % Bonds are defined on the crystal of magnetic ions using the positions 6 | % within the unit cell. Each bond is defined by two atoms that are 7 | % connected with direction. The bond points from atom1 to atom2 where atom1 8 | % is at the zeroth unit cell (cell at the origin of the lattice coordinate 9 | % system), atom2 is in the unit cell defined by the *dl* translation vector 10 | % (in lattice units). The equivalent bonds that are related by lattice 11 | % vectors to the above defined one are not stored explicitly but assumed in 12 | % the spin wave calculation. The list of bonds are stored in the 13 | % sw.coupling field, where each column of dl, atom1 and atom2 subfields 14 | % defines different bonds. Each bond has an identifier stored in the idx 15 | % subfield. These identifiers let the user select certain set of bonds 16 | % easily. If two bonds have the same identifier, they are regarded 17 | % equivalent. Coupling matrix can be quickly assigned to multiple 18 | % equivalent bonds using the sw.addcoupling command. 19 | % 20 | %% Generating bonds 21 | % Although the sw.coupling matrix can be filled manually, the 22 | % sw.gencoupling command can generate the list of bonds automatically. The 23 | % generated list of bonds sorted according to increasing length, however no 24 | % particular order can be assumed between equal length bonds. If no 25 | % symmetry operators are considered for the generation of bonds 26 | % ('forceNoSym' option set to true) all bonds with equal length are 27 | % assigned the same identifier, starting with 1 for the shortest bonds. If 28 | % symmetry operators are considered, only symmetry equivalent bonds will 29 | % have the same identifier. 30 | % 31 | %% Listing bonds 32 | % To list bonds in an easyer to read format, the sw.couplingtable command 33 | % can be used. To list bonds with a set of identifiers use the 34 | % sw.couplingtable(bond_id) command. 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tutorials/help/Documentation.m: -------------------------------------------------------------------------------- 1 | %% Documentation 2 | 3 | %% Old documentation 4 | % The old documentation that will be slowly replaced, can be found here: 5 | % [[https://wiki.helmholtz-berlin.de/spinw/index.php5/Documentation]] 6 | 7 | %% Introduction 8 | % *SpinW* is a Matlab Library for numerical and symbolic calculation on 9 | % spin wave dispersion on magnetic lattices. The main unit of the package 10 | % is the sw class, that contains the necessary properties and methods to 11 | % achieve this. The numerical method is described in the links under the 12 | % [[PublicationsEN][Publications]]. 13 | -------------------------------------------------------------------------------- /tutorials/help/Documentation/Documentation.txt: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 |

Documentation

Contents

Old documentation

The old documentation that will be slowly replaced, can be found here: [[https://wiki.helmholtz-berlin.de/spinw/index.php5/Documentation]]

Introduction

SpinW is a Matlab Library for numerical and symbolic calculation on spin wave dispersion on magnetic lattices. The main unit of the package is the [[SwclassEN][sw class]], that contains the necessary properties and methods to achieve this. The numerical method is described in the links under the [[PublicationsEN][Publications]].

18 | 19 | 20 | 28 | 29 | -------------------------------------------------------------------------------- /tutorials/help/Exchangecoupling/gen_Exchangecoupling_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Exchangecoupling/gen_Exchangecoupling_01.png -------------------------------------------------------------------------------- /tutorials/help/GenerateFigures.m: -------------------------------------------------------------------------------- 1 | %% sw properties 2 | 3 | docDir = '~/spinwdoc_git/docs/'; 4 | imDir = [docDir 'images/']; 5 | 6 | plot(sw) 7 | saveas(gcf,[imDir 'swclass1.png']) 8 | close all 9 | 10 | 11 | -------------------------------------------------------------------------------- /tutorials/help/Iondat.m: -------------------------------------------------------------------------------- 1 | %% Ion.dat 2 | % The ion.dat file contains information about different magnetic ions, 3 | % where each row defines an ion. The meaning of the columns are 4 | % the following: 5 | % 6 | % * *Name* of ion, string. These labels can be used in the 7 | % sw.unit_cell.label field to assign different ions to crystallographic 8 | % positions, predefined names follow the [M][element name][charge] notation 9 | % similarly to FullProf. 10 | % * *Magnetic form factor*, double. It is either 7 or 9 doubles the A, a, 11 | % B, b, ... coefficients in the formula: 12 | % LATEX\langle j_0(Q_s)\rangle = A\cdot exp(-a\cdot Q_s^2) + B\cdot exp(-b\cdot Q_s^2) + C* exp(-c\cdot Q_s^2)+D\cdot exp(-d\cdot Q_s^2) + EPATEX. 13 | % * *Spin quantum number*, double. This number defines the spin value that 14 | % is used as default in the sw.addatom mathod if 'S' is undefined. 15 | % 16 | % See also atom.dat, SW_MFF. -------------------------------------------------------------------------------- /tutorials/help/Iondat/Iondat.txt: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 |

Ion.dat

The ion.dat file contains information about different magnetic ions, where each row defines an ion. The meaning of the columns are the following:

  • Name of ion, string. These labels can be used in the [[SwpropertiesEN#2][sw.unit_cell]].label field to assign different ions to crystallographic positions, predefined names follow the [M][element name][charge] notation similarly to FullProf.
  • Magnetic form factor, double. It is either 7 or 9 doubles the A, a, B, b, ... coefficients in the formula: \langle j_0(Q_s)\rangle = A\cdot exp(-a\cdot Q_s^2) + B\cdot exp(-b\cdot Q_s^2) + C* exp(-c\cdot Q_s^2)+D\cdot exp(-d\cdot Q_s^2) + E.
  • Spin quantum number, double. This number defines the spin value that is used as default in the sw.addatom mathod if 'S' is undefined.

See also [[AtomdatEN][atom.dat]], SW_MFF.

17 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /tutorials/help/Keywords.m: -------------------------------------------------------------------------------- 1 | %% Keywords 2 | 3 | %% 4 | % You can search for keywords below, that describe different topics. If you 5 | % have a question, this is a good starting point to search. 6 | % 7 | %
8 | % 9 | % *A, B, C* 10 | % 11 | %
12 | % 13 | % atom.dat, bond, cif class, cif file, constraint function, 14 | % coordinate system, crystal structure 15 | % 16 | % 17 | %
18 | % 19 | % *D, E, F* 20 | % 21 | %
22 | % 23 | % exchange coupling 24 | % 25 | %
26 | % 27 | % *G, H, I* 28 | % 29 | %
30 | % 31 | % g-matrix, ion.dat, help, Horace 32 | % 33 | % 34 | %
35 | % 36 | % *J, K, L* 37 | % 38 | % 39 | %
40 | % 41 | % *M, N, O* 42 | % 43 | %
44 | % 45 | % list of sw methods, long range order, magnetic field, magnetic structure 46 | % 47 | %
48 | % 49 | % *P, Q, R* 50 | % 51 | %
52 | % 53 | % plotting crystal structure, list of sw properties, powder spectrum 54 | % 55 | %
56 | % 57 | % *S, T, U* 58 | % 59 | %
60 | % 61 | % simulated annealing, space group, spin, spin-spin correlation function, 62 | % spin wave, symmetry.dat, sw class, temperature, twin, units 63 | % 64 | %
65 | % 66 | % *V, W, X, Y, Z* 67 | % -------------------------------------------------------------------------------- /tutorials/help/Powderspectrum.m: -------------------------------------------------------------------------------- 1 | %% -------------------------------------------------------------------------------- /tutorials/help/Swclass/export_fig_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Swclass/export_fig_out.png -------------------------------------------------------------------------------- /tutorials/help/Swclass/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Swclass/fig1.png -------------------------------------------------------------------------------- /tutorials/help/Swclass/fig_test1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Swclass/fig_test1.png -------------------------------------------------------------------------------- /tutorials/help/Swclass/gen_Swclass_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Swclass/gen_Swclass_01.png -------------------------------------------------------------------------------- /tutorials/help/Swclass/painter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/Swclass/painter.png -------------------------------------------------------------------------------- /tutorials/help/links.txt: -------------------------------------------------------------------------------- 1 | "sw.lattice" "[[SwpropertiesEN#1][sw.lattice]]" 2 | "sw.unit_cell" "[[SwpropertiesEN#2][sw.unit_cell]]" 3 | "sw.twin" "[[SwpropertiesEN#3][sw.twin]]" 4 | "sw.matrix" "[[SwpropertiesEN#4][sw.matrix]]" 5 | "sw.single_ion" "[[SwpropertiesEN#5][sw.single_ion]]" 6 | "sw.coupling" "[[SwpropertiesEN#6][sw.coupling]]" 7 | "sw.mag_str" "[[SwpropertiesEN#7][sw.mag_str]]" 8 | "sw.unit" "[[SwpropertiesEN#8][sw.unit]]" 9 | "sw class" "[[SwclassEN][sw class]]" 10 | "coordinate system" "[[CoordinatesystemEN][coordinate system]]" 11 | "powder spectrum" "[[PowderspectrumEN][powder spectrum]]" 12 | "exchange coupling" "[[ExchangecouplingEN][exchange coupling]]" 13 | "atom.dat" "[[AtomdatEN][atom.dat]]" 14 | "ion.dat" "[[IondatEN][ion.dat]]" 15 | "bond" "[[BondEN][bond]]" -------------------------------------------------------------------------------- /tutorials/help/swclass1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/help/swclass1.png -------------------------------------------------------------------------------- /tutorials/publish/LuVO3_fitted_modes.txt: -------------------------------------------------------------------------------- 1 | QH QK QL ENlim1 ENlim2 I1 EN1 sigma1 I2 EN2 sigma2 2 | 0 1.0000 2.1000 2.0000 40.0000 185.5220 27.9475 0.1788 0 0 0 3 | 0 1.0000 2.2000 2.0000 40.0000 237.3841 27.4221 0.3170 0 0 0 4 | 0 1.0000 2.3000 2.0000 40.0000 243.4974 26.2392 0.1756 0 0 0 5 | 0 1.0000 2.4000 2.0000 40.0000 271.7875 24.8575 0.1297 0 0 0 6 | 0 1.0000 2.5000 2.0000 40.0000 292.3563 22.7275 0.1265 0 0 0 7 | 0 1.0000 2.6000 2.0000 40.0000 350.5324 20.2714 0.1148 0 0 0 8 | 0 1.0000 2.7000 2.0000 40.0000 380.7541 17.4248 0.1450 0 0 0 9 | 0 1.0000 2.8000 2.0000 40.0000 446.7639 13.8905 0.1390 0 0 0 10 | 0 1.0000 2.9000 2.0000 40.0000 86.3028 5.6092 0.5161 540.3167 10.5548 0.2542 11 | 0 1.0000 3.0000 2.0000 40.0000 538.0782 3.9185 0.1739 577.6867 8.9039 0.4067 12 | 0 1.1000 3.1000 2.0000 40.0000 433.0529 12.9913 0.1046 0 0 0 13 | 0 1.2000 3.2000 2.0000 40.0000 243.7242 20.7170 0.1041 0 0 0 14 | 0 1.3000 3.3000 2.0000 40.0000 172.8896 27.2992 0.1228 0 0 0 15 | 0 1.4000 3.4000 2.0000 40.0000 166.9054 31.7067 0.0933 0 0 0 16 | 0 1.5000 3.5000 2.0000 40.0000 20.7324 36.6609 0.4899 0 0 0 -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial1/tutorial1_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial1/tutorial1_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial10/tutorial10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial10/tutorial10.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial10/tutorial10_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial10/tutorial10_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial10/tutorial10_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial10/tutorial10_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial10/tutorial10_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial10/tutorial10_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial10/tutorial10_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial10/tutorial10_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial11.m: -------------------------------------------------------------------------------- 1 | %% Spin wave spectrum of La2CuO4 2 | % Crystal structure of La2CuO4 contains Cu2+ atoms with S = 1/2 spin on a 3 | % square lattice. Exchange parameters are taken from the paper: 4 | % R. Coldea, Phys. Rev. Lett. *86*, 5377 (2001). 5 | % The exchanges are corrected for the ring exchange but the energy 6 | % renormalization factor included in the paper is not applied. 7 | 8 | J = 138.3; 9 | Jp = 2; 10 | Jpp = 2; 11 | Jc = 38; 12 | 13 | lacuo = sw_model('squareAF',[J-Jc/2 Jp-Jc/4 Jpp]/2,0); 14 | lacuo.unit_cell.S = 1/2; 15 | plot(lacuo,'range',[2 2 1]) 16 | 17 | %% Magnon dispersion and intensity 18 | % We plot the magnon dispersion and the neutron scattering intensity that 19 | % can be directly compared to the paper. We manually apply the quantum 20 | % renormalization factor on the energies. 21 | 22 | Zc = 1.18; 23 | 24 | Qlist = {[3/4 1/4 0] [1/2 1/2 0] [1/2 0 0] [3/4 1/4 0] [1 0 0] [1/2 0 0] 100}; 25 | Qlab = {'P' 'M' 'X' 'P' '\Gamma' 'X'}; 26 | 27 | lacuoSpec = lacuo.spinwave(Qlist,'hermit',false); 28 | lacuoSpec.omega = lacuoSpec.omega*Zc; 29 | 30 | lacuoSpec = sw_neutron(lacuoSpec); 31 | lacuoSpec = sw_egrid(lacuoSpec,'component','Sperp'); 32 | figure 33 | subplot(2,1,1) 34 | sw_plotspec(lacuoSpec,'mode',3,'axLim',[0 5],'dE',35,'dashed',true,'qlabel',Qlab) 35 | colorbar off 36 | subplot(2,1,2) 37 | lacuoSpec = sw_omegasum(lacuoSpec,'zeroint',1e-5,'tol',1e-3); 38 | sw_plotspec(lacuoSpec,'mode',2,'axLim',[0 20],'dashed',true,'colormap',[0 0 0],'qlabel',Qlab) 39 | swplot.subfigure(1,3,1) 40 | 41 | %% 42 | % Written by 43 | % Sandor Toth 44 | % 16-June-2014 -------------------------------------------------------------------------------- /tutorials/publish/tutorial11/tutorial11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial11/tutorial11.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial11/tutorial11_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial11/tutorial11_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial11/tutorial11_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial11/tutorial11_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial12/tutorial12_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial12/tutorial12_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial13/tutorial13_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial13/tutorial13_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial14/tutorial14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial14/tutorial14.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial14/tutorial14_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial14/tutorial14_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial14/tutorial14_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial14/tutorial14_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial14/tutorial14_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial14/tutorial14_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial15/tutorial15_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial15/tutorial15_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_08.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_09.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_10.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial16/tutorial16_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial16/tutorial16_11.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial18/tutorial18_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial18/tutorial18_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial19/tutorial19_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial19/tutorial19_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial2/tutorial2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial2/tutorial2.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial2/tutorial2_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial2/tutorial2_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial2/tutorial2_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial2/tutorial2_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial2/tutorial2_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial2/tutorial2_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial2/tutorial2_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial2/tutorial2_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial20/tutorial20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial20/tutorial20.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial20/tutorial20_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial20/tutorial20_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial20/tutorial20_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial20/tutorial20_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial20/tutorial20_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial20/tutorial20_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial20/tutorial20_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial20/tutorial20_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial21/tutorial21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial21/tutorial21.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial21/tutorial21_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial21/tutorial21_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial21/tutorial21_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial21/tutorial21_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial21/tutorial21_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial21/tutorial21_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial21/tutorial21_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial21/tutorial21_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial28/tutorial28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial28/tutorial28.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial28/tutorial28_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial28/tutorial28_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial28/tutorial28_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial28/tutorial28_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial28/tutorial28_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial28/tutorial28_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial28/tutorial28_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial28/tutorial28_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial3/tutorial3_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial3/tutorial3_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial30/tutorial30_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial30/tutorial30_08.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_08.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_09.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_10.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_11.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial31/tutorial31_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial31/tutorial31_12.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial32/tutorial32_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial32/tutorial32_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial33/tutorial33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial33/tutorial33.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial33/tutorial33_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial33/tutorial33_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial33/tutorial33_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial33/tutorial33_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial33/tutorial33_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial33/tutorial33_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial34/tutorial34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial34/tutorial34.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial34/tutorial34_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial34/tutorial34_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial34/tutorial34_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial34/tutorial34_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial34/tutorial34_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial34/tutorial34_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial35/tutorial35_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial35/tutorial35_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial37.m: -------------------------------------------------------------------------------- 1 | %% triangular lattice dispersion 2 | 3 | spec = sw_egrid(spinwave(sw_model('triAF',1),{[0 0 0] [1 1 0] 501})); 4 | 5 | %% constant resolution 6 | 7 | figure; 8 | 9 | % plot the constant resolution value 10 | dE = 0.3; 11 | subplot(3,2,1) 12 | plot([0 4],[dE dE],'r-') 13 | title('Constant resolution function') 14 | xlabel('Energy Transfer (meV)') 15 | ylabel('FWHM energy resolution (meV)') 16 | 17 | % apply constant resolution on the simulation 18 | subplot(3,2,2) 19 | spec = sw_instrument(spec,'dE',0.3); 20 | sw_plotspec(spec,'mode','color'); 21 | 22 | 23 | % fit and plot tabulated resoltuion values and apply to the simulation 24 | EN = [0 1 2 3 4]; % meV 25 | dE = [0.05 0.05 0.05 0.3 0.4]; % meV 26 | R = [EN' dE']; 27 | 28 | subplot(3,2,3) 29 | spec = sw_instrument(spec,'dE',R,'polDeg',3,'plot',true); 30 | 31 | subplot(3,2,4) 32 | sw_plotspec(spec,'mode','color'); 33 | 34 | % resolution is defined by user provided function (anonymous or .m file) 35 | a = 0.01; 36 | b = 1.0; 37 | resFun = @(x)a+b*exp(-x); 38 | 39 | % plot the user defined resolution function 40 | xVal = linspace(0,5,501); 41 | subplot(3,2,5) 42 | plot(xVal,resFun(xVal),'r-') 43 | title('Resolution function') 44 | xlabel('Energy Transfer (meV)') 45 | ylabel('FWHM energy resolution (meV)') 46 | 47 | % apply the function to the simulation 48 | subplot(3,2,6) 49 | spec = sw_instrument(spec,'dE',resFun); 50 | sw_plotspec(spec,'mode','color'); 51 | -------------------------------------------------------------------------------- /tutorials/publish/tutorial38/tutorial38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial38/tutorial38.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial38/tutorial38_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial38/tutorial38_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial38/tutorial38_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial38/tutorial38_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial38/tutorial38_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial38/tutorial38_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial38/tutorial38_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial38/tutorial38_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial4/tutorial4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial4/tutorial4.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial4/tutorial4_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial4/tutorial4_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial4/tutorial4_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial4/tutorial4_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial4/tutorial4_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial4/tutorial4_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial4/tutorial4_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial4/tutorial4_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial5/tutorial5_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial5/tutorial5_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial6/tutorial6_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial6/tutorial6_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7.m: -------------------------------------------------------------------------------- 1 | %% k=0 Kagome antiferromagnet 2 | % We create a lattice with space group "P -3" where all first neighbor 3 | % bonds are symmetry equivalent and add a magnetic Cr+ with S=1 spin. 4 | 5 | AFkagome = spinw; 6 | AFkagome.genlattice('lat_const',[6 6 10],'angled',[90 90 120],'spgr','P -3') 7 | AFkagome.addatom('r',[1/2 0 0],'S', 1,'label','MCu1','color','r') 8 | plot(AFkagome,'range',[2 2 1]) 9 | 10 | %% Create bonds 11 | % Generate the list of bonds and lists them. 12 | 13 | AFkagome.gencoupling('maxDistance',7) 14 | disp('Bonds:') 15 | AFkagome.table('bond',[]) 16 | 17 | %% Hamiltonian 18 | % We create AFM first neighbor interaction and weak 2nd neighbor AFM 19 | % exchange. 20 | 21 | AFkagome.addmatrix('label','J1','value',1.00,'color','r') 22 | AFkagome.addmatrix('label','J2','value',0.11,'color','g') 23 | AFkagome.addcoupling('mat','J1','bond',1) 24 | AFkagome.addcoupling('mat','J2','bond',2) 25 | plot(AFkagome,'range',[3 3 1]) 26 | 27 | %% Generate magnetic structure 28 | % We create a k = (0 0 0) magnetic structure, with the three spin directions 29 | % in the unit cell (120 degree between neighbors). The spin vector 30 | % components are given in the coordinate system of the lattice vectors 31 | % (abc). 32 | 33 | S0 = [1 -2 1; 2 -1 -1; 0 0 0]; 34 | AFkagome.genmagstr('mode','direct','k',[0 0 0],'n',[0 0 1],'unitS','lu','S',S0); 35 | disp('Magnetic structure:') 36 | AFkagome.table('mag') 37 | AFkagome.energy 38 | 39 | plot(AFkagome,'range',[3 3 1]) 40 | 41 | %% Calculate spin wave dispersion 42 | 43 | afkSpec = AFkagome.spinwave({[-1/2 0 0] [0 0 0] [1/2 1/2 0] 100},'hermit',false); 44 | figure 45 | sw_plotspec(afkSpec,'mode',1,'axLim',[0 3],'colorbar',false,'colormap',[0 0 0],'dashed',true) 46 | 47 | %% Powder spectrum 48 | 49 | afkPow = AFkagome.powspec(linspace(0,2.5,150),'Evect',linspace(0,3,250),... 50 | 'nRand',1e3,'hermit',false); 51 | 52 | figure 53 | sw_plotspec(afkPow,'axLim',[0 0.2]) 54 | 55 | %% 56 | % Written by 57 | % Bjorn Fak & Sandor Toth 58 | % 06-Jun-2014, 06-Feb-2016 59 | -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial7/tutorial7_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial7/tutorial7_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_06.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_07.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial8/tutorial8_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial8/tutorial8_08.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9_01.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9_02.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9_03.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9_04.png -------------------------------------------------------------------------------- /tutorials/publish/tutorial9/tutorial9_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsdev/spinw/03e6d885c1d992404572c6fe22f930bd3330a7e5/tutorials/publish/tutorial9/tutorial9_05.png -------------------------------------------------------------------------------- /tutorials/publish/tutorials.txt: -------------------------------------------------------------------------------- 1 | Examples.txt 2 | 3 | ex1 Ferromagnetic NN chain: energies and intensities (constant) OK 4 | ex2 AF NN chain: energies OK, 5 | intensities a bit wiggly when plotted by sw_plotspec(bfs, 'mode',2) 6 | ex3 Frustrated J1-J2 chain: some matlab warnings 7 | did not check results in detail 8 | ex4 Square lattice: energies and intensities OK [Coldea01, Headings01] 9 | ex5 ferro kagome: energies OK, intensities OK except for spikes at 10 | crossing points 11 | ex6 ferro kagome w/ 4 exchanges: energies OK, intensities OK except for 12 | spikes at crossing points 13 | ex7 AF k=0 kagome: magnetic structure and ground state energy OK 14 | dispersion OK [Fig 15 in Yildirim06] 15 | ex8 AF k=0 J1-DM kagome: OK for opposite sign convention of Dz 16 | as compared to Fig 13 of Yildirim06 17 | ex9 AF sqrt3Xsqrt3 kagome: OK with Sylvain Petit 18 | (despite that the gs is not unique for J1 only!) 19 | -------------------------------------------------------------------------------- /tutorials/tutorial/aniso_rotation.m: -------------------------------------------------------------------------------- 1 | Aniso = diag([-1 0 0]); 2 | 3 | %% you define 2 vectors (the easy axis of Aniso (100) above and the easy axis direction you want in your system (111)): 4 | 5 | v1 = [1 0 0]; 6 | v2 = [1 1 1]/sqrt(3); 7 | 8 | Find the axis around which v1 can be rotated to v2: 9 | 10 | ax = cross(v1,v2); 11 | 12 | Find the rotation angle: 13 | 14 | phi = atan2(norm(cross(v1,v2)),dot(v1,v2)); 15 | 16 | Create a rotation matrix: 17 | 18 | R = sw_rotmat(ax,phi); 19 | 20 | Rotate the Aniso matrix: 21 | 22 | A = R*Aniso*R?; 23 | 24 | This A matrix will define an easy axis anisotropy along the (111) direction with the size of 1 meV. To double check that it is right, we calculate the eigenvalues: 25 | 26 | [V,Aniso2] = eig(A); 27 | -------------------------------------------------------------------------------- /tutorials/tutorial/anneal_tutorial.m: -------------------------------------------------------------------------------- 1 | % Test to reproduce results of this paper: 2 | % P. Lacorre, et al., J. of Magn. and Magn. Mat., 71, 63(1987). 3 | 4 | %% Defines lattice for antiferromagnetic chains 5 | 6 | % AFM chain along a-axis 7 | hChain = sw_model('chain',2); 8 | 9 | % Adds D easy-axis single-ion anisotropy 10 | hChain.addmatrix('value',diag([0 0 -0.2]),'label','A','color','red') 11 | 12 | % Adds the defined D anisotropy to all magnetic atoms 13 | hChain.addaniso('A') 14 | 15 | % Removes units 16 | hChain.unit.kB = 1; 17 | hChain.unit.muB = 1; 18 | 19 | %% Plots crystal structure 20 | 21 | plot(hChain,'range',[1 1/2 1/2]); 22 | 23 | 24 | %% Plots initial magnetic structure 25 | 26 | plot(hChain,'range',[10 1/2 1/2]); 27 | 28 | %% Perform simulated annealing with periodic boundary condition in magnetic field 29 | % 150 unit cell along a-axis 30 | 31 | T = 1e-2; 32 | hChain.field([0 0 0]); 33 | param = struct('verbosity',2,'cool',@(T)(0.8*T),'initT',40,'endT',T,'nMC',1e3,'nStat',0,'random',true,'nExt',[150 1 1]); 34 | aRes = hChain.anneal(param); 35 | 36 | fieldSweep = [linspace(0,5,40) linspace(5,0,40)]; 37 | loop_param = struct('x',fieldSweep,'func',@(obj,x)obj.field([0 0 x]),'nMC',2e4,'nStat',1e4,'tid',2,'fineT',T); 38 | 39 | pStat = hChain.annealloop(loop_param); 40 | 41 | 42 | M = squeeze(sum(pStat.avgM,2))/hChain.nmagext; 43 | 44 | %% Plot M versus external magnetic field 45 | 46 | hold on 47 | plot(pStat.x,M(3,:),'g.-') 48 | 49 | title(sprintf('S=1 Heisenberg antiferromagnetic chain, 150x1x1 unit cell, T=%g K',param.endT)); 50 | xlabel('Magnetic Field (T)') 51 | ylabel('Magnetic moment') 52 | legend('M_z') 53 | axis([0 5 0 1.2]) -------------------------------------------------------------------------------- /tutorials/tutorial/ca2ruo4.m: -------------------------------------------------------------------------------- 1 | %% generate structure with 1st neghbor bonds 2 | 3 | ca2ruo4 = spinw('/Users/sandortoth/Documents/structures/Ca2RuO4/ca2ruo4.cif'); 4 | ca2ruo4.unit_cell.S(2) = 1; 5 | plot(ca2ruo4) 6 | 7 | ca2ruo4.gencoupling() 8 | ca2ruo4.addmatrix('label','J','value',1) 9 | ca2ruo4.addcoupling('bond',1,'mat','J') 10 | 11 | %% symmetry allowed elements of the exchange interaction 12 | 13 | ca2ruo4.getmatrix('mat','J') 14 | 15 | %% assign values to the exchange matrix 16 | 17 | J = 5.2; 18 | a = 0.10*J; 19 | e = 1; 20 | E = 21.5; 21 | A = 1.0; 22 | 23 | Jmat = [J A 0;A J 0;0 0 J-a]; 24 | Amat = [e 0 0; 0 0 0; 0 0 E]; 25 | ca2ruo4.addmatrix('label','J','value',Jmat) 26 | ca2ruo4.addmatrix('label','A','value',Amat) 27 | ca2ruo4.addaniso('A') 28 | % show bond directional interactions, generated using the symmetry 29 | % operators of the space group 30 | %plot(ca2ruo4,'range',[2 2 1]) 31 | 32 | % optimize magnetic structure 33 | 34 | ca2ruo4.genmagstr('mode','random','S',[1 0 0]','k',[0 0 0]) 35 | magRes = ca2ruo4.optmagsteep('nRun',1e4); 36 | ca2ruo4.energy 37 | % calculate spin wave dispersion 38 | 39 | A = [1/2 0 0]; 40 | M = [1/2 1/2 0]; 41 | B = [1 0 0]; 42 | G = [0 0 0]; 43 | spec = ca2ruo4.spinwave({A M B G M}); 44 | %spec = ca2ruo4.spinwave({[1/2 1/2 0] [1 0 0] [1 1 0] [0 0 0] [1 0 0]}); 45 | spec = sw_egrid(spec,'component','Sxx+Syy+Szz','Evect',linspace(0,65,501)); 46 | spec = sw_instrument(spec,'dE',4.2); 47 | figure 48 | sw_plotspec(spec,'qlabel',{'A' 'M' 'B' '\Gamma' 'M'},'axLim',[0 65],'mode','disp','colormap',[0 0 0],'dashed',false,'linestyle','--') 49 | hold on 50 | sw_plotspec(spec,'qlabel',{'(1/2,0)' '(1/2,1/2)' '(1,0)' '(0,0)' '(1/2,1/2)'},'axLim',[0 0.05],'mode','color') 51 | legend('off') 52 | colorbar 53 | title('') 54 | 55 | 56 | -------------------------------------------------------------------------------- /tutorials/tutorial/damping_example.m: -------------------------------------------------------------------------------- 1 | %% 2 | 3 | model = sw_model('triAF',1); 4 | plot(model) 5 | 6 | % calculate LSWT spectrum 7 | spec = model.spinwave({[0 0 0] [1 1 0] 601}); 8 | EvBin = linspace(0,5,501); 9 | EvCenter = (EvBin(2:end)+EvBin(1:(end-1)))/2; 10 | spec = sw_egrid(spec,'Evect',EvBin); 11 | 12 | % FWHM of the Lorentzian component 13 | lorFWHM = 0.2; 14 | % should be larger than zero 15 | gauFWHM = 1e-5; 16 | 17 | spec = sw_instrument(spec,'dE',gauFWHM,'func',@(x,p)swfunc.voigtfwhm(x,[p lorFWHM 0])); 18 | 19 | figure 20 | subplot(2,1,1) 21 | sw_plotspec(spec,'mode','color') 22 | axis([0 1 0 5]) 23 | legend off 24 | 25 | % plot cut at a selected Q value 26 | Q = 1/2; % (1/2,1/2,0) 27 | 28 | % find the index of the Q in the calculated Q points 29 | idx = findmin(abs(spec.hkl(1,:)-Q)); 30 | % intensity 31 | I = spec.swConv(:,idx); 32 | 33 | 34 | subplot(2,1,2) 35 | plot(EvCenter,I) 36 | xlabel('Energy Transfer (meV)') 37 | ylabel('Intensity (arb. units)') 38 | 39 | title(sprintf('Q=(%4.2f,%4.2f,%4.2f)',[Q Q 0])) 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tutorials/tutorial/helical_chain_infield.m: -------------------------------------------------------------------------------- 1 | %% Optimize chain in magnetic field 2 | 3 | chain = spinw; 4 | chain.genlattice('lat_const',[3 4 4]) 5 | chain.addatom('r',[0 0 0],'S',1) 6 | chain.addmatrix('label','J1','value',1) 7 | chain.addmatrix('label','D','value',[0 0 0.1]) 8 | chain.gencoupling 9 | chain.addcoupling('mat','J1','bond',1) 10 | chain.addcoupling('mat','D','bond',1) 11 | plot(chain) 12 | 13 | 14 | %% Optimize chain in magnetic field 15 | 16 | chain = spinw; 17 | chain.genlattice('lat_const',[6 4 4]) 18 | chain.addatom('r',[0 0 0],'S',1) 19 | chain.addatom('r',[1/2 0 0],'S',1) 20 | chain.addmatrix('label','J1','value',1) 21 | chain.addmatrix('label','D','value',[0 0 0.1]) 22 | chain.gencoupling 23 | chain.addcoupling('mat','J1','bond',1) 24 | chain.addcoupling('mat','D','bond',1) 25 | plot(chain) 26 | 27 | %% k-vector 28 | 29 | res = chain.optmagk; 30 | chain.energy 31 | -------------------------------------------------------------------------------- /tutorials/tutorial/inpurity.m: -------------------------------------------------------------------------------- 1 | %% simulate non-magnetic inpurities on the square lattice 2 | 3 | % probability that the site is magnetic 4 | p = 0.95; 5 | 6 | S = 1/2; 7 | 8 | N1 = 10; 9 | N2 = 10; 10 | nMagSite = rand(N1,N2) the ground state is trivial, since there is no frustration 33 | 34 | pMC.initT = 10; 35 | pMC.endT = 0.1; 36 | pMC.nMC = 1e3; 37 | pMC.nORel = 2; 38 | 39 | aStat = sq.anneal(pMC); 40 | 41 | % energy after MC 42 | E0 = sq.energy; 43 | 44 | % further optimisation using steepest descendent method 45 | sq.optmagsteep; 46 | E1 = sq.energy; 47 | 48 | 49 | %% plot magnetic structure 50 | 51 | sq.plot 52 | 53 | %% spin waves 54 | 55 | H = 1; 56 | K = 1; 57 | nQ = 200; 58 | 59 | spec = sq.spinwave({[0 0 0] [H*N1 K*N2 0] nQ},'hermit',false); 60 | spec = sw_egrid(spec); 61 | 62 | figure 63 | sw_plotspec(spec,'mode','color','dE',0.1) 64 | 65 | 66 | %% no disorder 67 | 68 | sq2 = sw_model('squareAF',[1 0.3]); 69 | spec0 = sq2.spinwave({[0 0 0] [H K 0] nQ}); 70 | spec0 = sw_egrid(spec0); 71 | 72 | %% plot spec 73 | 74 | figure 75 | sw_plotspec(spec0,'mode','disp','imag',true,'colorbar',false,'axLim',[0 3],'colormap',[0 0 255]) 76 | 77 | %% overplot the two calculations 78 | 79 | spec.hkl = [spec.hkl(1,:)/N1;spec.hkl(2,:)/N2;spec.hkl(3,:)]; 80 | 81 | figure 82 | sw_plotspec(spec,'mode','color','dE',0.1) 83 | hold on 84 | sw_plotspec(spec0,'mode','disp','imag',true,'colorbar',false,'axLim',[0 3],'colormap',[0 0 255]) 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /tutorials/tutorial/tutorial22.m: -------------------------------------------------------------------------------- 1 | %% antiferromagnetic chain 2 | 3 | afc = spinw; 4 | afc.genlattice('lat_const',[3 4 4]) 5 | afc.addatom('r',[ 0 0 0],'S',1) 6 | afc.addmatrix('label','A','value',diag([0 0 0.1])) 7 | afc.addmatrix('label','J1','value',1) 8 | afc.addmatrix('label','J2-','value',1/3,'color','orange') 9 | afc.gencoupling 10 | afc.addcoupling('mat','J1', 'bond',1) 11 | afc.addcoupling('mat','J2-','bond',5) 12 | afc.addaniso('A') 13 | %afc.optmagsteep; 14 | plot(afc,'range',[2 1 1]) 15 | 16 | %% opt magnetic structure 17 | 18 | %afc.field([0 0 7]) 19 | afc.optmagstr('func',@gm_spherical3d,'xmin',[0 0, 0 0 0,0 0],'xmax',[pi/2 0,1/2 0 0,0 0]) 20 | E0 = afc.energy; 21 | %% magnetic field 22 | 23 | optRes = afc.optmagsteep('random',false,'nRun',400); 24 | %plot(afc) 25 | figure; 26 | plot(optRes.e,'o-') 27 | 28 | %% spin wave 29 | spec = afc.spinwave({[0 0 0] [2 0 0] 500},'hermit',true); 30 | spec = sw_egrid(spec,'Evect',linspace(0,3,300)); 31 | figure 32 | sw_plotspec(spec);%,'mode','disp','imag',true); 33 | axis([0 2 0 3]) 34 | 35 | 36 | -------------------------------------------------------------------------------- /tutorials/tutorial/tutorial26.m: -------------------------------------------------------------------------------- 1 | % Spiral dispersion and correlation function on Bravais lattice 2 | % Theoretical and experimental calculation 3 | 4 | %% chain 5 | 6 | J1 = 1; 7 | J2 = 3; 8 | 9 | ch = spinw; 10 | ch.genlattice('lat_const',[3 4 4]) 11 | ch.addatom('r',[0 0 0],'S',1) 12 | ch.addmatrix('label','J1','value',1) 13 | ch.addmatrix('label','J2-','value',3,'color','blue') 14 | 15 | ch.gencoupling 16 | ch.addcoupling('mat','J1','bond',1) 17 | ch.addcoupling('mat','J2-','bond',5) 18 | 19 | plot(ch,'range',[3 1 1]) 20 | 21 | %% 22 | 23 | ch.optmagstr('func',@gm_planar,'xmin',[0, 0 0 0, 0 0],'xmax',[0 1/2 0 0, 0 0]) 24 | 25 | %% 26 | 27 | spec = ch.spinwave({[0 0 0] [1 0 0] 500}); 28 | spec = sw_egrid(spec); 29 | 30 | figure 31 | subplot(2,1,1) 32 | sw_plotspec(spec,'mode','disp','linestyle','-'); 33 | subplot(2,1,2) 34 | sw_plotspec(spec,'mode','int','linestyle','-'); 35 | 36 | % 37 | 38 | Q = ch.mag_str.k(1); 39 | 40 | J = @(k)2*J1*cos(2*pi*k)+2*J2*cos(4*pi*k); 41 | A = @(k)J(k)+J(k+Q)/2+J(k-Q)/2-2*J(Q); 42 | B = @(k)J(k)-J(k+Q)/2-J(k-Q)/2; 43 | 44 | k = linspace(0,1,500); 45 | 46 | w1 = @(k)sqrt(A(k).^2-B(k).^2); 47 | w2 = @(k)-sqrt(A(k).^2-B(k).^2); 48 | %w1 = A(k)+B(k); 49 | %w2 = A(k)-B(k); 50 | Sxx = 2*(A(k)-B(k))./w1(k); 51 | Sxixi = @(k)2*(A(k)+B(k))./w1(k); 52 | Syy = 1/4*(Sxixi(k-Q)+Sxixi(k+Q)); 53 | Szz = Syy; 54 | 55 | %figure; 56 | subplot(2,1,1) 57 | hold on 58 | plot(k,(w1(k))/2,'ro') 59 | hold on 60 | plot(k,(w1(k-Q))/2,'go') 61 | plot(k,(w1(k+Q))/2,'bo') 62 | axis([0 1 0 10]) 63 | % 64 | subplot(2,1,2) 65 | hold on 66 | plot(k,Sxx/4+0.01,'r-') 67 | hold on 68 | plot(k,Sxixi(k-Q)/4/4+0.01,'g-') 69 | plot(k,Sxixi(k+Q)/4/4+0.01,'b-') 70 | 71 | axis([0 1 0 1]) 72 | -------------------------------------------------------------------------------- /tutorials/tutorial/tutorial29.m: -------------------------------------------------------------------------------- 1 | %% antiferromagnetic chain 2 | 3 | afc = spinw; 4 | afc.genlattice('lat_const',[4 4 6]) 5 | afc.addatom('r',[ 0 0 0],'S',1) 6 | afc.addatom('r',[1/2 0 0],'S',1) 7 | afc.addmatrix('label','A','value',diag([0 0 -0.1])) 8 | afc.addmatrix('label','J','value',1) 9 | afc.gencoupling 10 | afc.addcoupling('mat','J','bond',1) 11 | afc.addaniso('A') 12 | afc.optmagsteep; 13 | plot(afc) 14 | 15 | %% magnetic field 16 | 17 | afc.field([0 0 7]) 18 | afc.optmagsteep('random',true,'nRun',400); 19 | plot(afc) 20 | 21 | %% spin wave 22 | spec = afc.spinwave({[0 0 0] [2 0 0] 500},'hermit',true); 23 | spec = sw_egrid(spec,'Evect',linspace(0,3,300)); 24 | figure 25 | sw_plotspec(spec);%,'mode','disp','imag',true); 26 | axis([0 2 0 3]) 27 | 28 | 29 | --------------------------------------------------------------------------------