ramannoodle.dataset.torch

Polarizability dataset for pytorch.

class ramannoodle.dataset.torch.PolarizabilityDataset(lattice, atomic_numbers, positions, polarizabilities)

Bases: Dataset[tuple[Tensor, Tensor, Tensor, Tensor]]

PyTorch dataset of atomic structures and polarizabilities.

Polarizabilities are standard scaled and flattened into 6-vectors containing the independent tensor components.

Parameters:
  • lattice (ndarray[Any, dtype[float64]]) – (Å) Array with shape (3,3).

  • atomic_numbers (list[int]) – List of length N where N is the number of atoms.

  • positions (ndarray[Any, dtype[float64]]) – (fractional) Array with shape (S,N,3) where S is the number of samples.

  • polarizabilities (ndarray[Any, dtype[float64]]) – Array with shape (S,3,3).

  • scale_mode – Supports "standard" (standard scaling), "stddev" (division by standard deviation), and "none" (no scaling).

scale_polarizabilities(mean, stddev)

Standard-scale polarizabilities given a mean and standard deviation.

This method may be used to scale validation or test datasets according to the mean and standard deviation of the training set, as is best practice.

Parameters:
Return type:

None

property atomic_numbers: list[int]

Get (a copy of) atomic numbers.

Returns:

List of length N where N is the number of atoms.

property mean_polarizability: ndarray[Any, dtype[float64]]

Get mean polarizability.

Returns:

Array with shape (3,3).

property num_atoms: int

Get number of atoms per sample.

property num_samples: int

Get number of samples.

property polarizabilities: ndarray[Any, dtype[float64]]

Get (a copy of) polarizabilities.

Returns:

Array with shape (S,3,3) where S is the number of samples.

property positions: ndarray[Any, dtype[float64]]

Get (a copy of) positions.

Returns:

Array with shape (S,N,3) where S is the number of samples and N is the number of atoms.

property scaled_polarizabilities: ndarray[Any, dtype[float64]]

Get (a copy of) scaled polarizabilities.

Returns:

Array with shape (S,6) where S is the number of samples.

property stddev_polarizability: ndarray[Any, dtype[float64]]

Get standard deviation of polarizabilities.

Returns:

Array with shape (3,3).

Submodules

ramannoodle.dataset.torch.utils module

Some torch utilities.

ramannoodle.dataset.torch.utils.get_tensor_size_error(name, tensor, desired_size)

Get ValueError indicating a PyTorch Tensor has the wrong size.

Return type:

ValueError

Parameters:
ramannoodle.dataset.torch.utils.polarizability_tensors_to_vectors(polarizability_tensors)

Convert polarizability tensors to vectors.

Parameters:

polarizability_tensors (Tensor) – Tensor with size [S,3,3] where S is the number of samples.

Return type:

Tensor

Returns:

Tensor with size [S,6].

ramannoodle.dataset.torch.utils.polarizability_vectors_to_tensors(polarizability_vectors)

Convert polarizability vectors to symmetric tensors.

Parameters:

polarizability_vectors (Tensor) – Tensor with size [S,6].

Return type:

Tensor

Returns:

Tensor with size [S,3,3].