TUHH-TVT / openCOSMO-RS_py

GNU General Public License v2.0
56 stars 11 forks source link

ValueError in OpenCOSMO-RS When Adding ORCA Output for Descriptor Calculation #8

Closed VN-jsjeon closed 3 weeks ago

VN-jsjeon commented 3 weeks ago

Issue: I'm using OpenCOSMO-RS to calculate descriptors for a molecule, and I'm encountering a ValueError when I attempt to add a molecule using a .orcacosmo file generated from ORCA 6.0.

Steps to Reproduce:

Generated the COSMO-RS compatible .orcacosmo file (cosmors-10.solute.orcacosmo) using ORCA 6.0.

Used the following Python code to add this molecule in OpenCOSMO-RS:

import numpy as np from opencosmorspy import Parameterization, COSMORS

crs = COSMORS(par='default_orca') crs.par.calculate_contact_statistics_molecule_properties = True

molecule = ['/home/jeon/test/cosmors-10.solute.orcacosmo'] crs.add_molecule(molecule)

Error Message:

ValueError Traceback (most recent call last) ... File ~/miniconda3/envs/cosmors/lib/python3.13/site-packages/opencosmorspy/cosmors.py, line 120, in COSMORSEnthalpic.add_molecule self.seg_sigma_raw = cosmo_info['seg_sigma_raw'] if cosmo_info['seg_sigma_raw'] else cosmo_info['seg_sigma_raw_uncorrected'] ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The error indicates an issue with the seg_sigma_raw array, suggesting that OpenCOSMO-RS is unable to properly parse or handle this data.

Details:

Python Environment: Miniconda, Python 3.13 OpenCOSMO-RS version: [Specify the version here] ORCA Version: ORCA 6.0 Operating System: [Specify OS here, e.g., Ubuntu 20.04]

Additional Notes:

I tried with different .orcacosmo files, and the error consistently appears with the same trace. The documentation does not specify any limitations for ORCA 6.0 output compatibility, so I assume the file format is supported.

Expected Behavior: OpenCOSMO-RS should parse the .orcacosmo file correctly and proceed with descriptor calculations without errors.

Request for Help: Could you provide guidance on whether this is a compatibility issue or if there is a workaround for this error? Additionally, if there is a specific format expected for the .orcacosmo file beyond the standard ORCA output, please let me know.

Thank you for your assistance!

simonmb commented 3 weeks ago

Hi, can you change the line of code in moleules.py to:

self.seg_sigma_raw = cosmo_info['seg_sigma_raw'] if cosmo_info['seg_sigma_raw'].size != 0 else cosmo_info['seg_sigma_raw_uncorrected']

If you can confirm, that this solves the issue, I would commit the changes.

VN-jsjeon commented 3 weeks ago

Thank you for your quick response, and it has been resolved.

simonmb commented 3 weeks ago

I fixed this with the latest commit