Here is my code:
sa = SubstrateAnalyzer()
film = Structure.from_file('xxx')
docs = loadfn("substrates_doc.json.gz")
for doc in tqdm(docs[0:1]):
substrate = doc["structure"]
generator = sa.calculate(film,substrate,film_millers=(1,1,1),lowest=True)
a = sorted(generator,key = lambda x: x.substrate_miller)
The generator that SubstrateAnalyzer class with a calculate method returns can not use. The code was working fine before, but now I am getting an error .The error message are provided below. Can anyone help me understand what might be causing this issue and how to fix it? Thank you .
Traceback (most recent call last):
File "/home/lark/pythonplot/substrates/ana.py", line 27, in <module>
a = sorted(generator,key = lambda x: x.substrate_miller)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lark/anaconda3/lib/python3.12/site-packages/pymatgen/analysis/interfaces/substrate_analyzer.py", line 181, in calculate
surface_vector_sets = self.generate_surface_vectors(film, substrate, film_millers, substrate_millers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lark/anaconda3/lib/python3.12/site-packages/pymatgen/analysis/interfaces/substrate_analyzer.py", line 129, in generate_surface_vectors
film_slab = SlabGenerator(film, f_miller, 20, 15, primitive=False).get_slab()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lark/anaconda3/lib/python3.12/site-packages/pymatgen/core/surface.py", line 1040, in __init__
miller_index = reduce_vector(miller_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lark/anaconda3/lib/python3.12/site-packages/pymatgen/core/surface.py", line 940, in reduce_vector
divisor = abs(reduce(gcd, vector)) # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^
TypeError: reduce() arg 2 must support iteration