def _read_lattice(self,line): line = self.fd.readline() line = self.fd.readline() ax = float(line.split()[0]) ay = float(line.split()[1]) az = float(line.split()[2]) line = self.fd.readline() bx = float(line.split()[0]) by = float(line.split()[1]) bz = float(line.split()[2]) line = self.fd.readline() cx = float(line.split()[0]) cy = float(line.split()[1]) cz = float(line.split()[2]) aVector = [ ax, ay, az ] bVector = [ bx, by, bz ] cVector = [ cx, cy, cz ] cell = UnitCell(aVector, bVector, cVector) self.unitCells.append(cell) self.volume = cell.volume self.ncells = len(self.unitCells) # Convert fractional coordinates to cartesians if len(self.cartesian_coordinates) == 0: if len(self.fractional_coordinates) == 0: print("Error no coordinates fraction or cartesian found") exit() for atom_frac in self.fractional_coordinates: atom_cart = cell.convertAbc2Xyz(atom_frac) self.cartesian_coordinates.append(atom_cart) # end for # end if self.unitCells[-1].fractionalCoordinates(self.fractional_coordinates)
def _read_lattice_vectors(self,line): self.volume = float(line.split()[4]) line = self.fd.readline() line = self.fd.readline() aVector = [ float(line.split()[0]), float(line.split()[1]), float(line.split()[2]) ] line = self.fd.readline() bVector = [ float(line.split()[0]), float(line.split()[1]), float(line.split()[2]) ] line = self.fd.readline() cVector = [ float(line.split()[0]), float(line.split()[1]), float(line.split()[2]) ] cell = UnitCell(aVector, bVector, cVector) if self.ncells > 0: cell.fractionalCoordinates(self.unitCells[-1].fractional_coordinates) self.unitCells.append(cell) self.ncells = len(self.unitCells) return