tsdev / spinw

SpinW Matlab library for spin wave calculation
www.psi.ch/spinw
GNU General Public License v3.0
30 stars 35 forks source link

Bug related to swpref when updating SpinW #29

Open henrikjacobsenfys opened 7 years ago

henrikjacobsenfys commented 7 years ago

Hi Sandor

I get the following error message after updating to the latest version: Error using swpref.pref (line 86) The requested SpinW preference does not exists!

Error in swpref.getpref (line 33) rPref = swpref.pref(prefName,'get',varargin{:});

Error in spinw/spinwave (line 175) useMex = swpref.getpref('usemex',[]);

Error in CuO_AFM (line 403) CuOSpec = CuO.spinwave({ Gamma, X, N, Gamma, M, X, 200},'hermit',false);

I assume it's related to me running SpinW on Linux. If needed, I can provide a minimal example of the bug, but it's probably something general. I tried bug hunting a bit, but it's not easy.. What I know is that in getpref, the input variables when it fails are

prefName =

usemex

varargin =

cell

{[]}

Cheers,

Henrik

mducle commented 7 years ago

Hi @henrikjacobsenfys,

I got this bug on Windows too, but it was because I was updating within a Matlab session, and for some reason, matlab still used an old version of swpref. I solved it using clear classes (but restarting Matlab should also work). E.g. do

clear classes
swpref.getpref('usemex')

If you still get the The requested SpinW preference does not exists! error, then could you do a which swpref.pref to find out which +swpref/pref.m file is being used and paste its contents here (or send it to us).

Note that clear classes will also clear all your variables, so you might want to save everything first...

Duc.

henrikjacobsenfys commented 7 years ago

Hi Duc Thanks a lot, this worked. I'm so used to getting bugs because of mex in Linux that I jumped to conclusions.. Henrik

tsdev commented 7 years ago

The problem is that swpref uses mlock to avoid reinitialisation of persistent variables that store the settings. I am surprised that clear classes actually worked. I might have to add a piece of code into install_spinw to update swpref. @mducle any insight?

henrikjacobsenfys commented 7 years ago

I actually decided to just restart matlab right away, since I found out I had several versions of spinw lying around anywhere, and my computer could use a reboot in any case. So it may be that clear classes wouldn't have worked...