Example #1
0
 def parser(self,):
     """ parse poscar to system
     @todo : handle coordinates acoording to Direct tag
     """
     s = System()
     scale = float(self.scale)
     a = [scale*float(i) for i in self.a]
     b = [scale*float(i) for i in self.b]
     c = [scale*float(i) for i in self.c]
     s.name = self.name
     s.pbc = v2lattice(a, b, c)
     s.geotag = "XTLGRF 200"
     for i in range(len(self.atoms)):
         if i == 0:
             prev = 0
             now = int(self.atoms[0])
         else:
             prev = now
             now += int(self.atoms[i])
         for j in range(prev, now):
             atom = Atom()
             atom.name = self.atomtypes[i]
             x = float(self.coords[j][0])
             y = float(self.coords[j][1])
             z = float(self.coords[j][2])
             atom.x[0] = a[0]*x + b[0]*y + c[0]*z
             atom.x[1] = a[1]*x + b[1]*y + c[1]*z
             atom.x[2] = a[2]*x + b[2]*y + c[2]*z
             s.atoms.append(atom)
     return s
Example #2
0
 def parser(self, ):
     """ parse geo file into System
     """
     s = System()
     s.name = self.name
     s.pbc = [float(i) for i in self.pbc]
     s.geotag = self.type
     for i in self.coords:
         a = Atom()
         a.name = i[13:16]
         a.x[0] = float(i[31:41])
         a.x[1] = float(i[41:51])
         a.x[2] = float(i[51:61])
         s.atoms.append(a)
     return s
Example #3
0
 def parser(self,):
     """ parse geo file into System
     """
     s = System()
     s.name = self.name
     s.pbc = [float(i) for i in self.pbc]
     s.geotag = self.type
     for i in self.coords:
         a = Atom()
         a.name= i[13:16]
         a.x[0] = float(i[31:41])
         a.x[1] = float(i[41:51])
         a.x[2] = float(i[51:61])
         s.atoms.append(a)
     return s
Example #4
0
 def parser(self, ):
     """ parse poscar to system
     @todo : handle coordinates acoording to Direct tag
     """
     s = System()
     scale = float(self.scale)
     a = [scale * float(i) for i in self.a]
     b = [scale * float(i) for i in self.b]
     c = [scale * float(i) for i in self.c]
     s.name = self.name
     s.pbc = v2lattice(a, b, c)
     s.natoms = self.natoms
     s.atomtypes = self.atomtypes
     s.scaleFactor = self.scale
     s.geotag = "XTLGRF 200"
     for i in range(len(self.natoms)):
         if i == 0:
             prev = 0
             now = int(self.natoms[0])
         else:
             prev = now
             now += int(self.natoms[i])
         for j in range(prev, now):
             atom = Atom()
             #print self.atomtypes, i
             atom.name = self.atomtypes[i]
             x = float(self.coords[j][0])
             y = float(self.coords[j][1])
             z = float(self.coords[j][2])
             atom.xFrac = [x, y, z]
             atom.x[0] = a[0] * x + b[0] * y + c[0] * z
             atom.x[1] = a[1] * x + b[1] * y + c[1] * z
             atom.x[2] = a[2] * x + b[2] * y + c[2] * z
             if len(self.coords[j]) == 6 and self.sd == 1:
                 xr = self.coords[j][3]
                 yr = self.coords[j][4]
                 zr = self.coords[j][5]
                 if xr == "F":
                     atom.xr[0] = 1
                 if yr == "F":
                     atom.xr[1] = 1
                 if zr == "F":
                     atom.xr[2] = 1
             if len(self.coords[j]) == 3:
                 atom.xr = [0, 0, 0]
             s.atoms.append(atom)
     return s
Example #5
0
 def parser(self,):
     """ parse poscar to system
     @todo : handle coordinates acoording to Direct tag
     """
     s = System()
     scale = float(self.scale)
     a = [scale*float(i) for i in self.a]
     b = [scale*float(i) for i in self.b]
     c = [scale*float(i) for i in self.c]
     s.name = self.name
     s.pbc = v2lattice(a, b, c)
     s.natoms = self.natoms
     s.atomtypes = self.atomtypes
     s.scaleFactor = self.scale
     s.geotag = "XTLGRF 200"
     for i in range(len(self.natoms)):
         if i == 0:
             prev = 0
             now = int(self.natoms[0])
         else:
             prev = now
             now += int(self.natoms[i])
         for j in range(prev, now):
             atom = Atom()
             #print self.atomtypes, i
             atom.name = self.atomtypes[i]
             x = float(self.coords[j][0])
             y = float(self.coords[j][1])
             z = float(self.coords[j][2])
             atom.xFrac = [x, y, z]
             atom.x[0] = a[0]*x + b[0]*y + c[0]*z
             atom.x[1] = a[1]*x + b[1]*y + c[1]*z
             atom.x[2] = a[2]*x + b[2]*y + c[2]*z
             if len(self.coords[j]) == 6 and self.sd == 1:
                 xr = self.coords[j][3]
                 yr = self.coords[j][4]
                 zr = self.coords[j][5]
                 if xr == "F":
                     atom.xr[0] = 1
                 if yr == "F":
                     atom.xr[1] = 1
                 if zr == "F":
                     atom.xr[2] = 1
             s.atoms.append(atom)
     return s