Coverage for /builds/ase/ase/ase/calculators/names.py: 64.71%
17 statements
« prev ^ index » next coverage.py v7.5.3, created at 2025-08-02 00:12 +0000
« prev ^ index » next coverage.py v7.5.3, created at 2025-08-02 00:12 +0000
1# fmt: off
3import importlib
4from collections.abc import Mapping
6# Recognized names of calculators sorted alphabetically:
7names = ['abinit', 'ace', 'aims', 'amber', 'asap', 'castep', 'cp2k',
8 'crystal', 'demon', 'demonnano', 'dftb', 'dftd3', 'dmol', 'eam',
9 'elk', 'emt', 'espresso', 'exciting', 'ff', 'gamess_us',
10 'gaussian', 'gpaw', 'gromacs', 'gulp', 'hotbit', 'kim',
11 'lammpslib', 'lammpsrun', 'lj', 'mopac', 'morse', 'nwchem',
12 'octopus', 'onetep', 'openmx', 'orca',
13 'plumed', 'psi4', 'qchem', 'siesta', 'tersoff',
14 'tip3p', 'tip4p', 'turbomole', 'vasp']
17builtin = {'eam', 'emt', 'ff', 'lj', 'morse', 'tersoff', 'tip3p', 'tip4p'}
20class Templates(Mapping):
21 def __init__(self, dct):
22 self._dct = dct
24 def __iter__(self):
25 return iter(self._dct)
27 def __getitem__(self, index):
28 importpath, clsname = self._dct[index].rsplit('.', 1)
29 module = importlib.import_module(importpath)
30 cls = getattr(module, clsname)
31 return cls()
33 def __len__(self):
34 return len(self._dct)
37templates = Templates({
38 'abinit': 'ase.calculators.abinit.AbinitTemplate',
39 'aims': 'ase.calculators.aims.AimsTemplate',
40 'espresso': 'ase.calculators.espresso.EspressoTemplate',
41 'octopus': 'ase.calculators.octopus.OctopusTemplate',
42})