From dbdcf733a94f0104f33daa4125b1bd6b7a848240 Mon Sep 17 00:00:00 2001 From: Andy Xu <68248599+andaero@users.noreply.github.com> Date: Wed, 8 Jan 2025 02:37:45 -0500 Subject: [PATCH] Support tuples for random_crystal Bugfix for _check_consistency for tuples, otherwise causes the following error: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'tuple' --- pyxtal/crystal.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyxtal/crystal.py b/pyxtal/crystal.py index 09ec58d9..a8bfdfdc 100644 --- a/pyxtal/crystal.py +++ b/pyxtal/crystal.py @@ -404,6 +404,9 @@ def _check_consistency(self, site, numIon): if isinstance(s, dict): for key in s: num += int(key[:-1]) + elif isinstance(s, tuple): + (letter, x, y, z) = s + num += int(letter[:-1]) else: num += int(s[:-1]) if numIon == num: