CellOptimState

class torch_sim.optimizers.cell_filters.CellOptimState(*, reference_cell, positions, masses, cell, pbc, atomic_numbers, system_idx=None, _constraints=<factory>, _system_extras=<factory>, _atom_extras=<factory>, _rng=None, forces, energy, stress, cell_filter, cell_factor=<factory>, pressure=<factory>, hydrostatic_strain=False, constant_volume=False, frechet_method=None, cell_positions=<factory>, cell_forces=<factory>, cell_masses=<factory>)[source]

Bases: OptimState, DeformGradMixin

State class for cell optimization.

Parameters:
deform_grad_forces()[source]

Atomic forces in deformation gradient space, forces @ deform_grad.

Mirrors the transform ASE’s get_forces_unitcellfilter and get_forces_frechet apply to the atomic forces. Equals forces when the cell is undeformed relative to the reference cell.

Returns:

The transformed atomic forces, shape (n_atoms, 3)

Return type:

Tensor

frac_positions()[source]

Atomic positions in the reference cell frame, solve(deform_grad, r).

Returns:

The reference-frame positions, shape (n_atoms, 3)

Return type:

Tensor

positions_from_frac(frac_positions)[source]

Cartesian positions from reference-frame positions, frac @ deform_grad.mT.

Parameters:

frac_positions (Tensor) – Reference-frame positions, shape (n_atoms, 3)

Returns:

The Cartesian positions, shape (n_atoms, 3)

Return type:

Tensor