4Opens an DYNAMO86 EAM funcfl file, parses the data and writes out
5separate files for F[rho], rho(r), and Z(r)
10 -h, --help show this help
11 -f, --funcfl=... use specified funcfl file for the data
12 -o, --output-base=... use specified name for the base of the output files
15 funcflExtractor -f Au.u3.funcfl -o Au_u3
19__author__ = "Dan Gezelter (gezelter@nd.edu)"
20__copyright__ = "Copyright (c) 2004-present The University of Notre Dame. All Rights Reserved."
34def readFuncflFile(funcflFileName):
36 eamFile = open(funcflFileName, 'r')
37 lines = eamFile.readlines()
55 tokensFound = tokensFound + 1
56 if (tokensFound <= nrho):
57 fRho.append(float(L[i]))
58 elif (tokensFound <= nrho+nR):
61 rho.append(float(L[i]))
64 return (nrho, drho, nR, dR, rcut)
66def writeFiles(outputBaseName, nrho, drho, nR, dR, rcut):
68 fFile = open(outputBaseName + ".F.dat", 'w')
69 zFile = open(outputBaseName + ".Z.dat", 'w')
70 rhoFile = open(outputBaseName + ".rho.dat", 'w')
72 for i in range(0, nR):
74 zFile.write( "%f\t%f\n" % (r, z[i]))
75 rhoFile.write( "%f\t%f\n" % (r, rho[i]))
78 for i in range(0, nrho):
80 fFile.write("%f\t%f\n" % (rhoVal, fRho[i]))
88 global haveFuncflFileName
89 global haveOutputBaseName
91 haveFuncflFileName = False
92 haveOutputBaseName = False
95 opts, args = getopt.getopt(argv, "hf:o:", ["help", "funcfl=", "output-base="])
96 except getopt.GetoptError:
100 if opt in ("-h", "--help"):
103 elif opt in ("-f", "--funcfl"):
105 haveFuncflFileName = True
106 elif opt in ("-o", "--output-base"):
108 haveOutputBaseName = True
109 if (not haveFuncflFileName):
111 print("No funcfl file was specified")
113 if (not haveOutputBaseName):
115 print("No output base name was specified")
118 (nrho, drho, nR, dR, rcut) = readFuncflFile(funcflFileName)
119 writeFiles(outputBaseName, nrho, drho, nR, dR, rcut)
121if __name__ == "__main__":
122 if len(sys.argv) == 1: