../fullrmc/Examples/exploreCO2/
A box of 3000 CO2 molecules which makes a total of 9000 atoms is used to fit x-rays pair distribution function of supercritical CO2 gas under high pressure. If it wasn’t for explore and refine fitting modes, creating a model is impossible especially because of the peak at \(0.67 \AA\). This example was used to generate the explore CO2 video as seen in the online documentation.
PairDistributionConstraint
constraint data.PairDistributionConstraint
constraint data in three different
axes just like in the video.IMPORTING USEFUL DEFINITIONS:
All useful packages, modules and definitions are imported.
CREATE ENGINE:
Create the engine and the needed constraints. BondsAngleConstraint
is forces O=C=O bond angle to be not more than degrees off by setting the
limits to be between 170 and 180 degrees. Also all constraints used
flag are set to True. Actually by default used flag is True, but here we
wanted to demonstrate how to turn on or off a constraint at any time during
the fitting process.
DIFFERENT RUNS:
Define functions to run the fitting engine. All of the following functions finish running the engine using Engine.run method. A trajectory of all moves is saved to the disk by setting XYZPath argument not to None.
RandomSelector
and random
atomic translations using TranslationGenerator
move
generator.TranslationGenerator
and RotationGenerator
are collected and passed to a
MoveGeneratorCollector
and set to every and each group.
RecursiveGroupSelector
to allow recurring selection and
therefore enabling fitting modes such as ‘recur’, ‘refine’ and ‘explore’RandomSelector
is wrapped with
RecursiveGroupSelector
to allow recurring selection and therefore
enabling fitting modes such as ‘recur’, ‘refine’ and ‘explore’RUN SIMULATION:
run_atoms and run_molecules functions are called first but this is not enough to achieve decent fit and model. Therefore run_recurring_atoms is called twice with explore flag set to True in the first time and refine in the second.
PLOT PDF CONSTRAINT:
Plotting the PairDistributionConstraint
data after fitting.