iFit: Changes and Bugs

  1. Releases and Changes
  2. Bugs list:
    1. File path names do not support spaces
    2. Data set maximum size
    3. CDF files written by Matlab can not be read by other software (hdfview, ncBrowse)
    4. Convolution brings strange results (Models/fconv)
    5. Too many warnings displayed
    6. Execution/compilation issue with text files importer (iLoad/iData/load, looktxt, CrysFML/cif2hkl)
    7. Limitations in the standalone (binary) package
    8. McStas and external programs can not be found from Matlab/iFit
    9. iFit standalone can not be launched (libmwmclmcrrt.so)
    10. iFit crashes when typing special characters (accents, ...)
    11. iFit fails with a message such as 'version `GFORTRAN_1.4' not found' or 'version `GCC_4.3.0' not found'
    12. Import of a text file fails
    13. Model sqw_phonon fails with Dacapo/Jacapo and MPI
    14. Matlab crashes when displaying 3D plots
    15. Matlab rendering is poor
    16. miFit/matlab crashes when starting/loading/saving

Releases and Changes

Bugs list:

You may test the package integrity by issuing the command:
>> ifittest
which will test, in a few minutes, all the examples given in this documentation and report failures. The test may be aborted by closing the progress bar window.

Please report bugs to ifit-users@mccode.org or to me [farhi (at) ill.fr]. You are encouraged to register to the ifit-users list.

File path names do not support spaces

Under Windows systems, file names including spaces, such as in 'My Documents' may not be supported properly. In this case, move your files and directories to another location which does not contain spaces.

Data set maximum size

The iFit package may currently handle routinely data sets up to few Gb. Larger data sets can still be loaded, but are restricted by the disk access and the available memory. Some file formats are limited to 2 Gb size. We recommend to use SSD to load files with increased efficiency.

CDF files written by Matlab can not be read by other software (hdfview, ncBrowse)

The CDF format (which you can view with OpenDX and Autoplot) is incompatible with the NetCDF one (which you can e.g. view with ncview, hdfview, ncBrowse, Panoply). In such cases, we recommend to rather export in HDF5 format with:
>> save(object, 'file.hdf5')

Convolution brings strange results (Models/fconv)

The fconv function (FFT convolution) provided in the Models sub-library requires the two signals sampling not to be too coarse. Axes values too sparse will lead to inaccurate results. One solution is to re-sample the signals with more points. For iData objects, this can be achieved with e.g. the interp(object, 3) to triple the number of points along axes.

Too many warnings displayed

If the warnings being displayed produce too much output, you may reduce the level of verbosity with:
>> warning off backtrace	% reduce the warning message length
>> warning off % suppress all warnings (not recommended)

Execution/compilation issue with text files importer (iLoad/iData/load, looktxt, CrysFML/cif2hkl)

You should first try the automatic fix procedure:
>> iLoad('force')	% checks and possibly re-compiles text and CBF importers
>> iLoad('compile') % fully re-compiles text and CBF importers
The recompilation tries to:
  1. use the matlab mex command (requires a valid C compiler supported by Matlab) ;
  2. use of any other C compiler such as gcc, ifc, pgcc, clang/llvm, tcc;
  3. use any Fortran compiler such as gfortran, g95, pgfc, ifort.
Most systems provide a default C compiler.
You may need to select the compiler with the mex -setup command from Matlab, but as said above, any other compiler can be used.

In some cases, the provided iFit/Loaders/private/looktxt commands may fail to execute (wrong architecture, missing library).
Under Windows 64bit systems, you may need the Visual C++ runtime libraries e.g. msvc[mpr]90.dll which are provided with the Visual C++ installation (see below), to put in the Windows system directory.

It has been reported that MeX compilation may fail when spaces are part of the path name to the iFit location (esp. under Windows systems). Move iFit to an other location which does not include spaces in its name (e.g. avoid My Documents) for compilation.

Manual compilation

If all this fails, you can try a manual compilation as follows.

A C compiler is required to make use of the generic text importer looktxt. Navigate to the iFit/Libraries/Loaders/private directory, and issue:
# gcc -O2 -o looktxt looktxt.c -lm
A Fortran compiler is required when using cif2hkl (CIF,CFL,PCR,ShelX files), especially for the Rietveld model function. Navigate to the iFit/Scripts/Models/scattering/powder_diffraction directory and issue:
# gfortran -O2 -o cif2hkl cif2hkl.F90 -lm
which creates a cif2hkl executable file, used by iFit. Remove the collateral *.mod files.

Once done, check from iFit:
>> iLoad('force')	% checks and possibly re-compiles text and CBF importers
Refer to the related item in the Install page.

Limitations in the standalone (binary) package

When running the standalone version (binary), new Matlab functions can not be defined, except anonymous functions (inline). You may use iFunc models as a substitute. Also, the doc, web and edit commands are limited, and may not work properly, depending on the system.

McStas and external programs can not be found from Matlab/iFit

The location of executable programs available from the system are stored in the PATH environment variable. But on some systems (e.g. MacOSX), this variable is not fully initialised when used from Matlab/iFit.

The following issue may show-up for any external program launched from Matlab/iFit, e.g. McStas, PHON, Quantum Espress, ASE. We detail the case of 'mcstas'.

To diagnose this issue, open a Terminal, and test if e.g. 'mcstas' is properly installed (the example below if for MacOSX/Linux):
% mcstas -v
mcstas-2.3-rc2 version 2.3-rc2 (Nov. 16, 2015)
Copyright (C) DTU Physics and Risoe National Laboratory, 1997-2015
Additions (C) Institut Laue Langevin, 2003-2015
All rights reserved
% which mcstas
Then you need to add the path to 'mcstas' executables inside the PATH variable seen from Matlab.
Type, from Matlab/iFit prompt:
>> setenv('PATH', [getenv('PATH') ':/usr/local/bin' ':/usr/bin' ':/usr/share/bin' ]);	% under MacOSX and Linux
>> setenv('PATH', [getenv('PATH') 'C:\mcstas\bin' ]); % under Windows
Once done, e.g. McStas and other programs will be immediately reachable from Matlab/iFit.
This procedure may have to be repeated whenever Matlab/iFit is (re)started.

iFit standalone can not be launched (libmwmclmcrrt.so)

When starting iFit standalone, you get a message such as:

./run_ifit: error while loading shared libraries: libmwmclmcrrt.so: cannot open shared object file: No such file or directory

This message indicates that the Matlab Runtime Library has not been found. Instal the MCR as indicated in the Install page. You may have to edit the 'ifit' command and set the location of the MCR. Alternatively, you can set the MCRROOT environment variable to point to it, e.g. under bash (Linux/Mac OSX):

iFit crashes when typing special characters (accents, ...)

The iFit standalone (compiled version) can be used from the prompt/command line, within a terminal. However, the Matlab readline library can not handle properly localised characters (e.g. with accents, for specific languages) [bug 624817].

You thus have to be cautious when typing, to avoid e.g. , , , and so on, or an immediate crash will occur, without saving your work, and save your work regularly. US keyboard characters are all fully supported.

iFit fails with a message such as 'version `GFORTRAN_1.4' not found' or 'version `GCC_4.3.0' not found'

