| 1 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 2 |
// Author: Kristian Lytje |
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <hist/intensity_calculator/CompositeDistanceHistogramFFExplicit.h> |
| 7 |
#include <hist/intensity_calculator/crysol/FormFactorCrysol.h> |
| 8 |
|
| 9 |
namespace ausaxs::hist { |
| 10 |
/** |
| 11 |
* @brief An alternative to CompositeDistanceHistogramFFExplicit that mimics the CRYSOL excluded volume fitting. |
| 12 |
*/ |
| 13 |
class CompositeDistanceHistogramCrysol : public CompositeDistanceHistogramFFExplicitBase<form_factor::lookup::atomic::table_t, form_factor::lookup::cross::table_t, form_factor::lookup::exv::table_t>{ |
| 14 |
public: |
| 15 |
CompositeDistanceHistogramCrysol(); |
| 16 |
CompositeDistanceHistogramCrysol(const CompositeDistanceHistogramCrysol&); |
| 17 |
CompositeDistanceHistogramCrysol(CompositeDistanceHistogramCrysol&&) noexcept; |
| 18 |
CompositeDistanceHistogramCrysol& operator=(CompositeDistanceHistogramCrysol&&) noexcept; |
| 19 |
CompositeDistanceHistogramCrysol& operator=(const CompositeDistanceHistogramCrysol&); |
| 20 |
virtual ~CompositeDistanceHistogramCrysol() override; |
| 21 |
|
| 22 |
/** |
| 23 |
* @brief Create a new unweighted composite distance histogram with form factors. |
| 24 |
* The same distance histogram is used for aa, ax, and xx interactions (with different form factor tables). |
| 25 |
* Similarly, the same histogram is used for aw and wx interactions. |
| 26 |
* |
| 27 |
* @param p_aa The partial distance histogram for atom-atom interactions (also used for ax and xx). |
| 28 |
* @param p_aw The partial distance histogram for atom-water interactions (also used for wx). |
| 29 |
* @param p_ww The partial distance histogram for water-water interactions. |
| 30 |
* @param p_tot The total distance histogram. This is only used for determining the maximum distance. |
| 31 |
* @param avg_displaced_V The average displaced volume per atom. |
| 32 |
*/ |
| 33 |
CompositeDistanceHistogramCrysol( |
| 34 |
hist::Distribution3D&& p_aa, |
| 35 |
hist::Distribution2D&& p_aw, |
| 36 |
hist::Distribution1D&& p_ww, |
| 37 |
hist::Distribution1D&& p_tot, |
| 38 |
double avg_displaced_V |
| 39 |
); |
| 40 |
|
| 41 |
/** |
| 42 |
* @brief Create a new weighted composite distance histogram with form factors. |
| 43 |
* The same distance histogram is used for aa, ax, and xx interactions (with different form factor tables). |
| 44 |
* Similarly, the same histogram is used for aw and wx interactions. |
| 45 |
* |
| 46 |
* @param p_aa The partial distance histogram for atom-atom interactions (also used for ax and xx). |
| 47 |
* @param p_aw The partial distance histogram for atom-water interactions (also used for wx). |
| 48 |
* @param p_ww The partial distance histogram for water-water interactions. |
| 49 |
* @param p_tot The total distance histogram. This is only used to extract the bin centers. |
| 50 |
* @param avg_displaced_V The average displaced volume per atom. |
| 51 |
*/ |
| 52 |
CompositeDistanceHistogramCrysol( |
| 53 |
hist::Distribution3D&& p_aa, |
| 54 |
hist::Distribution2D&& p_aw, |
| 55 |
hist::Distribution1D&& p_ww, |
| 56 |
hist::WeightedDistribution1D&& p_tot, |
| 57 |
double avg_displaced_V |
| 58 |
); |
| 59 |
|
| 60 |
const form_factor::lookup::atomic::table_t& get_ff_table() const override; |
| 61 |
const form_factor::lookup::cross::table_t& get_ffax_table() const override; |
| 62 |
const form_factor::lookup::exv::table_t& get_ffxx_table() const override; |
| 63 |
|
| 64 |
Limit get_excluded_volume_scaling_factor_limits() const override; |
| 65 |
|
| 66 |
/** |
| 67 |
* @brief Get the excluded volume scaling factor. |
| 68 |
* |
| 69 |
* @param cx The scaling factor for the excluded volume. |
| 70 |
* @param q The scattering vector. |
| 71 |
* @param avg_displaced_V The average displaced volume per atom. |
| 72 |
*/ |
| 73 |
static double exv_factor(double q, double cx, double avg_displaced_V); |
| 74 |
|
| 75 |
double average_displaced_V = 0; |
| 76 |
|
| 77 |
protected: |
| 78 |
double exv_factor(double q) const override; |
| 79 |
void initialize(); |
| 80 |
|
| 81 |
inline static form_factor::lookup::atomic::table_t ffaa_table; |
| 82 |
inline static form_factor::lookup::cross::table_t ffax_table; |
| 83 |
inline static form_factor::lookup::exv::table_t ffxx_table; |
| 84 |
}; |
| 85 |
} |