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