Skip to main content

    PyWPEM inputs and parameters

    Pick one of 14 operations, then supply an XRD intensity CSV, a CIF by URL or inline text, a wavelength preset such as CuKa1Ka2, and the two-theta range.

    pywpeminputs

    You provide an operation along with XRD data, a CIF structure, or both. The operation you choose is what most affects the result, since it determines which of those inputs are required and how the pattern is processed.

    PyWPEM inputs and parameters

    Common parameters

    ParameterTypeDefaultDescription
    operationstringrequiredOne of the 14 operation names above
    wavelength_presetstring"CuKa1Ka2"X-ray source preset — see table below
    custom_wavelengthsnumber[]--Custom wavelength(s) in Å, used when wavelength_preset is "custom"
    two_theta_minnumber10Minimum 2-theta angle (degrees)
    two_theta_maxnumber90Maximum 2-theta angle (degrees)
    two_theta_stepnumber0.02Angular step size (degrees)

    Not every operation reads all of these — wavelength_preset/custom_wavelengths and the two-theta range mainly matter for simulate_xrd, preprocess_cif, and fit_amorphous.

    Wavelength presets (wavelength_preset)

    Preset keySourceWavelength (Å)
    CuKa1Ka2Cu K-alpha doublet (default, most common lab setup)1.5406 / 1.5444
    CuKaCu K-alpha (weighted average)1.5418
    MoKaMo K-alpha (single-crystal diffraction)0.7107
    CoKaCo K-alpha (reduces fluorescence from Fe-containing samples)1.7902
    FeKaFe K-alpha1.9373
    CrKaCr K-alpha (stress analysis, texture)2.291
    AgKaAg K-alpha (high-energy, deep penetration)0.5594
    customUser-defined — supply custom_wavelengths--

    XRD data input

    For operations requiring experimental data:

    ParameterTypeDescription
    xrd_data_urlstringS3 URL to an XRD intensity CSV (two_theta, intensity columns)

    There is no inline/raw-text alternative for this field — upload the CSV and pass its URL.

    CIF structure input

    For operations requiring crystal structure data:

    ParameterTypeDescription
    cif_urlstringURL to a CIF file — from the COD (crystallography.net/cod/XXXXXXX.cif), CCDC, ICDD, or S3. Do not use a PubChem 3D-conformer URL — it serves an HTML page, not a CIF file.
    cif_contentstringInline CIF file content (alternative to cif_url)

    CIF requirements

    • Must include _cell_length_a/b/c and _cell_angle_alpha/beta/gamma
    • Must include _atom_site_fract_x/y/z coordinates
    • Must include _symmetry_space_group_name_H-M or equivalent

    Operation-specific parameters

    fit_background

    ParameterTypeDefaultDescription
    background_segmentsinteger5Number of segments for piecewise background fitting

    simulate_xrd

    ParameterTypeDefaultDescription
    grain_size_nmnumber--Crystallite grain size for peak broadening (nm, 5-100)
    replace_atomstring--Atom to replace for solid-solution simulation (e.g., "Cu2+")
    substitute_atomstring--Substituting atom (e.g., "Ti4+")
    substitution_rationumber0.1Fraction of atoms to replace (0-1)

    refine_xrd

    ParameterTypeDefaultDescription
    background_urlstring--S3 URL to a background CSV (from fit_background)
    no_background_urlstring--S3 URL to a background-subtracted CSV (from fit_background)
    variancenumber--Background variance (from the fit_background result)
    phasesarrayrequiredPhases to refine — one or more objects with name (required), cif_url, and fixed (keep lattice fixed)
    max_iterationsinteger40Maximum refinement iterations
    betanumber0.8Initial Lorentzian fraction in the pseudo-Voigt peak profile (0-1)

    fit_amorphous

    ParameterTypeDefaultDescription
    num_componentsinteger1Number of Gaussian components for amorphous fitting

    calculate_rdf

    ParameterTypeDefaultDescription
    density_atoms_per_ccnumber--Atomic density for RDF calculation (atoms per cubic cm)
    scattering_factornumber--Scattering factor for RDF normalization
    r_maxnumber10Maximum radial distance for RDF (Å)

    fit_xps

    ParameterTypeDefaultDescription
    xps_data_urlstringrequiredS3 URL to XPS intensity data (binding_energy, intensity columns)
    peaksarrayrequiredPeaks to fit — objects with atom, orbital, and binding_energy (all required)

    fit_exafs

    ParameterTypeDefaultDescription
    xafs_data_urlstringrequiredS3 URL to XAFS data (energy, mu columns)
    powernumber2k-weighting power for the EXAFS transform
    k_cutoffnumber12k-space cutoff for the Fourier transform (Å⁻¹)
    transform_typestring"fourier""fourier" or "wavelet"

    generate_crystal_graph

    ParameterTypeDefaultDescription
    graph_typestring"connectivity""connectivity" (bond-based, CGCNN/standard GNN), "voronoi" (dense/amorphous phases), or "distance" (MEGNet-style continuous edges)
    max_neighborsinteger12Maximum neighbors per atom in the graph
    cutoff_distancenumber5.0Distance cutoff for neighbor search (Å)

    search_substitutional_sites

    ParameterTypeDefaultDescription
    target_elementstringrequiredElement to substitute (e.g., "Fe")
    substitute_elementstringrequiredSubstituting element (e.g., "Co")
    energy_thresholdnumber1.0Maximum formation energy threshold (eV)

    This operation requires cif_url specifically (not cif_content).

    plot_components

    ParameterTypeDefaultDescription
    plot_typestringrequired"xrd", "xps", "exafs", "rdf", or "amorphous"
    componentsinteger[]--Component indices to include in the plot
    show_residualbooleantrueShow the residual curve
    titlestring--Custom plot title

    convert_file_format

    ParameterTypeDefaultDescription
    input_urlstringrequiredS3 URL to the input file
    input_formatstringrequired"csv", "xy", "xye", "cif", "json", "raw", or "brml"
    output_formatstringrequiredSame set of values as input_format

    compute_graph_matrix

    ParameterTypeDefaultDescription
    matrix_operationstring"to_adjacency""to_matrix", "to_adjacency", or "laplacian"
    normalizebooleanfalseNormalize the matrix

    split_ml_datasets

    ParameterTypeDefaultDescription
    data_urlstring--S3 URL to the dataset to split
    data_urlsstring[]--Multiple S3 URLs to merge and split (alternative to data_url)
    train_rationumber0.8Fraction of data for the training set
    val_rationumber0.1Fraction of data for the validation set
    test_rationumber0.1Fraction of data for the test set
    stratify_columnstring--Column name for stratified splitting
    random_seedinteger42Random seed for reproducible splits

    Input validation

    • operation is always required; every other field is operation-dependent
    • CIF files must parse without syntax errors
    • refine_xrd requires at least one entry in phases
    • fit_xps requires at least one entry in peaks, each with atom, orbital, and binding_energy

    Was this page helpful?

    Loading...