peteboyd/lammps_interface

TypeError: 'method' object is not iterable

Closed this issue · 1 comments

Hi,

I was having this error when executing lammps_interface in the command line:

File "/usr/local/bin/lammps_interface", line 14, in
sim.assign_force_fields()
File "/home/user/Documents/programs/lammps_interface/lammps_interface/lammps_main.py", line 442, in assign_force_fields
param = getattr(ForceFields, self.options.force_field)(**attr)
File "/home/user/Documents/programs/lammps_interface/lammps_interface/ForceFields.py", line 3144, in init
self.compute_force_field_terms()
File "/home/user/Documents/programs/lammps_interface/lammps_interface/ForceFields.py", line 53, in compute_force_field_terms
self.compute_atomic_pair_terms()
File "/home/user/Documents/programs/lammps_interface/lammps_interface/ForceFields.py", line 60, in compute_atomic_pair_terms
charges = not np.allclose(0.0, [float(self.graph.node[i]['charge']) for i in list(self.graph.nodes)], atol=0.00001)
TypeError: 'method' object is not iterable

To solve this, I added "()" to "self.graph.nodes" in the 60th line of ForceFields.py, and 306th line of lammps_main.py:
charges = not np.allclose(0.0, [float(self.graph.node[i]['charge']) for i in list(self.graph.nodes())], atol=0.00001)

Best regards

fixed in #64 thanks to @jaharvey8 !