Skip to content

Commit

Permalink
Fix minor bugs and improve python3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ttadano committed Feb 10, 2018
1 parent 1b19c03 commit 6743998
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/displace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ def read_OpenMX_input(file_original):

#errors
if nat == 0:
print "Could not read dat file properly."
print("Could not read dat file properly.")
exit(1)


Expand Down Expand Up @@ -1063,7 +1063,7 @@ def write_OpenMX_input(prefix, counter, nzerofills, disp, lavec, file_in):
conv_inv = np.linalg.inv(conv)

for i in range(nat):
print np.dot(conv_inv, disp[i])
print(np.dot(conv_inv, disp[i]))

disp[disp < 0] += 1

Expand Down
19 changes: 15 additions & 4 deletions tools/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def get_energies_QE(pwout_file):
found_tag = True

if not found_tag:
print("%s tag not found in %s" % (search_tag, search_target))
print("%s tag not found in %s" % (search_tag, pwout_file))
exit(1)

return np.array(etot, dtype=np.float)
Expand Down Expand Up @@ -904,7 +904,6 @@ def print_atomicforces_LAMMPS(lammps_files, nat,




"""OpenMX"""
# Function for OpenMX
def read_outfile(out_file, nat, column):
Expand Down Expand Up @@ -1214,11 +1213,20 @@ def refold(x):
disp_conv_factor = 1.0
energy_conv_factor = 1.0

else:
elif options.unitname == "Rydberg":
convert_unit = True
disp_conv_factor = 1.0 / Bohr_radius
energy_conv_factor = 1.0 / Rydberg_to_eV

elif options.unitname == "Hartree":
convert_unit = True
disp_conv_factor = 1.0 / Bohr_radius
energy_conv_factor = 0.5 / Rydberg_to_eV

else:
print("Error : Invalid option for --unit")
exit(1)


elif options.OpenMX:
code = "OpenMX"
Expand All @@ -1241,7 +1249,10 @@ def refold(x):
disp_conv_factor = 1.0 / Bohr_radius
energy_conv_factor = 1.0
force_conv_factor = 1.0


else:
print("Error : Invalid option for --unit")
exit(1)

if options.OpenMX is None:
force_conv_factor = energy_conv_factor / disp_conv_factor
Expand Down

0 comments on commit 6743998

Please sign in to comment.