Read Potentials and Initial Testing
This commit is contained in:
0
diceplayer/shared/config/__init__.py
Normal file
0
diceplayer/shared/config/__init__.py
Normal file
54
diceplayer/shared/config/dice_dto.py
Normal file
54
diceplayer/shared/config/dice_dto.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from diceplayer.shared.utils.dataclass_protocol import Dataclass
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dacite import from_dict
|
||||
from typing import List
|
||||
|
||||
|
||||
@dataclass
|
||||
class DiceDTO(Dataclass):
|
||||
|
||||
ljname: str
|
||||
outname: str
|
||||
ncores: int
|
||||
dens: float
|
||||
nmol: List[int]
|
||||
nstep: List[int]
|
||||
|
||||
upbuf = 360
|
||||
combrule = "*"
|
||||
isave: int = 1000
|
||||
press: float = 1.0
|
||||
temp: float = 300.0
|
||||
randominit: str = 'first'
|
||||
|
||||
def __post_init__(self):
|
||||
|
||||
if self.ljname is None:
|
||||
raise ValueError(
|
||||
"Error: 'ljname' keyword not specified in config file"
|
||||
)
|
||||
|
||||
if self.outname is None:
|
||||
raise ValueError(
|
||||
"Error: 'outname' keyword not specified in config file"
|
||||
)
|
||||
|
||||
if self.dens is None:
|
||||
raise ValueError(
|
||||
"Error: 'dens' keyword not specified in config file"
|
||||
)
|
||||
|
||||
if self.nmol == 0:
|
||||
raise ValueError(
|
||||
"Error: 'nmol' keyword not defined appropriately in config file"
|
||||
)
|
||||
|
||||
if self.nstep == 0:
|
||||
raise ValueError(
|
||||
"Error: 'nstep' keyword not defined appropriately in config file"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, param: dict):
|
||||
return from_dict(DiceDTO, param)
|
||||
28
diceplayer/shared/config/gaussian_dto.py
Normal file
28
diceplayer/shared/config/gaussian_dto.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from diceplayer.shared.utils.dataclass_protocol import Dataclass
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dacite import from_dict
|
||||
|
||||
|
||||
@dataclass
|
||||
class GaussianDTO(Dataclass):
|
||||
level: str
|
||||
qmprog: str
|
||||
keywords: str
|
||||
|
||||
chgmult = [0, 1]
|
||||
pop: str = 'chelpg'
|
||||
|
||||
def __post_init__(self):
|
||||
if self.qmprog not in ("g03", "g09", "g16"):
|
||||
raise ValueError(
|
||||
"Error: invalid qmprog value."
|
||||
)
|
||||
if self.level is None:
|
||||
raise ValueError(
|
||||
"Error: 'level' keyword not specified in config file."
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, param: dict):
|
||||
return from_dict(GaussianDTO, param)
|
||||
24
diceplayer/shared/config/player_dto.py
Normal file
24
diceplayer/shared/config/player_dto.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from diceplayer.shared.utils.dataclass_protocol import Dataclass
|
||||
|
||||
from dataclasses import dataclass
|
||||
from dacite import from_dict
|
||||
|
||||
|
||||
@dataclass
|
||||
class PlayerDTO(Dataclass):
|
||||
opt: bool
|
||||
maxcyc: int
|
||||
nprocs: int
|
||||
|
||||
qmprog: str = 'g16'
|
||||
altsteps: int = 20000
|
||||
simulation_dir = 'simfiles'
|
||||
|
||||
def __post_init__(self):
|
||||
MIN_STEP = 20000
|
||||
# altsteps value is always the nearest multiple of 1000
|
||||
self.altsteps = round(max(MIN_STEP, self.altsteps) / 1000) * 1000
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, param: dict):
|
||||
return from_dict(PlayerDTO, param)
|
||||
Reference in New Issue
Block a user