From 189da15810deabd739d7c11c6e95fea55739fe60 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 1 Aug 2020 15:13:49 +0200 Subject: Initial import from archive --- src/multislice.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/multislice.c (limited to 'src/multislice.c') diff --git a/src/multislice.c b/src/multislice.c new file mode 100644 index 0000000..b314098 --- /dev/null +++ b/src/multislice.c @@ -0,0 +1,126 @@ +/* + * multislice.c + * + * Multislice Dynamical Simulations + * + * (c) 2006-2007 Thomas White + * + * synth2d - Two-Dimensional Crystallographic Fourier Synthesis + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +#include "reflist.h" +#include "model.h" +#include "data.h" + +/* Relativistic Electron Interaction Constant. Voltage in volts. */ +static double multislice_interaction(double voltage) { + + double a, b; + + a = (1 + voltage*1.9569341e-6) * 0.25615739; + b = sqrt(voltage) * sqrt(1 + voltage*0.97846707e-6); + + return a / b; + +} + +/* Unit cell volume */ +static double multislice_volume(double a, double b, double c, double alpha, double beta, double gamma) { + + + +} + +static fftw_complex *multislice_phasegrating(AtomicModel *model_orig, size_t width, size_t height) { + + AtomicModel *model; + fftw_complex *phase_grating_real; + fftw_complex *phase_grating_reciprocal; + fftw_plan plan; + ReflectionList *V; + ReflectionList *template; + + template = reflist_new(); + + model = model_copy(model_orig); + model->thickness = 0.0; + V = model_calculate_f(template, model, 69); + model_free(model); + reflist_free(template); + + plan = fftw_plan_dft_2d(width, height, phase_grating_real, phase_grating_reciprocal, FFTW_FORWARD, FFTW_MEASURE); + fftw_execute(plan); + fftw_destroy_plan(plan); + + return phase_grating_reciprocal; + +} + +static fftw_complex *multislice_propogator(AtomicModel *model_orig, size_t width, size_t height, double slice) { + + + + return NULL; + +} + +static void multislice_multiply(fftw_complex *a, fftw_complex *b, size_t size) { + size_t i; + for ( i=0; ithickness; t+=c ) { + multislice_multiply(wavefunction, propogator, width*height); + multislice_convolve(wavefunction, phasegrating, width*height); + printf("MS: Current thickness: %f\n", t); fflush(stdout); + } + + return NULL; + +} + -- cgit v1.2.3