Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CP2K TaskDocument #900

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/atomate2/cp2k/schemas/calc_types/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path

from monty.serialization import loadfn
from pymatgen.io.cp2k.inputs import Cp2kInput, Keyword, KeywordList
from pymatgen.io.cp2k.inputs import Keyword, KeywordList

from atomate2.cp2k.schemas.calc_types import CalcType, RunType, TaskType

Expand Down Expand Up @@ -71,7 +71,7 @@ def task_type(inputs: dict) -> TaskType:
"""
calc_type = []
cp2k_run_type = inputs.get("cp2k_global", {}).get("Run_type", "")
ci = Cp2kInput.from_dict(inputs["cp2k_input"])
ci = inputs["cp2k_input"]

if cp2k_run_type.upper() in (
"ENERGY",
Expand Down
8 changes: 5 additions & 3 deletions src/atomate2/cp2k/schemas/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pymatgen.electronic_structure.bandstructure import BandStructure
from pymatgen.electronic_structure.dos import Dos
from pymatgen.io.common import VolumetricData
from pymatgen.io.cp2k.inputs import BasisFile, DataFile, PotentialFile
from pymatgen.io.cp2k.inputs import BasisFile, Cp2kInput, DataFile, PotentialFile
from pymatgen.io.cp2k.outputs import Cp2kOutput, parse_energy_file
from typing_extensions import Self

Expand Down Expand Up @@ -71,7 +71,9 @@ class CalculationInput(BaseModel):
None, description="Description of parameters used for each atomic kind"
)

cp2k_input: dict = Field(None, description="The cp2k input used for this task")
cp2k_input: Union[dict, Cp2kInput] = Field(
None, description="The cp2k input used for this task"
)

dft: dict = Field(
None,
Expand Down Expand Up @@ -170,7 +172,7 @@ class CalculationOutput(BaseModel):
ionic_steps: list[dict[str, Any]] = Field(
None, description="Energy, forces, and structure for each ionic step"
)
locpot: dict[int, list[float]] = Field(
locpot: Union[dict[int, list[float]], None] = Field(
None, description="Average of the local potential along the crystal axes"
)
run_stats: RunStatistics = Field(
Expand Down
Loading