Ejemplo n.º 1
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=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()
Ejemplo n.º 2
0
if opt_dict['arange'] is not None:
	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'] ]



for iq,Q in enumerate( Qs ):
	for ik,K in enumerate( Ks ):
		dirname = "Q%1.2fK%1.2f" %(Q,K)

                print "Working in {} directory".format(dirname)

                fzs,lvec,nDim=GU.load_scal_field(dirname+'/OutFz',format=format)
                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])
Ejemplo n.º 3
0
import pyProbeParticle.GridUtils      as GU

from optparse import OptionParser


parser = OptionParser()
parser.add_option(      "--dfrange", action="store", type="float", help="Range of plotted frequency shift (df)", nargs=2)
parser.add_option( "--npy" , action="store_true" ,  help="load and save fields in npy instead of xsf"     , default=False)
(options, args) = parser.parse_args()

if options.npy:
    format ="npy"
else:
    format ="xsf"

dfs,lvec,nDim=GU.load_scal_field('df',format=format)
#print lvec
#print nDim

print " # ============  Plot Relaxed Scan 3D "
slices = range( 0, len(dfs) )
#print slices
extent=( 0.0, lvec[1][0], 0.0, lvec[2][1])

for ii,i in enumerate(slices):
	print " plotting ", i
	plt.figure( figsize=( 10,10 ) )
	if(options.dfrange != None):
		fmin = options.dfrange[0]
		fmax = options.dfrange[1]
		plt.imshow( dfs[i], origin='image', interpolation='bicubic', vmin=fmin, vmax=fmax,  cmap='gray', extent=extent)
Ejemplo n.º 4
0
                  action="store",
                  type="float",
                  help="Range of plotted frequency shift (df)",
                  nargs=2)
parser.add_option("--npy",
                  action="store_true",
                  help="load and save fields in npy instead of xsf",
                  default=False)
(options, args) = parser.parse_args()

if options.npy:
    data_format = "npy"
else:
    data_format = "xsf"

dfs, lvec, nDim = GU.load_scal_field('df', data_format=data_format)
#print lvec
#print nDim

print " # ============  Plot Relaxed Scan 3D "
slices = range(0, len(dfs))
#print slices
extent = (0.0, lvec[1][0], 0.0, lvec[2][1])

for ii, i in enumerate(slices):
    print " plotting ", i
    plt.figure(figsize=(10, 10))
    if (options.dfrange != None):
        fmin = options.dfrange[0]
        fmax = options.dfrange[1]
        plt.imshow(dfs[i],
Ejemplo n.º 5
0
for i in range(len(Voltages)):
    if didv_b:
        print("Importing dIdV data for V:", namez[i])
        #print("DEBUG:WF:", WorkFunction , "Voltages[i]:", Voltages[i], "WF_decay", WF_decay  )
        name_file1 = 'didv_' + namez[
            i] + "_tip_" + tip_type + "-" + tip_orb1 + "_WF_" + str(
                WorkFunction - Voltages[i] * WF_decay
            ) + "_eta_" + str(
                eta
            )  # WorkFunction gets higher with lower (higher negative) sample bias
        name_file2 = 'didv_' + namez[
            i] + "_tip_" + tip_type + "-" + tip_orb2 + "_WF_" + str(
                WorkFunction - Voltages[i] * WF_decay) + "_eta_" + str(eta)
        #print ("DEBUG: name_file1", name_file1)
        tmp_dIdV1, lvec1, nDim1 = GU.load_scal_field(files_path + name_file1,
                                                     data_format=data_format)
        didv1 = np.array([tmp_dIdV1]) if i == 0 else np.append(
            didv1, np.array([tmp_dIdV1]), axis=0)
        #print "DEBUG: name_file2", name_file2
        tmp_dIdV2, lvec2, nDim2 = GU.load_scal_field(files_path + name_file2,
                                                     data_format=data_format)
        didv2 = np.array([tmp_dIdV2]) if i == 0 else np.append(
            didv2, np.array([tmp_dIdV2]), axis=0)
        assert np.array(lvec1).all() == np.array(
            lvec2).all(), "lvec1 != lvec2 control your input files"
        assert np.array(nDim2).all() == np.array(
            nDim2).all(), "nDim1 != nDim2 control your input files"
        print("dIdV for V:", namez[i], " imported")
        #print "DEBUG: didv1.shape", didv1.shape
    if STM_b:
        print("Importing STM data for V:", namez[i])
Ejemplo n.º 6
0
# Amps
if opt_dict['arange'] is not None:
    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']]

for iq, Q in enumerate(Qs):
    for ik, K in enumerate(Ks):
        dirname = "Q%1.2fK%1.2f" % (Q, K)

        print "Working in {} directory".format(dirname)

        fzs, lvec, nDim = GU.load_scal_field(dirname + '/OutFz',
                                             data_format=data_format)
        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])
