Skip to content

AssertionError: "coordinates shape is not align atoms" when using custom dict input for UniMolRepr.get_repr() #6

@srdjan125

Description

@srdjan125

Describe the bug

I’m trying to use the UniMolRepr class with a custom molecule input in the form of a dict containing 'atoms' and 'coordinates', following the documentation. However, I get an AssertionError deep inside the library stating:

AssertionError: coordinates shape is not align atoms

Here is my minimal example code:

from unimol_tools import UniMolRepr

data = {
'atoms': ['C', 'C', 'O', 'N', 'H', 'H'],
'coordinates': [
[0.0, 0.0, 0.0],
[1.2, 0.0, 0.0],
[2.4, 0.1, 0.0],
[0.0, 1.3, 0.0],
[-0.5, -0.8, 0.0],
[1.7, -0.9, 0.0]
]
}

clf = UniMolRepr(data_type='molecule', remove_hs=True)
result = clf.get_repr(data, return_atomic_reprs=True)

print("cls_repr shape:", result['cls_repr'].shape)
print("atomic_reprs shape:", result['atomic_reprs'].shape)

The atoms list and coordinates list have matching lengths (6 atoms, 6 coordinate sets). The coordinates are well-formed 3D lists.

Full error traceback snippet:

AssertionError: coordinates shape is not align atoms

I’ve verified that the lengths and shapes are correct, but it still fails inside the inner_coords function in conformer.py. Could you please clarify the expected input format for the data dict or let me know if this is a bug?

Thank you!

unimol_tools Version

latet one

Expected behavior

I provide data as given in your documenations, I don't understand why do I get this erroe

To Reproduce

No response

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions