Skip to content

Commit

Permalink
crystal tool now compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
gduscher committed Jan 27, 2024
1 parent 33e6cd3 commit 6cdc048
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
7 changes: 4 additions & 3 deletions notebooks/0_pyTEMlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [],
"metadata": {
"collapsed": false
}
}
],
"metadata": {
Expand Down
11 changes: 1 addition & 10 deletions pyTEMlib/crystal_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,7 @@ def ball_and_stick(atoms, extend=1, max_bond_length=0.):
neighbor_list.update(super_cell)
bond_matrix = neighbor_list.get_connectivity_matrix()

del_double = []
for (k, s) in bond_matrix.keys():
if k > s:
del_double.append((k, s))
del_double.sort(reverse=False)
for key in del_double:
# Todo: why is ther a key error
# bond_matrix.pop(key)
pass

bond_matrix = np.triu(bond_matrix.toarray())
if super_cell.info is None:
super_cell.info = {}
super_cell.info['plot_cell'] = {'bond_matrix': bond_matrix, 'corner_vectors': corner_vectors,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_crystal_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_ball_and_stick(self):
[0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0]]
# np.testing.assert_allclose(cell_2_plot.info['plot_cell']['bond_matrix'].toarray(), bonds_desired)
np.testing.assert_allclose(cell_2_plot.info['plot_cell']['bond_matrix'], bonds_desired)

def test_from_dictionary(self):
tags = {'unit_cell': np.array([[4.05, 0, 0], [0, 4.05, 0], [0, 0, 4.05]]),
Expand Down

0 comments on commit 6cdc048

Please sign in to comment.