Skip to content

Commit

Permalink
MULTEM 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivanlh20 committed Aug 28, 2017
1 parent 4e3acaf commit da3aeca
Show file tree
Hide file tree
Showing 109 changed files with 12,322 additions and 9,746 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
*Copy*.cpp
MULTEM_binary
MULTEM_binary.rar
MULTEM_binary.zip
compile_mex_general.m
mex_examples_general
mex_files_general
visual_studio_multem
src_temporal
mex_test
design
build-multem-Desktop_Qt_5_9_0_MSVC2015_64bit-Debug
build-multem-Desktop_Qt_5_9_0_MSVC2015_64bit-Release
Expand Down
78 changes: 65 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Introduction
============

**MULTEM** is a collection of routines written in C++ with CUDA to perform accurate and fast multislice simulations for different TEM experiments as: HRTEM, STEM, ISTEM, ED, PED, CBED, ADF-TEM, ABF-HC, EFTEM and EELS.
**MULTEM** is a collection of routines written in C++ with CUDA to perform accurate and fast multislice simulations for different TEM experiments as: HRTEM, STEM, ISTEM, ED, PED, CBED, ADF-TEM, ABF-HC, EFTEM and EELS. It is developed by Ivan Lobato ([email protected]).

Currently, there are three supported ways to use MULTEM:
- C++: using the library itself
Expand All @@ -15,9 +15,9 @@ The Matlab interface is the recommended way for researchers.

