Skip to content

Conversation

@Lexachoc
Copy link

@Lexachoc Lexachoc commented Jun 3, 2025

Summary

This PR adds support for disabling the calculation of 3D descriptors independently in the from_smiles function, while preserving backward compatibility.

Problem

Currently, the from_smiles function uses a single descriptors flag to control both 2D and 3D descriptor calculation. However, some SMILES strings (e.g., "C") cause RuntimeError when 3D descriptors are enabled, even though they work fine with only 2D descriptors.

For example:

from padelpy import from_smiles

# This raises RuntimeError
from_smiles("C", descriptors=True)

# This works fine
padeldescriptor(mol_dir="input.smi", d_file="output.csv", d_2d=True, d_3d=False)

Usage behavior

If descriptors_3d is not provided, it defaults to the value of descriptors (preserving current behavior).

If descriptors_3d=False, 3D descriptor calculation is skipped even when descriptors=True.

Usage example:

from padelpy import from_smiles

# Only calculate 2D descriptors
from_smiles("C", descriptors=True, descriptors_3d=False)

# Or, in short
from_smiles("C", descriptors_3d=False)

Potential fix for

This change may also help fix related issues such as #51 or #9 and #11.

Lexachoc added 3 commits June 3, 2025 14:17
### Summary

This PR adds support for disabling the calculation of 3D descriptors independently in the `from_smiles` function, while preserving backward compatibility.

### Problem

Currently, the `from_smiles` function uses a single `descriptors` flag to control both 2D and 3D descriptor calculation. However, some SMILES strings (e.g., "C") cause `RuntimeError` when 3D descriptors are enabled, even though they work fine with only 2D descriptors.

For example:

```python
from padelpy import from_smiles

# This raises RuntimeError
from_smiles("C", descriptors=True)

# This works fine
padeldescriptor(mol_dir="input.smi", d_file="output.csv", d_2d=True, d_3d=False)

### Solution
If `descriptors_3d` is not provided, it defaults to the value of descriptors (preserving current behavior).

If `descriptors_3d=False`, 3D descriptor calculation is skipped even when descriptors=True.
forgot to add the new flag for `from_mdl`
add usages of the new flag `descriptors_3d` for "from_mdl", "from_smiles", and "from_sdf" functions
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

Successfully merging this pull request may close these issues.

1 participant