Skip to content

Commit 52b3bd8

Browse files
authored
Merge pull request #3 from manny405/make_unit_tests
Added MCSENeighborList from dev
2 parents 0f059e5 + ef942d7 commit 52b3bd8

File tree

4 files changed

+1399
-5
lines changed

4 files changed

+1399
-5
lines changed

mcse/core/structure.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,20 +401,23 @@ def from_geo_array(self, geometry, elements):
401401

402402

403403
@classmethod
404-
def from_geo(cls, array, elements, lat=[]):
404+
def from_geo(cls, array, elements, lat=[], struct_id=""):
405405
"""
406406
Construction method of Structure object.
407407
408408
"""
409409
struct = cls()
410410
struct.from_geo_array(array, elements)
411-
struct.get_struct_id(update=True)
411+
if len(struct_id) == 0:
412+
struct.get_struct_id(update=True)
413+
else:
414+
struct.struct_id = struct_id
412415
if len(lat) > 0:
413416
struct.set_lattice_vectors(lat)
414417
return struct
415418

416419

417-
def get_sub(self, idx, lattice=True):
420+
def get_sub(self, idx, lattice=True, struct_id=""):
418421
"""
419422
Returns the sub-structure with respect to provided indices.
420423
@@ -426,7 +429,9 @@ def get_sub(self, idx, lattice=True):
426429
If True, will include the original lattice vectors
427430
"""
428431
geo = self.get_geo_array()
429-
sub = Structure.from_geo(geo[idx], self.elements[idx])
432+
sub = Structure.from_geo(geo[idx],
433+
self.elements[idx],
434+
struct_id=struct_id)
430435
sub.properties["Parent_ID"] = self.struct_id
431436
if lattice:
432437
if len(self.lattice) > 0:

0 commit comments

Comments
 (0)