StollLab / EasySpin

MATLAB toolbox for Electron Paramagnetic Resonance (EPR) spectroscopy
http://easyspin.org
MIT License
49 stars 26 forks source link

Cannot read Orca 6 output #349

Closed Liam-Twomey closed 1 month ago

Liam-Twomey commented 2 months ago

Hi, when attempting to import ORCA output with orca2easyspin, if the ORCA version used is 6.0.0, I get the error:

Unable to perform assignment because the indices on
the left side are not compatible with the size of
the right side.

Error in orca2easyspin_maintxt

Error in orca2easyspin_maintxt

Error in orca2easyspin

Error in untitled (line 4)
Sys2 = orca2easyspin('cubr2-etoac-ghfc.out');

Specifically, every file is fine if re-run with ORCA 5.0.4. I did some poking through the source code, but I wasn't able to figure out where the orca2easyspin_maintxt function came from, since it's only referenced in orca2easyspin.m. I know they changed the output formatting slightly with ORCA 6, so I'm assuming that's breaking EasySpin's parsing.

Looking back at #230, it's worth noting that the filename parsing for property files will also need to be updated for properties files to be supported: ORCA 6 switched from job_property.txt to job.property.txt for the filenaming convention. It looks like the file formatting for the properties between ORCA 5 and 6 is also substantially changed.

stestoll commented 2 months ago

Thanks for reporting. Yes, this needs to be fixed.

Liam-Twomey commented 1 month ago

Based on Frank's comments here, it seems like the most future-proof way to handle this is to import the JSON form of the properties file, as that seems like it's the "intended" way to access orca parameters going forward. It can be generated by including

%Method
   WriteJSONPropertyfile True
End

or by using orca_2json jobname -properties (there's a typo in the manual omitting the -, but it's section 7.62). I think generating the json file should probably be left to the user, as otherwise it makes loading files generated by ORCA on a server cluster complicated.

I tried to make a MVP of reading the JSON into Matlab, but evidently the json formatting is broken in ORCA 6.0.0 (see here, hopefully it'll get fixed in v6.0.1 in a month or so.

It also seems like MATLAB JSON interpretation is only implemented properly in R2023b (see here), so using this method could create a hard minimum MATLAB version requirement for reading ORCA 6 output.

stestoll commented 1 month ago

Thanks for the details!

The ORCA output file formats (main file, property text file, and now JSON file) has been a moving target for many years, with bugs and changes in every ORCA version. As in the past, we'll try to keep up, but it is challenging.

At the moment, I think it's best for EasySpin to update the main-text import code to support ORCA 6.0 and defer JSON import support until the JSON property output has stabilized in ORCA 6.0.1 or 6.1.

Liam-Twomey commented 1 month ago

Sounds good, I'm working on a PR