Skip to content

Commit

Permalink
Added MCSENeighborList from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
manny405 committed Feb 13, 2022
1 parent 60bc1c3 commit ef942d7
Show file tree
Hide file tree
Showing 4 changed files with 1,399 additions and 5 deletions.
13 changes: 9 additions & 4 deletions mcse/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,20 +401,23 @@ def from_geo_array(self, geometry, elements):


@classmethod
def from_geo(cls, array, elements, lat=[]):
def from_geo(cls, array, elements, lat=[], struct_id=""):
"""
Construction method of Structure object.
"""
struct = cls()
struct.from_geo_array(array, elements)
struct.get_struct_id(update=True)
if len(struct_id) == 0:
struct.get_struct_id(update=True)
else:
struct.struct_id = struct_id
if len(lat) > 0:
struct.set_lattice_vectors(lat)
return struct


def get_sub(self, idx, lattice=True):
def get_sub(self, idx, lattice=True, struct_id=""):
"""
Returns the sub-structure with respect to provided indices.
Expand All @@ -426,7 +429,9 @@ def get_sub(self, idx, lattice=True):
If True, will include the original lattice vectors
"""
geo = self.get_geo_array()
sub = Structure.from_geo(geo[idx], self.elements[idx])
sub = Structure.from_geo(geo[idx],
self.elements[idx],
struct_id=struct_id)
sub.properties["Parent_ID"] = self.struct_id
if lattice:
if len(self.lattice) > 0:
Expand Down
Loading

0 comments on commit ef942d7

Please sign in to comment.