Matlab comes with its own C and Fortran libraries (e.g. in MATLABROOT/sys/os/<arch>/). Some of these may not match those from the running system (seen on Linux systems).

The following issue may show-up for any external program launched from Matlab/iFit, e.g. McStas, PHON, Quantum Espress, ASE, looktxt, cif2hkl.
In this case, as e.g. McStas runs from a Matlab environment that overloads libraries on top of the normal libraries from the system - used by external programs - you may get a message such as (here libgfortran.so is faulty) :
Can't load '/usr/local/lib/perl/5.12.4/auto/PGPLOT/PGPLOT.so' for module PGPLOT: 
/usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3: version
`GFORTRAN_1.4' not found
(required by /usr/lib/libpgplot.so.5) at
/usr/lib/perl/5.12/DynaLoader.pm line 192.
at /usr/local/lib/mcstas/tools/perl/mcstas_config.perl line 123
A similar message has also been reported for the libgcc_s.so library with error e.g. 'version `GCC_4.3.0' not found'.

On an Apple Mac OS X system, the faulty library is e.g.
In order to solve this, you need to either remove or update the faulty Matlab libraries with the one from the system. The following procedure is valid for Linux systems (where it was identified), assuming Matlab has been installed in e.g. MATLABROOT = /usr/local/MATLAB/R2012a - but it may also be in e.g. /opt/MATLAB/R2012a.

The first attempt is to simply rename the faulty library shipped with Matlab, e.g. (you may also remove it):
# sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.org
# sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgcc_s.so.1 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgcc_s.so.1.org
Then restart Matlab/iFit to check if the issue is solved.

