PAOFLOW.pyskeaf.geometry#

Geometry helpers — reciprocal-lattice volumes and field-direction setup.

Mirrors the Fortran utility code in skeaf_v1p3p0_r149.F90:

  • unit_cell_volume reproduces the unitcellvolume = |det(plr)| computation at line 1056.

  • set_field_angle reproduces the subroutine psetangle (lines 3071–3129), which converts an hvd selector (‘a’, ‘b’, ‘c’, ‘n’, ‘r’) into spherical angles (theta, phi) of the magnetic field axis.

Conventions#

  • All angles are in radians (the Fortran stores degrees in user input and converts to radians internally; we standardise on radians).

  • recip is a (3, 3) array with recip[i] the i-th reciprocal lattice vector in Cartesian Å^-1 with the 2π factor (i.e. the plr* form).

  • The H-vector spherical convention matches Fortran psetangle:

    theta = atan2(v_y, v_x) # azimuth in xy-plane phi = acos(v_z / \(|v|\)) # polar angle from +z

Attributes#

Functions#

unit_cell_volume(recip)

Return the BZ (reciprocal unit cell) volume |det(recip)|.

set_field_angle(recip, hvd[, theta, phi])

Compute the (theta, phi) of the magnetic-field axis from an hvd flag.

k_axis_lengths(recip)

Return the three reciprocal-lattice vector lengths |b_i|.

k_axis_angles(recip)

Return the inter-axis angles (angle_xy, angle_xz, angle_yz) in radians.

Module Contents#

PAOFLOW.pyskeaf.geometry.HvdLiteral[source]#
PAOFLOW.pyskeaf.geometry.unit_cell_volume(recip)[source]#

Return the BZ (reciprocal unit cell) volume |det(recip)|.

Parameters:

recip (ndarray, shape (3, 3)) – Reciprocal lattice vectors as rows (Å^-1, with 2π factor).

PAOFLOW.pyskeaf.geometry.set_field_angle(recip, hvd, theta=0.0, phi=0.0)[source]#

Compute the (theta, phi) of the magnetic-field axis from an hvd flag.

Reproduces psetangle (skeaf_v1p3p0_r149.F90 lines 3071–3129).

Parameters:
  • recip (ndarray, shape (3, 3)) – Reciprocal lattice vectors as rows (Å^-1, with 2π factor). Only used for hvd in {'a', 'b', 'c'}.

  • hvd ({'a', 'b', 'c', 'n', 'r'}) –

    Field-direction selector:

    • 'a', 'b', 'c' — align field with reciprocal vector 0, 1 or 2 respectively.

    • 'n' — return the user-supplied theta, phi unchanged (caller has already obtained them from input).

    • 'r' — auto-rotation; this routine returns (theta, phi) unchanged for the caller to set in a sweep.

  • theta (float, optional) – Used for hvd in {'n', 'r'}; angles in radians.

  • phi (float, optional) – Used for hvd in {'n', 'r'}; angles in radians.

Returns:

(theta_rad, phi_rad)

Return type:

tuple of float

PAOFLOW.pyskeaf.geometry.k_axis_lengths(recip)[source]#

Return the three reciprocal-lattice vector lengths |b_i|.

PAOFLOW.pyskeaf.geometry.k_axis_angles(recip)[source]#

Return the inter-axis angles (angle_xy, angle_xz, angle_yz) in radians.

Mirrors anglelatxy, anglelatxz, anglelatyz from preadbxsf (lines ~3060).