<div dir="ltr">Dear All,<div>I tried to modify the source code of cif2qe.sh, also cleaning the code a little bit...</div><div>At my first attempt apparently the code now is working better and print the correct number of atoms.</div><div>I would greatly appreciate if anyone will test it with some cif files.</div><div>Merry Chrstmas and Happy New Year!</div><div><br></div><div>Carlo</div><div><br></div><div><div>#!/bin/bash</div><div><br></div><div>#</div><div># CIF to Quantum Espresso format converter</div><div>#  Version 1.1  Date: 23-Dec-2014  Bug Fix</div><div>#  Version 1.0  Date: 15-Mar-2014  First Full conversion</div><div>#  Version 0.5  Date: 02-Oct-2013</div><div>#  Version 0.4  Date: 12 Jun 2013</div><div>#  Version 0.3  Date: 15 Nov 2012</div><div>#</div><div># Copyright (C) 2012 Carlo Nervi</div><div># This file is distributed under the terms of the</div><div># GNU General Public License. See the file `License'</div><div># in the root directory of the present distribution,</div><div># or <a href="http://www.gnu.org/copyleft/gpl.txt">http://www.gnu.org/copyleft/gpl.txt</a> .</div><div>#</div><div># Use dos2unix to strip carriage returns at the end of the .cif files!!!!</div><div>#</div><div># symmetry x,-y+1/2,z+y without ''</div><div>#</div><div><br></div><div>version="1.0"</div><div>USAGE="cif2qe.sh Version ${version}\nUsage: cif2qe.sh [-i] File\n    ( -i uses the ibrav of QE. Do not add .cif extension!) -  Requires File.cif\n"</div><div>if [ $# == 0 -o $# -gt 2 ]; then</div><div> printf "$USAGE"</div><div> exit</div><div>fi</div><div><br></div><div>do_ibrav=0</div><div>if [ $# == 2 ]; then</div><div> if [ $1 == "-i" ]; then</div><div>  do_ibrav=1</div><div>  shift</div><div> else</div><div>  printf "$USAGE"</div><div>  exit</div><div> fi</div><div>fi</div><div><br></div><div>if [ ! -f $1.cif ]; then</div><div> echo "Error. Cannot find file $1.cif"</div><div> exit</div><div>fi</div><div><br></div><div>awk -v FILE="$1" -v VERSION="$version" -v do_IBRAV=$do_ibrav '</div><div><br></div><div>BEGIN {</div><div> bohr = 0.52917721092</div><div> nfield=split("H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr " \</div><div>              "Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb " \</div><div>              "Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr Rf " \</div><div>              "Db Sg Bh Hs Mt", AtomSymb, " ")</div><div> split("1.0079 4.0026 6.941 9.0122 10.811 12.0107 14.0067 15.9994 18.9984 20.1797 22.9897 24.305 26.9815 28.0855 30.9738 32.065 35.453 " \</div><div>       "39.948 39.0983 40.078 44.9559 47.867 50.9415 51.9961 54.938 55.845 58.9332 58.6934 63.546 65.39 69.723 72.64 74.9216 78.96 79.904 " \</div><div>       "83.8 85.4678 87.62 88.9059 91.224 92.9064 95.94 98 101.07 102.906 106.42 107.868 112.411 114.818 118.71 121.76 127.6 126.904 131.293 " \</div><div>       "132.905 137.327 138.905 140.116 140.908 144.24 145 150.36 151.964 157.25 158.925 162.5 164.93 167.259 168.934 173.04 174.967 178.49 " \</div><div>       "180.948 183.84 186.207 190.23 192.217 195.078 196.966 200.59 204.383 207.2 208.98 209 210 222 223 226 227 232.038 231.036 238.029 " \</div><div>       "237 244 243 247 247 251 252 257 258 259 262 261 262 266 264 277 268", AtomMass, " ")</div><div> for (i=1; i<=nfield; i++) Atoms[AtomSymb[i]] = AtomMass[i]</div><div><br></div><div>#</div><div># nKey             = number of recognized Keywords</div><div># KeyW[0][1..nKey] = recognized Keywords</div><div># KeyW[1][1..nKey] = first synonym</div><div># ...                  ....</div><div>#</div><div><br></div><div> nsynon=2</div><div> nKey=13</div><div><br></div><div> KeyW[0][1] ="_cell_length_a";               KeyW[1][1]="" </div><div> KeyW[0][2] ="_cell_length_b";               KeyW[1][2]=""</div><div> KeyW[0][3] ="_cell_length_c";               KeyW[1][3]=""</div><div> KeyW[0][4] ="_cell_angle_alpha";            KeyW[1][4]=""</div><div> KeyW[0][5] ="_cell_angle_beta";             KeyW[1][5]=""</div><div> KeyW[0][6] ="_cell_angle_gamma";            KeyW[1][6]=""</div><div> KeyW[0][7] ="_atom_site_type_symbol";       KeyW[1][7]=""</div><div> KeyW[0][8] ="_atom_site_fract_x";           KeyW[1][8]=""</div><div> KeyW[0][9] ="_atom_site_fract_y";           KeyW[1][9]=""</div><div> KeyW[0][10]="_atom_site_fract_z";           KeyW[1][10]=""</div><div> KeyW[0][11]="_symmetry_equiv_pos_as_xyz";   KeyW[1][11]="_space_group_symop_operation_xyz"</div><div> KeyW[0][12]="_symmetry_cell_setting";       KeyW[1][12]="_space_group_crystal_system"</div><div> KeyW[0][13]="_symmetry_Int_Tables_number";  KeyW[1][13]="_space_group_IT_number"</div><div> </div><div><br></div><div># for (i=1; i<=nKey; i++) {</div><div>#   for (j=0; j<nsynon; j++) printf "[%2i][%2i]=%40s  ", j, i, KeyW[j][i]</div><div>#   printf "\n"</div><div># }</div><div><br></div><div>#</div><div>#Tolerance for recognize identical atoms generate by symmetry</div><div>#</div><div> tol=0.0001</div><div>#</div><div># Separation (in A) to generate K Points</div><div>#</div><div> separation=0.07</div><div> totatom=0</div><div><br></div><div>#</div><div># International Tables</div><div>#</div><div># 1-2 Triclinic, 3-15 Monoclinic, 16-74 Orthorhombic, 75-142 Tetragonal, 143-167 Trigonal, 168-194 Hexagonal, 195-230 Cubic</div><div><br></div><div>split("P1 P-1 " \</div><div>   "P2 P2(1) C2 Pm Pc Cm Cc P2/m P2(1)/m C2/m P2/c P2(1)/c C2/c " \</div><div>   "P222 P222(1) P2(1)2(1)2 P2(1)2(1)2(1) C222(1) C222 F222 I222 I2(1)2(1)2(1) Pmm2 Pmc2(1) Pcc2 Pma2 Pca2(1) Pnc2 Pmn2(1) Pba2 Pna2(1) Pnn2 " \</div><div>       "Cmm2 Cmc2(1) Ccc2 Amm2 Abm2 Ama2 Aba2 Fmm2 Fdd2 Imm2 Iba2 Ima2 Pmmm Pnnn Pccm Pban Pmma Pnna Pmna Pcca Pbam Pccn Pbcm Pnnm Pmmn Pbcn Pbca " \</div><div>       "Pnma Cmcm Cmca Cmmm Cccm Cmma Ccca Fmmm Fddd Immm Ibam Ibca Imma " \</div><div>   "P4 P4(1) P4(2) P4(3) I4 I4(1) P-4 I-4 P4/m P4(2)/m P4/n P4(2)/n I4/m I4(1)/a P422 P42(1)2 P4(1)22 P4(1)2(1)2 P4(2)22 P4(2)2(1)2 P4(3)22 " \</div><div>       "P4(3)2(1)2 I422 I4(1)22 P4mm P4bm P4(2)cm P4(2)nm P4cc P4nc P4(2)mc P4(2)bc I4mm I4cm I4(1)md I4(1)cd P-42m P-42c P-42(1)m P-42(1)c " \</div><div>       "P-4m2 P-4c2 P-4b2 P-4n2 I-4m2 I-4c2 I-42m I-42d P4/mmm P4/mcc P4/nbm P4/nnc P4/mbm P4/mnc P4/nmm P4/ncc P4(2)/mmc P4(2)/mcm P4(2)/nbc " \</div><div>       "P4(2)/nnm P4(2)/mbc P4(2)/mnm P4(2)/nmc P4(2)/ncm I4/mmm I4/mcm I4(1)/amd I4(1)/acd " \</div><div>   "P3 P3(1) P3(2) R3 P-3 R-3 P312 P321 P3(1)12 P3(1)21 P3(2)12 P3(2)21 R32 P3m1 P31m P3c1 P31c R3m R3c P-31m P-31c P-3m1 P-3c1 R-3m R-3c " \</div><div>       "P6 P6(1) P6(5) P6(2) P6(4) P6(3) P-6 P6/m P6(3)/m P622 P6(1)22 P6(5)22 P6(2)22 P6(4)22 P6(3)22 P6mm P6cc P6(3)cm P6(3)mc P-6m2 P-6c2 P-62m " \</div><div>       "P-62c P6/mmm P6/mcc P6(3)/mcm P6(3)/mmc " \</div><div>   "P23 F23 I23 P2(1)3 I2(1)3 Pm-3 Pn-3 Fm-3 Fd-3 Im-3 Pa-3 Ia-3 P432 P4(2)32 F432 F4(1)32 I432 P4(3)32 P4(1)32 I4(1)32 P-43m F4-3m I-43m P-43n " \</div><div>       "F-43c I-43d Pm-3m Pn-3n Pm-3n Pn-3m Fm-3m Fm-3c Fd-3m Fd-3c Im-3m Ia-3d", Int_Tables, " ")</div><div>}</div><div><br></div><div>function parseX(str, field) {</div><div>#</div><div># Consideriamo il testo fra due apostrofi singoli come una stringa</div><div># ritorna il campo field-esimo della stringa str</div><div>#</div><div> c=0</div><div> str=str " "</div><div> while (str) {</div><div>   match(str,/ *\47[^\47]*\47 * |[^ ]* /) </div><div>   f=substr(str,RSTART,RLENGTH)             # save what matched in f</div><div>   gsub(/^ *\47?|\47? * $/,"",f)               # remove extra stuff</div><div>   if ( ++c == field) { if (f!="") return f</div><div>     else return $field</div><div>   }</div><div> str=substr(str,RLENGTH+1)                 # "consume" what matched</div><div> }</div><div> return ""</div><div>}</div><div><br></div><div>function search_K(str) {</div><div> i0=0</div><div> for (i1=1; i1<=nKey; i1++) {</div><div>   for (i2=0; i2<nsynon; i2++) {</div><div>#     printf "KeyW[%i][%i]=%s == %s\n", i2, i1, KeyW[i2][i1], str</div><div>#     if (KeyW[i2][i1] == str) printf "FOUND %s in [%i]\n", str, i1</div><div>     if (KeyW[i2][i1] == str) return i1</div><div>   }</div><div> }</div><div># printf "[%s] NOT FOUND\n", str</div><div> return 0</div><div>}</div><div><br></div><div>function eval(cmd,expression) {</div><div> expression = "awk \047BEGIN{printf \"%19.15f\", " cmd " }\047"</div><div> expression |& getline l</div><div> close(expression)</div><div> return l     </div><div>}</div><div><br></div><div>#</div><div># In str sostituisce tutte le occorrenze di pat con il valore repl es:</div><div>#   pat="x"  repl="0.945" str="x+1/2"</div><div>#</div><div>function norma(x, y, z, str) {</div><div> gsub("x", x, str)</div><div> gsub("y", y, str)</div><div> gsub("z", z, str)</div><div> gsub(/--/, "+", str)</div><div> val=eval(str)</div><div> while (val < 0.) val+=1.</div><div> while (val >= 1.) val-=1.</div><div> return val</div><div>}</div><div><br></div><div>function abs(numero) {</div><div> if (numero < 0) numero=-numero;</div><div> return numero</div><div>}</div><div><br></div><div>function Find_Lattice(a,b,c,alpha,beta,gamma) {</div><div>#</div><div># find the bravais lattice name from lattice parameters</div><div>#</div><div><br></div><div> thr = 1.e-4</div><div> reticolo=""</div><div> if ( (abs(alpha-90.0)<thr) && (abs(gamma-90.0)<thr) ) {</div><div>   if (abs(beta-90.0)<thr) {</div><div>     if ( (abs(a-b)<thr) && (abs(a-c)<thr) ) reticolo = "cubic";</div><div>     else if ( abs(a-b)<thr ) reticolo = "tetragonal";</div><div>     else reticolo = "orthorhombic";</div><div>   } else reticolo = "monoclinic"</div><div> } else if ( (abs(alpha-90.0)<thr) && (abs(beta-90.0)<thr) && (abs(gamma-120.0)<thr) ) reticolo = "hexagonal";</div><div>   else if ( (abs(alpha-beta)<thr) && (abs(alpha-gamma)<thr) && (abs(a-b)<thr) && (abs(a-c)<thr) ) reticolo = "rhombohedral";</div><div> else  reticolo = "triclinic"</div><div> return reticolo</div><div>}</div><div><br></div><div>function Find_ibrav(spacegroup, reticolo) {</div><div> ibrav=0</div><div> primitive=match(spacegroup, "P")</div><div> bodycentered=match(spacegroup, "I")</div><div> facecentered=match(spacegroup, "F")</div><div> basecentered=match(spacegroup, "C")</div><div> switch (reticolo) {</div><div> case "cubic":</div><div>   if (primitive) ibrav=1</div><div>   if (facecentered) ibrav=2</div><div>   if (bodycentered) ibrav=3</div><div>   break</div><div> case "tetragonal":</div><div>   if (primitive) ibrav=6</div><div>   if (bodycentered) ibrav=7</div><div>   break</div><div> case "orthorhombic":</div><div>   if (primitive) ibrav=8</div><div>   if (basecentered) ibrav=9</div><div>   if (facecentered) ibrav=10</div><div>   if (bodycentered) ibrav=11</div><div>   break;</div><div> case "monoclinic":</div><div>   if (primitive) ibrav=-12</div><div>   if (basecentered) ibrav=13</div><div>   break</div><div> case "triclinic":</div><div>   ibrav=14</div><div>   break</div><div> case "hexagonal":</div><div>   ibrav=4</div><div>   break</div><div> case "rhombohedral":</div><div>   if (primitive) ibrav=4; else ibrav=5</div><div>   break</div><div> default: ibrav=0</div><div> }</div><div> return ibrav</div><div>}</div><div><br></div><div>function test_Var(test_type) {</div><div> is_present=0</div><div> for (i=0; i<Num_Var; i++) if (Var[i] == test_type) is_present=1</div><div> return is_present</div><div>}</div><div><br></div><div># Salta il commento</div><div>$1 ~ /^\#/||/^\;/ { next }</div><div><br></div><div>$1 ~ /loop_/ { loop_switch=1; next }</div><div><br></div><div>$1 ~ /^_/ {</div><div> jvar=0</div><div> tmp=search_K($1)</div><div> if (loop_switch==1) {</div><div>  if (tmp > 0) Var[ivar++]=KeyW[0][tmp]; else Var[ivar++]=$1</div><div>  Num_Var=ivar</div><div> } else {</div><div>   ivar=0</div><div>   loop_switch=0</div><div>   if (tmp > 0) Var2[KeyW[0][tmp]]=$2</div><div> }</div><div>}</div><div><br></div><div>$1 ~ /^[^_]/ {</div><div> ivar=0</div><div> if (loop_switch==1 || loop_switch==2) {</div><div>  loop_switch=2</div><div>  for (i=0; i<Num_Var; i++) {</div><div>    Array[Var[i]][jvar]=parseX($0, i+1)</div><div>  }</div><div>  jvar++</div><div>  i = test_Var("_atom_site_type_symbol") + test_Var("_atom_site_fract_x")</div><div>  if (i == 2) natom++</div><div>  nsymm = nsymm + test_Var("_symmetry_equiv_pos_as_xyz")</div><div> } else {</div><div>  jvar=0</div><div>  loop_switch=0</div><div> }</div><div>}</div><div><br></div><div>END {</div><div> a=strtonum(Var2["_cell_length_a"])</div><div> b=strtonum(Var2["_cell_length_b"])</div><div> c=strtonum(Var2["_cell_length_c"])</div><div> alpha=strtonum(Var2["_cell_angle_alpha"])</div><div> beta=strtonum(Var2["_cell_angle_beta"])</div><div> gamma=strtonum(Var2["_cell_angle_gamma"])</div><div> alphar=alpha/180.0*3.14159265358979323846</div><div> betar=beta/180.0*3.14159265358979323846</div><div> gammar=gamma/180.0*3.14159265358979323846</div><div> reticolo=Find_Lattice(a,b,c,alpha,beta,gamma)</div><div> tmpspacegroup=Var2["_symmetry_space_group"]</div><div> tmptablenumber=Var2["_symmetry_Int_Tables_number"]</div><div> if (tmptablenumber > 0 ) tmpspacegroup=Int_Tables[tmptablenumber]</div><div> ibrav=Find_ibrav(tmpspacegroup, reticolo)</div><div> KP_x = int(1./(a*separation)+0.5)</div><div> KP_y = int(1./(b*separation)+0.5)</div><div> KP_z = int(1./(c*separation)+0.5)</div><div><br></div><div> ntyp=0</div><div> for (i=0; i<natom; i++) {</div><div>  if (Type_Atom[Array["_atom_site_type_symbol"][i]] != 1) {</div><div>    Type_Atom[Array["_atom_site_type_symbol"][i]]=1</div><div>    AtomTyp[ntyp]=Array["_atom_site_type_symbol"][i]</div><div>    ntyp++</div><div>  }</div><div> }</div><div><br></div><div> for (i=0; i<natom; i++) {</div><div>  f_x=strtonum(Array["_atom_site_fract_x"][i])</div><div>  f_y=strtonum(Array["_atom_site_fract_y"][i])</div><div>  f_z=strtonum(Array["_atom_site_fract_z"][i])</div><div>  for (j=0; j<nsymm; j++) {</div><div>   if (split(Array["_symmetry_equiv_pos_as_xyz"][j], Tmp, ",") != 3) {</div><div>     print "Error in _symmetry_equiv_pos_as_xyz. Number of fields != 3: [1]=" Tmp[1] " [2]=" Tmp[2] " [3]=" Tmp[3]</div><div>     print "D: " Array["_symmetry_equiv_pos_as_xyz"][j] "  " Tmp[1] "  " Tmp[2] "  " Tmp[3]</div><div>     exit</div><div>   }</div><div>   p_X=norma(f_x, f_y, f_z, Tmp[1])</div><div>   p_Y=norma(f_x, f_y, f_z, Tmp[2])</div><div>   p_Z=norma(f_x, f_y, f_z, Tmp[3])   </div><div>   ff=0</div><div>   for (ii=0; ii<totatom; ii++) if (abs(p_X - save_X[ii]) < tol && abs(p_Y - save_Y[ii]) < tol && abs(p_Z - save_Z[ii]) < tol) ff=1</div><div>    if (ff==0) {</div><div>      save_S[totatom]=Array["_atom_site_type_symbol"][i]</div><div>      save_X[totatom]=p_X</div><div>      save_Y[totatom]=p_Y</div><div>      save_Z[totatom]=p_Z</div><div>      totatom++</div><div>    }</div><div>  }</div><div> }</div><div> print "! Generated by using cif2qe Version " VERSION " - Date: " strftime()</div><div> print "!   _symmetry_space_group_name_H-M = "  Var2["_symmetry_space_group"]</div><div> print "!   _symmetry_Int_Tables_number = " tmptablenumber</div><div> print "!   _symmetry_cell_setting = " Var2["_symmetry_cell_setting"]</div><div> print "! a=" a "  b=" b "  c=" c "  alpha=" alpha "  beta=" beta "  gamma=" gamma</div><div> print "! Found by cif2qe: lattice = " reticolo "    Space group = " Int_Tables[tmptablenumber] "   ibrav = " ibrav</div><div> print "!"</div><div> print "! Symmetry found:"</div><div> for (j=0; j<nsymm; j++) {</div><div>   printf "! %3i %30s    ", j+1, Array["_symmetry_equiv_pos_as_xyz"][j] </div><div>   split(Array["_symmetry_equiv_pos_as_xyz"][j], Tmp, ",")</div><div>   printf "[%s]  [%s]  [%s]\n", Tmp[1], Tmp[2], Tmp[3]</div><div> }</div><div> print "&CONTROL"</div><div> print "                       title = \x027" FILE "\x027"</div><div> print "                 calculation = \x027" "relax\x027"</div><div> print "                restart_mode = \x027" "from_scratch\x027"</div><div> print "                      outdir = \x027" "./1\x027"</div><div> print "                  pseudo_dir = \x027" "../PP/atompaw\x027"</div><div> print "                      prefix = \x027" FILE "\x027"</div><div> print "                     disk_io = \x027" "none\x027"</div><div> print "                   verbosity = \x027" "default\x027"</div><div> print "               etot_conv_thr = 0.0001"</div><div> print "               forc_conv_thr = 0.001"</div><div> print "                       nstep = 400"</div><div> print "                     tstress = .true."</div><div> print "                     tprnfor = .true."</div><div> print " /"</div><div> print " &SYSTEM"</div><div> if (do_IBRAV == 1 && ibrav != 0) {</div><div>   print "                       ibrav = " ibrav</div><div>   printf "                   celldm(1) = %19.15f\n", a/bohr</div><div>   switch (ibrav) {</div><div>    case 4:</div><div>    case 6:</div><div>    case 7:</div><div>     printf "                   celldm(3) = %19.15f\n", c/a</div><div>     break</div><div>    case 5:</div><div>    case -5:</div><div>     printf "                   celldm(4) = %19.15f\n", cos(alphar)</div><div>     break</div><div>    case 14:</div><div>     printf "                   celldm(2) = %19.15f, celldm(3) = %19.15f\n", b/a, c/a</div><div>     printf "                   celldm(4) = %19.15f\n", cos(alphar)</div><div>     printf "                   celldm(5) = %19.15f\n", cos(betar)</div><div>     printf "                   celldm(6) = %19.15f\n", cos(gammar)</div><div>     break</div><div>    case -12:</div><div>     printf "                   celldm(2) = %19.15f, celldm(3) = %19.15f\n", b/a, c/a</div><div>     printf "                   celldm(5) = %19.15f\n", cos(betar)</div><div>     break</div><div>    case 13:</div><div>     printf "                   celldm(2) = %19.15f, celldm(3) = %19.15f\n", b/a, c/a</div><div>     printf "                   celldm(4) = %19.15f\n", cos(gammar)</div><div>     break</div><div>    case 8:</div><div>    case 9:</div><div>    case 10:</div><div>    case 11:</div><div>     printf "                   celldm(2) = %19.15f, celldm(3) = %19.15f\n", b/a, c/a</div><div>     break</div><div>    case 12:</div><div>     printf "                   celldm(2) = %19.15f, celldm(3) = %19.15f\n", b/a, c/a</div><div>     printf "                   celldm(4) = %19.15f\n", cos(gammar)</div><div>     break</div><div>    case 1:</div><div>    case 2:</div><div>    case 3:</div><div>   }</div><div> } else print "                       ibrav = 0"</div><div> print "                         nat = " totatom</div><div> print "                        ntyp = " ntyp</div><div> print "                     ecutwfc = 50"</div><div> print "                     ecutrho = 400"</div><div> print "                      london = .true."</div><div> print "                   london_s6 = 0.75"</div><div> print " /"</div><div> print " &ELECTRONS"</div><div> print "            electron_maxstep = 200"</div><div> print "                    conv_thr = 1.0D-7"</div><div> print "              diago_thr_init = 1e-4"</div><div> print "                 startingpot = \x027" "atomic\x027"</div><div> print "                 startingwfc = \x027" "atomic\x027"</div><div> print "                 mixing_mode = \x027" "plain\x027"</div><div> print "                 mixing_beta = 0.5"</div><div> print "                 mixing_ndim = 8"</div><div> print "             diagonalization = \x027" "david\x027"</div><div> print " /"</div><div> print "&IONS"</div><div> print "                ion_dynamics = \x027" "bfgs\x027"</div><div> print " /"</div><div> print "\nATOMIC_SPECIES"</div><div> for (i=0; i<ntyp; i++) printf "  %3s  %14.10f  %s.pbe-n-rrkjus_psl.0.1.UPF\n", AtomTyp[i], Atoms[AtomTyp[i]], AtomTyp[i];</div><div><br></div><div> print "\nATOMIC_POSITIONS crystal"</div><div> for (i=0; i<totatom; i++)</div><div>   printf "%2s   %19.15f   %19.15f   %19.15f\n", save_S[i], save_X[i], save_Y[i], save_Z[i]</div><div> print "\nK_POINTS automatic"</div><div> print KP_x "  " KP_y "  " KP_z "   0 0 0"</div><div><br></div><div> if (do_IBRAV == 0) {</div><div>   cell_px[0]=a</div><div>   cell_py[0]=0.0</div><div>   cell_pz[0]=0.0</div><div>   cell_px[1]=b*cos(gammar)</div><div>   cell_py[1]=b*sin(gammar)</div><div>   cell_pz[1]=0.0</div><div>   cell_px[2]=c*cos(betar)</div><div>   cell_py[2]=c*(cos(alphar)-cos(betar)*cos(gammar))/sin(gammar)</div><div>   cell_pz[2]=c*sqrt(1.0 - cos(alphar)^2 - cos(betar)^2 - cos(gammar)^2 + 2*cos(alphar)*cos(betar)*cos(gammar))/sin(gammar)</div><div>   print "\nCELL_PARAMETERS"</div><div>   for (i=0; i<3; i++) printf "  %19.15f   %19.15f   %19.15f\n", cell_px[i]/bohr, cell_py[i]/bohr, cell_pz[i]/bohr;</div><div> }</div><div> print "\n\n"</div><div><br></div><div>} ' $1.cif</div><div><br></div></div><div><br></div><div><br></div></div>