Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Ideal gas calculator - the potential energy is always zero."""
3import numpy as np
4from ase.calculators.calculator import Calculator, all_changes
7class IdealGas(Calculator):
8 """The ideal gas: non-interacting atoms.
10 The ideal gas is atoms that do not interact. The potential is thus
11 always zero, and so are forces and stresses (apart from the dynamic
12 part of the stress, which is handled by the atoms themselves).
14 This calculator is probably only useful for testing purposes.
15 """
17 implemented_properties = ['energy', 'energies', 'forces',
18 'stress', 'stresses']
20 def calculate(self, atoms=None, properties=[],
21 system_changes=all_changes):
22 """'Calculate' the zero energies and their derivatives."""
23 super().calculate(atoms, properties, system_changes)
24 n = len(self.atoms)
25 self.results = {
26 'energy': 0.0,
27 'energies': np.zeros(n),
28 'forces': np.zeros((n, 3)),
29 'stress': np.zeros(6),
30 'stresses': np.zeros((n, 6)),
31 }