Ejemplo n.º 7
0
if opt_dict['arange'] is not None:
	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'] ]



for iq,Q in enumerate( Qs ):
	for ik,K in enumerate( Ks ):
		dirname = "Q%1.2fK%1.2f" %(Q,K)

                print "Working in {} directory".format(dirname)

                fzs,lvec,nDim,head=GU.load_scal_field(dirname+'/OutFz', format=format)
                dfs = PPU.Fz2df( fzs, dz = dz, k0 = PPU.params['kCantilever'], f0=PPU.params['f0Cantilever'], n=Amp/dz )
                for p in options.points:
                    x=float(p.split('x')[0])
                    y=float(p.split('x')[1])
                    x_pos=int(x/scan_step)
                    y_pos=int(y/scan_step)
                    
                    Zplot=np.zeros(fzs.shape[0])
                    Fplot=np.zeros(fzs.shape[0])
                    DFplot=np.zeros(fzs.shape[0])
                    
                    
                    for k in range(0,fzs.shape[0]):
                            Fplot[k]=fzs[-k-1][y_pos][x_pos]
                            Zplot[k]=scan_max-scan_step*k
Ejemplo n.º 8
0
parser.add_option( "--npy" , action="store_true" ,  help="load and save fields in npy instead of xsf"     , default=False)
(options, args) = parser.parse_args()

try:
    points = np.genfromtxt( options.p ,dtype='int')
    print("plotting in points", points)
except:
    print(options.p+" not found => exiting ...")
    sys.exit()

if options.npy:
    data_format ="npy"
else:
    data_format ="xsf"

fzs,lvec,nDim=GU.load_scal_field(options.i,data_format=data_format)
#xs = lvec[3,2]/*np.array( range(nDim[0]) )
xs = np.linspace( 0, lvec[3,2], nDim[0] )

#print nDim
print(xs)

plt.imshow( fzs[options.iz], origin='imgage', cmap='gray' )
for point in points:
    plt.plot(point[0],point[1],'o')
plt.xlim(0,nDim[2])
plt.ylim(0,nDim[1])
plt.savefig( options.i+'_zcurves_legend.png', bbox_inches='tight')

plt.figure()
curves = np.zeros((len(points)+1,len(xs)))
Ejemplo n.º 9
0
def WriteOutput(Potential, Lattice):

    lat_mat = np.array([[0, 0, eval_height[0]], Lattice[0], Lattice[1],
                        [0, 0, eval_height[1] - eval_height[0]]])

    GU.saveXSF('dipole_potential.xsf', Potential, lat_mat)
Ejemplo n.º 10
0
# iZs - 1D array, containing the numbers of the elements, which corresponds to
# their position in the atomtypes.ini file (Number of line - 1)
# Rs  - 2D array, containing the coordinates of the atoms:
#       [ [x1,y1,z1],
#         [x2,y2,z2],
#          ... 
#         [xn,yn,zn]]
# Qs  - 1D array, containing the atomic charges

