-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from pyiron/get_cell
Get cell
- Loading branch information
Showing
5 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
get_wrapped_coordinates, | ||
pymatgen_to_ase, | ||
select_index, | ||
get_cell, | ||
) | ||
|
||
# Visualize | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# coding: utf-8 | ||
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department | ||
# Distributed under the terms of "New BSD License", see the LICENSE file. | ||
|
||
import unittest | ||
import numpy as np | ||
from ase.build import bulk | ||
import structuretoolkit as stk | ||
|
||
|
||
class TestHelpers(unittest.TestCase): | ||
def test_get_cell(self): | ||
self.assertEqual((3 * np.eye(3)).tolist(), stk.get_cell(3).tolist()) | ||
self.assertEqual( | ||
([1, 2, 3] * np.eye(3)).tolist(), stk.get_cell([1, 2, 3]).tolist() | ||
) | ||
atoms = bulk("Fe") | ||
self.assertEqual( | ||
atoms.cell.tolist(), stk.get_cell(atoms).tolist() | ||
) | ||
with self.assertRaises(ValueError): | ||
stk.get_cell(np.arange(4)) | ||
with self.assertRaises(ValueError): | ||
stk.get_cell(np.ones((4, 3))) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |