Coverage for /builds/kinetik161/ase/ase/utils/abc.py: 80.00%
25 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
1import collections
2from abc import abstractmethod
4import numpy as np
6# Due to the high prevalence of cyclic imports surrounding ase.optimize,
7# we define the Optimizable ABC here in utils.
8# Can we find a better way?
11class Optimizable(collections.abc.Sized):
12 @abstractmethod
13 def get_positions(self):
14 ...
16 @abstractmethod
17 def set_positions(self, positions):
18 ...
20 @abstractmethod
21 def get_forces(self):
22 ...
24 @abstractmethod
25 def get_potential_energy(self):
26 ...
28 @abstractmethod
29 def iterimages(self):
30 ...
32 def converged(self, forces, fmax):
33 return np.linalg.norm(forces, axis=1).max() < fmax
35 def is_neb(self):
36 return False
38 def __ase_optimizable__(self):
39 return self