[docs]@dataclasses.dataclassclassFixedSphereConstraint:"""Attributes ---------- atom_id: int The id to use as the center of the sphere to fix. If None, the closed atom to the center will be picked. atom_type: str, optional The type of the atom to fix. E.g. if atom_type = H, atom_id = 1, the first hydrogen atom will be fixed. If None, the first atom will be fixed, no matter the type. radius: float """radius:floatatom_id:int|None=Noneatom_type:str|None=Nonedef__post_init__(self):ifself.atom_typeisnotNoneandself.atom_idisNone:raiseValueError("If atom_type is given, atom_id must be given as well.")
[docs]@dataclasses.dataclassclassFixedLayerConstraint:"""Class to fix a layer of atoms within a MD simulation Attributes ---------- upper_limit: float all atoms with a lower z pos will be fixed. lower_limit: float all atoms with a higher z pos will be fixed. """upper_limit:floatlower_limit:float
[docs]@dataclasses.dataclassclassFixedBondLengthConstraint:"""Fix the Bondlength between two atoms Attributes ---------- atom_id_1: int index of atom 1 atom_id_2: int index of atom 2 Returns ------- ase.constraints.FixBondLengths Constraint that fixes the bond Length between atom_id_1 and atom_id_2 """atom_id_1:intatom_id_2:int
[docs]@dataclasses.dataclassclassHookeanConstraint:"""Applies a Hookean (spring) force between pairs of atoms. Attributes ---------- atom_ids: list[tuple] List of atom indices that need to be constrained. Example: Fix only atoms in water with bonds if the IDs are as follows: H=0, H=1, O=2 Then the following atom_ids list is needed: [(0, 2), (1, 2)] k: float Hookes law (spring) constant to apply when distance exceeds threshold_length. Units of eV A^-2. # TODO: Allow different k for each pair rt: float The threshold length below which there is no force. # TODO: Allow different rt for each pair Returns ------- list[ase.constraints.Hookean] List of constraints that fixes the bond Length between the molecules in the atom_id tuples. """atom_ids:list[tuple]k:floatrt:float