QM_engines.dftb_wrapper module¶
Description¶
This module defines the ParaMol.QM_engines.dftb_wrapper.DFTBWrapper class, which is a ParaMol implementation of a DFTB+ wrapper.
-
class
ParaMol.QM_engines.dftb_wrapper.DFTBWrapper(system_name, interface, n_atoms, atom_list, n_calculations, slater_koster_files_prefix, work_dir_prefix='DFTBWorkDir_', calc_file='dftb_in.hsd', geometry_file='geometry.gen', calc_dir_prefix='dftb_', detailed_file_output='detailed.out', calc_file_output='dftb_output.out', max_ang_mom={'C': 'p', 'F': 'p', 'H': 's', 'N': 'p', 'O': 'p', 'S': 'p'})¶ Bases:
objectParaMol implementation of a DFTB+ wrapper.
- Parameters
system_name (str) – Name of the system to which this wrapper is associated.
interface (
ParaMol.Utils.interface.ParaMolInterface) – ParaMol interface object instance.n_atoms (int) – number of atoms
atom_list (list of str) – List with the atom symbols
n_calculations (int) – Number of parallel calculations.
slater_koster_files_prefix (str) – Path to the Slater-Koster files.
work_dir (str, default="DFTBWorkDir") – Path to the working directory.
calc_file (str, default="dftb_output.out") – Name given to the DFTB+ calculation file.
calc_file – Name given to the DFTB+ stdout file.
detailed_file_output (str, default="detailed.out") – Name of the detailed output file written by DFTB+. By default DFTB+ writes this to ‘detailed.out’. Don’t change this unless you know what you’re doing.
geometry_file (str, default="geometry.gen") – Name given to the DFTB+ .gen geometry file.
calc_dir_prefix (str, default="dftb_") – Prefix given to the directories where the calculations will be performed.
max_ang_mom (dict, default={"H": "s", "C": "p", "N": "p", "O": "p", "F": "p", "S": "p"}) – Dictionary that defines the maximum angular momentum for each chemical element.
-
_prepare_work_dir()¶ Method that prepares the working directory.
- Returns
None
-
_write_geometry_gen_format(coords)¶ Method that writes the geometry in gen format.
- Parameters
coords (list or np.array) – (n_atoms,3) coordinates array
- Returns
True if file was closed successfully. False otherwise.
-
_write_input_file(dispersion_correction=False)¶ Method that writes the input file necessary to run single-point with forces calculation.
Notes
It only needs to be run upon creation of the QM wrapper.
- Parameters
dispersion_correction (bool) – Whether or not to include D3 dispersion correction section.
- Returns
True if file was closed successfully. False otherwise.
-
run_calculation(coords, label)¶ Method that perform a single-point calculation with forces.
- Parameters
coords (np.ndarray, shape=(n_atoms, 3), dtype=float) – Coordinates array.
label (str) – Seed for the calculation.
- Returns
energy (float) – Energy in kJ/mol.
forces (np.ndarray, shape=np.array(n_atoms,3)) – Forces in kJ/mol/nm