Source code for scm.input_classes.drivers.symmetrize

from __future__ import annotations
from pathlib import Path
from typing import Iterable, Literal, Sequence
from scm.pisa.block import DriverBlock,EngineBlock,FixedBlock,FreeBlock,InputBlock
from scm.pisa.key import BoolKey,FloatKey,FloatListKey,IntKey,IntListKey,MultipleChoiceKey,PathStringKey,StringKey,BoolType

[docs]class Symmetrize(DriverBlock): r""" :ivar LoadSystem: Block that controls reading the chemical system from a KF file instead of the [System] block. :vartype LoadSystem: Symmetrize._LoadSystem :ivar Symmetry: Specifying details about the details of symmetry detection and usage. :vartype Symmetry: Symmetrize._Symmetry :ivar System: Specification of the chemical system. For some applications more than one system may be present in the input. In this case, all systems except one must have a non-empty string ID specified after the System keyword. The system without an ID is considered the main one. :vartype System: Symmetrize._System """
[docs] class _LoadSystem(FixedBlock): r""" Block that controls reading the chemical system from a KF file instead of the [System] block. :ivar File: The path of the KF file from which to load the system. It may also be the results directory containing it. :vartype File: str | Path | StringKey :ivar Section: The section on the KF file from which to load the system. :vartype Section: str | StringKey """ def __post_init__(self): self.File: str | Path | StringKey = PathStringKey(name='File', comment='The path of the KF file from which to load the system. It may also be the results directory containing it.', ispath=True) self.Section: str | StringKey = StringKey(name='Section', comment='The section on the KF file from which to load the system.', default='Molecule')
[docs] class _Symmetry(FixedBlock): r""" Specifying details about the details of symmetry detection and usage. :ivar SymmetrizeTolerance: Tolerance used to detect symmetry in case symmetrize is requested. :vartype SymmetrizeTolerance: float | FloatKey :ivar Tolerance: Tolerance used to detect symmetry in the system. :vartype Tolerance: float | FloatKey """ def __post_init__(self): self.SymmetrizeTolerance: float | FloatKey = FloatKey(name='SymmetrizeTolerance', comment='Tolerance used to detect symmetry in case symmetrize is requested.', default=0.05) self.Tolerance: float | FloatKey = FloatKey(name='Tolerance', comment='Tolerance used to detect symmetry in the system.', default=1e-07)
[docs] class _System(FixedBlock): r""" Specification of the chemical system. For some applications more than one system may be present in the input. In this case, all systems except one must have a non-empty string ID specified after the System keyword. The system without an ID is considered the main one. :ivar AllowCloseAtoms: No longer functional. Just here for backwards compatibility. :vartype AllowCloseAtoms: BoolType | BoolKey :ivar Charge: The system's total charge in atomic units. :vartype Charge: float | FloatKey :ivar FractionalCoords: Whether the atomic coordinates in the Atoms block are given in fractional coordinates of the lattice vectors. Requires the presence of the Lattice block. :vartype FractionalCoords: BoolType | BoolKey :ivar GeometryFile: Read the geometry from a file (instead of from Atoms and Lattice blocks). Supported formats: .xyz :vartype GeometryFile: str | Path | StringKey :ivar GuessBonds: Equivalent to 'Modify%GuessBonds'. Please update input file to use 'Modify' block instead. :vartype GuessBonds: BoolType | BoolKey :ivar LatticeStrain: Equivalent to 'Modify%LatticeStrain'. Please update input file to use 'Modify' block instead. :vartype LatticeStrain: Iterable[float] | FloatListKey :ivar MapAtomsToUnitCell: Equivalent to 'Modify%MapAtomsToUnitCell'. Please update input file to use 'Modify' block instead. :vartype MapAtomsToUnitCell: BoolType | BoolKey :ivar PerturbCoordinates: Equivalent to 'Modify%PerturbCoordinates'. Please update input file to use 'Modify' block instead. :vartype PerturbCoordinates: float | FloatKey :ivar PerturbLattice: Equivalent to 'Modify%PerturbLattice'. Please update input file to use 'Modify' block instead. :vartype PerturbLattice: float | FloatKey :ivar ShiftCoordinates: Equivalent to 'Modify%Translate', but in the unit of bohr by default. Please update input file to use 'Modify' block instead. :vartype ShiftCoordinates: Iterable[float] | FloatListKey :ivar SuperCell: Equivalent to 'Modify%SuperCell'. Please update input file to use 'Modify' block instead. :vartype SuperCell: Iterable[int] | IntListKey :ivar SuperCellTrafo: Equivalent to 'Modify%SuperCellTrafo'. Please update input file to use 'Modify' block instead. :vartype SuperCellTrafo: Iterable[int] | IntListKey :ivar Symmetrize: Equivalent to 'Modify%Symmetrize'. Please update input file to use 'Modify' block instead. :vartype Symmetrize: BoolType | BoolKey :ivar Atoms: The atom types and coordinates. Unit can be specified in the header. Default unit is Angstrom. :vartype Atoms: str | Sequence[str] | FreeBlock :ivar BondOrders: Defined bond orders. Each line should contain two atom indices, followed by the bond order (1, 1.5, 2, 3 for single, aromatic, double and triple bonds) and (optionally) the cell shifts for periodic systems. May be used by MM engines and for defining constraints. If the system is periodic and none of the bonds have the cell shift defined then AMS will attempt to determine them following the minimum image convention. :vartype BondOrders: str | Sequence[str] | FreeBlock :ivar ElectrostaticEmbedding: Container for electrostatic embedding options, which can be combined. :vartype ElectrostaticEmbedding: Symmetrize._System._ElectrostaticEmbedding :ivar Lattice: Up to three lattice vectors. Unit can be specified in the header. Default unit is Angstrom. :vartype Lattice: str | Sequence[str] | FreeBlock :ivar Modify: Modifications to make to the chemical system after construction. This block is read like a script and the modifications applied top to bottom. :vartype Modify: Symmetrize._System._Modify """
[docs] class _Atoms(FreeBlock): r""" The atom types and coordinates. Unit can be specified in the header. Default unit is Angstrom. """ def __post_init__(self): pass
[docs] class _BondOrders(FreeBlock): r""" Defined bond orders. Each line should contain two atom indices, followed by the bond order (1, 1.5, 2, 3 for single, aromatic, double and triple bonds) and (optionally) the cell shifts for periodic systems. May be used by MM engines and for defining constraints. If the system is periodic and none of the bonds have the cell shift defined then AMS will attempt to determine them following the minimum image convention. """ def __post_init__(self): pass
[docs] class _ElectrostaticEmbedding(FixedBlock): r""" Container for electrostatic embedding options, which can be combined. :ivar ElectricField: External homogeneous electric field with three Cartesian components: ex, ey, ez, the default unit being V/Å. In atomic units: Hartree/(e bohr) = 51.422 V/Angstrom; the relation to SI units is: 1 Hartree/(e bohr) = 5.14 ... e11 V/m. Supported by the engines adf, band, dftb and mopac. For periodic systems the field may only have nonzero components orthogonal to the direction(s) of periodicity (i.e. for 1D periodic system the x-component of the electric field should be zero, while for 2D periodic systems both the x and y components should be zero. This options cannot be used for 3D periodic systems. :vartype ElectricField: Iterable[float] | FloatListKey :ivar MultipolePotential: External point charges (and dipoles). :vartype MultipolePotential: Symmetrize._System._ElectrostaticEmbedding._MultipolePotential """
[docs] class _MultipolePotential(FixedBlock): r""" External point charges (and dipoles). :ivar ChargeModel: A multipole may be represented by a point (with a singular potential at its location) or by a spherical Gaussian distribution. :vartype ChargeModel: Literal["Point", "Gaussian"] :ivar ChargeWidth: The width parameter in a.u. in case a Gaussian charge model is chosen. A negative value means that the width will be chosen automatically. :vartype ChargeWidth: float | FloatKey :ivar Coordinates: Positions and values of the multipoles, one per line. Each line has the following format: x y z q, or x y z q µx µy µz. Here x, y, z are the coordinates in Å, q is the charge (in atomic units of charge) and µx, µy, µz are the (optional) dipole moment components (in atomic units, i.e. e*Bohr). Periodic systems are not supported. :vartype Coordinates: str | Sequence[str] | FreeBlock """
[docs] class _Coordinates(FreeBlock): r""" Positions and values of the multipoles, one per line. Each line has the following format: x y z q, or x y z q µx µy µz. Here x, y, z are the coordinates in Å, q is the charge (in atomic units of charge) and µx, µy, µz are the (optional) dipole moment components (in atomic units, i.e. e*Bohr). Periodic systems are not supported. """ def __post_init__(self): pass
def __post_init__(self): self.ChargeModel: Literal["Point", "Gaussian"] = MultipleChoiceKey(name='ChargeModel', comment='A multipole may be represented by a point (with a singular potential at its location) or by a spherical Gaussian distribution.', default='Point', choices=['Point', 'Gaussian']) self.ChargeWidth: float | FloatKey = FloatKey(name='ChargeWidth', comment='The width parameter in a.u. in case a Gaussian charge model is chosen. A negative value means that the width will be chosen automatically.', default=-1.0) self.Coordinates: str | Sequence[str] | FreeBlock = self._Coordinates(name='Coordinates', comment='Positions and values of the multipoles, one per line. Each line has the following format:\n\nx y z q, or\nx y z q µx µy µz.\n\nHere x, y, z are the coordinates in Å, q is the charge (in atomic units of charge) and µx, µy, µz are the (optional) dipole moment components (in atomic units, i.e. e*Bohr). \n\nPeriodic systems are not supported.', header=True)
def __post_init__(self): self.ElectricField: Iterable[float] | FloatListKey = FloatListKey(name='ElectricField', comment='External homogeneous electric field with three Cartesian components: ex, ey, ez, the default unit being V/Å.\n\nIn atomic units: Hartree/(e bohr) = 51.422 V/Angstrom; the relation to SI units is: 1 Hartree/(e bohr) = 5.14 ... e11 V/m.\n\nSupported by the engines adf, band, dftb and mopac.\n\nFor periodic systems the field may only have nonzero components orthogonal to the direction(s) of periodicity (i.e. for 1D periodic system the x-component of the electric field should be zero, while for 2D periodic systems both the x and y components should be zero. This options cannot be used for 3D periodic systems.', unit='V/Angstrom') self.MultipolePotential: Symmetrize._System._ElectrostaticEmbedding._MultipolePotential = self._MultipolePotential(name='MultipolePotential', comment='External point charges (and dipoles).')
[docs] class _Lattice(FreeBlock): r""" Up to three lattice vectors. Unit can be specified in the header. Default unit is Angstrom. """ def __post_init__(self): pass
[docs] class _Modify(FixedBlock): r""" Modifications to make to the chemical system after construction. This block is read like a script and the modifications applied top to bottom. :ivar EnableAtomicProperties: Enables an atomic property group. This is only necessary if you want a group enabled, but no atom in the input is using any property from that group. :vartype EnableAtomicProperties: Literal["gui", "adf", "band", "forcefield", "dftb", "reaxff", "qe"] :ivar GuessBonds: Guesses bonds based on the atomic elements and the geometry. Keeps existing bonds. :vartype GuessBonds: BoolType | BoolKey :ivar LatticeStrain: Deform the input system by the specified strain. The strain elements are in Voigt notation, so one should specify 6 numbers for 3D periodic system (order: xx,yy,zz,yz,xz,xy), 3 numbers for 2D periodic systems (order: xx,yy,xy) or 1 number for 1D periodic systems. :vartype LatticeStrain: Iterable[float] | FloatListKey :ivar MapAtomsToUnitCell: For periodic systems the atoms will be moved to the central unit cell where all their fractional coordinates are in the range [start_range,start_range+1). No mapping will take place along non-periodic directions. If just a single number is given, it corresponds to start_range. If multiple numbers are given, they should match the number of lattice vectors and will be used as start ranges along the individual lattice vectors. If no number is given at all, the mapping will be done to the [-0.5:0.5) cell. :vartype MapAtomsToUnitCell: Iterable[float] | FloatListKey :ivar PerturbCoordinates: Perturb the atomic coordinates by adding random numbers between [-PerturbCoordinates,PerturbCoordinates] to each Cartesian component. This can be useful if you want to break the symmetry of your system (e.g. for a geometry optimization). :vartype PerturbCoordinates: float | FloatKey :ivar PerturbLattice: Perturb the lattice vectors by applying random strain with matrix elements between [-PerturbLattice,PerturbLattice]. This can be useful if you want to deviate from an ideal symmetric geometry, for example if you look for a phase change due to high pressure. :vartype PerturbLattice: float | FloatKey :ivar SuperCell: Create a supercell of the input system (only possible for periodic systems). The integer numbers represent the diagonal elements of the supercell transformation; you should specify as many numbers as lattice vectors (i.e. 1 number for 1D, 2 numbers for 2D and 3 numbers for 3D periodic systems). :vartype SuperCell: Iterable[int] | IntListKey :ivar SuperCellTrafo: Create a supercell of the input system (only possible for periodic systems) :math:`\vec{a}_i' = \sum_j T_{ij} \vec{a}_j`. The integer numbers represent the supercell transformation :math:`T_{ij}`: 1 number for 1D PBC, 4 numbers for 2D PBC corresponding to a 2x2 matrix (order: (1,1),(1,2),(2,1),(2,2)) and 9 numbers for 3D PBC corresponding to a 3x3 matrix (order: (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)). :vartype SuperCellTrafo: Iterable[int] | IntListKey :ivar Symmetrize: Symmetrizes the atomic coordinates to machine precision and rototranslates the molecule to the AMS standard orientation. This allows optimal use of the system's symmetry for calculations with the AMS driver and its engines. :vartype Symmetrize: BoolType | BoolKey :ivar Translate: Translate all atoms by a vector. :vartype Translate: Iterable[float] | FloatListKey """ def __post_init__(self): self.EnableAtomicProperties: Literal["gui", "adf", "band", "forcefield", "dftb", "reaxff", "qe"] = MultipleChoiceKey(name='EnableAtomicProperties', comment='Enables an atomic property group. This is only necessary if you want a group enabled, but no atom in the input is using any property from that group.', unique=False, choices=['gui', 'adf', 'band', 'forcefield', 'dftb', 'reaxff', 'qe']) self.GuessBonds: BoolType | BoolKey = BoolKey(name='GuessBonds', comment='Guesses bonds based on the atomic elements and the geometry. Keeps existing bonds.', unique=False) self.LatticeStrain: Iterable[float] | FloatListKey = FloatListKey(name='LatticeStrain', comment='Deform the input system by the specified strain. The strain elements are in Voigt notation, so one should specify 6 numbers for 3D periodic system (order: xx,yy,zz,yz,xz,xy), 3 numbers for 2D periodic systems (order: xx,yy,xy) or 1 number for 1D periodic systems.', unique=False) self.MapAtomsToUnitCell: Iterable[float] | FloatListKey = FloatListKey(name='MapAtomsToUnitCell', comment='For periodic systems the atoms will be moved to the central unit cell where all their fractional coordinates are in the range [start_range,start_range+1). No mapping will take place along non-periodic directions. If just a single number is given, it corresponds to start_range. If multiple numbers are given, they should match the number of lattice vectors and will be used as start ranges along the individual lattice vectors. If no number is given at all, the mapping will be done to the [-0.5:0.5) cell.', unique=False) self.PerturbCoordinates: float | FloatKey = FloatKey(name='PerturbCoordinates', comment='Perturb the atomic coordinates by adding random numbers between [-PerturbCoordinates,PerturbCoordinates] to each Cartesian component. This can be useful if you want to break the symmetry of your system (e.g. for a geometry optimization).', unique=False, unit='angstrom') self.PerturbLattice: float | FloatKey = FloatKey(name='PerturbLattice', comment='Perturb the lattice vectors by applying random strain with matrix elements between [-PerturbLattice,PerturbLattice]. This can be useful if you want to deviate from an ideal symmetric geometry, for example if you look for a phase change due to high pressure.', unique=False) self.SuperCell: Iterable[int] | IntListKey = IntListKey(name='SuperCell', comment='Create a supercell of the input system (only possible for periodic systems). The integer numbers represent the diagonal elements of the supercell transformation; you should specify as many numbers as lattice vectors (i.e. 1 number for 1D, 2 numbers for 2D and 3 numbers for 3D periodic systems).', unique=False) self.SuperCellTrafo: Iterable[int] | IntListKey = IntListKey(name='SuperCellTrafo', comment="Create a supercell of the input system (only possible for periodic systems) :math:`\\vec{a}_i' = \\sum_j T_{ij} \\vec{a}_j`. The integer numbers represent the supercell transformation :math:`T_{ij}`: 1 number for 1D PBC, 4 numbers for 2D PBC corresponding to a 2x2 matrix (order: (1,1),(1,2),(2,1),(2,2)) and 9 numbers for 3D PBC corresponding to a 3x3 matrix (order: (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)).", unique=False) self.Symmetrize: BoolType | BoolKey = BoolKey(name='Symmetrize', comment="Symmetrizes the atomic coordinates to machine precision and rototranslates the molecule to the AMS standard orientation. This allows optimal use of the system's symmetry for calculations with the AMS driver and its engines.", unique=False, default=False) self.Translate: Iterable[float] | FloatListKey = FloatListKey(name='Translate', comment='Translate all atoms by a vector.', unique=False, unit='angstrom')
def __post_init__(self): self.AllowCloseAtoms: BoolType | BoolKey = BoolKey(name='AllowCloseAtoms', comment='No longer functional. Just here for backwards compatibility.', hidden=True, default=True) self.Charge: float | FloatKey = FloatKey(name='Charge', comment="The system's total charge in atomic units.", gui_name='Total charge:', default=0.0, engines='-forcefield') self.FractionalCoords: BoolType | BoolKey = BoolKey(name='FractionalCoords', comment='Whether the atomic coordinates in the Atoms block are given in fractional coordinates of the lattice vectors. Requires the presence of the Lattice block.', default=False) self.GeometryFile: str | Path | StringKey = PathStringKey(name='GeometryFile', comment='Read the geometry from a file (instead of from Atoms and Lattice blocks). Supported formats: .xyz', ispath=True) self.GuessBonds: BoolType | BoolKey = BoolKey(name='GuessBonds', comment="Equivalent to 'Modify%GuessBonds'. Please update input file to use 'Modify' block instead.", hidden=True) self.LatticeStrain: Iterable[float] | FloatListKey = FloatListKey(name='LatticeStrain', comment="Equivalent to 'Modify%LatticeStrain'. Please update input file to use 'Modify' block instead.", hidden=True) self.MapAtomsToUnitCell: BoolType | BoolKey = BoolKey(name='MapAtomsToUnitCell', comment="Equivalent to 'Modify%MapAtomsToUnitCell'. Please update input file to use 'Modify' block instead.", hidden=True) self.PerturbCoordinates: float | FloatKey = FloatKey(name='PerturbCoordinates', comment="Equivalent to 'Modify%PerturbCoordinates'. Please update input file to use 'Modify' block instead.", hidden=True, unit='angstrom') self.PerturbLattice: float | FloatKey = FloatKey(name='PerturbLattice', comment="Equivalent to 'Modify%PerturbLattice'. Please update input file to use 'Modify' block instead.", hidden=True) self.ShiftCoordinates: Iterable[float] | FloatListKey = FloatListKey(name='ShiftCoordinates', comment="Equivalent to 'Modify%Translate', but in the unit of bohr by default. Please update input file to use 'Modify' block instead.", hidden=True, unit='bohr') self.SuperCell: Iterable[int] | IntListKey = IntListKey(name='SuperCell', comment="Equivalent to 'Modify%SuperCell'. Please update input file to use 'Modify' block instead.", hidden=True) self.SuperCellTrafo: Iterable[int] | IntListKey = IntListKey(name='SuperCellTrafo', comment="Equivalent to 'Modify%SuperCellTrafo'. Please update input file to use 'Modify' block instead.", hidden=True) self.Symmetrize: BoolType | BoolKey = BoolKey(name='Symmetrize', comment="Equivalent to 'Modify%Symmetrize'. Please update input file to use 'Modify' block instead.", hidden=True, default=False) self.Atoms: str | Sequence[str] | FreeBlock = self._Atoms(name='Atoms', comment='The atom types and coordinates. Unit can be specified in the header. Default unit is Angstrom.', header=True) self.BondOrders: str | Sequence[str] | FreeBlock = self._BondOrders(name='BondOrders', comment='Defined bond orders. Each line should contain two atom indices, followed by the bond order (1, 1.5, 2, 3 for single, aromatic, double and triple bonds) and (optionally) the cell shifts for periodic systems. May be used by MM engines and for defining constraints. If the system is periodic and none of the bonds have the cell shift defined then AMS will attempt to determine them following the minimum image convention.') self.ElectrostaticEmbedding: Symmetrize._System._ElectrostaticEmbedding = self._ElectrostaticEmbedding(name='ElectrostaticEmbedding', comment='Container for electrostatic embedding options, which can be combined.') self.Lattice: str | Sequence[str] | FreeBlock = self._Lattice(name='Lattice', comment='Up to three lattice vectors. Unit can be specified in the header. Default unit is Angstrom.', header=True) self.Modify: Symmetrize._System._Modify = self._Modify(name='Modify', comment='Modifications to make to the chemical system after construction. This block is read like a script and the modifications applied top to bottom.', ordered=True)
def __post_init__(self): self.LoadSystem: Symmetrize._LoadSystem = self._LoadSystem(name='LoadSystem', comment='Block that controls reading the chemical system from a KF file instead of the [System] block.', unique=False, header=True, extra_info='not_in_fragment', shared_id='AMSLoadSystem') self.Symmetry: Symmetrize._Symmetry = self._Symmetry(name='Symmetry', comment='Specifying details about the details of symmetry detection and usage.', shared_id='AMSSymmetry') self.System: Symmetrize._System = self._System(name='System', comment='Specification of the chemical system. For some applications more than one system may be present in the input. In this case, all systems except one must have a non-empty string ID specified after the System keyword. The system without an ID is considered the main one.', unique=False, header=True, gui_type='Repeat at least once', shared_id='AMSSystem')