Skip to content

Commit

Permalink
initial commit of EMTBBW program [legacy from CTEM book]
Browse files Browse the repository at this point in the history
program works fine; needs HDF5 output routine
  • Loading branch information
marcdegraef committed Feb 21, 2024
1 parent 973e39d commit 0f87e5c
Show file tree
Hide file tree
Showing 8 changed files with 1,121 additions and 3 deletions.
24 changes: 24 additions & 0 deletions NamelistTemplates/EMTBBW.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
&TBBWlist
! do not change the first line in this file !
!
! Note: All parameter values are default values for the program
!
!--------------
! the name of the crystal input file MUST be specified
xtalname = 'undefined',
! microscope accelerating voltage [kV]
voltage = 200.0,
! Miller indices of reflection for two-beam case
g = 1 0 0,
! incident beam direction indices
k = 0 0 1,
! foil normal direction indices
f = 0 0 1,
! maximum value of tangential k_t in units of g
ktmax = 1.0,
! number of incident beam orientations [between -ktmax and ktmax]
numkt = 256,
! name of output HDF5 file [relative to EMdatapathname]
outname = 'undefined'
! this last line must be present!
/
9 changes: 9 additions & 0 deletions Source/CTEMbook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ if(EMsoftOO_ENABLE_HDF5_SUPPORT)
INCLUDE_DIRS ${EMsoftHDFLib_BINARY_DIR}
)

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

Add_EMsoftOO_Executable(TARGET EMTBBFDF
SOURCES ${APP_DIR}/EMTBBFDF.f90
LINK_LIBRARIES ${EXE_LINK_LIBRARIES}
Expand Down
69 changes: 69 additions & 0 deletions Source/CTEMbook/EMTBBW.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
! ###################################################################
! Copyright (c) 2016-2024, Marc De Graef Research Group/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.
! ###################################################################

program EMTBBW
!! author: MDG
!! version: 1.0
!! date: 02/21/24
!!
!! Simple two-beam Bloch wave program [legacy from CTEM book]
!!
!! This is a legacy program to reproduce some of the figures in chapter 6 of the CTEM book
!! The original code has been updated using the modern object oriented fortran 2018 approach.

use mod_kinds
use mod_global
use mod_EMsoft
use mod_BW
use mod_HDFnames
use stringconstants

IMPLICIT NONE

character(fnlen) :: progname = 'EMTBBW.f90'
character(fnlen) :: progdesc = 'Simple two-beam Bloch wave program [legacy from CTEM book]'

type(EMsoft_T) :: EMsoft
type(TBBW_T) :: BW
type(HDFnames_T) :: HDFnames

! print the EMsoft header and handle any command line arguments
EMsoft = EMsoft_T( progname, progdesc, tpl = (/ 401 /) )

! deal with the namelist stuff
BW = TBBW_T(EMsoft%nmldeffile)

HDFnames = HDFnames_T()
call HDFnames%set_ProgramData(SC_TBBW)
call HDFnames%set_NMLlist(SC_TBBWNameList)
call HDFnames%set_NMLfilename(SC_TBBWNML)

! perform the computations
call BW%TBBW(EMsoft, progname, HDFnames)

end program EMTBBW
1 change: 1 addition & 0 deletions Source/EMsoftOOLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ set(EMsoftOOLib_SRCS
${EMsoftOOLib_SOURCE_DIR}/program_mods/mod_SRCBED.f90
${EMsoftOOLib_SOURCE_DIR}/program_mods/mod_STEMDCI.f90
${EMsoftOOLib_SOURCE_DIR}/program_mods/mod_BWEW.f90
${EMsoftOOLib_SOURCE_DIR}/program_mods/mod_BW.f90
${EMsoftOOLib_SOURCE_DIR}/program_mods/mod_BFDF.f90

${EMsoftOOLib_Additional_SRCS}
Expand Down
4 changes: 2 additions & 2 deletions Source/EMsoftOOLib/mod_TB.f90
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ recursive subroutine TBCalcInten(It,Is,sg,z,xig,xigp,xizero,betag)
real(kind=sgl),INTENT(IN) :: betag
!! phase parameter
real(kind=sgl),INTENT(OUT) :: It
!! real part of result
!! transmitted intensity
real(kind=sgl),INTENT(OUT) :: Is
!! imaginary part of result
!! scattered intensity

real(kind=sgl) :: q, r, sq, qgsi, e, sr, si, cp, ch, pr, pi, xigi, xigpi, sgs

Expand Down
Loading

0 comments on commit 0f87e5c

Please sign in to comment.