To write trajectory of helcial-axis as a PDB format file.

        Both local helical axis and global (smoothed) axis can be written to PDB file.
        For global axis, curvature could be written in B-factor field of PDB file.

        Parameters
        ----------
        filename : str
            Name of the output PDB format file.

        step_range : bool
            * ``step_range = True`` : Make axis smooth for the given range of base-steps
            * ``step_range = False``: Make axis smooth for entire DNA. If original helical-axis of any base-step will
                be found to be not available, error will be raised.

        step : list
            List containing lower and higher limit of base-steps range.
                * This option only works with ``step_range=True``.
                * This list should not contain more than two number.
                * First number should be less than second number.

            Example for base-step 4 to 15:
                ``step = [4,15]         # step_range = True``

        write_smooth_axis : bool
            Write coordinates of smoothed helical axis as chain A.

        write_orig_axis : bool
            Write coordinates of original helical axis (output from do_x3dna) as chain B.

        write_curv : bool
            Write curvature of smoothed helical axis in B-factor column of PDB file.

        scale_curv : int
            Scaling of curvature. ``curvature * scale_curv`` is written in  B-factor column of PDB file.

def write_haxis_pdb(self, filename='helical_axis.pdb', step_range=False, step=None, write_smooth_axis=True, write_orig_axis=False, write_curv=False, scale_curv=1):
        """To write trajectory of helcial-axis as a PDB format file.

        Both local helical axis and global (smoothed) axis can be written to PDB file.
        For global axis, curvature could be written in B-factor field of PDB file.

        Parameters
        ----------
        filename : str
            Name of the output PDB format file.

        step_range : bool
            * ``step_range = True`` : Make axis smooth for the given range of base-steps
            * ``step_range = False``: Make axis smooth for entire DNA. If original helical-axis of any base-step will
                be found to be not available, error will be raised.

        step : list
            List containing lower and higher limit of base-steps range.
                * This option only works with ``step_range=True``.
                * This list should not contain more than two number.
                * First number should be less than second number.

            Example for base-step 4 to 15:
                ``step = [4,15]         # step_range = True``

        write_smooth_axis : bool
            Write coordinates of smoothed helical axis as chain A.

        write_orig_axis : bool
            Write coordinates of original helical axis (output from do_x3dna) as chain B.

        write_curv : bool
            Write curvature of smoothed helical axis in B-factor column of PDB file.

        scale_curv : int
            Scaling of curvature. ``curvature * scale_curv`` is written in  B-factor column of PDB file.

        """

        if (step_range) and (step == None):
            raise ValueError(
                "See, documentation for step  and step_range usage!!!")

        if not write_orig_axis and not write_smooth_axis:
            raise ValueError(
                "Nothing to write as both \"write_orig_axis=False\" and \"write_smooth_axis=False\" !!!")

        if step_range:
            if (len(step) != 2):
                raise ValueError("See, documentation for step usage!!!")

            if step[0] > step[1]:
                raise ValueError("See, documentation for step usage!!!")

            # Original helical axis
            if (write_orig_axis):
                RawX, bp_idx = self.get_parameters(
                    'helical x-axis', step, bp_range=True)
                RawY, dummy = self.get_parameters(
                    'helical y-axis', step, bp_range=True)
                RawZ, dummy = self.get_parameters(
                    'helical z-axis', step, bp_range=True)

            # Smoothed helical axis
            if (write_smooth_axis):
                SmoothX, bp_idx = self.get_parameters(
                    'helical x-axis smooth', step, bp_range=True)
                SmoothY, bp_idx = self.get_parameters(
                    'helical y-axis smooth', step, bp_range=True)
                SmoothZ, bp_idx = self.get_parameters(
                    'helical z-axis smooth', step, bp_range=True)

            # curvature
            if (write_curv):
                curvature, bp_idx = self.get_parameters(
                    'curvature', step, bp_range=True)

        else:

            # Original helical axis
            if (write_orig_axis):
                RawX, bp_idx = self.get_parameters(
                    'helical x-axis', [1, self.num_step], bp_range=True)
                RawY, dummy = self.get_parameters(
                    'helical y-axis', [1, self.num_step], bp_range=True)
                RawZ, dummy = self.get_parameters(
                    'helical z-axis', [1, self.num_step], bp_range=True)

            # Smoothed helical axis
            if (write_smooth_axis):
                SmoothX, bp_idx = self.get_parameters(
                    'helical x-axis smooth', [1, self.num_step], bp_range=True)
                SmoothY, bp_idx = self.get_parameters(
                    'helical y-axis smooth', [1, self.num_step], bp_range=True)
                SmoothZ, bp_idx = self.get_parameters(
                    'helical z-axis smooth', [1, self.num_step], bp_range=True)

            # curvature
            if (write_curv):
                curvature, bp_idx = self.get_parameters(
                    'curvature', [1, self.num_step], bp_range=True)

        if (write_orig_axis):
            RawX = np.array(RawX).T
            RawY = np.array(RawY).T
            RawZ = np.array(RawZ).T

        if (write_smooth_axis):
            SmoothX = np.array(SmoothX).T
            SmoothY = np.array(SmoothY).T
            SmoothZ = np.array(SmoothZ).T

        if (write_curv):
            curvature = np.array(curvature).T

        f = open(filename, 'w')

        for i in range(len(self.time)):
            f.write('%-6s    %4d\n' % ("MODEL", i + 1))

            bfactor = 0.00

            if (write_smooth_axis):
                for j in range(len(SmoothX[i])):

                    if (write_curv):
                        bfactor = curvature[i][j] * scale_curv

                    f.write('%-6s%5d %4s%1s%3s %1s%4d%1s   %8.3f%8.3f%8.3f%6.2f%6.2f\n' % ("ATOM", j + 1, "CA",
                                                                                           " ", "AXS", "A", j + 1, " ", SmoothX[i][j], SmoothY[i][j], SmoothZ[i][j], 1.00, bfactor))

                for j in range(len(SmoothX[i]) - 1):
                    f.write('CONECT %4d %4d\n' % (j + 1, j + 2))

                f.write("TER\n")

            if (write_orig_axis):
                atomstart = 0
                if (write_smooth_axis):
                    atomstart = len(SmoothX[i])

                for j in range(len(RawX[i])):
                    f.write('%-6s%5d %4s%1s%3s %1s%4d%1s   %8.3f%8.3f%8.3f%6.2f%6.2f\n' % ("ATOM", j + 1 +
                                                                                           atomstart, "O", " ", "AXS", "B", j + 1, " ", RawX[i][j], RawY[i][j], RawZ[i][j], 1.00, 0.00))

                for j in range(len(RawX[i]) - 1):
                    f.write('CONECT %4d %4d\n' %
                            (j + 1 + atomstart, j + 2 + atomstart))

                f.write("TER\n")

            f.write("ENDMDL\n")

        f.close()