prism-em / prismatic

C++/CUDA package for parallelized simulation of image formation in Scanning Transmission Electron Microscopy (STEM) using the PRISM and multislice algorithms
GNU General Public License v3.0
79 stars 40 forks source link

4D frozen phonon calculation question #5

Closed matkraj closed 6 years ago

matkraj commented 6 years ago

I was just wondering if this block of a code means that frozen phonon is only done for 3D output? (but I am in doubt) https://github.com/prism-em/prismatic/blob/ce5fed79545266d72a2d6e6aa4974230ff9bb4d8/src/Multislice_entry.cpp#L41-L73

apryor6 commented 6 years ago

Multiple frozen phonons are calculated. The block of code of interest computes all remaining frozen phonons after the first and stores them as a running average. If only one frozen phonon is requested, there is no need to create this second copy for the running average, and this step is skipped. Note that the inner loop starts at fp_num=1, which is the second configuration since C++ is zero-based for indexing.

matkraj commented 6 years ago

Cool! I asked for the following reason. If I select i.e. 5 configurations for frozen phonon for 4D STEM output, I get 5 files per probe position (their name ends with '..FP_1.mrc', '..FP_2.mrc', ..). However, these files are exactly the same, which confuses me a bit. My file *xyz file is:

STO 3.905 3.905 3.905 38 0.00000000 0.00000000 0.00000000 1 0.08 22 1.95250000 1.95250000 1.95250000 1 0.08 8 0.00000000 1.95250000 1.95250000 1 0.08 8 1.95250000 0.00000000 1.95250000 1 0.08 8 1.95250000 1.95250000 0.00000000 1 0.08 -1

edt: the files are exactly the same as multislice run with a single FP (all run on CUDA)

apryor6 commented 6 years ago

Thanks for including the file you are using for input. Could you also tell me the exact call to prismatic so I can try to replicate?

matkraj commented 6 years ago

prismatic -i "STO.xyz" -t 20 20 40 -o "STOsim.mrc" -wx 0.5 0.5 -wy 0.5 0.5 -a m -4D 1 -3D 0 -F 5 -p 0.05

apryor6 commented 6 years ago

The files I get are close to identical, but not identical. There are small floating point differences. As a quick test I amplified the thermal factor from 0.08 to 8.0 and the resulting files are significantly different. Perhaps the original similarity is because the thermal factor is not much larger than 1 pixel, and then you are averaging over 40 unit cells in Z. I could look in more detail later this week.

matkraj commented 6 years ago

ah ok, was that with a single or a double precision? I did a single precision and sum(abs(A-B)) was 0

matkraj commented 6 years ago

I changed the thermal parameter and FP is clearly working, thanks for the suggestion