FFLJ, VLJ=PPH.computeLJ( Rs, iZs, FFLJ=None, FFparams=FFparams, Vpot=options.energy )
# This function computes the LJ forces experienced by the ProbeParticle
# FFparams either read from the local "atomtypes.ini" file, or will be read from
# the default one inside the computeLJ function


GU.limit_vec_field( FFLJ, Fmax=10.0 ) # remove too large valuesl; keeps the same direction; good for visualization 


print "--- Save  ---"
GU.save_vec_field( 'FFLJ', FFLJ, lvec,format=format)
if options.energy :
	Vmax = 10.0; VLJ[ VLJ>Vmax ] = Vmax
	GU.save_scal_field( 'VLJ', VLJ, lvec,format=format)


if opt_dict["charge"]:
    print "Electrostatic Field from xyzq file"
    FFel, VeL = PPH.computeCoulomb( Rs, Qs, FFel=None, Vpot=options.energy  )
    print "--- Save ---"
    GU.save_vec_field('FFel', FFel, lvec, format=format)
    if options.energy :
Ejemplo n.º 11
0
beta = 1/(kBoltz*T)   # [eV]
print "T= ", T, " [K] => beta ", beta/1000.0, "[meV] " 

#E_cutoff = 32.0 * beta
E_cutoff = 18.0 * beta

wGauss =  2.0
Egauss = -0.01


# =============== main

if options.noProbab :
	print " ==== calculating probabilties ===="
	# --- tip
	V_tip,   lvec, nDim = GU.load_scal_field('tip/VLJ',format=format)
	#cell   = np.array( [ lvec[1],lvec[2],lvec[3] ] ); print "nDim ", nDim, "\ncell ", cell
	#X,Y,Z  = getXYZ( nDim, cell )
	#V_tip = V_tip*0 + Egauss * getProbeDensity( (cell[0,0]/2.+cell[1,0]/2.,cell[1,1]/2,cell[2,2]/2.-3.8), X, Y, Z, wGauss ) # works for tip (the last flexible tip apex atom) in the middle of the cell
	limitE( V_tip,  E_cutoff ) 
	W_tip  = np.exp( -beta * V_tip  )
	#W_tip = W_cut(W_tip,nz=95,side='down',sm=5)
	del V_tip;
	GU.save_scal_field ( 'W_tip',  W_tip,    lvec, format=format)

	# --- sample
	V_surf,  lvec, nDim = GU.load_scal_field('sample/VLJ',format=format)
	limitE( V_surf, E_cutoff ) 
	W_surf = np.exp( -beta * V_surf )
	#W_surf=W_cut(W_surf,nz=50,side='up',sm=1)
	del V_surf; 
Ejemplo n.º 12
0
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)
Ejemplo n.º 13
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' ,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 )
Ejemplo n.º 14
0
# --- downloading and examples of downloading of the eigen-energies, the LCAO coefficients and geometry (this time for spin-unpolarized calculations):

#eigEn, coefs, Ratin = RS.read_FIREBALL_all(name = path+'phik_example_', geom=path+'crazy_mol.xyz', fermi=fermi, orbs = orbs, pbc=pbc,
#					    cut_min=cut_min, cut_max=cut_max,cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin = RS.read_AIMS_all(name = 'KS_exx_1_spin_up.out', geom='geometry.in',fermi=fermi, orbs = orbs, pbc=pbc,
#					imaginary = False, cut_min=cut_min, cut_max=cut_max, cut_at=cut_at,
#					lower_atoms=lower_atoms, lower_coefs=lower_coefs)
eigEn, coefs, Ratin  = RS.read_CP2K_all(name = 'TOAT', fermi=fermi, orbs = orbs, pbc=pbc,
                                        cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);
#eigEn, coefs, Ratin  = RS.read_GPAW_all(name = 'out_LCAO_LDA.gpw', fermi=fermi, orbs = orbs, pbc=pbc,
#					cut_min=cut_min, cut_max=cut_max, cut_at=cut_at, lower_atoms=lower_atoms, lower_coefs=lower_coefs);

