Пример #1
0
                        n=Amp / dz)
        #                print "TYT", fzs.shape

        for p in options.points:
            xmin = float(p[0].split('x')[0])
            ymin = float(p[0].split('x')[1])
            zmin = float(p[0].split('x')[2])
            xmax = float(p[1].split('x')[0])
            ymax = float(p[1].split('x')[1])
            zmax = float(p[1].split('x')[2])
            npoints = float(p[2])

            print opt_dict['disp']
            if opt_dict['disp']:
                print "Displacment {}".format(opt_dict['disp'][0])
                disp_all, lvec, nDim, head = GU.load_vec_field(dirname +
                                                               '/PPdisp_')
                disp_x, disp_y, disp_z = GU.unpackVecGrid(disp_all)
                del disp_all
                if (opt_dict['disp'][0] == 'x'):
                    disp = disp_x
                    del disp_y, disp_z
                elif (opt_dict['disp'][0] == 'y'):
                    disp = disp_y
                    del disp_x, disp_z
                elif (opt_dict['disp'][0] == 'z'):
                    disp = disp_z
                    del disp_x, disp_y
                DSPplot = selectLine(BIGarray=disp,
                                     MIN=scan_min,
                                     MAX=scan_max,
                                     startingPoint=np.array([xmin, ymin,
Пример #2
0
if (plot_atoms):
    geom_plot, tmp1, tmp2 = Bu.loadAtoms('input_plot.xyz')
    del tmp1, tmp2
    #print "DEBUG: geom_plot", geom_plot
else:
    geom_plot = None

# --- the grid on which the STM signal is calculated --- #

if ((tip_type == 'relaxed') or (tip_type == 'r')):
    print(
        "Importing positions of PP from the PP-AFM calculations. Path for the data:"
    )
    path_pos = "Q%1.2fK%1.2f/" % (Q, K)
    print(path_pos)
    tip_r, lvec, nDim = GU.load_vec_field(path_pos + 'PPpos',
                                          data_format=data_format)
    extent = (lvec[0, 0], lvec[0, 0] + lvec[1, 0], lvec[0, 1],
              lvec[0, 1] + lvec[2, 1])
    #print "DEBUG: extent", extent
    print("PP postions imported")
    dx = lvec[1, 0] / (nDim[2] - 1)
    dy = lvec[2, 1] / (nDim[1] - 1)
    dz = lvec[3, 2] / (nDim[0] - 1)
    tip_r0 = RS.mkSpaceGrid(lvec[0, 0], lvec[0, 0] + lvec[1, 0], dx,
                            lvec[0, 1], lvec[0, 1] + lvec[2, 1], dy,
                            lvec[0, 2], lvec[0, 2] + lvec[3, 2], dz)
    #print "DEBUG: dx, dy, dz", dx, dy, dz
    #print "DEBUG: tip_r.shape, tip_r0.shape", tip_r.shape, tip_r0.shape
else:
    print("Priparing the scan grid for fixed scan")
    extent = (x[0], x[1], y[0], y[1])
Пример #3
0
                dfs = PPU.Fz2df( fzs, dz = dz, k0 = PPU.params['kCantilever'], f0=PPU.params['f0Cantilever'], n=Amp/dz )
#                print "TYT", fzs.shape

                for p in options.points:
                    xmin=float(p[0].split('x')[0])
                    ymin=float(p[0].split('x')[1])
                    zmin=float(p[0].split('x')[2])
                    xmax=float(p[1].split('x')[0])
                    ymax=float(p[1].split('x')[1])
                    zmax=float(p[1].split('x')[2])
                    npoints=float(p[2])
                    
                    print opt_dict['disp']
                    if opt_dict['disp'] :
                        print "Displacment {}".format(opt_dict['disp'][0])
                        disp_all,lvec,nDim,head=GU.load_vec_field(dirname+'/PPdisp_')
                        disp_x,disp_y,disp_z = GU.unpackVecGrid( disp_all ); del disp_all;
                        if (opt_dict['disp'][0]=='x'):
                            disp = disp_x; del disp_y, disp_z;
                        elif (opt_dict['disp'][0]=='y'):
                            disp = disp_y; del disp_x, disp_z;
                        elif (opt_dict['disp'][0]=='z'):
                            disp = disp_z; del disp_x, disp_y;
                        DSPplot=selectLine(BIGarray=disp, MIN=scan_min,
                                   MAX=scan_max,startingPoint=np.array([xmin,ymin,zmin]),
                                   endPoint=np.array([xmax,ymax,zmax]),
                                   nsteps=npoints)
                        DSPplt=np.transpose(DSPplot)[1].copy()
                        Lplot=np.transpose(DSPplot)[0].copy()
                        DSP_interp=interp1d(Lplot, DSPplt,kind='cubic')
                        plt.plot(Lplot, DSPplt, 'ko',Lplot, DSP_interp(Lplot),'k--')
Пример #4
0
    #print "atom_colors: ", atom_colors
if opt_dict['bonds']:
    bonds = basUtils.findBonds(atoms, iZs, 1.0, FFparams=FFparams)
    #print "bonds ", bonds
atomSize = 0.15

cbar_str = ""
if opt_dict['cbar']:
    cbar_str = "_cbar"

for iq, Q in enumerate(Qs):
    for ik, K in enumerate(Ks):
        dirname = "Q%1.2fK%1.2f" % (Q, K)
        if opt_dict['pos']:
            try:
                PPpos, lvec, nDim = GU.load_vec_field(dirname + '/PPpos',
                                                      data_format=data_format)
                print(" plotting PPpos : ")
                PPPlot.plotDistortions(dirname + "/xy" + atoms_str + cbar_str,
                                       PPpos[:, :, :, 0],
                                       PPpos[:, :, :, 1],
                                       slices=list(range(0, len(PPpos))),
                                       BG=PPpos[:, :, :, 2],
                                       extent=extent,
                                       atoms=atoms,
                                       bonds=bonds,
                                       atomSize=atomSize,
                                       markersize=2.0,
                                       cbar=opt_dict['cbar'])
                del PPpos
            except:
                print("error: ", sys.exc_info())
Пример #5
0
    del V_surf; 
    GU.save_scal_field ( 'W_surf', W_surf,   lvec, data_format=data_format)

#=================== Force

if options.noForces :
    print(" ==== calculating Forces ====") 
    if (options.noProbab==False) :
        print(" ==== loading probabilties ====") 
        # --- tip
        W_tip,   lvec, nDim = GU.load_scal_field('W_tip',data_format=data_format)
        # --- sample
        W_surf,  lvec, nDim = GU.load_scal_field('W_surf',data_format=data_format)

    W_tip = np.roll(np.roll(np.roll(W_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
    FF_tmp, lvec, nDim = GU.load_vec_field('tip/FFLJ',data_format=data_format)
    Fx_tip, Fy_tip, Fz_tip = GU.unpackVecGrid( FF_tmp )
    del FF_tmp;

    # Fz:
    Fz_tip = np.roll(np.roll(np.roll(Fz_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
    F1=fFFT.Average_tip( Fz_tip , W_surf, W_tip  )
    #GU.saveXSF        ( 'FFboltz_z.xsf', F1, lvec)#, echo=True )

    # Fx:
    Fx_tip = np.roll(np.roll(np.roll(Fx_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
    F2=fFFT.Average_tip( Fx_tip , W_surf, W_tip  )
    #GU.saveXSF        ( 'FFboltz_x.xsf', F1, lvec)#, echo=True )

    # Fy:
    Fy_tip = np.roll(np.roll(np.roll(Fy_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
#	Amps = np.linspace( opt_dict['arange'][0], opt_dict['arange'][1], opt_dict['arange'][2] )
#elif opt_dict['a'] is not None:
#	Amps = [ opt_dict['a'] ]
#else:
#	Amps = [ PPU.params['Amplitude'] ]

print "Ks   =", Ks 
print "Qs   =", Qs 
#print "Amps =", Amps 

print " ============= RUN  "

#PPPlot.params = PPU.params 			# now we dont use PPPlot here
if ( charged_system == True):
        print " load Electrostatic Force-field "
        FFel, lvec, nDim = GU.load_vec_field( "FFel" ,format=format)

if (options.boltzmann  or options.bI) :
        print " load Boltzmann Force-field "
        FFboltz, lvec, nDim = GU.load_vec_field( "FFboltz", format=format)


print " load Lenard-Jones Force-field "
FFLJ, lvec, nDim = GU.load_vec_field( "FFLJ" , format=format)
PPU.lvec2params( lvec )
PPC.setFF( FFLJ )

xTips,yTips,zTips,lvecScan = PPU.prepareScanGrids( )

for iq,Q in enumerate( Qs ):
	if ( charged_system == True):
Пример #7
0
        sys.exit()

tip_base = options.tip_base
if not tip_base:
    tip_base = True if ((PPU.params["tip_base"][0] != 'None') and
                        (PPU.params["tip_base"][0] != None)) else False

print("Ks   =", Ks)
print("Qs   =", Qs)
print("tip_base =", tip_base)

print(" ============= RUN  ")

if (charged_system == True):
    print(" load Electrostatic Force-field ")
    FFel, lvec, nDim = GU.load_vec_field("FFel", data_format=data_format)

if (options.boltzmann or options.bI):
    print(" load Boltzmann Force-field ")
    FFboltz, lvec, nDim = GU.load_vec_field("FFboltz", data_format=data_format)

print(" load Lenard-Jones Force-field ")
FFLJ, lvec, nDim = GU.load_vec_field("FFLJ", data_format=data_format)
PPU.lvec2params(lvec)
PPC.setFF(FFLJ)

xTips, yTips, zTips, lvecScan = PPU.prepareScanGrids()

for iq, Q in enumerate(Qs):
    if (charged_system == True):
        FF = FFLJ + FFel * Q
	del V_surf; 
	GU.save_scal_field ( 'W_surf', W_surf,   lvec, format=format)

#=================== Force

if options.noForces :
	print " ==== calculating Forces ====" 
	if (options.noProbab==False) :
		print " ==== loading probabilties ====" 
		# --- tip
		W_tip,   lvec, nDim = GU.load_scal_field('W_tip',format=format)
		# --- sample
		W_surf,  lvec, nDim = GU.load_scal_field('W_surf',format=format)

	W_tip = np.roll(np.roll(np.roll(W_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
	FF_tmp, lvec, nDim = GU.load_vec_field('tip/FFLJ',format=format)
	Fx_tip, Fy_tip, Fz_tip = GU.unpackVecGrid( FF_tmp )
	del FF_tmp;

	# Fz:
	Fz_tip = np.roll(np.roll(np.roll(Fz_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
	F1=fFFT.Average_tip( Fz_tip , W_surf, W_tip  )
	#GU.saveXSF        ( 'FFboltz_z.xsf', F1, lvec)#, echo=True )

	# Fx:
	Fx_tip = np.roll(np.roll(np.roll(Fx_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
	F2=fFFT.Average_tip( Fx_tip , W_surf, W_tip  )
	#GU.saveXSF        ( 'FFboltz_x.xsf', F1, lvec)#, echo=True )

	# Fy:
	Fy_tip = np.roll(np.roll(np.roll(Fy_tip,nDim[0]/2, axis=0),nDim[1]/2, axis=1),nDim[2]/2, axis=2) # works for tip (the last flexible tip apex atom) in the middle of the cell
	#print "atom_colors: ", atom_colors
if opt_dict['bonds']:
	bonds = basUtils.findBonds(atoms,iZs,1.0,FFparams=FFparams)
	#print "bonds ", bonds
atomSize = 0.15

cbar_str =""
if opt_dict['cbar']:
	cbar_str="_cbar"

for iq,Q in enumerate( Qs ):
	for ik,K in enumerate( Ks ):
		dirname = "Q%1.2fK%1.2f" %(Q,K)
		if opt_dict['pos']:
			try:
				PPpos, lvec, nDim = GU.load_vec_field( dirname+'/PPpos' ,format=format)
				print " plotting PPpos : "
				PPPlot.plotDistortions( dirname+"/xy"+atoms_str+cbar_str, PPpos[:,:,:,0], PPpos[:,:,:,1], slices = range( 0, len(PPpos) ), BG=PPpos[:,:,:,2], extent=extent, atoms=atoms, bonds=bonds, atomSize=atomSize, markersize=2.0, cbar=opt_dict['cbar'] )
				del PPpos
			except:
				print "error: ", sys.exc_info()
				print "cannot load : " + ( dirname+'/PPpos_?.' + format ) 
		if ( ( opt_dict['df'] or opt_dict['save_df'] or opt_dict['WSxM'] ) ):
			try :
				fzs, lvec, nDim = GU.load_scal_field( dirname+'/OutFz' , format=format)
				for iA,Amp in enumerate( Amps ):
					AmpStr = "/Amp%2.2f" %Amp
					print "Amp= ",AmpStr
					dirNameAmp = dirname+AmpStr
					if not os.path.exists( dirNameAmp ):
						os.makedirs( dirNameAmp )