LCAOCalculator¶
- class LCAOCalculator(basis_set=None, exchange_correlation=None, charge=None, fixed_spin_moment=None, numerical_accuracy_parameters=None, iteration_control_parameters=None, poisson_solver=None, checkpoint_handler=None, dynamical_matrix_parameters=None, correction_extension=None, algorithm_parameters=None, hamiltonian_derivatives_parameters=None, parallel_parameters=None, solvation_parameters=None)¶
Class for representing calculations using the ATK-DFT numerical orbital model for configurations of the type MoleculeConfiguration and BulkConfiguration.
- Parameters:
basis_set (list | tuple |
BasisSet
|PAWBasisSet
) –An object describing the basis set used for the LCAO calculation. This keyword can be given in three ways.
As a single
BasisSet
|PAWBasisSet
object.As a tuple (string, BasisSet). The string must match a tag on the atom in order to be applied.
As a sequence of entries matching either of the above formats
Default:
BasisGGAPseudoDojo.Medium
exchange_correlation (
ExchangeCorrelation
) – The exchange correlation functional for this calculation. Default:GGA.PBE
charge (float) – The charge of the system, a charge of -1 corresponds to one extra electron. Default: 0.0
fixed_spin_moment (float |
False
) – Total spin moment (per unit cell) to use, defined as \(\Delta N = N_{\uparrow} - N_{\downarrow}\), where \(N_{\uparrow}\) and \(N_{\downarrow}\) are the number of electrons in the Up and Down spin channels, respectively. When specified the spin moment will be fixed at the given value by introducing separate Fermi levels for the Up and Down spin channels. Can only be specified when doing a calculation with polarized spin. If set toFalse
the spin moment will not be fixed - a single Fermi level is used. Default:False
numerical_accuracy_parameters (
NumericalAccuracyParameters
) –The numerical accuracy parameters used for the DFT calculation. Default:
NumericalAccuracyParameters( density_mesh_cutoff=75.0*Hartree, k_point_sampling=MonkhorstPackGrid(1, 1, 1), radial_step_size=0.001*Bohr, density_cutoff=1.0e-6, interaction_max_range=20.0*Angstrom, number_of_reciprocal_points=1024, reciprocal_energy_cutoff=1250.0*Hartree, occupation_method=FermiDirac(1000.0*Kelvin))
Note that the density mesh cutoff will be altered depending on the elements present in the configuration.
iteration_control_parameters (
IterationControlParameters
|NonSelfconsistent
) –The iteration control parameters used for the DFT calculation. For non-self-consistent calculations set this parameter to
NonSelfconsistent
. Default:IterationControlParameters( tolerance=1.0e-4, max_steps=100, algorithm=PulayMixer(restart_strategy=AdaptiveHistoryRestart()), damping_factor=0.1, number_of_history_steps=20, start_mixing_after_step=0, mixing_variable=HamiltonianVariable, linear_dependence_threshold=0.0, preconditioner=Preconditioner.Off)
poisson_solver (
DirectSolver
|MultigridSolver
|FastFourierSolver
|FastFourier2DSolver
) – The Poisson solver used to determine the electrostatic potential. Default: Configuration dependent.FastFourierSolver
for aBulkConfiguration
without any metallic or dielectricSpatialRegion
.checkpoint_handler (
CheckpointHandler
) – The CheckpointHandler used for specifying the save-file and the time interval between saving the calculation during the scf-loop. Default: A defaultCheckpointHandler
object.dynamical_matrix_parameters (not used) – Deprecated: from v2015, see the
DynamicalMatrix
analysis object.correction_extension (
GrimmeDFTD2
|GrimmeDFTD3
) – The correction extension to used, when calculating energy, forces and stress. Default: None.algorithm_parameters (
AlgorithmParameters
) –The algorithm parameters used for calculating the density matrix. Default:
AlgorithmParameters( density_matrix_method=DiagonalizationSolver(), store_grids=True, store_basis_on_grid=Automatic, store_energy_density_matrix=Automatic, scf_restart_step_length=0.1*Angstrom, use_symmetries=False)
hamiltonian_derivatives_parameters (not used) – Deprecated: from v2015, see the
HamiltonianDerivatives
analysis object.parallel_parameters (
ParallelParameters
) –The parameters used to control parallelization options. Default:
ParallelParameters( processes_per_neb_image=None, processes_per_individual=None, processes_per_bias_point=None, processes_per_saddle_search=1)
solvation_parameters (None |
CosmoSolvationParameters
) – Optional parameters for a COSMO solvation model. If this is specified, the COSMO solvation model contribution will be included in the SCF loop.
- algorithmParameters()¶
- Returns:
The algorithm parameters.
- Return type:
- basisSet()¶
- Returns:
The basis set.
- Return type:
list
- charge()¶
- Returns:
The charge of the system.
- Return type:
float
- checkpointHandler()¶
- Returns:
The checkpoint handler.
- Return type:
- correctionExtension()¶
- Returns:
The correction extension or None if not set.
- Return type:
GrimmeDFTD2
|GrimmeDFTD3
| None
- dynamicalMatrixParameters()¶
Return the DynamicalMatrixParameters. Deprecated.
- Returns:
None since the class DynamicalMatrixParameters is deprecated.
- Return type:
None
- exchangeCorrelation()¶
- Returns:
The exchange-correlation.
- Return type:
- fixedSpinMoment()¶
Get the fixed spin moment.
- Returns:
The fixed spin moment or
False
if the spin moment is not held fixed.- Return type:
float |
False
- hamiltonianDerivativesParameters()¶
Return the HamiltonianDerivativesParameters. Deprecated.
- Returns:
None since the class HamiltonianDerivativesParameters is deprecated.
- Return type:
None
- isConverged()¶
- Returns:
True when the call to “update()” resulted in a converged SCF loop.
- Return type:
bool
- iterationControlParameters()¶
- Returns:
The iteration control parameters.
- Return type:
- metatext()¶
- Returns:
The metatext of the object or None if no metatext is present.
- Return type:
str | None
- numericalAccuracyParameters()¶
- Returns:
The numerical accuracy parameters.
- Return type:
- parallelParameters()¶
- Returns:
The parallel parameters object.
- Return type:
- poissonSolver()¶
- Returns:
The Poisson solver set on the calculator.
- Return type:
DirectSolver
|MultigridSolver
|FastFourierSolver
|FastFourier2DSolver
- setBasisSet(basis_set)¶
Set the basis set.
- Parameters:
basis_set (list) – The basis set to use. The basis set is given as a sequence of
BasisSet
objects for each element in the configuration.
- setCheckpointHandler(checkpoint_handler)¶
Set the checkpoint handler.
- Parameters:
checkpoint_handler (
CheckpointHandler
) – The checkpoint handler to use.
- setCorrectionExtension(correction_extension)¶
Set the iteration correction extension.
- Parameters:
correction_extension (
GrimmeDFTD2
|GrimmeDFTD3
| None) – The correction extension to use.
- setExchangeCorrelation(exchange_correlation)¶
Set the exchange-correlation.
- Parameters:
exchange_correlation (
ExchangeCorrelation
) – The exchange-correlation to use.
- setIterationControlParameters(iteration_control_parameters)¶
Set the iteration control parameters.
- Parameters:
iteration_control_parameters (
IterationControlParameters
) – The iteration control parameters to use.
- setMetatext(metatext)¶
Set a given metatext string on the object.
- Parameters:
metatext (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.
- setNumericalAccuracyParameters(numerical_accuracy_parameters)¶
Set the numerical accuracy parameters.
- Parameters:
numerical_accuracy_parameters (
NumericalAccuracyParameters
) – The numerical accuracy parameters to use.
- setParallelParameters(parallel_parameters)¶
Method for setting the parallel parameters.
- Parameters:
parallel_parameters (
ParallelParameters
| None) – The parallel parameters to set. If None a default version of the parameters is used.
- setPoissonSolver(poisson_solver)¶
Set the poisson solver.
- Parameters:
poisson_solver (
DirectSolver
|MultigridSolver
|FastFourierSolver
|FastFourier2DSolver
) – The Poisson solver to set on the calculator.
- setSolvationParameters(solvation_parameters)¶
Set the solvation parameters.
- Parameters:
solvation_parameters (
CosmoSolvationParameters
) – The solvent parameters to use.
- solvationParameters()¶
- Returns:
The solvation parameters.
- Return type:
- uniqueString()¶
Return a unique string representing the state of the object.
- upgrade(configuration)¶
Private method for updating the calculator from the configuration, if it is possible. @private
- versionUsed()¶
- Returns:
The version of ATK used to update the calculator.
- Return type:
str
Usage Examples¶
Define an LCAOCalculator with user defined basis set:
basis_set = [
LDABasis.Hydrogen_DoubleZetaPolarized,
LDABasis.Oxygen_DoubleZetaPolarized,
LDABasis.Nitrogen_DoubleZeta,
LDABasis.Carbon_SingleZeta,
]
calculator = LCAOCalculator(basis_set=basis_set)
Restart an LCAO calculation using the self-consistent state from a previous calculation:
# Read in the BulkConfiguration with the old scf state
old_calculation=nlread("filename.nc",BulkConfiguration)[0]
# Define the BulkConfiguration with similar number of atoms
new_calculation=BulkConfiguration(...)
# extract the old calculator
old_calculator = old_calculation.calculator()
# make a clone of the old calculator
new_calculator = old_calculator()
# Attach the calculator and use the old initial state
new_calculation.setCalculator(new_calculator, initial_state=old_calculation)