../fullrmc/Examples/molecularTHF/
A cubic box of tetrahydrofuran molecules used to model liquid tetrahydrofuran battery
electrolyte x-rays pair distribution function. In this example, it was necessary to use
many kinds of move generators in order to be able to converge.
TranslationGenerator
, TranslationAlongSymmetryAxisGenerator
,
RotationGenerator
, RotationAboutSymmetryAxisGenerator
,
DistanceAgitationGenerator
, AngleAgitationGenerator
, and a
collection of those using MoveGeneratorCollector
are used at some point.
Also, different type of selectors are used RandomSelector
,
DefinedOrderSelector
and RecursiveGroupSelector
with different
fitting modes (recur, refine and explore). This example was used to generate the
simulation video as seen in the online documentation.
PairCorrelationConstraint
constraint data.PairCorrelationConstraint
constraint data in three different
axes showing multiple zooming to data.IMPORTING USEFUL DEFINITIONS:
All useful packages, modules and definitions are imported.
CREATE ENGINE:
Check if engine already saved on disk. In the affirmative load it to continue
fitting from last saved configuration. Otherwise, build the engine and the needed
constraints. Also, in this example we decided to make it a bit more difficult and
to fit a pair correlation function using PairCorrelationConstraint
instead
of a pair distribution function. As ‘thf_pdf.exp’ is a pair distribution function data
file, we used ‘convert_Gr_to_gr’ function to convert the latter to pair correlation
function. Also it makes sense to neglect all initial ‘N’ negative data points, hence a
dataWeights array is created where all its values are equal to 1 except for the first ‘N’
elements.
DIFFERENT RUNS:
Define functions to run the fitting engine. All of the following functions finish running the engine using Engine.run method.
DistanceAgitationGenerator
is assigned to each group. A
RecursiveGroupSelector
is used if any of refine or explore flags
are set to True.RecursiveGroupSelector
is used if any of refine or explore flags
are set to True.RecursiveGroupSelector
is used if any of refine or explore flags
are set to True.RecursiveGroupSelector
is used if any of refine or explore flags
are set to True.RotationAboutSymmetryAxisGenerator
with axis=0 is assigned to each group.
DefinedOrderSelector
wrapped with a RecursiveGroupSelector
with the order of selection being the sorted groups indexes list computed in a such
a way ordering groups from the further to the closest to the center of the
simulation box.RotationAboutSymmetryAxisGenerator
with axis=1 is assigned to each group.
DefinedOrderSelector
wrapped with a RecursiveGroupSelector
with the order of selection being the sorted groups indexes list computed in a such
a way ordering groups from the further to the closest to the center of the
simulation box.RotationAboutSymmetryAxisGenerator
with axis=2 is assigned to each group.
DefinedOrderSelector
wrapped with a RecursiveGroupSelector
with the order of selection being the sorted groups indexes list computed in a such
a way ordering groups from the further to the closest to the center of the
simulation box.TranslationAlongSymmetryAxisGenerator
with axis=0 is assigned to each
group. DefinedOrderSelector
wrapped with a
RecursiveGroupSelector
with the order of selection being the sorted groups
indexes list computed in a such a way ordering groups from the further to the
closest to the center of the simulation box.TranslationAlongSymmetryAxisGenerator
with axis=1 is assigned to each
group. DefinedOrderSelector
wrapped with a
RecursiveGroupSelector
with the order of selection being the sorted groups
indexes list computed in a such a way ordering groups from the further to the
closest to the center of the simulation box.TranslationAlongSymmetryAxisGenerator
with axis=2 is assigned to each
group. DefinedOrderSelector
wrapped with a
RecursiveGroupSelector
with the order of selection being the sorted groups
indexes list computed in a such a way ordering groups from the further to the
closest to the center of the simulation box.MoveGeneratorCollector
of move generators is created and set
to every group. RotationGenerator
and TranslationGenerator
are
added to this collection. RecursiveGroupSelector
is used allowing to
refine or explore fitting.MoveGeneratorCollector
of move generators is created and set
to every group. RotationGenerator
and TranslationGenerator
are
added to this collection. DefinedOrderSelector
wrapped with a
RecursiveGroupSelector
with the order of selection being the sorted
groups indexes list computed in a such a way ordering groups from the further to
the closest to the center of the simulation box. New boundary condition is set
using set_boundary_conditions method.RUN SIMULATION:
run the different functions to fit the system.
PLOT PDF CONSTRAINT:
Plotting PairCorrelationConstraint
data after fitting.