|
| 1 | +from __future__ import division |
| 2 | +from qm.qm_calculator import QM_calculator |
| 3 | +from misc import call_name |
| 4 | +import os |
| 5 | + |
| 6 | +class GAMESS(QM_calculator): |
| 7 | + """ Class for common parts of GAMESS |
| 8 | +
|
| 9 | + :param string basis_set: Basis set information |
| 10 | + :param string memory: Allocatable memory in the calculations |
| 11 | + :param string qm_path: Path for QM binary |
| 12 | + :param integer nthreads: Number of threads in the calculations |
| 13 | + :param string version: Version of GAMESS, check $VERNO |
| 14 | + """ |
| 15 | + def __init__(self, basis_set, memory, qm_path, nthreads, version): |
| 16 | + # Save name of QM calculator and its method |
| 17 | + super().__init__() |
| 18 | + |
| 19 | + # Initialize GAMESS common variables |
| 20 | + self.basis_set = basis_set |
| 21 | + |
| 22 | + self.memory = memory |
| 23 | + self.qm_path = qm_path |
| 24 | + if (not os.path.isdir(self.qm_path)): |
| 25 | + error_message = "Directory for GAMESS binary not found!" |
| 26 | + error_vars = f"qm_path = {self.qm_path}" |
| 27 | + raise FileNotFoundError (f"( {self.qm_method}.{call_name()} ) {error_message} ( {error_vars} )") |
| 28 | + |
| 29 | + self.nthreads = nthreads |
| 30 | + self.version = version |
| 31 | + |
| 32 | + if (isinstance(self.version, str)): |
| 33 | + if not (self.version in ["00"]): |
| 34 | + error_message = "Other versions not implemented!" |
| 35 | + error_vars = f"version = {self.version}" |
| 36 | + raise ValueError (f"( {self.qm_method}.{call_name()} ) {error_message} ( {error_vars} )") |
| 37 | + else: |
| 38 | + error_message = "Type of version must be string!" |
| 39 | + error_vars = f"version = {self.version}" |
| 40 | + raise TypeError (f"( {self.qm_method}.{call_name()} ) {error_message} ( {error_vars} )") |
| 41 | + |
| 42 | + |
0 commit comments