From 2d574e118fae3c96c9813cb1e02bc20fc909a081 Mon Sep 17 00:00:00 2001 From: qzhu2017 Date: Wed, 24 Jan 2024 15:41:39 -0500 Subject: [PATCH] fix the bug and not pyxtal accepts the input of array for lattice in the build function --- pyxtal/__init__.py | 9 +++++---- pyxtal/test_all.py | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pyxtal/__init__.py b/pyxtal/__init__.py index 8fd19665..c48612a0 100644 --- a/pyxtal/__init__.py +++ b/pyxtal/__init__.py @@ -1479,7 +1479,7 @@ def build(self, group, species, numIons, lattice, sites, tol=1e-2, use_hall=Fals self.group = Group(group, use_hall=use_hall) # Lattica needs some special handling heree - if not isinstance(lattice, Lattice): + if type(lattice) != Lattice: if type(lattice) == np.ndarray: ltype = self.group.lattice_type if len(lattice) == 3: @@ -1493,9 +1493,10 @@ def build(self, group, species, numIons, lattice, sites, tol=1e-2, use_hall=Fals else: msg = 'Cannot convert the input array to pyxtal.lattice.Lattice' raise ValueError(msg, lattice) - else: - msg = 'The input lattice needs to be a pyxtal.lattice.Lattice class' - raise ValueError(msg) + #else: + # print(lattice, type(lattice), type(lattice)==Lattice, type(lattice)!=Lattice) + # msg = 'The input lattice needs to be a pyxtal.lattice.Lattice class' + # raise ValueError(msg, lattice) self.lattice = lattice self.dim = 3 diff --git a/pyxtal/test_all.py b/pyxtal/test_all.py index 738fb43b..3899be03 100644 --- a/pyxtal/test_all.py +++ b/pyxtal/test_all.py @@ -1140,21 +1140,21 @@ class Test_operations(unittest.TestCase): def test_inverse(self): coord0 = [0.35, 0.1, 0.4] coords = np.array([ - [0.350, 0.100, 0.400], - [0.350, 0.100, 0.000], - [0.350, 0.100, 0.000], - [0.350, 0.000, 0.667], - [0.350, 0.000, 0.250], - [0.350, 0.350, 0.400], - [0.350, 0.350, 0.500], - [0.350, 0.350, 0.000], - [0.350, 0.350, 0.350], - [0.100, 0.100, 0.100], - [0.400, 0.400, 0.400], - [0.350, 0.000, 0.000], - [0.000, 0.100, 0.400], - [0.350, 0.000, 0.400], - ]) + [0.350, 0.100, 0.400], + [0.350, 0.100, 0.000], + [0.350, 0.100, 0.000], + [0.350, 0.000, 0.667], + [0.350, 0.000, 0.250], + [0.350, 0.350, 0.400], + [0.350, 0.350, 0.500], + [0.350, 0.350, 0.000], + [0.350, 0.350, 0.350], + [0.100, 0.100, 0.100], + [0.400, 0.400, 0.400], + [0.350, 0.000, 0.000], + [0.000, 0.100, 0.400], + [0.350, 0.000, 0.400], + ]) xyzs = ['x,y,z', 'x,y,0', 'y,x,0',