peteboyd / lammps_interface

automatic generation of LAMMPS input files for molecular dynamics simulations of MOFs
MIT License
125 stars 63 forks source link

Test error :TypeError: object of type 'dictionary-keyiterator' has no len() #6

Closed QianyuanLiu closed 6 years ago

QianyuanLiu commented 6 years ago

HI, After installing lammps_interface, I run the code to test by typing: >python lammps_interface.py C:\Users\Cloud-win10\Desktop\lammps_interface\IRMOF-1.cif but errors is throwed: `C:\Users\Cloud-win10\Desktop\lammps_interface>python lammps_interface.py C:\Users\Cloud-win10\Desktop\lammps_interface\IRMOF-1.cif

No bonds reported in cif file - computing bonding..

Traceback (most recent call last): File "lammps_interface.py", line 11, in sim.set_graph(graph) File "C:\Users\Cloud-win10\Desktop\lammps_interface\lammps_interface\lammps_main.py", line 375, in set_graph self.graph.compute_topology_information(self.cell, self.options.tol, self.options.neighbour_size) File "C:\Users\Cloud-win10\Desktop\lammps_interface\lammps_interface\structure_data.py", line 953, in compute_topology_information self.compute_init_typing() File "C:\Users\Cloud-win10\Desktop\lammps_interface\lammps_interface\structure_data.py", line 577, in compute_init_typing if len(neighbours) >= 2:

TypeError: object of type 'dictionary-keyiterator' has no len()`

I am a new for python. Cloud you help me ? thanks a lot. @peteboyd

peteboyd commented 6 years ago

@liuqy1994 - Thanks for the bug report. Turns out the networkx library version 2.0 has changed some of it's data structures, breaking the lammps interface code. I've made the appropriate fixes, so please test on your system. I've tested on a linux box and it now works, but I don't have access to a Windows machine. So if there are further bugs, please create a new issue and I will try to fix it ASAP. Thanks! Pete