# --- the grid on which the STM signal is calculated; no tip_r1 - PP distored by the relaxation in the PPAFM code;  only tip_r2 - uniform grid:

tip_r1, lvec, nDim = GU.load_vec_field( path_pos+'PPpos' ,data_format=data_format)

dz=0.1
dx=dy =0.1

xl = lvec[1,0]
yl = lvec[2,1]
zl = lvec[3,2]
extent = (lvec[0,0],lvec[0,0]+xl,lvec[0,1],lvec[0,1]+yl)

tip_r2 = RS.mkSpaceGrid(lvec[0,0],lvec[0,0]+xl,dx,lvec[0,1],lvec[0,1]+yl,dy,lvec[0,2],lvec[0,2]+zl,dz)

# --- specification on which voltages the STM (dI/dV ...) calculations are performed - two methods - direct specification or sequence of voltages

Voltages=[-0.338, -0.09406976,  0., 2.422684]
namez=['H**O-3-2','H**O-1','H**O','LUMO++1']
Ejemplo n.º 15
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
Ejemplo n.º 16
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())
Ejemplo n.º 17
0
    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!")    
Ejemplo n.º 18
0
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:
Ejemplo n.º 19
0
if opt_dict['arange'] is not None:
    Amps = np.linspace( opt_dict['arange'][0], opt_dict['arange'][1], int(opt_dict['arange'][2] ) )
elif opt_dict['a'] is not None:
    Amps = [ opt_dict['a'] ]
else:
    Amps = [ PPU.params['Amplitude'] ]



for iq,Q in enumerate( Qs ):
    for ik,K in enumerate( Ks ):
        dirname = "Q%1.2fK%1.2f" %(Q,K)

                print("Working in {} directory".format(dirname))

                fzs,lvec,nDim,head=GU.load_scal_field(dirname+'/OutFz', data_format=data_format)
                dfs = PPU.Fz2df( fzs, dz = dz, k0 = PPU.params['kCantilever'], f0=PPU.params['f0Cantilever'], n= int(Amp/dz) )
                for p in options.points:
                    x=float(p.split('x')[0])
                    y=float(p.split('x')[1])
                    x_pos=int(x/scan_step)
                    y_pos=int(y/scan_step)
                    
                    Zplot=np.zeros(fzs.shape[0])
                    Fplot=np.zeros(fzs.shape[0])
                    DFplot=np.zeros(fzs.shape[0])
                    
                    
                    for k in range(0,fzs.shape[0]):
                            Fplot[k]=fzs[-k-1][y_pos][x_pos]
                            Zplot[k]=scan_max-scan_step*k
Ejemplo n.º 20
0
#         [x2,y2,z2],
#          ...
#         [xn,yn,zn]]
# Qs  - 1D array, containing the atomic charges

FFLJ, VLJ = PPH.computeLJ(Rs,
                          iZs,
                          FFLJ=None,
                          FFparams=FFparams,
                          Vpot=options.energy)
# This function computes the LJ forces experienced by the ProbeParticle
# FFparams either read from the local "atomtypes.ini" file, or will be read from
# the default one inside the computeLJ function

GU.limit_vec_field(
    FFLJ, Fmax=10.0
)  # remove too large valuesl; keeps the same direction; good for visualization

print "--- Save  ---"
GU.save_vec_field('FFLJ', FFLJ, lvec, data_format=data_format)
if options.energy:
    Vmax = 10.0
    VLJ[VLJ > Vmax] = Vmax
    GU.save_scal_field('VLJ', VLJ, lvec, data_format=data_format)

