diff --git a/tools/analyze_phonons.py b/tools/analyze_phonons.py index 9f49e91c..42981e9d 100644 --- a/tools/analyze_phonons.py +++ b/tools/analyze_phonons.py @@ -297,7 +297,7 @@ def print_cumulative_thermal_conductivity(analyze_obj, cumulative_mode, file_res + str(beg_s) + " " + str(end_s) \ + " " + isotope + " " + file_isotope \ + " " + str(max_len) + " " \ - + str(d_len) + " " + options.temp + " "\ + + str(d_len) + " " + options.temp + " " \ + str(options.nsample) + " " \ + options.gridtype diff --git a/tools/interface/LAMMPS.py b/tools/interface/LAMMPS.py index f413e364..9a8873a3 100644 --- a/tools/interface/LAMMPS.py +++ b/tools/interface/LAMMPS.py @@ -191,7 +191,8 @@ def _print_displacements_and_forces(self, lammps_files, file_offset): f[i, 1], f[i, 2])) else: - raise RuntimeError("Could not find ITEM: TIMESTEP keyword in the dump file %s" % lammps_files[0]) + raise RuntimeError("Could not find ITEM: " + "TIMESTEP keyword in the dump file %s" % lammps_files[0]) @staticmethod def _compute_lattice_vector_from_boxparams(box_params): @@ -292,7 +293,8 @@ def _print_displacements(self, lammps_files, file_offset): disp[i, 2])) else: - raise RuntimeError("Could not find ITEM: TIMESTEP keyword in the dump file %s" % lammps_files[0]) + raise RuntimeError("Could not find ITEM: " + "TIMESTEP keyword in the dump file %s" % lammps_files[0]) def _print_atomicforces(self, lammps_files, file_offset): @@ -344,7 +346,7 @@ def _set_unit_conversion_factor(self, str_unit): def _set_output_flags(self, output_flags): self._print_disp, self._print_force, \ - self._print_energy, self._print_born = output_flags + self._print_energy, self._print_born = output_flags def _set_number_of_zerofill(self, npattern): diff --git a/tools/interface/OpenMX.py b/tools/interface/OpenMX.py index ee69ad60..fbf33ec7 100644 --- a/tools/interface/OpenMX.py +++ b/tools/interface/OpenMX.py @@ -110,13 +110,13 @@ def load_initial_structure(self, file_original): lavec.append([float(t) for t in line.strip().split()]) if ipos_lavec > ipos_coord: - common_settings.extend(lines[:ipos_coord-1]) - common_settings.extend(lines[fpos_coord+1:ipos_lavec-1]) - common_settings.extend(lines[fpos_lavec+1:]) + common_settings.extend(lines[:ipos_coord - 1]) + common_settings.extend(lines[fpos_coord + 1:ipos_lavec - 1]) + common_settings.extend(lines[fpos_lavec + 1:]) else: - common_settings.extend(lines[:ipos_lavec-1]) - common_settings.extend(lines[fpos_lavec+1:ipos_coord-1]) - common_settings.extend(lines[fpos_coord+1:]) + common_settings.extend(lines[:ipos_lavec - 1]) + common_settings.extend(lines[fpos_lavec + 1:ipos_coord - 1]) + common_settings.extend(lines[fpos_coord + 1:]) x_frac0 = np.array(x_frac0) lavec = np.array(lavec).transpose() @@ -366,7 +366,7 @@ def _set_unit_conversion_factor(self, str_unit): def _set_output_flags(self, output_flags): self._print_disp, self._print_force, \ - self._print_energy, self._print_born = output_flags + self._print_energy, self._print_born = output_flags @property def nat(self): diff --git a/tools/interface/QE.py b/tools/interface/QE.py index ce200975..f563a2dd 100644 --- a/tools/interface/QE.py +++ b/tools/interface/QE.py @@ -10,11 +10,13 @@ # or http://opensource.org/licenses/mit-license.php for information. # from __future__ import print_function -import numpy as np -import math + import copy +import math import sys +import numpy as np + class QEParser(object): @@ -765,7 +767,7 @@ def _set_unit_conversion_factor(self, str_unit): def _set_output_flags(self, output_flags): self._print_disp, self._print_force, \ - self._print_energy, self._print_born = output_flags + self._print_energy, self._print_born = output_flags @property def nat(self): @@ -918,7 +920,7 @@ def _get_coordinates_pwout(self, pwout_file): line = f.readline() if not found_tag: - #print("%s tag not found in %s" % (search_flag, pwout_file), file=sys.stderr) + # print("%s tag not found in %s" % (search_flag, pwout_file), file=sys.stderr) return None x = self._celldm[0] * np.dot(x, self._inverse_lattice_vector.transpose()) \ @@ -1030,7 +1032,7 @@ def _get_borninfo_phout(phout_file): found_tag1 = False found_tag2 = False - + while line: if search_tag1 in line: found_tag1 = True @@ -1055,5 +1057,3 @@ def _get_borninfo_phout(phout_file): dielec = np.reshape(np.array(dielec[9:]), (3, 3)) borncharge = np.reshape(np.array(borncharge), (nat2, 3, 3)) return dielec, borncharge[:nat2 // 2, :, :] - - diff --git a/tools/interface/xTAPP.py b/tools/interface/xTAPP.py index 4b33a0e5..409b530a 100644 --- a/tools/interface/xTAPP.py +++ b/tools/interface/xTAPP.py @@ -238,11 +238,12 @@ def _set_unit_conversion_factor(self, str_unit): else: raise RuntimeError("This cannot happen.") - self._force_conversion_factor = self._energy_conversion_factor / self._disp_conversion_factor + self._force_conversion_factor = (self._energy_conversion_factor + / self._disp_conversion_factor) def _set_output_flags(self, output_flags): self._print_disp, self._print_force, \ - self._print_energy, self._print_born = output_flags + self._print_energy, self._print_born = output_flags @property def nat(self): diff --git a/tools/plotband.py b/tools/plotband.py index 5111c749..160a4a87 100644 --- a/tools/plotband.py +++ b/tools/plotband.py @@ -230,7 +230,7 @@ def preprocess_data(files, unitname, normalize_xaxis, emin=None, emax=None): = gridspec_setup(data_merged, xtickslabels, xticksvars) return naxes, xticks_grids, xticklabels_grids, \ - xmin, xmax, ymin, ymax, data_merged_grids + xmin, xmax, ymin, ymax, data_merged_grids def run_plot(files, nax, xticks_ax, xticklabels_ax, xmin_ax, xmax_ax, ymin, ymax, @@ -318,7 +318,7 @@ def run_plot(files, nax, xticks_ax, xticklabels_ax, xmin_ax, xmax_ax, ymin, ymax print("Number of files = %d" % nfiles) nax, xticks_ax, xticklabels_ax, xmin_ax, xmax_ax, ymin, ymax, \ - data_merged_ax = preprocess_data( + data_merged_ax = preprocess_data( files, options.unitname, options.normalize_xaxis, options.emin, options.emax) run_plot(files, nax, xticks_ax, xticklabels_ax,