Skip to content

Commit

Permalink
adds new TEMbook folder with EMTBSM and EMSRCBED programs
Browse files Browse the repository at this point in the history
finally catching up on including all the programs from the CTEM text book in one form or another ...
  • Loading branch information
marcdegraef committed Feb 19, 2024
1 parent 4ea9b11 commit ce60889
Show file tree
Hide file tree
Showing 10 changed files with 1,579 additions and 2 deletions.
41 changes: 41 additions & 0 deletions NamelistTemplates/EMSRCBED.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
&SRCBEDlist
! Note: All values in this template file correspond to the program defaults
!
!------------
! multi-threading parameters
!------------
! number of threads to be used in multi-threaded mode
nthreads = 6,
!------------
! microscope parameters
!------------
! microscope accelerating voltage [kV]
voltage = 200.0,
! camera length [mm]
camlen = 1000.0,
!------------
! crystal structure and incident beam parameters
!------------
! string with the filename of the structure data (e.g., Cu.xtal; default = undefined)
xtalname = 'undefined',
! fundamental reciprocal lattice vector of the systematic row
SRG = 1 0 0,
! incident beam direction as a real space direction vector; must be normal to SRG
SRK = 0 0 1,
! range of reflections to be taken into account (-Grange*SRG to +Grange*SRG); number of beams = 2*Grange+1
Grange = 4,
! up to 10 Laue centers for G at the center of the diffraction disk, defined as k_t/|g| (GLaue = 0.5 means g in Bragg)
numrows = 10,
ktonG = 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0,
! incident beam convergence angle in mrad
convergence = 5.0,
! foil thickness [nm]
thick = 100.0,
!------------
! various filenames
!------------
! full filename of the HDF5 output file [relative to EMdatapathname]
outname = 'undefined',
! tiff prefix to be used for each systematic row pattern [relative to EMdatapathname]
tiffprefix = 'undefined',
/
50 changes: 50 additions & 0 deletions Source/CTEMbook/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
set(APP_DIR "${EMsoftOO_SOURCE_DIR}/Source/CTEMbook")
set(TMPLT_DIR "${EMsoftOO_SOURCE_DIR}/NamelistTemplates")
set(LIB_SEARCH_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

if((EMsoftOO_ENABLE_HDF5_SUPPORT) AND (EMsoftOO_ENABLE_OpenCL_SUPPORT))

# The libraries are specifically laid out this way in order to ensure the link line
# has the correct ordering. This seems to be more important on Windows than on macOS/Linux
set(EXE_LINK_LIBRARIES
${OpenCL_LIBRARY}
clfortran
EMsoftOOLib
EMOpenCLLib
)


# Add_EMsoftOO_Executable(TARGET EMdddSTEM
# SOURCES ${APP_DIR}/EMdddSTEM.f90
# LINK_LIBRARIES ${EXE_LINK_LIBRARIES}
# TEMPLATE ${TMPLT_DIR}/EMmdSTEM.template
# SOLUTION_FOLDER EMsoftPublic/TEM
# INCLUDE_DIRS ${EMsoftHDFLib_BINARY_DIR} ${EMOpenCLLib_BINARY_DIR}
# )

endif()

if(EMsoftOO_ENABLE_HDF5_SUPPORT)

GetHDF5LinkLibraries(EMSOFTOO)
set(EXE_LINK_LIBRARIES ${EXE_LINK_LIBRARIES} ${EMSOFTOO_hdf5LinkLibs} )

Add_EMsoftOO_Executable(TARGET EMTBSM
SOURCES ${APP_DIR}/EMTBSM.f90
LINK_LIBRARIES ${EXE_LINK_LIBRARIES}
SOLUTION_FOLDER EMsoftOOPublic/CTEMbook
INSTALL_PROGRAM TRUE
INCLUDE_DIRS ${EMsoftHDFLib_BINARY_DIR}
)

Add_EMsoftOO_Executable(TARGET EMSRCBED
SOURCES ${APP_DIR}/EMSRCBED.f90
LINK_LIBRARIES ${EXE_LINK_LIBRARIES}
TEMPLATE ${TMPLT_DIR}/EMSRCBED.template
SOLUTION_FOLDER EMsoftOOPublic/CTEMbook
INSTALL_PROGRAM TRUE
INCLUDE_DIRS ${EMsoftHDFLib_BINARY_DIR}
)


endif()
69 changes: 69 additions & 0 deletions Source/CTEMbook/EMSRCBED.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
! ###################################################################
! Copyright (c) 2013-2024, Marc De Graef/Carnegie Mellon University
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without modification, are
! permitted provided that the following conditions are met:
!
! - Redistributions of source code must retain the above copyright notice, this list
! of conditions and the following disclaimer.
! - Redistributions in binary form must reproduce the above copyright notice, this
! list of conditions and the following disclaimer in the documentation and/or
! other materials provided with the distribution.
! - Neither the names of Marc De Graef, Carnegie Mellon University nor the names
! of its contributors may be used to endorse or promote products derived from
! this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
! USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! ###################################################################

!--------------------------------------------------------------------------
! EMsoft: EMSRCBED.f90
!--------------------------------------------------------------------------
!
! PROGRAM: EMSRCBED
!
!> @author Marc De Graef, Carnegie Mellon University
!
!> @brief Systematic Row Convergent Beam Electron Diffraction
!> using scattering matrix approach
!
!> @date 06/07/01 MDG 1.0 original (for the CTEMbook)
!> @date 04/18/13 MDG 2.0 rewrite
!> @date 02/16/13 MDG 3.0 complete rewrite for EMsoftOO
!--------------------------------------------------------------------------
program EMSRCBED

use mod_kinds
use mod_global
use mod_EMsoft
use mod_SRCBED

IMPLICIT NONE


character(fnlen) :: progname = 'EMSRCBED.f90'
character(fnlen) :: progdesc = 'CTEMbook: Systematic row convergent beam pattern using scattering matrix'

type(EMsoft_T) :: EMsoft
type(SRCBED_T) :: SRCBED


EMsoft = EMsoft_T( progname, progdesc, tpl = (/ 103 /) )

! generate a set of systematic row CBED patterns
SRCBED = SRCBED_T( EMsoft%nmldeffile )

! perform the computations
call SRCBED%SRCBED( EMsoft, progname )

end program EMSRCBED
Loading

0 comments on commit ce60889

Please sign in to comment.