55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
from diceplayer.config.dice_config import DiceConfig
|
|
from diceplayer.config.gaussian_config import GaussianConfig
|
|
|
|
from pydantic import BaseModel, Field, model_validator, ConfigDict
|
|
from typing_extensions import Self, Any
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
MIN_STEP = 20000
|
|
STEP_INCREMENT = 1000
|
|
|
|
|
|
class PlayerConfig(BaseModel):
|
|
"""
|
|
Data Transfer Object for the player configuration.
|
|
"""
|
|
model_config = ConfigDict(
|
|
frozen=True,
|
|
)
|
|
|
|
opt: bool = Field(..., description="Whether to perform geometry optimization")
|
|
maxcyc: int = Field(
|
|
..., description="Maximum number of cycles for the geometry optimization"
|
|
)
|
|
nprocs: int = Field(
|
|
..., description="Number of processors to use for the QM calculations"
|
|
)
|
|
ncores: int = Field(
|
|
..., description="Number of cores to use for the QM calculations"
|
|
)
|
|
|
|
dice: DiceConfig = Field(..., description="Dice configuration")
|
|
gaussian: GaussianConfig = Field(..., description="Gaussian configuration")
|
|
|
|
mem: int = Field(None, description="Memory configuration")
|
|
switchcyc: int = Field(3, description="Switch cycle configuration")
|
|
qmprog: str = Field("g16", description="QM program to use for the calculations")
|
|
altsteps: int = Field(
|
|
20000, description="Number of steps for the alternate simulation"
|
|
)
|
|
geoms_file: Path = Field(
|
|
"geoms.xyz", description="File name for the geometries output"
|
|
)
|
|
simulation_dir: Path = Field(
|
|
"simfiles", description="Directory name for the simulation files"
|
|
)
|
|
|
|
@model_validator(mode="before")
|
|
@staticmethod
|
|
def validate_altsteps(fields) -> dict[str, Any]:
|
|
altsteps = fields.pop("altsteps", MIN_STEP)
|
|
fields["altsteps"] = round(max(MIN_STEP, altsteps) / STEP_INCREMENT) * STEP_INCREMENT
|
|
return fields
|