예제 #1
0
    def __copy__(self, target=None):
        '''Create a deep copy of this instance.

        target   -- optional target instance for copying, useful for
                    copying a derived class.  Defaults to new instance
                    of the same type as self.

        Return a duplicate instance of this object.
        '''
        if target is None:
            target = Structure()
        elif target is self:
            return target
        # copy attributes as appropriate:
        target.title = self.title
        target.lattice = Lattice(self.lattice)
        target.pdffit = copy.deepcopy(self.pdffit)
        # copy all atoms to the target
        target[:] = self
        return target
예제 #2
0
 def __emptySharedStructure(self):
     '''Return empty Structure with standard attributes same as in self.
     '''
     rv = Structure()
     rv.__dict__.update([(k, getattr(self, k)) for k in rv.__dict__])
     return rv