coltonbh / qcop

A package for operating Quantum Chemistry programs using qcio standardized data structures. Compatible with TeraChem, psi4, QChem, NWChem, ORCA, Molpro, geomeTRIC and many more.
MIT License
3 stars 3 forks source link

[BUG] - Optimizations with geomeTRIC and xtb start to pick up the `qcio_optim.xyz` file created by geomeTRIC after a few steps in the trajectory #34

Closed coltonbh closed 1 month ago

coltonbh commented 1 month ago

This code

from pathlib import Path

from qcio import Structure, CalcType, ProgramInput, DualProgramInput, constants
from qcop import compute

from xtb.utils import Solvent

STRUCT_DIR = Path("./data/2017-jacs/structures")

u1_anion_180 = Structure.open(STRUCT_DIR / "U1-_mmff94s_180.json")
pi = DualProgramInput(
    calctype=CalcType.optimization,
    structure=u1_anion_180,
    subprogram="xtb",
    subprogram_args={
        "model": {"method": "GFN2xTB"},
        "keywords": {"solvent": Solvent.thf},
    },
)
po = compute("geometric", pi, raise_exc=False, print_stdout=True)

Some outputs

>>> po.files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[0].files.keys()
dict_keys([])
>>> po.results.trajectory[1].files.keys()
dict_keys([])
>>> po.results.trajectory[2].files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[3].files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[4].files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[4].files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[5].files.keys()
dict_keys(['qcio_optim.xyz'])
>>> po.results.trajectory[5].files['qcio_optim.xyz'] == po.results.trajectory[6].files['qcio_optim.xyz']
False
>>> len(po.results.trajectory[5].files['qcio_optim.xyz'])
10725
>>> len(po.results.trajectory[6].files['qcio_optim.xyz'])
12870
>>> len(po.results.trajectory[7].files['qcio_optim.xyz'])
15015
>>> len(po.results.trajectory[8].files['qcio_optim.xyz'])

I did not pass collect_files=True.

coltonbh commented 1 month ago

This got fixed with .uses_files class method on adapters.