Ejemplo n.º 1
0
    def __init__(self, filename="OUTCAR", poscar="POSCAR"):
        """
        Create a OUTCAR file class.

        Parameters:
        -----------
        filename: File name of OUTCAR, default name is "OUTCAR"(OUTCAR in current path).

        poscar: File name of POSCAR, default value is "POSCAR"(POSCAR in current path).

        Example:

        >>> a = OutCar(filename='OUTCAR', poscar="POSCAR")

        Class attributes descriptions
        =================================================================
          Attribute           Description
          ===============    ============================================
          filename            string, name of OUTCAR file
          max_forces          list of float, 每个离子步迭代的最大原子受力
          last_max_force      float, 最后一步的最大原子受力
          last_max_atom       int, 最后一步受力最大原子序号
          zpe                 float, 零点能
          freq_types          list of str, 频率类型列表
          ===============    ============================================
        """
        VasPy.__init__(self, filename)

        # Get PosCar object.
        self.poscar = PosCar(poscar)

        # Check parameter validity.
        self.__check()
Ejemplo n.º 2
0
    def __init__(self, filename='OSZICAR'):
        """
        Create a OSZICAR file class.

        Example:

        >>> a = OsziCar(filename='OSZICAR')

        Class attributes descriptions
        =======================================================================
          Attribute      Description
          ============  =======================================================
          filename       string, name of the file the direct coordiante data
                         stored in
          vars           list of strings, 每次迭代得到的数据
          esort()        method, 对数据进行排序
          plot()         method, 对数据绘图
          ============  =======================================================
        """
        VasPy.__init__(self, filename)

        #set regex patterns
        float_regex = r'[\+|-]?\d*\.\d*(?:[e|E][\+|-]?\d+)?'
        eq_regex = r'\s*([\w|\d|\s]+)\=\s*(' + float_regex + r')\s*'
        split_regex = r'^\s*(\d+)\s*((' + eq_regex + r')+)$'  # 将step和其余部分分开

        self.eq_regex = re.compile(eq_regex)
        self.split_regex = re.compile(split_regex)

        self.load()
Ejemplo n.º 3
0
    def __init__(self, filename="OUTCAR", poscar="POSCAR"):
        """
        Create a OUTCAR file class.

        Parameters:
        -----------
        filename: File name of OUTCAR, default name is "OUTCAR"(OUTCAR in current path).

        poscar: File name of POSCAR, default value is "POSCAR"(POSCAR in current path).

        Example:

        >>> a = OutCar(filename='OUTCAR', poscar="POSCAR")

        Class attributes descriptions
        =================================================================
          Attribute           Description
          ===============    ============================================
          filename            string, name of OUTCAR file
          max_forces          list of float, 每个离子步迭代的最大原子受力
          last_max_force      float, 最后一步的最大原子受力
          last_max_atom       int, 最后一步受力最大原子序号
          zpe                 float, 零点能
          freq_types          list of str, 频率类型列表
          ===============    ============================================
        """
        VasPy.__init__(self, filename)

        # Get PosCar object.
        self.poscar = PosCar(poscar)

        # Check parameter validity.
        self.__check()
Ejemplo n.º 4
0
    def __init__(self, filename="OSZICAR"):
        """
        Create a OSZICAR file class.

        Example:

        >>> a = OsziCar(filename='OSZICAR')

        Class attributes descriptions
        =======================================================
          Attribute      Description
          ============  =======================================
          filename       string, name of the SPLITED DOS file
          vars           list of strings, 每次迭代得到的数据
          esort()        method, 对数据进行排序
          plot()         method, 对数据绘图
          ============  =======================================
        """
        VasPy.__init__(self, filename)

        # set regex patterns
        float_regex = r"[\+|-]?\d*\.\d*(?:[e|E][\+|-]?\d+)?"
        eq_regex = r"\s*([\w|\d|\s]+)\=\s*(" + float_regex + r")\s*"
        split_regex = r"^\s*(\d+)\s*((" + eq_regex + r")+)$"  # 将step和其余部分分开

        self.eq_regex = re.compile(eq_regex)
        self.split_regex = re.compile(split_regex)

        self.load()