if opt_dict["charge"]:
    print "Electrostatic Field from xyzq file"
    multipole = {
        options.tip: 1.0
    } if (options.tip in {
        's', 'px', 'py', 'pz', 'dx2', 'dy2', 'dz2', 'dxy', 'dxz', 'dyz'
Ejemplo n.º 21
0
#	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):
Ejemplo n.º 22
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])
Ejemplo n.º 23
0
beta = 1/(kBoltz*T)   # [eV]
print("T= ", T, " [K] => beta ", beta/1000.0, "[meV] ") 

#E_cutoff = 32.0 * beta
E_cutoff = 18.0 * beta

wGauss =  2.0
Egauss = -0.01


# =============== main

if options.noProbab :
    print(" ==== calculating probabilties ====")
    # --- tip
    V_tip,   lvec, nDim = GU.load_scal_field('tip/VLJ',data_format=data_format)
    #cell   = np.array( [ lvec[1],lvec[2],lvec[3] ] ); print "nDim ", nDim, "\ncell ", cell
    #X,Y,Z  = getXYZ( nDim, cell )
    #V_tip = V_tip*0 + Egauss * getProbeDensity( (cell[0,0]/2.+cell[1,0]/2.,cell[1,1]/2,cell[2,2]/2.-3.8), X, Y, Z, wGauss ) # works for tip (the last flexible tip apex atom) in the middle of the cell
    limitE( V_tip,  E_cutoff ) 
    W_tip  = np.exp( -beta * V_tip  )
    #W_tip = W_cut(W_tip,nz=95,side='down',sm=5)
    del V_tip;
    GU.save_scal_field ( 'W_tip',  W_tip,    lvec, data_format=data_format)

    # --- sample
    V_surf,  lvec, nDim = GU.load_scal_field('sample/VLJ',data_format=data_format)
    limitE( V_surf, E_cutoff ) 
    W_surf = np.exp( -beta * V_surf )
    #W_surf=W_cut(W_surf,nz=50,side='up',sm=1)
    del V_surf; 
Ejemplo n.º 24
0
                 (0.0, 0.0, 6.0)])
rTips = ocl.getPos_f4(lvec)

# ======= Run

t1 = time.clock()
kargs = ocl.initArgs(atoms, CAOs, spectral, rTips)
Gout = ocl.run(kargs, rTips.shape[:3])
t1 = time.clock() - t1

print(" Run time %g [s] " % t1)

# =====================
# =====================  Plotting
# =====================

Ftmp = np.zeros(rTips.shape[:3])
Ftmp[:, :, :] = Gout[:, :, :]
#Ftmp[:,:,:] = rTips[:,:,:,0]

GU.saveXSF(path + "G_s_sp_ocl.xsf", Ftmp, lvec)
'''
import matplotlib
# matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend. ## !!! important for working on clusters !!!!
import matplotlib.pyplot as plt

extent  = (lvec[0,0],lvec[0,0]+lvec[1,0],lvec[0,1],lvec[0,1]+lvec[2,1])
'''

print("===== ALL DONE ==== ")
Ejemplo n.º 25
0
parser.add_option( "--npy" , action="store_true" ,  help="load and save fields in npy instead of xsf"     , default=False)
(options, args) = parser.parse_args()

try:
	points = np.genfromtxt( options.p )
	print "plotting in points", points
except:
	print options.p+" not found => exiting ..."
	sys.exit()

if options.npy:
    format ="npy"
else:
    format ="xsf"

fzs,lvec,nDim=GU.load_scal_field(options.i,format=format)
#xs = lvec[3,2]/*np.array( range(nDim[0]) )
xs = np.linspace( 0, lvec[3,2], nDim[0] )

#print nDim
print xs

plt.imshow( fzs[options.iz], origin='imgage', cmap='gray' )
for point in points:
	plt.plot(point[0],point[1],'o')
plt.xlim(0,nDim[2])
plt.ylim(0,nDim[1])
plt.savefig( options.i+'_zcurves_legend.png', bbox_inches='tight')

plt.figure()
curves = np.zeros((len(points)+1,len(xs)))