manny405 / mcse

Molecular Crystal Simulation Library (mcse) is an open-source Python package for manipulating and analyzing molecular crystal structures
Apache License 2.0
14 stars 1 forks source link

Typerror when running RMSD #4

Open ignaciomigliaro opened 1 year ago

ignaciomigliaro commented 1 year ago

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.

ankur56 commented 6 months ago

I am getting the same error.