Workflow - asche1/PyCrystalField GitHub Wiki

PyCrystalField workflow

workflow_image

There are three basic operations that PyCrystalField carries out: building a CEF Hamiltonian, fitting a CEF Hamiltonian, and calculating observables based on the CEF Hamiltonian.


Building a CEF Hamiltonian

PyCrystalField can build a crystal field Hamiltonian in two ways: directly define CEF parameters, or build a point charge model.

Method A: Defining CEF Parameters

There are two ways to build a CEF Hamiltonian from CEF parameters:

  1. Call CFLevels.Bdict(ion, Bdict) (recommended method)
    ion is a string (e.g., 'Nd3+')
    Bdict is a dictionary with labels Bnm and values of CEF parameters, e.g.: {'B20': 0.45, 'B44', -0.034, ...}

  2. Call CFLevels(StevensOperators, Parameters)
    StevensOperators is a list of operators generated by StevensOp(J,n,m), and Parameters are the CEF parameters.

Note there is also a third way CFLevels.Hamiltonian(H), where one provides a Hamiltonian matrix H as an input. This method is only meant for use when building CEF Hamiltonians within fit functions (it reduces the number of operations).

Method B: Building a point charge model

PyCrystalField can construct a point charge model two ways:

  1. Import structure from a .cif file using importCIF(ciffile, mag_ion) (recommended method)
    One must specify the cif file and the name of the central ion, and PyCrystalField automatically aligns the axes along the symmetry directions to minimize the number of CEF parameters. One can also specify custom axes, which basis to calculate, the number of nearest neighbors, etc.

  2. Create an instance of Ligands(ion, ligandPos, latticeParams, ionPos), and then use the Ligands.PointChargeModel function. [add hyperlinks] ``


Fitting a CEF Hamiltonian

The CFLevels.fitdata function is a wrapper around scipy's minimize function. The user must provide a cost function to minimize which has a CFLevels object as its first argument, and specify which variables in the cost function are to be fit.

Ligands.FitCharges is a similar function which is set up to fit effective charges of a point charge model.


Calculating observables

The CFLevels class has many functions which can calculate observable quantities:

function description
CFLevels.neutronSpectrum calculates the energy-dependent (Q-independent) neutron spectrum
CFLevels.normalizedNeutronSpectrum calculates the neutron spectrum without the k_i/k_f correction (common for time-of-flight measurements).
CFLevels.neutronSpectrum2D computes the Q and E dependent neutron spectrum
CFLevels.magnetization compute the directional magnetization for a given temperature and applied magnetic field
CFLevels.susceptibility compute magnetic susceptibility (single-crystal or powder-averaged) for the ion
CFLevels.gtensor returns the g-tensor of the ion computed numerically

The CFLevels class also has some functions which print key quantities of interest:

function description
CFLevels.printEigenvectors prints the eigenvalues and eigenvectors of a CEF Hamiltonian
CFLevels.printLaTexEigenvectors prints the eigenvalues and eigenvectors in the format of a LaTex ruledtabular table
CFLevels.gsExpectation prints <J_x>, <J_y>, and <J_z> for the ground state
⚠️ **GitHub.com Fallback** ⚠️