Scattering#

The scattering module contains classes for simulating and refining disordered structures.

class Refinement(sc, filename)[source]

Refinement.

Parameters:
scsupercell

Supercell for refinement.

filenamestr

Name of file.

Methods

save()

Save refinement data.

load()

Load refinement data.

load_intensity()

Load intensity data.

reset_intensity()

Reset intensity data.

crop()

Crop intensity data to new extents.

rebin()

Rebin intensity data to new bin sizes.

punch()

Punch intensity data.

initialize_refinement()

Initialize refinement.

magnetic_refinement()

Perform magnetic refinement.

crop(slices)[source]

Crop intensity data to new extents.

Parameters:
sliceslist of lists

Extents along each dimension.

initialize_refinement(temp=1, const=0)[source]

Initialize refinement.

Parameters:
tempfloat

Initial temperature.

constfloat

Cooling constant.

load(filename)[source]

Load refinement data.

Parameters:
filenamestr

Name of HDF5 file.

load_intensity(filename)[source]

Load intensity data.

Parameters:
filenamestr

Name of file.

magnetic_refinement(cycles, sigma, batch=1)[source]

Perform magnetic refinement.

Parameters:
cyclesint

Number of Monte Carlo cycles.

sigmalist

Pixel size of filter along each dimension.

punch(radii, centering='P', outlier=1.5, ptype='cuboid')[source]

Punch intensity data.

Centering

Condition

P

None

I

h + k + l = 2n

F

h + k = 2n, k + l = 2n, l + h = 2n

C

h + k = 2n

A

k + l = 2n

B

l + h = 2n

R(obv)

k - h + l = 3n

R(rev)

h - k + l = 3n

H

h - k = 3n

D

h + k + l = 3n

Parameters:
radiilist, int

Punch radii along each dimension.

centeringstr, optional

Reflection condition lattice centering. The default is 'P'.

outlierfloat, optional

Multiplier of interquartile range. The default is 1.5.

ptypestr, optional

Punch type, either 'cuboid' or 'ellipsoid'. The default is 'cuboid'.

rebin(sizes)[source]

Rebin intensity data to new bin sizes.

Parameters:
sizeslist, int

Bins along each dimension.

reset_intensity()[source]

Reset intensity data.

save(filename)[source]

Save refinement data.

Parameters:
filenamestr

Name of HDF5 file.

class Simulation(sc, filename=None, extend=False)[source]

Simulation.

Parameters:
scsupercell

Supercell for simulation.

extendbool, optional

Extend beyond one unit cell for neighbor bonds. Defualt is False.

Methods

save()

Save simulation data.

load()

Load simulation data.

get_active_bonds()

Active bonds.

set_active_bonds():

Update active bonds.

get_bond_lengths()

Bond lengths.

get_charge_charge_matrix()

Charge-charge interaction matrix.

get_charge_dipole_matrix()

Charge-dipole interaction matrix.

get_dipole_dipole_matrix()

Dipole-dipole interaction matrix.

get_easy_axes_matrices()

Easy axes matrices.

get_magnetic_exchange_interaction_matrices()

Magnetic exchange interaction matrices.

set_magnetic_exchange_interaction_matrices()

Update magnetic exchange interaction matrices.

get_magnetic_single_ion_anisotropy_matrices()

Magnetocrystalline anisotropy matrices.

set_magnetic_single_ion_anisotropy_matrices()

Update magnetocrystalline anisotropy matrices.

get_magnetic_g_tensor_matrices()

g-tensor matrices.

set_magnetic_g_tensor_matrices()

Update g-tensor matrices.

get_magnetic_field()

External magnetic field vector.

set_magnetic_field()

Update external magnetic field vector.

get_magnetic_dipole_dipole_coupling_strength()

Magnetic dipole-dipole coupling strength.

set_magnetic_dipole_dipole_coupling_strength()

Update magnetic dipole-dipole coupling strength.

initialize_parallel_tempering()

Initialize parallel tempering simulation.

magnetic_energy()

Magnetic interaction energy.

magnetic_dipole_dipole_interaction_energy()

Magnetic dipole-dipole interaction energy.

magnetic_simulation()

Perform magnetic Heisenberg simulation.

get_active_bonds()[source]

Active bonds.

Returns:
active1d array, bool

The bonds that are active.

get_bond_lengths()[source]

Bond lengths.

Returns:
d1d array

The length of the bonds.

get_bond_vectors()[source]

Bond vectors.

Returns:
dx, dy, dz1d array

The bond separation vectors.

get_charge_charge_matrix()[source]

Charge-charge interaction matrix.

