Relative path

../fullrmc/Examples/exploreCO2/

Description

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.

Files

  1. CO2.pdb: The initial configuration input file.
  2. Xrays.gr: The x-rays experimental pair distribution function data.
  3. run.py: The script file used to run the simulation.
  4. plot.py: The script file to plot the last saved engine state of PairDistributionConstraint constraint data.
  5. multiplot.py: The script file to plot the last saved engine state PairDistributionConstraint constraint data in three different axes just like in the video.

run.py explained

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.

  1. run_atoms: used set_groups(None) which is equivalent to creating a group per atom. Here the engine runs traditional RMC with random selection of groups using RandomSelector and random atomic translations using TranslationGenerator move generator.
  2. run_molecules: Groups are created by molecules using engine set_groups_as_molecules method. 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’
  3. run_recurring_atoms: Here also set_groups(None) is used which is equivalent to creating a group per atom. But 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.

Table of Contents