Initial Work on Reading Crystal and Creation Gaussian Input

This commit is contained in:
2022-12-26 06:49:14 -03:00
parent 787d17eccd
commit 3716017cb0
30 changed files with 3262 additions and 852 deletions

View File

@@ -0,0 +1,42 @@
from dataclasses import dataclass, field, fields
@dataclass
class Config:
mem: int
level: str
n_atoms: int
n_procs: int = 1
pop: str = "chelpg"
comment: str = "crystalpol"
simulation_dir = "simfiles"
mult: list = \
field(default_factory=lambda: [0, 1])
def __post_init__(self):
for field in fields(self):
value = getattr(self, field.name)
if not isinstance(value, field.type):
raise ValueError(
f'Expected {field.name} to be {field.type}, '
f'got {repr(value)}'
)
if self.mem is None or self.mem <= 0:
raise ValueError(
f'Invalid value for mem: {self.mem},'
f'Memory must be a integer greater than 0.'
)
if self.level is None:
raise ValueError(
f'Invalid value for level. Level must not be none.'
)
if self.n_atoms is None or self.n_atoms <= 0:
raise ValueError(
f'Invalid value for n_atoms: {self.mem},'
f'Number of Atoms must be a integer greater than 0.'
)