@@ -401,20 +401,23 @@ def from_geo_array(self, geometry, elements):
401
401
402
402
403
403
@classmethod
404
- def from_geo (cls , array , elements , lat = []):
404
+ def from_geo (cls , array , elements , lat = [], struct_id = "" ):
405
405
"""
406
406
Construction method of Structure object.
407
407
408
408
"""
409
409
struct = cls ()
410
410
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
412
415
if len (lat ) > 0 :
413
416
struct .set_lattice_vectors (lat )
414
417
return struct
415
418
416
419
417
- def get_sub (self , idx , lattice = True ):
420
+ def get_sub (self , idx , lattice = True , struct_id = "" ):
418
421
"""
419
422
Returns the sub-structure with respect to provided indices.
420
423
@@ -426,7 +429,9 @@ def get_sub(self, idx, lattice=True):
426
429
If True, will include the original lattice vectors
427
430
"""
428
431
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 )
430
435
sub .properties ["Parent_ID" ] = self .struct_id
431
436
if lattice :
432
437
if len (self .lattice ) > 0 :
0 commit comments