Returns:
Qij2d array

Matrix for calculating charge-charge interactions between charges.

get_charge_dipole_matrix()[source]

Charge-dipole interaction matrix.

Returns:
Qijk3d array

Matrix for calculating charge-dipole interactions between charges and moments.

get_dipole_dipole_matrix()[source]

Dipole-dipole interaction matrix.

Returns:
Qijkl4d array

Matrix for calculating dipole-dipole interactions between moments.

get_displacive_distortion_constants()[source]

Displacive distortion constants.

Returns:
eta2d array

Distortion constants.

get_displacive_stiffness_constants()[source]

Displacive stiffness constants.

Returns:
K1d array

Stiffness constants.

get_easy_axes_matrices()[source]

Easy axes matrices.

Returns:
U3d array

Axes matrices.

get_magnetic_dipole_dipole_coupling_strength()[source]

Magnetic dipole-dipole coupling strength.

Returns:
constfloat

Strength of dipole-dipole interaction.

get_magnetic_exchange_interaction_matrices()[source]

Magnetic exchange interaction matrices.

Returns:
J3d array

Interaction matrices.

get_magnetic_field()[source]

External magnetic field vector.

Returns:
B1d array

Fied vector.

get_magnetic_g_tensor_matrices()[source]

g-tensor matrices.

Returns:
g3d array

g-tensors.

get_magnetic_single_ion_anisotropy_matrices()[source]

Magnetocrystalline anisotropy matrices.

Returns:
K3d array

Anisotropy matrices.

get_occupational_interaction_constants()[source]

Occupational interaction constants.

Returns:
J1d array

Interaction constants.

get_occupational_single_site_constant()[source]

Single site constant.

Returns:
H1d array

Site constant.

initialize_parallel_tempering(T0, T1, replicas=1, space='log2')[source]

Initialize parallel tempering simulation.

Parameters:
T0float

Start temperature.

T1float

End temperature.

replicasint, optional

Number of replica simulations. The default is 1.

spacestr, optional

Temperature spacing among 'log2'`, ``'log10'`, and ``'linear'`. The default is ``'log2'.

load(filename)[source]

Load simulation data.

Parameters:
filenamestr

Name of HDF5 file.

magnetic_dipole_dipole_interaction_energy()[source]

Magnetic dipole-dipole interaction energy.

Returns:
E4d array

Magnetic dipole-dipole interaction energies.

magnetic_energy()[source]

Magnetic interaction energy.

Returns:
E6d array

Magnetic interaction energies.

magnetic_simulation(N, batch=1, cluster=False)[source]

Perform magnetic Heisenberg simulation.

Parameters:
Nint

Number of Monte Carlo cycles.

Returns:
H1d array

Hamiltonian of each replica.

T1d array

Temperature of each replica.

save(filename)[source]

Save simulation data.

Parameters:
filenamestr

Name of HDF5 file.

set_active_bonds(active)[source]

Update active bonds.

Parameters:
active1d array, bool

The bonds that are active.

set_displacive_distortion_constants(eta)[source]

Update displacive distortion constants.

Parameters:
eta2d array

Distortion constants.

set_displacive_stiffness_constants(K)[source]

Update displacive stiffness constants.

Parameters:
K1d array

Stiffness matrices.

set_magnetic_dipole_dipole_coupling_strength(const)[source]

Update magnetic dipole-dipole coupling strength.

Parameters:
constfloat

Strength of dipole-dipole interaction.

set_magnetic_exchange_interaction_matrices(J)[source]

Update magnetic exchange interaction matrices.

Parameters:
J3d array

Interaction matrices.

set_magnetic_field(B)[source]

Update external magnetic field vector.

Parameters:
B1d array

Fied vector.

set_magnetic_g_tensor_matrices(g)[source]

Update g-tensor matrices.

Parameters:
g3d array

g-tensors.

set_magnetic_single_ion_anisotropy_matrices(K)[source]

Update magnetocrystalline anisotropy matrices.

Parameters:
K3d array

Anisotropy matrices.

set_occupational_interaction_constants(J)[source]

Update occupational interaction constants.

Parameters:
J1d array

Interaction constants.

set_occupational_single_site_constant(H)[source]

Update single site constant.

Parameters:
H1d array

Site constant.

structural_energy()[source]

Structural interaction energy.

Returns:
E6d array

Structural interaction energies.

structural_simulation(N, batch=1)[source]

Perform structural occupational/displacive simulation.

Parameters:
Nint

Number of Monte Carlo cycles.

Returns:
H1d array

Hamiltonian of each replica.

T1d array

Temperature of each replica.