From 97d7d0fa591c153c6dd869c8dcc83c5646c559a0 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Tue, 12 Oct 2021 10:08:03 +0200 Subject: [PATCH 1/5] Allow hcp 4-axes indices as well --- pyiron_atomistics/atomistics/structure/factories/atomsk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyiron_atomistics/atomistics/structure/factories/atomsk.py b/pyiron_atomistics/atomistics/structure/factories/atomsk.py index 984709b96..1401cfef9 100644 --- a/pyiron_atomistics/atomistics/structure/factories/atomsk.py +++ b/pyiron_atomistics/atomistics/structure/factories/atomsk.py @@ -52,9 +52,9 @@ def create(cls, lattice, a, *species, c=None, hkl=None): a_and_c = str(a) if c is None else f"{a} {c}" line = f"--create {lattice} {a_and_c} {' '.join(species)}" if hkl is not None: - if np.asarray(hkl).shape != (3, 3): - raise ValueError(f"hkl must have shape 3x3 if provided, not {hkl}!") - line += f" orient {' '.join(hkl[0])} {' '.join(hkl[1])} {' '.join(hkl[2])}" + if np.asarray(hkl).shape not in ( (3, 3), (4, 4) ): + raise ValueError(f"hkl must have shape 3x3 or 4x4 if provided, not {hkl}!") + line += " ".join(" ".join(a) for a in hkl) # TODO: check len(species) etc. with the document list of supported phases self._options.append(line) return self From 754e840aab6462ce5a724a560690ef4c1cf6d5f6 Mon Sep 17 00:00:00 2001 From: prince-mathews <65777748+prince-mathews@users.noreply.github.com> Date: Tue, 12 Oct 2021 11:51:52 +0200 Subject: [PATCH 2/5] Update atomsk.py It looks much better now. The input hkl for hcp structures should be a 3x4 matrix so I just changed that. --- pyiron_atomistics/atomistics/structure/factories/atomsk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyiron_atomistics/atomistics/structure/factories/atomsk.py b/pyiron_atomistics/atomistics/structure/factories/atomsk.py index 1401cfef9..b720ea074 100644 --- a/pyiron_atomistics/atomistics/structure/factories/atomsk.py +++ b/pyiron_atomistics/atomistics/structure/factories/atomsk.py @@ -52,8 +52,8 @@ def create(cls, lattice, a, *species, c=None, hkl=None): a_and_c = str(a) if c is None else f"{a} {c}" line = f"--create {lattice} {a_and_c} {' '.join(species)}" if hkl is not None: - if np.asarray(hkl).shape not in ( (3, 3), (4, 4) ): - raise ValueError(f"hkl must have shape 3x3 or 4x4 if provided, not {hkl}!") + if np.asarray(hkl).shape not in ( (3, 3), (3, 4) ): + raise ValueError(f"hkl must have shape 3x3 or 3x4 if provided, not {hkl}!") line += " ".join(" ".join(a) for a in hkl) # TODO: check len(species) etc. with the document list of supported phases self._options.append(line) From bc731a0fa8cdf5fc166d27525e1205a29148dfd7 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Thu, 14 Oct 2021 14:23:14 +0200 Subject: [PATCH 3/5] Update docstring --- pyiron_atomistics/atomistics/structure/factories/atomsk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyiron_atomistics/atomistics/structure/factories/atomsk.py b/pyiron_atomistics/atomistics/structure/factories/atomsk.py index b720ea074..71132fb3e 100644 --- a/pyiron_atomistics/atomistics/structure/factories/atomsk.py +++ b/pyiron_atomistics/atomistics/structure/factories/atomsk.py @@ -178,7 +178,7 @@ def create(self, lattice, a, *species, c=None, hkl=None): *species (list of str): chemical short symbols for the type of atoms to create, length depends on lattice type c (float, optional): third lattice parameter, only necessary for some lattice types - hkl (array of int, (3,3)): three hkl vectors giving the crystallographic axes that should point along the x, + hkl (array of int, (3,3) or (3,4)): three hkl vectors giving the crystallographic axes that should point along the x, y, z directions Returns: From eec82a26f0937dc7d7a1a4793adfcc6548eff9b9 Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Thu, 14 Oct 2021 14:25:14 +0200 Subject: [PATCH 4/5] Convert axes to str from int --- pyiron_atomistics/atomistics/structure/factories/atomsk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyiron_atomistics/atomistics/structure/factories/atomsk.py b/pyiron_atomistics/atomistics/structure/factories/atomsk.py index 71132fb3e..d5997947d 100644 --- a/pyiron_atomistics/atomistics/structure/factories/atomsk.py +++ b/pyiron_atomistics/atomistics/structure/factories/atomsk.py @@ -54,7 +54,7 @@ def create(cls, lattice, a, *species, c=None, hkl=None): if hkl is not None: if np.asarray(hkl).shape not in ( (3, 3), (3, 4) ): raise ValueError(f"hkl must have shape 3x3 or 3x4 if provided, not {hkl}!") - line += " ".join(" ".join(a) for a in hkl) + line += " ".join(" ".join(map(str, a)) for a in hkl) # TODO: check len(species) etc. with the document list of supported phases self._options.append(line) return self From 6dbd30ccda9eb6e18fb2b143bf9f2951369d049d Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Thu, 14 Oct 2021 14:40:12 +0200 Subject: [PATCH 5/5] Use correct syntax for orient flag --- pyiron_atomistics/atomistics/structure/factories/atomsk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyiron_atomistics/atomistics/structure/factories/atomsk.py b/pyiron_atomistics/atomistics/structure/factories/atomsk.py index d5997947d..b28ad2aa1 100644 --- a/pyiron_atomistics/atomistics/structure/factories/atomsk.py +++ b/pyiron_atomistics/atomistics/structure/factories/atomsk.py @@ -54,7 +54,7 @@ def create(cls, lattice, a, *species, c=None, hkl=None): if hkl is not None: if np.asarray(hkl).shape not in ( (3, 3), (3, 4) ): raise ValueError(f"hkl must have shape 3x3 or 3x4 if provided, not {hkl}!") - line += " ".join(" ".join(map(str, a)) for a in hkl) + line += "orient" + " ".join("[" + "".join(map(str, a)) + "]" for a in hkl) # TODO: check len(species) etc. with the document list of supported phases self._options.append(line) return self