Skip to content

Improve docstring of std_lattice of SpglibDataset#603

Merged
atztogo merged 1 commit intospglib:developfrom
adrybakov:patch-1
Nov 18, 2025
Merged

Improve docstring of std_lattice of SpglibDataset#603
atztogo merged 1 commit intospglib:developfrom
adrybakov:patch-1

Conversation

@adrybakov
Copy link
Copy Markdown
Contributor

@adrybakov adrybakov commented Aug 20, 2025

Hello!

To my understanding of the spglib's documentation SpglibDataset.std_lattice is an idealised standardised lattice.

Here is an example to illustrate it

Code example

import spglib
import numpy as np

print(f"spglib version: {spglib.__version__}\n")

# Example structure
basis_vectors = np.diag([1, 1, 1])
atomic_points = [[0, 0, 0]]
types = [1]

# Rotate around z axis
theta = 42/180 * np.pi
R = np.array(
    [
        [np.cos(theta), -np.sin(theta), 0],
        [np.sin(theta), np.cos(theta), 0],
        [0, 0, 1],
    ]
)
basis_vectors = basis_vectors @ R.T

# Get a dataset
dataset = spglib.get_symmetry_dataset((basis_vectors, atomic_points, types))

# Print some info about the basis vectors
print(f"original basis vectors\n\n{basis_vectors}\n")
print(f"dataset.std_lattice\n\n{dataset.std_lattice}\n")

Code output

spglib version: 2.6.0

original basis vectors

[[ 0.74314483  0.66913061  0.        ]
 [-0.66913061  0.74314483  0.        ]
 [ 0.          0.          1.        ]]

dataset.std_lattice

[[1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]

Visualisation of two cells from code example

wulfric-plot

As one can see the dataset.std_lattice is an idealised one, according to docs.

Proposed changes make this fact more clear in the docs.

Best,
Andrey

@atztogo atztogo merged commit 208d2b5 into spglib:develop Nov 18, 2025
12 of 14 checks passed
@atztogo
Copy link
Copy Markdown
Collaborator

atztogo commented Nov 18, 2025

@adrybakov, yes, it is true. Thanks!

@adrybakov adrybakov deleted the patch-1 branch November 18, 2025 10:39
@adrybakov adrybakov changed the title Improve docstring of for std_lattice of SpglibDataset Improve docstring of std_lattice of SpglibDataset Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants