Пример #1
0
 def alat2angstroem(self):
     for atom in self.at():
         coo=[float(0.0),float(0.0),float(0.0)]
         # calculate coordinates
         coo=calc.scal_vecmult(self.celldm_vec()[0],atom.coord())
         # set relative and real coordinates
         atom.coord_crystal=atom.coord()
         atom.set_pos(coo)
Пример #2
0
 def crystal2angstroem(self):
     for atom in self.at():
         coo=[float(0.0),float(0.0),float(0.0)]
         # calculate coordinates
         for dim in range(len(atom.coord())):
             coo=calc.vecadd(coo,calc.scal_vecmult(
                 atom.coord()[dim],self.vec()[dim])
             )
         # set relative and real coordinates
         atom.coord_crystal=atom.coord()
         atom.set_pos(coo)
Пример #3
0
 def mol_multiply(self,mx,my,mz,offset=[0,0,0]):
     if not hasattr(self,"mol"): self.extend()
     # copy the molecules
     v=self.vec()
     for ix in range(offset[0],mx+offset[0]):
         for iy in range(offset[1],my+offset[1]):
             for iz in range(offset[2],mz+offset[2]):
                 x=float(ix)
                 y=float(iy)
                 z=float(iz)
                 shift=[x*v[0][0]+y*v[1][0]+z*v[2][0],
                        x*v[0][1]+y*v[1][1]+z*v[2][1],
                        x*v[0][2]+y*v[1][2]+z*v[2][2]]
                 if not(x==0 and y==0 and z==0): 
                     self.append_submol(self.mol[0],shift)
     # reset vectors
     self.set_vecs(calc.scal_vecmult(mx,self.celldm_vec()[1][0]),
                   calc.scal_vecmult(my,self.celldm_vec()[1][1]),
                   calc.scal_vecmult(mz,self.celldm_vec()[1][2]))
     self.extend_set()
     return