File self_vectors_scatter_device.hpp

This file contains a class which implements the scattering calculation for self scattering.

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

class SelfVectorsScatterDevice : public AbstractVectorsScatterDevice
#include <self_vectors_scatter_device.hpp>

Calculates scattering using an atom-based decomposition.

This device calculates the incoherent scattering contribution, which arises from the correlation of each atom with itself over time. It is selected by the ScatterDeviceFactory when scattering.type is set to “self”.

The parallelization strategy is decomposition by atoms. The stage_data() method, using DataStagerByAtom, distributes the full time-trajectories of a subset of atoms to each MPI rank. The computation is then parallelized over these atoms.

Public Functions

SelfVectorsScatterDevice(boost::mpi::communicator allcomm, boost::mpi::communicator partitioncomm, Sample &sample, std::vector<CartesianCoor3D> vectors, size_t NAF, boost::asio::ip::tcp::endpoint fileservice_endpoint, boost::asio::ip::tcp::endpoint monitorservice_endpoint)
SelfVectorsScatterDevice(const SelfVectorsScatterDevice&) = delete
SelfVectorsScatterDevice operator=(const SelfVectorsScatterDevice&) = delete

Protected Functions

fftw_complex *scatter(size_t qindex, size_t aindex)

Computes the scattering for a single atom and a single sub-vector.

This is the core computational kernel. It is executed by a worker thread and calculates the scattering contribution of one atom (aindex) for one sub-vector (qindex) across all frames.

Parameters:
  • qindex – The index of the orientationally-averaged sub-vector.

  • aindex – The index of the atom to compute.

void scatter_single(size_t qindex, size_t aindex, fftw_complex *buffer)
virtual double progress() override
virtual void stage_data() override

Distributes atom coordinates for subsets of atoms to each MPI rank.

Each rank receives the data specific to all frames for its assigned atoms.

virtual void compute() override

The worker thread’s main function (Consumer).

Runs on each worker thread, waiting for an (q-vector, atom) pair from the atscatter_ queue and calling scatter() to do the work.

Orchestrates the calculation for a single primary q-vector.

This function acts as the main producer. It iterates through the atoms assigned to its MPI rank. For each atom, it dispatches the calculations for all sub-vectors to the worker threads.

void scatterblock(size_t atomindex, size_t index, size_t count)

Pushes a block of work to the worker queue.

The work items are (q-vector, atom) pairs.

Parameters:
  • atomindex – The index of the atom for this block of work.

  • index – The starting sub-vector index.

  • count – The number of sub-vectors in the block.

void store(fftw_complex *at)
void dsp(fftw_complex *at)
virtual bool ram_check() override
~SelfVectorsScatterDevice()

Protected Attributes

fftw_complex *at_
coor_t *p_coordinates
size_t current_atomindex_ = 0
size_t coord_size_ = 0
ModAssignment assignment_
fftw_plan fftw_planF_
fftw_plan fftw_planB_