The SubSystem class works as an interface for defining subsystems in hybrid simulations. Through it you can define the atoms that belong to the subsystem and the calculator that is used for it. SubSystem objects also provides special options for QM subsystems: you can setup dynamical charge calculation with enable_charge_calculation() and cell optimization with enable_cell_optimization().
You can define the atoms in the subsystem as a list of indices, with a tag or with a special string: “remaining”, which means all the atoms that are not yet assigned to a subsystem.
Used to create and store information about a subsystem.
The end user can create and manipulate these objects when defining subsystems. The subsystems are added to the calculation by calling add_subsystem() which adds a SubSystem-object to the calculation.
When the HybridCalculator sees fit, the subsystems are materialized by converting the stored SubSystems into SubSystemInternals.
Enable cell size optimization.
A subsystem might spatially reside in only a small portion of the entire system. DFT calculators will then waste time doing calculations in empty space, where almost none of electron density reaches.
This optimization minimizes the cell size, so that the atoms in the subsystem fit the cell with the given padding. If the padding is too small, the DFT-calculator might not work properly!
The optimization is off by default. It cannot be turned on in systems with periodic boundary conditions. The new optimized cell is always ortorhombic, regardless of the shape of the original, unoptimized cell.
Enable the dynamic calculation of atom-centered charges with the specified algorithm and from the specified electron density. These charges are only used for the interaction between other subsystems.
Indicates the division algorithm that is used. Available options are:
- “Bader”: Bader algorithm
- “van Der Waals”: Spheres with van Der Waals radius
Indicates what type of electron density is used. Available options are:
- “pseudo”: Use the pseudo electron density provided by all ASE DFT calculators
- “all-electron”: Use the all-electron density provided by at least GPAW
Checks that the given atom specifiers are correctly given. Does not yet check that they exist or don’t overlap with other subssystems.
Set the atoms that belong to this subsystem. Give only one of the specifiers: indices or tag.
This class is meant for internal use only.
A materialization of a SubSystem object.
This class is materialised from a SubSystem, and should not be accessible to the end user.
Returns a 3D numpy array that contains forces for this subsystem.
The returned array contains a row for each atom in the full system, but there is only an entry for the atoms in this subsystem. This makes it easier to calculate the total forces later on.
Tries to optimize the cell of the subsystem so only the atoms in this subsystem fit in it with the defined padding to the edges. The new cell is always ortorhombic.
Updates the charges in the system. Depending on the value of self.division, calls either update_charges_bader(), or update_charges_van_der_waals()
Updates the charges in the atoms used for interaction with the Bader algorithm.
This function uses an external Bader charge calculator from http://theory.cm.utexas.edu/henkelman/code/bader/. This tool is provided also in pysic/tools. Before using this function the bader executable directory has to be added to PATH.
Updates the atomic charges by using the electron density within a sphere of van Der Waals radius.
The charge for each atom in the system is integrated from the electron density inside the van Der Waals radius of the atom in hand. The link atoms will affect the distribution of the electron density.