Skip to content

Commit

Permalink
fixed tests and prevent symmetrically_remove_atoms() from removing at…
Browse files Browse the repository at this point in the history
…oms on the same layer
  • Loading branch information
richardtran415 committed Aug 15, 2018
1 parent fb89fa4 commit 8abc50e
Show file tree
Hide file tree
Showing 3 changed files with 607 additions and 568 deletions.
5 changes: 3 additions & 2 deletions pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ def symmetrically_remove_atoms(self, indices):
for i2 in eq_indices:
if i2 == i1:
continue

if slabcopy[i2].frac_coords[2] == slabcopy[i1].frac_coords[2]:
continue
# Test site remove to see if it results in symmetric slab
s = self.copy()
s.remove_sites([i1, i2])
Expand Down Expand Up @@ -1475,7 +1476,7 @@ def build_slabs(self):
for p in pts_to_rm:
p[2] = slab.lattice.get_fractional_coords([top_site[0], top_site[1],
top_site[2]+p[2]*d])[2]
cart_point = self.lattice.get_cartesian_coords(p)
cart_point = slab.lattice.get_cartesian_coords(p)
dist = [site.distance_from_point(cart_point) for site in slab]
site1 = dist.index(min(dist))
slab.symmetrically_remove_atoms([site1])
Expand Down
38 changes: 38 additions & 0 deletions pymatgen/core/tests/slab.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# generated using pymatgen
data_Ti5O
_symmetry_space_group_name_H-M 'P 1'
_cell_length_a 4.60000000
_cell_length_b 4.60000000
_cell_length_c 22.56000000
_cell_angle_alpha 90.00000000
_cell_angle_beta 90.00000000
_cell_angle_gamma 120.00000000
_symmetry_Int_Tables_number 1
_chemical_formula_structural Ti5O
_chemical_formula_sum 'Ti10 O2'
_cell_volume 413.41420059
_cell_formula_units_Z 2
loop_
_symmetry_equiv_pos_site_id
_symmetry_equiv_pos_as_xyz
1 'x, y, z'
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_symmetry_multiplicity
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_occupancy
Ti Ti1 1 0.000000 0.000000 0.093750 1
Ti Ti2 1 0.000000 0.000000 0.218750 1
Ti Ti3 1 0.333333 0.666667 0.156250 1
Ti Ti4 1 0.666667 0.333333 0.156250 1
Ti Ti5 1 0.000000 0.000000 0.343750 1
Ti Ti6 1 0.333333 0.666667 0.281250 1
Ti Ti7 1 0.666667 0.333333 0.281250 1
Ti Ti8 1 0.000000 0.000000 0.468750 1
Ti Ti9 1 0.333333 0.666667 0.406250 1
Ti Ti10 1 0.666667 0.333333 0.406250 1
O O11 1 0.000000 0.000000 0.568750 1
O O12 1 0.000000 0.000000 -0.006250 1
Loading

0 comments on commit 8abc50e

Please sign in to comment.