else: data_format ="xsf" if options.input==None: sys.exit("ERROR!!! Please, specify the input file with the '-i' option \n\n"+HELP_MSG) print " >> OVEWRITING SETTINGS by params.ini " PPU.loadParams( 'params.ini' ) print " ========= get electrostatic forcefiled from hartree " # TODO with time implement reading a hartree potential generated by different software print " loading Hartree potential from disk " if(options.input.lower().endswith(".xsf") ): print "Use loadXSF" V, lvec, nDim, head = GU.loadXSF(options.input) elif(options.input.lower().endswith(".cube") ): print "Use loadCUBE" V, lvec, nDim, head = GU.loadCUBE(options.input) V*=27.211396132 else: sys.exit("ERROR!!! Unknown format of the input file\n\n"+HELP_MSG) rho = None sigma = options.sigma if ( options.sigma > 0.0) else PPU.params['sigma'] multipole = None if (options.tip.endswith(".xsf") or options.tip.endswith(".cube") ) : rho, lvec_tip, nDim_tip, tiphead = GU.loadXSF(options.tip) if (options.tip.endswith(".xsf")) else GU.loadCUBE(options.tip) if (nDim_tip != nDim): sys.exit("Error: Input file for tip charge density has been specified, but the dimensions are incompatible with the Hartree potential file!") else:
import pyProbeParticle as PPU from pyProbeParticle import basUtils import pyProbeParticle.GridUtils as GU #import pyProbeParticle.fieldFFT as fFFT #import pyProbeParticle.PPPlot as PPP center = np.array([10.0, 10.0, 10.0]) data1 = 'ddensity-Si232-H.xsf' data2 = 'ddensity-Si232-CH3.xsf' data3 = 'ddensity-Si232-C6.xsf' data4 = 'ddensity-Si232-OH.xsf' data5 = 'ddensity-Si232-CHO.xsf' data6 = 'ddensity-Si232-CH3.xsf' data, lvec, nDim, head = GU.loadXSF(str(data5)) ntot = nDim[0] * nDim[1] * nDim[2] dV = lvec[1][0] * lvec[2][1] * lvec[3][2] / ntot GU.setGridN(np.array(data.shape).astype(np.int32)) GU.setGridCell(np.array((lvec[1], lvec[2], lvec[3])).copy()) center, Hsum = GU.cog(data) #print center, Hsum rs, Hs, Ws = GU.sphericalHist(data, center, 0.1, 400) plt.subplot(2, 1, 1) plt.plot(rs, Hs * (len(Hs) / float(ntot)), label="raw") plt.plot(rs, Hs / Ws, label="weighted") sumHs = np.cumsum(Hs * dV) plt.subplot(2, 1, 2)
format ="xsf" if options.input==None: sys.exit("ERROR!!! Please, specify the input file with the '-i' option \n\n"+HELP_MSG) print " >> OVEWRITING SETTINGS by params.ini " PPU.loadParams( 'params.ini' ) print " ========= get electrostatic forcefiled from hartree " # TODO with time implement reading a hartree potential generated by different software print " loading Hartree potential from disk " if(options.input.lower().endswith(".xsf") ): print "Use loadXSF" V, lvec, nDim, head = GU.loadXSF(options.input) elif(options.input.lower().endswith(".cube") ): print "Use loadCUBE" V, lvec, nDim, head = GU.loadCUBE(options.input) V*=27.211396132 else: sys.exit("ERROR!!! Unknown format of the input file\n\n"+HELP_MSG) rho = None multipole = None if options.tip in {'s','px','py','pz','dx2','dy2','dz2','dxy','dxz','dyz'}: rho = None multipole={options.tip:1.0} elif options.tip.endswith(".xsf"): rho, lvec_tip, nDim_tip, tiphead = GU.loadXSF(options.tip) if any(nDim_tip != nDim): sys.exit("Error: Input file for tip charge density has been specified, but the dimensions are incompatible with the Hartree potential file!")
if options.input == None: sys.exit( "ERROR!!! Please, specify the input file with the '-i' option \n\n" + HELP_MSG) print(" >> OVEWRITING SETTINGS by params.ini ") PPU.loadParams('params.ini') print(" ========= get electrostatic forcefiled from hartree ") # TODO with time implement reading a hartree potential generated by different software print(" loading Hartree potential from disk ") if (options.input.lower().endswith(".xsf")): print("Use loadXSF") V, lvec, nDim, head = GU.loadXSF(options.input) elif (options.input.lower().endswith(".cube")): print("Use loadCUBE") V, lvec, nDim, head = GU.loadCUBE(options.input) V *= 27.211396132 else: sys.exit("ERROR!!! Unknown format of the input file\n\n" + HELP_MSG) if options.prolongez[0] > 0.0: V = np.array(V) assert options.prolongez[0] < lvec[ 3, 2], "prolongez is higher than height of the cell" print("prolonging_z at height %f by appr. %f" % (options.prolongez[0], options.prolongez[1])) #print "Debug: nDim", nDim nz = int(nDim[0] * options.prolongez[0] / lvec[3, 2])