File all_vectors_scatter_device.hpp

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

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

class AllVectorsScatterDevice : public AbstractVectorsScatterDevice
#include <all_vectors_scatter_device.hpp>

Calculates scattering using a frame-based decomposition.

This device calculates the total coherent scattering amplitude A(q,t) by considering all pairs of atoms in the system. It is selected by the ScatterDeviceFactory when the configuration scattering.type is set to “all”.

The parallelization strategy is decomposition by frames. The stage_data() method, implemented via DataStagerByFrame, distributes subsets of the total simulation frames to each MPI node within a partition. The computation for each q-vector is then parallelized across these nodes.

Public Functions

AllVectorsScatterDevice(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)

Constructs the AllVectorsScatterDevice.

This constructor is typically called by the ScatterDeviceFactory and not directly. It initializes the base class and prepares the device for computation.

Parameters:
  • allcomm – The MPI communicator for all participating nodes.

  • partitioncomm – The MPI communicator for the local partition (team) of nodes.

  • sample – The sample data (see Sample class), including set of atom coordinates and types.

  • vectors – The subset of q-vectors assigned to this partition.

  • NAF – The number of work units (frames for this device).

  • fileservice_endpoint – The network endpoint for the file writing service.

  • monitorservice_endpoint – The network endpoint for the progress monitoring service.

Protected Functions

void scatter(size_t this_subvector)

Performs scattering calculation for a single sub-vector.

This is the core computational kernel. It is executed by a worker thread and calculates the scattering computation for a given sub-vector over the subset of frames assigned to its parent MPI process.

Parameters:

this_subvector – The index of the sub-vector to compute.

virtual void stage_data()

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

Each rank receives all atom coordinates for its assigned frames.

virtual void compute()

Orchestrates the entire calculation for a single primary q-vector.

This function acts as the main producer. It initializes the orientationally-averaged sub-vectors, pushes them in blocks to the worker threads via scatterblock(), handles MPI data exchange, performs signal processing (dsp), and reduces the final results.

void scatterblock(size_t index, size_t count)

Pushes a block of sub-vector indices to the worker queue.

Parameters:
  • index – The starting sub-vector index for the block.

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

void store(fftw_complex *at)
void dsp(fftw_complex *at)
fftw_complex *alignpad(fftw_complex *at)
fftw_complex *exchange()
virtual bool ram_check()
~AllVectorsScatterDevice()

Protected Attributes

fftw_complex *at_
coor_t *p_coordinates
fftw_plan fftw_planF_
fftw_plan fftw_planB_