From 92094534e281206eb4ae0beaefc6b4d44cd0c441 Mon Sep 17 00:00:00 2001 From: TApplencourt Date: Mon, 7 Mar 2016 10:51:11 +0100 Subject: [PATCH] Fix qmc pack converter --- data/list_element.txt | 118 ++++++++++++++++++ .../qmcpack/qp_convert_qmcpack_to_ezfio.py | 24 +++- 2 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 data/list_element.txt diff --git a/data/list_element.txt b/data/list_element.txt new file mode 100644 index 00000000..b2d081c1 --- /dev/null +++ b/data/list_element.txt @@ -0,0 +1,118 @@ +1 H Hydrogen +2 He Helium +3 Li Lithium +4 Be Beryllium +5 B Boron +6 C Carbon +7 N Nitrogen +8 O Oxygen +9 F Fluorine +10 Ne Neon +11 Na Sodium +12 Mg Magnesium +13 Al Aluminum +14 Si Silicon +15 P Phosphorus +16 S Sulfur +17 Cl Chlorine +18 Ar Argon +19 K Potassium +20 Ca Calcium +21 Sc Scandium +22 Ti Titanium +23 V Vanadium +24 Cr Chromium +25 Mn Manganese +26 Fe Iron +27 Co Cobalt +28 Ni Nickel +29 Cu Copper +30 Zn Zinc +31 Ga Gallium +32 Ge Germanium +33 As Arsenic +34 Se Selenium +35 Br Bromine +36 Kr Krypton +37 Rb Rubidium +38 Sr Strontium +39 Y Yttrium +40 Zr Zirconium +41 Nb Niobium +42 Mo Molybdenum +43 Tc Technetium +44 Ru Ruthenium +45 Rh Rhodium +46 Pd Palladium +47 Ag Silver +48 Cd Cadmium +49 In Indium +50 Sn Tin +51 Sb Antimony +52 Te Tellurium +53 I Iodine +54 Xe Xenon +55 Cs Cesium +56 Ba Barium +57 La Lanthanum +58 Ce Cerium +59 Pr Praseodymium +60 Nd Neodymium +61 Pm Promethium +62 Sm Samarium +63 Eu Europium +64 Gd Gadolinium +65 Tb Terbium +66 Dy Dysprosium +67 Ho Holmium +68 Er Erbium +69 Tm Thulium +70 Yb Ytterbium +71 Lu Lutetium +72 Hf Hafnium +73 Ta Tantalum +74 W Tungsten +75 Re Rhenium +76 Os Osmium +77 Ir Iridium +78 Pt Platinum +79 Au Gold +80 Hg Mercury +81 Tl Thallium +82 Pb Lead +83 Bi Bismuth +84 Po Polonium +85 At Astatine +86 Rn Radon +87 Fr Francium +88 Ra Radium +89 Ac Actinium +90 Th Thorium +91 Pa Protactinium +92 U Uranium +93 Np Neptunium +94 Pu Plutonium +95 Am Americium +96 Cm Curium +97 Bk Berkelium +98 Cf Californium +99 Es Einsteinium +100 Fm Fermium +101 Md Mendelevium +102 No Nobelium +103 Lr Lawrencium +104 Rf Rutherfordium +105 Db Dubnium +106 Sg Seaborgium +107 Bh Bohrium +108 Hs Hassium +109 Mt Meitnerium +110 Ds Darmstadtium +111 Rg Roentgenium +112 Cn Copernicium +113 Uut Ununtrium +114 Fl Flerovium +115 Uup Ununpentium +116 Lv Livermorium +117 Uus Ununseptium +118 Uuo Ununoctium \ No newline at end of file diff --git a/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py b/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py index 7430ad54..0dc99029 100755 --- a/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py @@ -9,6 +9,7 @@ print "#QP -> QMCPACK" from ezfio import ezfio +import os import sys ezfio_path = sys.argv[1] @@ -17,7 +18,15 @@ ezfio.set_file(ezfio_path) do_pseudo = ezfio.get_pseudo_do_pseudo() if do_pseudo: print "do_pseudo True" - print "The charge of nucl will be decreasced for taking into acount the pseudo potentiel" + from qp_path import QP_ROOT + + l_ele_path = os.path.join(QP_ROOT,"data","list_element.txt") + with open(l_ele_path, "r") as f: + data_raw = f.read() + + l_element_raw = data_raw.split("\n") + l_element = [element_raw.split() for element_raw in l_element_raw] + d_z = dict((abr, z) for (z, abr, ele) in l_element) else: print "do_pseudo False" @@ -68,7 +77,10 @@ print "nucl_num", len(l_label) print "Atomic coord in Bohr" for i, t in enumerate(zip(l_label, l_charge, l_coord_str)): - print list_to_string(t) + t_1 = d_z[t[0]] if do_pseudo else t[1] + + t_new = [t[0],t_1,t[2]] + print list_to_string(t_new) # # Call externet process to get the sysmetry @@ -79,7 +91,6 @@ process = subprocess.Popen( stdout=subprocess.PIPE) out, err = process.communicate() -print len(out.split("\n\n\n")) basis_raw, sym_raw, _ , det_raw, _ = out.split("\n\n\n") # _ __ @@ -302,8 +313,8 @@ if do_pseudo: if l_dump: l_str.append(l_dump) - str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE -1 AND LMAX {2} ARE" - print str_.format(a, i + 1, int(len(l_str) - 1)) + str_ = "PARAMETERS FOR {0} ON ATOM {1} WITH ZCORE {2} AND LMAX {3} ARE" + print str_.format(a, i + 1, int(d_z[a])-int(l_charge[i]), int(len(l_str) - 1)) for i, l in enumerate(l_str): str_ = "FOR L= {0} COEFF N ZETA" @@ -311,7 +322,8 @@ if do_pseudo: for ii, ll in enumerate(l): print " ", ii + 1, ll - str_ = "THE ECP RUN REMOVES -1 CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS." + str_ = "THE ECP RUN REMOVES {0} CORE ELECTRONS, AND THE SAME NUMBER OF PROTONS." + print str_.format(sum([int(d_z[a])-int(l_charge[i]) for i,a in enumerate(l_label)])) print "END_PSEUDO" # _