If this is still not solved, we then look for locations of the faulty library in the system (requires package locate or mlocate to be installed - alternatively you can use ldconfig -v and look where libgfortran appears in the long list...)
# locate libgfortran.so
/usr/lib/x86_64-linux-gnu/libgfortran.so.3 <- this is the library from the system, to put in the Matlab location
Then we first make a copy of the initial Matlab library to update
# sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.org
Then we copy the library from the system into the Matlab location
# sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/
Then, you need to restart Matlab/iFit to notice the issue has been fixed.

Import of a text file fails

You can try the automatic fix procedure:
>> iLoad('force')	% checks and possibly re-compiles text and CBF importers
>> iLoad('compile') % fully re-compiles text and CBF importers
If this fails, then first check that the looktxt command is working (this will appear in the error message). If not, remove the invalid one (in iFit/Libraries/Loaders/private) and restart the importation. A new external command will be compiled from the source (requires a valid compiler, see above).

If the executable looktxt is valid, but you can not import a reluctant text file, try the most tolerant text reader configurations:
>> iData('filename','text format with fast import method')
>> iData('filename','Data (text format)')
will import the raw content, without post formatting of the object in memory. You will probably need to assign manually some of the Signal and Axes (see iData object help).

Text files containing NaN's inside matrices are not imported properly in iFit version <= 1.6 (NaN is read as a text inside a matrix, and thus breaks the matrix into bits). One way is to replace all NaN's by 0 values. This also stands for Inf's and other text embedded inside numerical blocks.

Model sqw_phonon fails with Dacapo/Jacapo and MPI

You should check the executable 'dacapo_mpi.run' from the command line. If an error message indicates missing libraries 'libmpi_f90.so.0' and 'libmpi_f77.so.0', then first check that openmpi is installed and identify the actual library with e.g.:
% locate libmpi_f77.so
then create a soft link from the existing library to the missing one:
% sudo ln -s /usr/lib/libmpi_f90.so.1 /usr/lib/libmpi_f77.so.0
Warning: We do not recommend using Dacapo/Jacapo, as this software is not maintained anymore.

Matlab crashes when displaying 3D plots

Since Matlab R2014b, the underlying infrastructure for display of plots has been fully revamped. As a consequence, displays are much nicer, but also much slower to render. Also, depending on the graphics card/driver installed on the computer, Matlab may crash with messages such as:
Nativewindow X11 IOError: Display 0x7f44e040e8b0 (:0.0): Bad address
MATLAB: javainit.cpp:1411: void {anonymous}::mwJavaAbort(): Assertion `Fatal Java Exception.  See Java Crash Report for details.' failed.
A way to get things fixed is to switch to the software OpenGL rendering. Start Matlab and type immediately:
then exit Matlab and restart it.

The immediate consequence is that all works (good), but also it gets even slower (!!!). Calculations are not affected.

Alternate solution for Linux

A very effective and simple solution under Linux/Debian is to install the 'matlab-support' package for both matlab and/or iFit:
then specify the Matlab directory path, such as:
You may use that fix for more than one Matlab/iFit installation typing again:

Matlab rendering is poor

If you get messages such as:
Warning: OpenGL appears to be installed incorrectly.
libGL error: unable to load driver: radeonsi_dri.so
and the rendering is not so nice (e.g. slow and no transparency), then you may overcome this issue by launching the matlab and ifit commands with e.g.:
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ifit
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' matlab
This overrides the C library shipped with Matlab/iFit in order to use the system one (which e.g. works better with the installed graphics cards).

The iFit / Matlab launchers (e.g. /usr/share/applications/ifit.desktop) should be updated accordingly at the line 'Exec':
[Desktop Entry]
Exec=env LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ifit -nodesktop %F

miFit/matlab crashes when starting/loading/saving

The storage class for iData and iFunc has changed. This makes old '.mat' files crash when imported. To solve this issue, you should start a previous version of iFit (e.g. 1.10) and export your objects into e.g. HDF5 files. Then, with the new iFit version, import back this files to recreate the same iData objects.

With miFit, you may reset the application with:
which fully resets its configuration and data to the factory settings. Your existing data stored in miFit will be lost. Alternatively, you may start an older iFit version (e.g. 1.10), and export the workspace items into e.g. HDF5. Then start the new miFit interface (from iFit 2.x), and load the HDF5 files in the workspace.

E. Farhi - iFit/Changes - oct.. 23, 2018 2.0 - back to Main iFit Page ILL,
            Grenoble, France <www.ill.eu>