PXRD Match Optimiser

Introduction

pxrd_match_optimiser.py - an API for optimising crystal structures to match powder X-ray diffraction (PXRD) patterns.

API

class ccdc.csp.pxrd_match_optimiser.PXRDMatchOptimiser(crystal_structure: Crystal, pxrd_pattern: PowderPattern, settings: Optional[Settings] = None)[source]

A class for optimising crystal structures to match powder X-ray diffraction (PXRD) patterns.

class Settings[source]

Settings for the PXRD match optimiser.

property cell_angle_tolerance: float

The maximum amount by which the cell angles can be modified, in degrees.

The default value is 5 degrees.

property cell_length_tolerance: float

The maximum amount by which the cell lengths can be modified, as a fraction of the starting value.

The default value is 0.05.

find_best_two_theta_shift(crystal, pxrd_pattern) float[source]

Find a two-theta shift that best matches the PXRD pattern.

Parameters
Returns

the best two-theta shift in degrees to match the pattern

property optimisation_accuracy: float

The optimisation accuracy.

Optimisation will terminate when the magnitude of the gradient of the cost function goes below this fraction of the optimised variable’s magnitude.

The default value is 1e-6.

property optimise_cell: bool

Whether to optimise the unit cell.

The defaults value is True.

property optimise_molecule: str

How much to optimise the crystal’s molecules.

The options are:

  • ‘None’ - The molecules will retain their internal geometry and position relative to the cell.

  • ‘Position’ - The molecules will retain their internal geometry but their position and orientation within the cell are optimised.

  • ‘Geometry’ - The molecules’ internal torsions, position and orientation within the cell are optimised.

The default value is ‘None’.

property optimise_preferred_orientation: bool

Whether to optimise preferred orientation.

The default value is False.

static predict_bfdh_preferred_orientation(crystal)[source]

Predict the PXRD preferred orientation using BFDH morphology.

Parameters

crystal – a ccdc.crystal.Crystal object

Returns

a ccdc.descriptors.CrystalDescriptors.PowderPattern.PreferredOrientation or None

The returned preferred orientation has an optimisable March-Dollase r parameter.

static predict_free_direction_preferred_orientation(crystal, pxrd_pattern)[source]

Predict the PXRD preferred orientation using free variables for direction and March Dollase r.

Parameters
Returns

a ccdc.descriptors.CrystalDescriptors.PowderPattern.PreferredOrientation

The returned prediction is not immediately useful as it needs to be optimised. After optimisation, the preferred orientation should be a better match to the PXRD pattern.

static predict_preferred_orientation(crystal, pxrd_pattern, mode='BFDH')[source]

Predict the preferred orientation using the specified mode.

Parameters

mode – one of

  • ‘BFDH’ - use BFDH morphology to predict a preferred orientation with optimisable March-Dollase r parameter.

  • ‘FREE’ - a fully opimisable preferred orientation, the actual values are only meaningful after optimisation.

  • ‘SEARCH’ - a brute force search to find a preferred orientation to match the PXRD pattern with optimisable March-Dollase r parameter.

Parameters
Returns

a ccdc.descriptors.CrystalDescriptors.PowderPattern.PreferredOrientation or None

property reduced_unit_cell: bool

Whether to use Niggli reduced unit cells to perform the optimisation. Default is false

static search_preferred_orientation(crystal, pxrd_pattern)[source]

Predict the PXRD preferred orientation by brute force search to best match a PXRD pattern.

Parameters
Returns

a ccdc.descriptors.CrystalDescriptors.PowderPattern.PreferredOrientation

The returned preferred orientation has an optimisable March-Dollase r parameter.

property simulator_settings

The settings for the PXRD simulator.

Returns

a ccdc.descriptors.CrystalDescriptors.PowderPattern.Settings

property two_theta_shift: float

The two-theta angle to shift the pattern, in degrees.

The default value is 0. The value will be rounded to a multiple of the two-theta step size.

property use_ESDs: bool

Whether to use ESDs in pattern matching.

The default value is False.

property verbose: bool

Whether to output verbose information.

The default value is False.

property width: float

The width (in degrees) of the base of the triangle weight function used in pattern matching.

The default value is 2.0 degrees. Values within the range 0 to 90 degrees are accepted.

property crystal_structure

The crystal structure to be optimised.

Returns

a ccdc.crystal.Crystal object

optimise()[source]

Create and return an optimised crystal structure that better matches the PXRD pattern.

Returns

an optimised ccdc.crystal.Crystal object

property pxrd_pattern

The PXRD pattern to match.

Returns

a ccdc.descriptors.PXRD object

property settings

The settings for the PXRD matching.

Returns

a ccdc.descriptors.PXRDMatchOptimiserSettings object