Coverage for ase/calculators/names.py: 64.71%
17 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-27 15:21 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-27 15:21 +0000
1import importlib
2from collections.abc import Mapping
4# Recognized names of calculators sorted alphabetically:
5names = [
6 'abinit',
7 'ace',
8 'aims',
9 'amber',
10 'asap',
11 'castep',
12 'cp2k',
13 'crystal',
14 'demon',
15 'demonnano',
16 'dftb',
17 'dftd3',
18 'dmol',
19 'eam',
20 'elk',
21 'emt',
22 'espresso',
23 'exciting',
24 'ff',
25 'gamess_us',
26 'gaussian',
27 'gpaw',
28 'gromacs',
29 'gulp',
30 'hotbit',
31 'kim',
32 'lammpslib',
33 'lammpsrun',
34 'lj',
35 'mopac',
36 'morse',
37 'nwchem',
38 'octopus',
39 'onetep',
40 'openmx',
41 'orca',
42 'plumed',
43 'psi4',
44 'qchem',
45 'siesta',
46 'tersoff',
47 'tip3p',
48 'tip4p',
49 'turbomole',
50 'vasp',
51]
54builtin = {'eam', 'emt', 'ff', 'lj', 'morse', 'tersoff', 'tip3p', 'tip4p'}
57class Templates(Mapping):
58 def __init__(self, dct):
59 self._dct = dct
61 def __iter__(self):
62 return iter(self._dct)
64 def __getitem__(self, index):
65 importpath, clsname = self._dct[index].rsplit('.', 1)
66 module = importlib.import_module(importpath)
67 cls = getattr(module, clsname)
68 return cls()
70 def __len__(self):
71 return len(self._dct)
74templates = Templates(
75 {
76 'abinit': 'ase.calculators.abinit.AbinitTemplate',
77 'aims': 'ase.calculators.aims.AimsTemplate',
78 'espresso': 'ase.calculators.espresso.EspressoTemplate',
79 'octopus': 'ase.calculators.octopus.OctopusTemplate',
80 }
81)