Coverage for /builds/kinetik161/ase/ase/calculators/general.py: 29.55%
44 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
1from ase.calculators.calculator import PropertyNotImplementedError
4class Calculator:
5 "Deprecated!!!!"
7 def __init__(self):
8 return
10 def set_atoms(self, atoms):
11 self.atoms = atoms.copy()
13 def get_atoms(self):
14 atoms = self.atoms.copy()
15 atoms.calc = self
16 return atoms
18 def get_name(self):
19 """Return the name of the calculator (string). """
20 return self.name
22 def get_version(self):
23 """Return the version of the calculator (string). """
24 raise NotImplementedError
26 def get_potential_energy(self, atoms, force_consistent=False):
27 self.update(atoms)
28 if force_consistent:
29 return self.energy_free
30 else:
31 return self.energy_zero
33 def get_forces(self, atoms):
34 self.update(atoms)
35 return self.forces
37 def get_stress(self, atoms):
38 self.update(atoms)
39 if self.stress is not None:
40 return self.stress
41 else:
42 raise PropertyNotImplementedError
44 def initialize(self, atoms):
45 """Prepare the input files required to
46 start the program (calculator). """
47 raise NotImplementedError
49 def read(self, atoms):
50 self.positions = atoms.get_positions()
51 self.energy_free, self.energy_zero = self.read_energy()
52 self.forces = self.read_forces(atoms)
53 self.dipole = self.read_dipole()
54 self.fermi = self.read_fermi()
55 self.atoms = atoms.copy()
56 try:
57 self.nbands = self.read_nbands()
58 except (NotImplementedError, AttributeError):
59 pass
60 try:
61 self.stress = self.read_stress()
62 except PropertyNotImplementedError:
63 self.stress = None