Commit 5719e4eb authored by Jan Oliver Oelerich's avatar Jan Oliver Oelerich

Improved slice potential calculation

parent 8593fa41
......@@ -70,6 +70,7 @@ void Slice::calculateTransmissionFunction(const shared_ptr<FPConfManager> &fpman
_transmission_function.init(samples_x, samples_y, complex<float>(1.0, 0.0));
for(auto &a: _atoms) {
sf.initPotential(a->getElement());
// now add up all the potentials
double dx = fpman->dx(a->getId());
......
......@@ -105,12 +105,6 @@ namespace stemsalabim { namespace atomic {
}
double getPotential(double distance, const std::shared_ptr<Element> &element) {
std::unique_lock<std::mutex> lck(_cache_mtx);
if(!_cache.count(element->symbol())) {
populateCache(element);
}
if(distance > _cutoff)
return 0.0;
......@@ -118,6 +112,14 @@ namespace stemsalabim { namespace atomic {
return _cache.at(element->symbol())[index];
}
void initPotential(const std::shared_ptr<Element> &element) {
std::unique_lock<std::mutex> lck(_cache_mtx);
if(!_cache.count(element->symbol())) {
populateCache(element);
}
}
private:
explicit Scattering(double cache_grating = 72, double cutoff = 3.0)
: _cutoff(cutoff)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment