25#include "neml2/models/crystallography/crystallography.h"
27#include "neml2/tensors/Transformable.h"
28#include "neml2/tensors/tensors.h"
30using namespace torch::indexing;
34namespace crystallography
36namespace crystal_symmetry_operators
41 return torch::tensor({{
o,
z,
z,
z},
55 return torch::tensor({{
o,
z,
z,
z},
71cubic(
const torch::TensorOptions & options)
73 return torch::tensor({{
o,
z,
z,
z}, {
h,
h,
h,
h}, {-
h,
h,
h,
h}, {
h, -
h,
h,
h},
74 {
h,
h, -
h,
h}, {-
h, -
h, -
h,
h}, {
h, -
h, -
h,
h}, {-
h, -
h,
h,
h},
75 {-
h,
h, -
h,
h}, {
z,
z,
o,
z}, {
z,
z,
z,
o}, {
z,
o,
z,
z},
76 {
z, -
a,
z,
a}, {
z,
a,
z,
a}, {
a,
z,
a,
z}, {
a,
z, -
a,
z},
77 {
z,
z, -
a,
a}, {
a,
a,
z,
z}, {
a, -
a,
z,
z}, {
z,
z,
a,
a},
78 {
z, -
a,
a,
z}, {
a,
z,
z, -
a}, {
z,
a,
a,
z}, {
a,
z,
z,
a}},
155 std::vector<torch::Tensor>
unique{torch::Tensor(options.batch_index({0}))};
157 for (
TorchSize i = 1;
i < options.batch_sizes()[0];
i++)
159 auto vi = options.batch_index({
i});
161 auto same = [](
const torch::Tensor & a,
const torch::Tensor & b)
162 {
return torch::any(torch::all(torch::isclose(a, b), 1)); };
165 unique.push_back(torch::Tensor(
vi));
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
A batched quaternion.
Definition Quaternion.h:44
A basic R2.
Definition R2.h:42
The (logical) vector.
Definition Vec.h:42
constexpr Real o
Definition crystallography.h:39
constexpr Real z
Definition crystallography.h:40
constexpr Real a
Definition crystallography.h:36
const torch::Tensor hexagonal(const torch::TensorOptions &options)
hexagonal symmetry operators
Definition crystallography.cxx:53
constexpr Real h
Definition crystallography.h:38
constexpr Real b
Definition crystallography.h:37
const torch::Tensor tetragonal(const torch::TensorOptions &options)
tetragonal symmetry operators
Definition crystallography.cxx:39
const torch::Tensor cubic(const torch::TensorOptions &options)
cubic symmetry operators
Definition crystallography.cxx:71
Vec unique_bidirectional(const R2 &ops, const Vec &inp)
Helper to return all symmetrically-equivalent directions from a cartesian vector.
Definition crystallography.cxx:147
R2 symmetry_operations_from_orbifold(std::string orbifold, const torch::TensorOptions &options)
Helper function to return the symmetry operators given the Orbifold notation.
Definition crystallography.cxx:84
Definition CrossRef.cxx:32
void neml_assert_dbg(bool assertion, Args &&... args)
Definition error.h:85
R2 transform_from_quaternion(const Quaternion &q)
Construct from quaternions, useful for comparison to old NEML.
Definition Transformable.cxx:33