Remarks
=================================
In order to use the GPU capability of MULTEM, you need a Nvidia Graphic card with **compute capability greater than 2.0** and **CUDA 8.0** installed in your operating system. You can check the compute capability of your graphic card using the following [nvidia website](https://developer.nvidia.com/cuda-gpus)
In order to use the GPU capability of MULTEM, you need a Nvidia Graphic card with **compute capability greater than 2.0** and **CUDA 8.0** installed in your operating system. You can check the compute capability of your graphic card using the following nvidia website: https://developer.nvidia.com/cuda-gpus.

Using GUI interface
Using precompile GUI interface
=================================
The precompile GUI interface is only available for Windows operating system.

Expand All @@ -34,18 +34,70 @@ The precompile mexfiles are only available for Windows operating system.
- Add to the Matlab path the following folders: crystalline_materials, matlab_functions and mex_bin.
- Run the examples located in 'mex_examples_multem'.

Compiling MULTEM for Matlab
Building MULTEM for Matlab
=================================
The following steps work using Matlab R2017a and CUDA 8.0. It assumes that Visual studio 2015, g++4.9 or Clang compiler is installed in your operating system:
The following steps work using Matlab R2017a and CUDA 8.0. It assumes that Visual studio 2015 professional, g++4.9 or Clang(Xcode 8.x) compiler is installed in your operating system. Additionally, Multem also requires fftw3, blas and lapack libraries.

- First of all, you have to add to the Matlab path the following folders: crystalline_materials, matlab_functions and mex_bin.
- First of all, you have to set a C++ compiler to Matlab by executing the following comand: `mex -setup cpp`. Be aware that Matlab 2017a only support the above compilers.
- Then add to the Matlab path the following folders: crystalline_materials, matlab_functions and mex_bin.
- Run the `compile_mex_multem.m` script. This will create the required executable files to run the examples.
- Run the examples located in `mex_examples_multem`.

- Then you need to modify the `mex_CUDA_xxxx` file located in the `mex_files_multem` folder, which corresponds to your operating system:
1. for Windows `mex_CUDA_win64`
2. for Linux `mex_CUDA_glnxa64`
3. for Mac `mex_CUDA_maci64`
Troubleshooting
=================================
- If MULTEM do not compile with the above procedures, one of the following procedures might fix it

- Go to the line which contains the following definition`NVCCFLAGS="$xxxxx ..."` and replace 'xxxxx' by 'SINGLE_CARD' or 'MULTI_CARD'. 'SINGLE_CARD'/'MULTI_CARD' defines the compute capability of your graphic card.
**for Windows:**

- Verify the installation of Visual studio 2015 professional.
- Verify the installation of Cuda 8.0 (https://developer.nvidia.com/cuda-downloads).

**for Linux:**

- Verify that gcc-4.9 and g++4.9 are the default compilers installed in your operating system. In Ubuntu, it can be installed by executing the following commands:

* `sudo add-apt-repository ppa:ubuntu-toolchain-r/test`
* `sudo apt-get update`
* `sudo apt-get install gcc-4.9 g++-4.9`
* `sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9`

- Run the `compile_mex_multem.m` script. This will create the required executable files to run the examples.
- Run the examples located in 'mex_examples_multem'.
- Verify the correct installation of Cuda 8.0 (https://developer.nvidia.com/cuda-downloads).

- Verify the installation of fftw3 libraries. In Ubuntu, it can be installed by executing the following command:
* `sudo apt-get install libfftw3-dev libfftw3-doc`

- Verify the installation of blas and lapack libraries. In Ubuntu, it can be installed by executing the following command:
* `sudo apt-get install libblas-dev liblapack-dev`

- Verify the intallation path of cuda 8.0, fftw3, blas and lapack. Their installation path should be specified in the `MEX.m` file located at `matlab_functions`.

**Please cite MULTEM in your publications if it helps your research:**

@article{LVAV16_1,
Author = {I.Lobato and S.Van Aert and J.Verbeeck},
Journal = {Ultramicroscopy},
Title = {Progress and new advances in simulating electron microscopy datasets using MULTEM},
Year = {2016},
volume = {168},
pages = {17-27}
}

@article{LD15_2,
Author = {I. Lobato and D. Van Dyck},
Journal = {Ultramicroscopy},
Title = {MULTEM: A new multislice program to perform accurate and fast electron diffraction and imaging simulations using Graphics Processing Units with CUDA},
Year = {2015},
volume = {156},
pages = {9-17}
}

**if you use our parameterization of the electronscattering factors, please cite the following article:**

@Article{LD14_1,
Title = {{An accurate parameterization for the scattering factors, electron densities and electrostatic potentials for neutral atoms that obey all physical constraints}},
Author = {I. Lobato and D. Van Dyck},
Journal = {Acta Crystallographica Section A},
Year = {2014},
Pages = {636-649},
Volume = {70}
}
67 changes: 44 additions & 23 deletions compile_mex_multem.m
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
addpath([ pwd '/matlab_functions'])

files = {'mex_lambda',...
'mex_sigma',...
'mex_gamma',...
'mex_fxeg_tabulated_data',...
'mex_feg',...
'mex_fxg',...
'mex_Pr',...
'mex_Vz',...
'mex_Vr',...
'mex_Vp',...
'mex_mrad_2_rAngs',...
'mex_scherzer_defocus',...
'mex_scherzer_aperture',...
'mex_crystal_by_lays',...
'mex_rdf_3d',...
'mex_amorp_spec',...
'mex_add_amorp_lay',...
'mex_spec_rot',...
'mex_spec_planes',...
'mex_spec_slicing',...
'mex_incident_wave',...
files = {'mex_incident_wave',...
'mex_propagate',...
'mex_microscope_aberrations',...
'mex_projected_potential',...
'mex_transmission_function',...
'mex_transmission_function',...
'mex_wave_function',...
'mex_MULTEM'};

for file=files
disp(['Compiling ' file{1}])
run(['mex_files_multem/',file{1}])
end
end

% addpath([ pwd '/matlab_functions'])
%
% files = {'mex_lambda',...
% 'mex_sigma',...
% 'mex_gamma',...
% 'mex_fxeg_tabulated_data',...
% 'mex_feg',...
% 'mex_fxg',...
% 'mex_Pr',...
% 'mex_Vz',...
% 'mex_Vr',...
% 'mex_Vp',...
% 'mex_gmax',...
% 'mex_min_spl',...
% 'mex_mrad_2_rAngs',...
% 'mex_mrad_2_sigma',...
% 'mex_fwhm_2_sigma',...
% 'mex_hwhm_2_sigma',...
% 'mex_iehwgd_2_sigma',...
% 'mex_scherzer_defocus',...
% 'mex_scherzer_aperture',...
% 'mex_crystal_by_lays',...
% 'mex_rdf_3d',...
% 'mex_amorp_spec',...
% 'mex_add_amorp_lay',...
% 'mex_spec_rot',...
% 'mex_spec_planes',...
% 'mex_spec_slicing',...
% 'mex_incident_wave',...
% 'mex_propagate',...
% 'mex_microscope_aberrations',...
% 'mex_projected_potential',...
% 'mex_transmission_function',...
% 'mex_wave_function',...
% 'mex_MULTEM'};
%
% for file=files
% disp(['Compiling ' file{1}])
% run(['mex_files_multem/',file{1}])
% end
Loading

0 comments on commit da3aeca

Please sign in to comment.