File: names.py

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (42 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# fmt: off

import importlib
from collections.abc import Mapping

# Recognized names of calculators sorted alphabetically:
names = ['abinit', 'ace', 'aims', 'amber', 'asap', 'castep', 'cp2k',
         'crystal', 'demon', 'demonnano', 'dftb', 'dftd3', 'dmol', 'eam',
         'elk', 'emt', 'espresso', 'exciting', 'ff', 'gamess_us',
         'gaussian', 'gpaw', 'gromacs', 'gulp', 'hotbit', 'kim',
         'lammpslib', 'lammpsrun', 'lj', 'mopac', 'morse', 'nwchem',
         'octopus', 'onetep', 'openmx', 'orca',
         'plumed', 'psi4', 'qchem', 'siesta', 'tersoff',
         'tip3p', 'tip4p', 'turbomole', 'vasp']


builtin = {'eam', 'emt', 'ff', 'lj', 'morse', 'tersoff', 'tip3p', 'tip4p'}


class Templates(Mapping):
    def __init__(self, dct):
        self._dct = dct

    def __iter__(self):
        return iter(self._dct)

    def __getitem__(self, index):
        importpath, clsname = self._dct[index].rsplit('.', 1)
        module = importlib.import_module(importpath)
        cls = getattr(module, clsname)
        return cls()

    def __len__(self):
        return len(self._dct)


templates = Templates({
    'abinit': 'ase.calculators.abinit.AbinitTemplate',
    'aims': 'ase.calculators.aims.AimsTemplate',
    'espresso': 'ase.calculators.espresso.EspressoTemplate',
    'octopus': 'ase.calculators.octopus.OctopusTemplate',
})