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

Bug: Q-Chem's TaskDoc.from_directory does not work with a custom directory #929

Closed
Andrew-S-Rosen opened this issue Jan 25, 2024 · 0 comments

Comments

@Andrew-S-Rosen
Copy link
Member

Problem

When supplying a custom directory to Q-Chem's TaskDoc.from_directory, the files cannot be parsed due to duplication of the base path.

from emmet.core.qc_tasks import TaskDoc

td = TaskDoc.from_directory('freq')

freq.zip

Traceback:

File ~/software/miniconda/envs/quacc/lib/python3.10/site-packages/emmet/core/qc_tasks.py:318, in TaskDoc.from_directory(cls, dir_name, store_additional_json, additional_fields, **qchem_calculation_kwargs)
    316         continue
    317     else:
--> 318         calc_doc = Calculation.from_qchem_files(
    319             dir_name, task_name, **files, **qchem_calculation_kwargs
    320         )
    321         calcs_reversed.append(calc_doc)
    322         # all_qchem_objects.append(qchem_objects)
    323
    324 # Lists need to be reversed so that newest calc is the first calc, all_qchem_objects are also reversed to match

File ~/software/miniconda/envs/quacc/lib/python3.10/site-packages/emmet/core/qchem/calculation.py:380, in Calculation.from_qchem_files(cls, dir_name, task_name, qcinput_file, qcoutput_file, store_energy_trajectory, qcinput_kwargs, qcoutput_kwargs)
    377 output_file_paths = _find_qchem_files(dir_name)
    379 qcinput_kwargs = qcinput_kwargs if qcinput_kwargs else {}
--> 380 qcinput = QCInput.from_file(qcinput_file, **qcinput_kwargs)
    382 qcoutput_kwargs = qcoutput_kwargs if qcoutput_kwargs else {}
    383 qcoutput = QCOutput(qcoutput_file, **qcoutput_kwargs)

File ~/software/miniconda/envs/quacc/lib/python3.10/site-packages/pymatgen/io/qchem/inputs.py:396, in QCInput.from_file(cls, filename)
    385 @classmethod
    386 def from_file(cls, filename: str | Path) -> QCInput:
    387     """
    388     Create QcInput from file.
    389
   (...)
    394         QcInput
    395     """
--> 396     with zopen(filename, "rt") as f:
    397         return cls.from_str(f.read())

File ~/software/miniconda/envs/quacc/lib/python3.10/site-packages/monty/io.py:45, in zopen(filename, *args, **kwargs)
     43 if ext in (".XZ", ".LZMA"):
     44     return lzma.open(filename, *args, **kwargs)
---> 45 return open(filename, *args, **kwargs)

FileNotFoundError: [Errno 2] No such file or directory: 'freq/freq/mol.qin'

Proposed Solution

N/A

Alternatives

CC @rdguha1995

munrojm pushed a commit that referenced this issue Feb 7, 2024
* Adding qc_tasks and calculation.py

* big_commit for implementing the drone fucntionality of atomate(qchem) in emmet

* ran pre-commit locally and some minor changes

* writing_unit_tests_for_sp_and_opt

* ran pre-commit on test files

* corrected Union type error

* added numpy custom validators

* datetime import problem

* allowing arbitrary types

* further tests

* further tests

* change in io file convention

* checking qcinput

* checking qcinput

* Incorporating all the pydantic 2 changes

* changes in lot, task_type, calc_type

* removing circular dependency

* calc_doc issue

* Make more fields optional in accordance with pydantic 2

* Corrected the Input Doc problems

* CalcInput smx attribute issue

* correcting input to qcinput and qcoutput

* changes in the Optimization test doc for inputs

* molecule -> initial_molecule

* changes to the sp valid task_schema

* test_output breakdowns

* test_output breakdowns OutputDoc

* test_output breakdowns OutputDoc

* test_output breakdowns OutputDoc

* test_output breakdowns OutputDoc

* test_output breakdowns OutputDoc

* test_output breakdowns OutputDoc

* Changes to the TaskDoc

* Changes to the TaskDoc np.array

* Changes to the conftest

* Changes to the conftest arrays

* Changes to the conftest arrays

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* Changes to test code

* fixing bug where solvent field was being accessed as a dict

* forgot pre-commit

* Changed the default args for initial_molecule and optimized_molecule to be Molecule not dict

* deleted the superfluous FW files

* making the TaskDoc.from_directory functionality for generalized to handle qchem calculaion directories not generated through atomate

* resolved the bugs with enthalpy, entropy and parsing frequencies
Andrew-S-Rosen added a commit to Quantum-Accelerators/quacc that referenced this issue Feb 7, 2024
Use Emmet's Qchem TaskDoc. Closes #956.

Requires: materialsproject/emmet#929,
materialsproject/emmet#930

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant