MolSSI / QCFractal

A distributed compute and database platform for quantum chemistry.
https://molssi.github.io/QCFractal/
BSD 3-Clause "New" or "Revised" License
144 stars 47 forks source link

What is stored in `OptimizationRecord.trajectory`? #677

Closed SimonBoothroyd closed 12 months ago

SimonBoothroyd commented 3 years ago

Describe what you are trying to achieve

The documentation for OptimizationRecord.trajectory states:

trajectory (List[ObjectId], Optional) – The list of Molecule Id’s the Optimization procedure generated at each step of the optimization.initial_molecule will be the first index, and final_molecule will be the last index.

However looking at the record with id='1760024':

{
  "id": "1760024",
  ...,
  "initial_molecule": "1365786",
  ...,
  "final_molecule": "1367453",
  "trajectory": [
    "1631196",
    "1631197",
    ...,
    "1631207",
    "1631208"
  ]
}

the first and last id in trajectory do not match the initial_molecule and final_molecule fields as expected. Am I right in thinking the docs are wrong here and trajectory stores references to result records rather than molecules?

Describe methods you have considered

bennybp commented 12 months ago

I believe this was true with v0.15.

With v0.50, this is also definitely true, although there some magic going on behind the scenes to fetch the records as needed. See type hints for the OptimizationRecord:

https://github.com/MolSSI/QCFractal/blob/7b67e018d67ebb2f0eb0ca2baa87f787ca0f22d8/qcportal/qcportal/optimization/record_models.py#L117