Coverage for /builds/kinetik161/ase/ase/calculators/idealgas.py: 100.00%
8 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
1"""Ideal gas calculator - the potential energy is always zero."""
3import numpy as np
5from ase.calculators.calculator import Calculator, all_changes
8class IdealGas(Calculator):
9 """The ideal gas: non-interacting atoms.
11 The ideal gas is atoms that do not interact. The potential is thus
12 always zero, and so are forces and stresses (apart from the dynamic
13 part of the stress, which is handled by the atoms themselves).
15 This calculator is probably only useful for testing purposes.
16 """
18 implemented_properties = ['energy', 'energies', 'forces',
19 'stress', 'stresses']
21 def calculate(self, atoms=None, properties=[],
22 system_changes=all_changes):
23 """'Calculate' the zero energies and their derivatives."""
24 super().calculate(atoms, properties, system_changes)
25 n = len(self.atoms)
26 self.results = {
27 'energy': 0.0,
28 'energies': np.zeros(n),
29 'forces': np.zeros((n, 3)),
30 'stress': np.zeros(6),
31 'stresses': np.zeros((n, 6)),
32 }