Coverage for /builds/kinetik161/ase/ase/calculators/names.py: 88.24%
17 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 collections.abc import Mapping
2import importlib
5# Recognized names of calculators sorted alphabetically:
6names = ['abinit', 'ace', 'aims', 'amber', 'asap', 'castep', 'cp2k',
7 'crystal', 'demon', 'demonnano', 'dftb', 'dftd3', 'dmol', 'eam',
8 'elk', 'emt', 'espresso', 'exciting', 'ff', 'gamess_us',
9 'gaussian', 'gpaw', 'gromacs', 'gulp', 'hotbit', 'kim',
10 'lammpslib', 'lammpsrun', 'lj', 'mopac', 'morse', 'nwchem',
11 'octopus', 'onetep', 'openmx', 'orca',
12 'plumed', 'psi4', 'qchem', 'siesta',
13 'tip3p', 'tip4p', 'turbomole', 'vasp']
16builtin = {'eam', 'emt', 'ff', 'lj', 'morse', 'tip3p', 'tip4p'}
19class Templates(Mapping):
20 def __init__(self, dct):
21 self._dct = dct
23 def __iter__(self):
24 return iter(self._dct)
26 def __getitem__(self, index):
27 importpath, clsname = self._dct[index].rsplit('.', 1)
28 module = importlib.import_module(importpath)
29 cls = getattr(module, clsname)
30 return cls()
32 def __len__(self):
33 return len(self._dct)
36templates = Templates({
37 'abinit': 'ase.calculators.abinit.AbinitTemplate',
38 'aims': 'ase.calculators.aims.AimsTemplate',
39 'espresso': 'ase.calculators.espresso.EspressoTemplate',
40 'octopus': 'ase.calculators.octopus.OctopusTemplate',
41})