Crate moyo

Crate moyo 

Source
Expand description

§moyo

moyo is a fast and robust crystal symmetry finder.

§Using moyo

Simply add the following to your Cargo.toml file:

[dependencies]
// TODO: replace the * with the latest version
moyo = "*"

§Examples

The basic usage of moyo is to create a moyo::base::Cell representing a crystal structure, and then create a moyo::MoyoDataset from the moyo::base::Cell. The moyo::MoyoDataset contains symmetry information of the input crystal structure: for example, the space group number, symmetry operations, and standardized cell.

Magnetic symmetry is also supported in moyo. Magnetic moments are represented by a struct implementing the moyo::base::MagneticMoment trait: for example, moyo::base::Collinear or moyo::base::NonCollinear. Magnetic cell is represented by a moyo::base::MagneticCell struct. The moyo::MoyoMagneticDataset contains magnetic symmetry information of the input magnetic cell: for example, the magnetic space-group type, magnetic symmetry operations, and standardized magnetic cell.

use nalgebra::{matrix, vector, Matrix3, Vector3};
use moyo::{MoyoDataset, MoyoMagneticDataset};
use moyo::base::{Cell, MagneticCell, AngleTolerance, Lattice, NonCollinear, RotationMagneticMomentAction};
use moyo::data::Setting;

let lattice = Lattice::new(matrix![
    4.603, 0.0, 0.0;
    0.0, 4.603, 0.0;
    0.0, 0.0, 2.969;
]);
let x_4f = 0.3046;
let positions = vec![
    Vector3::new(0.0, 0.0, 0.0),                // Ti(2a)
    Vector3::new(0.5, 0.5, 0.5),                // Ti(2a)
    Vector3::new(x_4f, x_4f, 0.0),              // O(4f)
    Vector3::new(-x_4f, -x_4f, 0.0),            // O(4f)
    Vector3::new(-x_4f + 0.5, x_4f + 0.5, 0.5), // O(4f)
    Vector3::new(x_4f + 0.5, -x_4f + 0.5, 0.5), // O(4f)
];
let numbers = vec![0, 0, 1, 1, 1, 1];
let cell = Cell::new(lattice.clone(), positions.clone(), numbers.clone());

let symprec = 1e-4;

let dataset = MoyoDataset::with_default(&cell, symprec).unwrap();
assert_eq!(dataset.number, 136);  // P4_2/mnm

let magnetic_moments = vec![
    NonCollinear(vector![0.0, 0.0, 0.7]),
    NonCollinear(vector![0.0, 0.0, -0.7]),
    NonCollinear(vector![0.0, 0.0, 0.0]),
    NonCollinear(vector![0.0, 0.0, 0.0]),
    NonCollinear(vector![0.0, 0.0, 0.0]),
    NonCollinear(vector![0.0, 0.0, 0.0]),
];
let magnetic_cell = MagneticCell::new(lattice, positions, numbers, magnetic_moments);

let action = RotationMagneticMomentAction::Axial;

let magnetic_dataset = MoyoMagneticDataset::with_default(&magnetic_cell, symprec, action).unwrap();
assert_eq!(magnetic_dataset.uni_number, 1159);  // BNS 136.499

§Features

  • Support most of the symmetry search functionality in Spglib
  • Primitive cell search
  • Symmetry operation search
  • Space-group type identification
  • Wyckoff position assignment
  • Crystal structure symmetrization
  • Magnetic space group support

Modules§

base
data
identify
math
search
utils

Structs§

MoyoDataset
A dataset containing symmetry information of the input crystal structure.
MoyoMagneticDataset