Sample#
The static and dynamic structure factors as well as current correlation functions generated by the main analysis functions are stored in Sample objects.
Information about the dynamic correlations generated by the compute_dynamic_structure_factors function is provided in the form of a DynamicSample object.
The latter allows one to access, for example, the intermediate scattering functions via the following attributes:
Attribute |
Explanation |
Symbol |
|---|---|---|
|
partial coherent intermediate scattering function for atom types A and B |
\(F(\boldsymbol{q},t)_\mathrm{AB}^\mathrm{coh}\) |
|
total coherent intermediate scattering function (also commonly referred to as just Fqt) |
\(F(\boldsymbol{q},t)^\mathrm{coh}\) |
|
partial incoherent intermediate scattering function for atom type A |
\(F(\boldsymbol{q},t)_\mathrm{A}^\mathrm{incoh}\) |
|
total incoherent intermediate scattering function |
\(F(\boldsymbol{q},t)^\mathrm{incoh}\) |
Similarly, one can access
dynamic structure factors \(S(\boldsymbol{q}, \omega)\) via attributes starting with
Sqwthe longitudinal and transverse current correlation functions in the time domain, \(C_L(\boldsymbol{q}, t)\) and \(C_T(\boldsymbol{q}, t)\), via attributes starting with
ClqtandCtqt, respectively, andthe longitudinal and transverse current correlation functions in the frequency domain, \(C_L(\boldsymbol{q}, \omega)\) and \(C_T(\boldsymbol{q}, \omega)\), via attributes starting with
ClqwandCtqw, respectively.
Information about static correlations can be obtained via the compute_static_structure_factors function, which returns a StaticSample object.
The latter allows one to access the static structure factor via the attribute Sq.
- dynasor.read_sample_from_npz(fname)[source]#
Read
Samplefrom file.- Parameters:
fname (
str) – Path to the file (numpy npz format) from which to read theSampleobject.- Return type:
Sample
- class dynasor.sample.DynamicSample(data_dict, simulation_data, history=None)[source]#
Class for holding dynamic correlation functions and additional metadata. Objects of this class are most commonly generated by calling
compute_dynamic_structure_factors. They can then be written to and subsequently read from file.You can see which correlation functions are available via the
available_correlation_functionsproperty. You can then access the correlation functions either by key or as property. For example, you could access the dynamic structure factor \(S(q,\omega)\) in the following ways:sample.Sqw # as property sample['Sqw'] # via key
The correlation functions are provided as numpy arrays.
There are several additional fields, the availability of which depends on the type of correlation function that was sampled.
q_points: list of q-point coordinatesq_norms: norms of the momentum vector (available when theDynamicSampleobject was generated, e.g., via
get_spherically_averaged_sample_smearingor similar functions)
time: timeomega: frequency
You can also see which fields are available by “printing” the
DynamicSampleobject.- Parameters:
data_dict (
dict[str,Any]) – Dictionary with correlation functions.simulation_data (
dict[str,Any]) – Dictionary with simulation data. The following fields are strongly encouraged (but not enforced):atom_types,cell,particle_counts.history (
Optional[list[dict[str,Any]]]) – Previous history of operations onSampleobject.
- property atom_types: list[str]#
Atom types.
- Type:
Simulation data
- property available_correlation_functions: list[str]#
All the available correlation functions in sample.
- property dimensions: list[str]#
The dimensions for the samples, e.g., for \(S(q, \omega)\) the dimensions would be the \(q\) and \(\omega\) axes.
- property has_currents: bool#
Whether this sample contains the current correlation functions or not.
- property has_incoherent: bool#
Whether this sample contains the incoherent correlation functions or not.
- property history: list[dict[str, Any]]#
List of operations applied to this
Sampleobject.
- property metadata: dict[str, Any]#
Metadata.
- property pairs: list[tuple[str, str]]#
Pairs of types for which correlation functions are available.
- property particle_counts: dict[str, int]#
Number of particles per type.
- Type:
Simulation data
- property simulation_data: dict[str, Any]#
Simulation data.
- to_dataframe(q_index)[source]#
Returns correlation functions as pandas dataframe for the given q-index.
- Parameters:
q_index (
int) – Index of q-point to return.- Return type:
DataFrame
- write_to_npz(fname)#
Write object to file in numpy npz format.
- Parameters:
fname (
str) – Name of the file in which to store the Sample object.
- class dynasor.sample.StaticSample(data_dict, simulation_data, history=None)[source]#
Class for holding static correlation functions and additional metadata. Objects of this class are most commonly generated by calling
compute_static_structure_factors. They can then be written to and subsequently read from file.You can see which correlation functions are available via the
available_correlation_functionsproperty. You can then access the correlation functions either by key or as property. For example, you could access the static structure factor \(S(q)\) in the following ways:sample.Sq # as property sample['Sq'] # via key
The correlation functions are provided as numpy arrays.
There are additional fields including: , the availability of which depends on the type of correlation function that was sampled.
q_normsis only available if spherical averaging was carried out, typically viaq_points: list of q-point coordinatesq_norms: norms of the momentum vector (available when theStaticSampleobject was generated, e.g., via
get_spherically_averaged_sample_smearingor similar functions)
You can also see which fields are available by “printing” the
StaticSampleobject.- Parameters:
data_dict (
dict[str,Any]) – Dictionary with correlation functions.simulation_data (
dict[str,Any]) – Dictionary with simulation data. The following fields are strongly encouraged (but not enforced):atom_types,cell,particle_counts.history (
Optional[list[dict[str,Any]]]) – Previous history of operations onSampleobject.
- property atom_types: list[str]#
Atom types.
- Type:
Simulation data
- property available_correlation_functions: list[str]#
All the available correlation functions in sample.
- property dimensions: list[str]#
The dimensions for the samples, e.g., for \(S(q, \omega)\) the dimensions would be the \(q\) and \(\omega\) axes.
- property has_currents: bool#
Whether this sample contains the current correlation functions or not.
- property has_incoherent: bool#
Whether this sample contains the incoherent correlation functions or not.
- property history: list[dict[str, Any]]#
List of operations applied to this
Sampleobject.
- property metadata: dict[str, Any]#
Metadata.
- property pairs: list[tuple[str, str]]#
Pairs of types for which correlation functions are available.
- property particle_counts: dict[str, int]#
Number of particles per type.
- Type:
Simulation data
- property simulation_data: dict[str, Any]#
Simulation data.
- write_to_npz(fname)#
Write object to file in numpy npz format.
- Parameters:
fname (
str) – Name of the file in which to store the Sample object.