Ejemplo n.º 5
0
    def __init__(self, filename="OUT.ANI"):
        VasPy.__init__(self, filename)

        # Get the total atom number for data reading.
        with open(self.filename, "r") as f:
            natom = f.readline()

        self.natom = int(natom)
Ejemplo n.º 6
0
    def __init__(self, filename="OUT.ANI"):
        VasPy.__init__(self, filename)

        # Get the total atom number for data reading.
        with open(self.filename, "r") as f:
            natom = f.readline()

        self.natom = int(natom)
Ejemplo n.º 7
0
    def __init__(self, filename='INCAR'):
        """
        Create a INCAR file class.

        Example:

        >>> a = InCar()

        Class attributes descriptions
        =======================================================
          Attribute      Description
          ============  =======================================
          filename       string, name of INCAR file
          ============  =======================================
        """
        VasPy.__init__(self, filename)
        self.load()
Ejemplo n.º 8
0
 def __getattribute__(self, attr):
     '''
     确保dict能够及时根据data, tf值的变化更新.
     '''
     if attr == 'atomco_dict':
         return self.get_atomco_dict(self.data)
     elif attr == 'tf_dict':
         return self.get_tf_dict(self.tf)
     else:
         return VasPy.__getattribute__(self, attr)
Ejemplo n.º 9
0
 def __getattribute__(self, attr):
     '''
     确保dict能够及时根据data, tf值的变化更新.
     '''
     if attr == 'atomco_dict':
         return self.get_atomco_dict(self.data)
     elif attr == 'tf_dict':
         return self.get_tf_dict(self.tf)
     else:
         return VasPy.__getattribute__(self, attr)
Ejemplo n.º 10
0
    def __init__(self, filename='OUTCAR'):
        """
        Create a OUTCAR file class.

        Example:

        >>> a = OsziCar(filename='OUTCAR')

        Class attributes descriptions
        =======================================================================
          Attribute           Description
          ===============    ==================================================
          filename            string, name of OUTCAR file
          total_forces        1d array, 每个离子步迭代原子受到的总力
          atom_forces         2d array, 最近一次离子步迭代每个原子的受力数据
          max_force_atom      int, 最近一次离子步迭代受力最大原子序数
          ===============    ==================================================
        """
        VasPy.__init__(self, filename)
        self.load()
Ejemplo n.º 11
0
    def __init__(self, filename='OUTCAR'):
        """
        Create a OUTCAR file class.

        Example:

        >>> a = OsziCar(filename='OUTCAR')

        Class attributes descriptions
        =======================================================================
          Attribute           Description
          ===============    ==================================================
          filename            string, name of OUTCAR file
          total_forces        1d array, 每个离子步迭代原子受到的总力
          atom_forces         2d array, 最近一次离子步迭代每个原子的受力数据
          max_force_atom      int, 最近一次离子步迭代受力最大原子序数
          ===============    ==================================================
        """
        VasPy.__init__(self, filename)
        self.load()
Ejemplo n.º 12
0
 def __getattribute__(self, attr):
     """
     Make sure we can return the newest data and tf.
     确保dict能够及时根据data, tf值的变化更新.
     """
     if attr == 'atomco_dict':
         return self.get_atomco_dict(self.data)
     elif attr == 'tf_dict':
         return self.get_tf_dict(self.tf)
     else:
         return VasPy.__getattribute__(self, attr)
Ejemplo n.º 13
0
 def __getattribute__(self, attr):
     """
     Make sure we can return the newest data and tf.
     确保dict能够及时根据data, tf值的变化更新.
     """
     if attr == "atomco_dict":
         return self.get_atomco_dict(self.data)
     elif attr == "tf_dict":
         return self.get_tf_dict(self.tf)
     else:
         return VasPy.__getattribute__(self, attr)
Ejemplo n.º 14
0
 def __init__(self, filename):
     VasPy.__init__(self, filename)
Ejemplo n.º 15
0
 def __init__(self, filename):
     VasPy.__init__(self, filename)