Skip to content

Small issue in atom2valence dictionary iteration in Molecule.is_valid #236

Open
@UmarZein

Description

@UmarZein

specs:
Python 3.11.4 (i am using my fork of torchdrug only to alleviate versioning constraints)
torch.__version__: 2.1.0+cu118
torchdrug.__version__: 0.2.1


calling Molecule.is_valid gives me the following error:

File ~\anaconda3\Lib\site-packages\torchdrug\data\molecule.py:521, in Molecule.is_valid(self)
    519 # TODO: cross-check by any domain expert
    520 atom2valence = torch.tensor(float("nan")).repeat(constant.NUM_ATOM)
--> 521 for k, v in self.atom2valence:
    522     atom2valence[k] = v
    523 atom2valence = torch.as_tensor(atom2valence, device=self.device)

TypeError: cannot unpack non-iterable int object

Wouldn't using dict.items() be the correct way to iterate over key-value pairs in a dict, as it is the case in PackerMolecule.is_valid?

for k,v in self.atom2valence.items():

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions