Skip to content

Commit

Permalink
genopt
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed May 6, 2024
1 parent 06dacac commit 3549444
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions qcmanybody/models/generalized_optimization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import Annotated, List, Literal, Union

try:
from pydantic.v1 import Field
except ImportError:
from pydantic import Field

from qcelemental.models import AtomicResult, OptimizationInput, OptimizationResult
from qcelemental.models.procedures import QCInputSpecification

from .manybody_input_pydv1 import ManyBodySpecification
from .manybody_output_pydv1 import ManyBodyResult


# note that qcel AtomicResult.schema_name needs editing
ResultTrajectories = Annotated[Union[AtomicResult, ManyBodyResult], Field(discriminator='schema_name')]

class GeneralizedOptimizationInput(OptimizationInput):
schema_name: Literal["qcschema_generalizedoptimizationinput"] = "qcschema_generalizedoptimizationinput"
schema_version: int = 1
input_specification: Union[QCInputSpecification, ManyBodySpecification] = Field(..., description="ordinary or mbe grad spec")


class GeneralizedOptimizationResult(OptimizationResult):
schema_name: Literal["qcschema_generalizedoptimizationresult"] = "qcschema_generalizedoptimizationresult"
trajectory: List[ResultTrajectories] = Field(
..., description="A list of ordered Result objects for each step in the optimization."
)
input_specification: Union[QCInputSpecification, ManyBodySpecification] = Field(..., description="ordinary or mbe grad spec")

0 comments on commit 3549444

Please sign in to comment.