def main(): for iq,Q in enumerate( Qs ): FF = FFLJ + FFel * Q PP.setFF_Pointer( FF ) for ik,K in enumerate( Ks ): dirname = "Q%1.2fK%1.2f" %(Q,K) os.makedirs( dirname ) PP.setTip( kSpring = np.array((K,K,0.0))/-PP.eVA_Nm ) fzs = relaxedScan3D( xTips, yTips, zTips ) PP.saveXSF( dirname+'/OutFz.xsf', headScan, lvecScan, fzs ) for iA,Amp in enumerate( Amps ): AmpStr = "/Amp%2.2f" %Amp print "Amp= ",AmpStr os.makedirs( dirname+AmpStr ) dfs = PP.Fz2df( fzs, dz = dz, k0 = PP.params['kCantilever'], f0=PP.params['f0Cantilever'], n=Amp/dz ) plotImages( dirname+AmpStr+"/df", dfs, slices = range( 0, len(dfs) ) )
print " # ============ define Scan and allocate arrays - do this before simulation, in case it will crash " dz = PP.params['scanStep'][2] zTips = np.arange( PP.params['scanMin'][2], PP.params['scanMax'][2]+0.00001, dz )[::-1]; ntips = len(zTips); print " zTips : ",zTips rTips = np.zeros((ntips,3)) rs = np.zeros((ntips,3)) fs = np.zeros((ntips,3)) rTips[:,0] = 1.0 rTips[:,1] = 1.0 rTips[:,2] = zTips PP.setTip() xTips = np.arange( PP.params['scanMin'][0], PP.params['scanMax'][0]+0.00001, 0.1 ) yTips = np.arange( PP.params['scanMin'][1], PP.params['scanMax'][1]+0.00001, 0.1 ) extent=( xTips[0], xTips[-1], yTips[0], yTips[-1] ) fzs = np.zeros(( len(zTips), len(yTips ), len(xTips ) )); nslice = 10; atomTypesFile = os.path.dirname(sys.argv[0]) + '/../code/defaults/atomtypes.ini' FFparams = PP.loadSpecies( atomTypesFile ) C6,C12 = PP.getAtomsLJ( PP.params['probeType'], iZs, FFparams ) print " # ============ define Grid " cell =np.array([
print " # ============ define Scan and allocate arrays - do this before simulation, in case it will crash " dz = PP.params['scanStep'][2] zTips = np.arange(PP.params['scanMin'][2], PP.params['scanMax'][2] + 0.00001, dz)[::-1] ntips = len(zTips) print " zTips : ", zTips rTips = np.zeros((ntips, 3)) rs = np.zeros((ntips, 3)) fs = np.zeros((ntips, 3)) rTips[:, 0] = 1.0 rTips[:, 1] = 1.0 rTips[:, 2] = zTips PP.setTip() xTips = np.arange(PP.params['scanMin'][0], PP.params['scanMax'][0] + 0.00001, 0.1) yTips = np.arange(PP.params['scanMin'][1], PP.params['scanMax'][1] + 0.00001, 0.1) extent = (xTips[0], xTips[-1], yTips[0], yTips[-1]) fzs = np.zeros((len(zTips), len(yTips), len(xTips))) nslice = 10 atomTypesFile = os.path.dirname( sys.argv[0]) + '/../code/defaults/atomtypes.ini' FFparams = PP.loadSpecies(atomTypesFile) C6, C12 = PP.getAtomsLJ(PP.params['probeType'], iZs, FFparams)
PP.lvec2params(lvec) PP.setFF(FFel) xTips, yTips, zTips, lvecScan = PP.prepareScanGrids() #Ks = [ 0.25, 0.5, 1.0 ] #Qs = [ -0.2, 0.0, +0.2 ] #Amps = [ 2.0 ] for iq, Q in enumerate(Qs): FF = FFLJ + FFel * Q PP.setFF_Pointer(FF) for ik, K in enumerate(Ks): dirname = "Q%1.2fK%1.2f" % (Q, K) os.makedirs(dirname) PP.setTip(kSpring=np.array((K, K, 0.0)) / -PP.eVA_Nm) #GU.saveVecFieldXsf( 'FFtot', FF, lvec, head ) fzs = PP.relaxedScan3D(xTips, yTips, zTips) GU.saveXSF(dirname + '/OutFz.xsf', fzs, lvecScan, GU.XSF_HEAD_DEFAULT) for iA, Amp in enumerate(Amps): AmpStr = "/Amp%2.2f" % Amp print("Amp= ", AmpStr) os.makedirs(dirname + AmpStr) dz = PP.params['scanStep'][2] dfs = PP.Fz2df(fzs, dz=dz, k0=PP.params['kCantilever'], f0=PP.params['f0Cantilever'], n=Amp / dz) extent = (xTips[0], xTips[-1], yTips[0], yTips[-1]) PPPlot.plotImages(dirname + AmpStr + "/df",
xTips,yTips,zTips,lvecScan = PP.prepareScanGrids( ) #Ks = [ 0.25, 0.5, 1.0 ] #Qs = [ -0.2, 0.0, +0.2 ] #Amps = [ 2.0 ] for iq,Q in enumerate( Qs ): FF = FFLJ + FFel * Q PP.setFF_Pointer( FF ) for ik,K in enumerate( Ks ): dirname = "Q%1.2fK%1.2f" %(Q,K) os.makedirs( dirname ) PP.setTip( kSpring = np.array((K,K,0.0))/-PP.eVA_Nm ) #GU.saveVecFieldXsf( 'FFtot', FF, lvec, head ) fzs = PP.relaxedScan3D( xTips, yTips, zTips ) GU.saveXSF( dirname+'/OutFz.xsf', fzs, lvecScan, GU.XSF_HEAD_DEFAULT ) for iA,Amp in enumerate( Amps ): AmpStr = "/Amp%2.2f" %Amp print "Amp= ",AmpStr os.makedirs( dirname+AmpStr ) dz = PP.params['scanStep'][2] dfs = PP.Fz2df( fzs, dz = dz, k0 = PP.params['kCantilever'], f0=PP.params['f0Cantilever'], n=Amp/dz ) extent=( xTips[0], xTips[-1], yTips[0], yTips[-1] ) PPPlot.plotImages( dirname+AmpStr+"/df", dfs, slices = range( 0, len(dfs) ), extent=extent ) print " ***** ALL DONE ***** " #plt.show()