Skip to content

Typerror when running RMSD #4

Description

@ignaciomigliaro

Hi, great software, I have been trying to run the RMSD and get the visualiation , except when I try to run the calc_struct funciton, it gives the following error.


TypeError Traceback (most recent call last)
Cell In[69], line 12
9 struct_dict = read(file_path)
10 oc = OverlappingClusters(dpa=dpa, interactive=interactive)
---> 12 rmsd.calc_struct(struct_dict["3ddf4a302a"], struct_dict["8aeae1272d"])
13 oc.calc_struct(rmsd.overlapping_clusters)
14 oc.write("RMSD_Images")

File ~/programs/mcse/mcse/crystals/rmsd.py:121, in RMSD.calc_struct(self, struct1, struct2, pre)
119 if not self.H:
120 keep_idx = np.where(self.struct1.elements != "H")
--> 121 self.struct1 = self.struct1.get_sub(keep_idx, lattice=True)
122 self.struct1.get_molecule_idx(**{'mult': 1.2, 'skin': 0.0, 'update': True})
123 struct1 = self.struct1

File ~/programs/mcse/mcse/core/structure.py:442, in Structure.get_sub(self, idx, lattice, struct_id, bonds)
438 if bonds:
439 ### Pre-fetch bonds for mol_idx such that they don't need to be
440 ### re-computed upon instantiation of structure class
441 self.get_bonds(**self.bonds_kw)
--> 442 full_sub_bonds = [self.bonds[x] for x in idx]
443 new_sub_bonds = []
444 lookup = {}

File ~/programs/mcse/mcse/core/structure.py:442, in (.0)
438 if bonds:
439 ### Pre-fetch bonds for mol_idx such that they don't need to be
440 ### re-computed upon instantiation of structure class
441 self.get_bonds(**self.bonds_kw)
--> 442 full_sub_bonds = [self.bonds[x] for x in idx]
443 new_sub_bonds = []
444 lookup = {}

TypeError: only integer scalar arrays can be converted to a scalar index

My code is an exact replica of the code from the tutorial.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions