xTips,yTips,zTips,lvecScan = PPU.prepareScanGrids( ) for iq,Q in enumerate( Qs ): if ( charged_system == True): FF = FFLJ + FFel * Q else: FF = FFLJ if options.boltzmann : FF += FFboltz PPC.setFF_Fpointer( FF ) for ik,K in enumerate( Ks ): dirname = "Q%1.2fK%1.2f" %(Q,K) print " relaxed_scan for ", dirname if not os.path.exists( dirname ): os.makedirs( dirname ) PPC.setTip( kSpring = np.array((K,K,0.0))/-PPU.eVA_Nm ) fzs,PPpos = PPH.relaxedScan3D( xTips, yTips, zTips ) GU.save_scal_field( dirname+'/OutFz', fzs, lvecScan, format=format ) #print "SHAPE", PPpos.shape, xTips.shape, yTips.shape, zTips.shape if opt_dict['disp']: PPdisp=PPpos.copy() nx=PPdisp.shape[2] ny=PPdisp.shape[1] nz=PPdisp.shape[0] test=np.meshgrid(xTips,yTips,zTips) #print "TEST SHAPE", np.array(test).shape #print nx,ny,nz i=0 while i<nx: j=0 while j<ny:
for iq, Q in enumerate(Qs): if (charged_system == True): FF = FFLJ + FFel * Q else: FF = FFLJ if options.boltzmann: FF += FFboltz PPC.setFF_Fpointer(FF) for ik, K in enumerate(Ks): dirname = "Q%1.2fK%1.2f" % (Q, K) print(" relaxed_scan for ", dirname) if not os.path.exists(dirname): os.makedirs(dirname) if Bds: PPC.setTip(kSpring=np.array((PPU.params['stiffness'][0], PPU.params['stiffness'][1], 0.0)) / -PPU.eVA_Nm) else: PPC.setTip(kSpring=np.array((K, K, 0.0)) / -PPU.eVA_Nm) Fs, rPPs, rTips = PPH.relaxedScan3D(xTips, yTips, zTips) GU.save_scal_field(dirname + '/OutFz', Fs[:, :, :, 2], lvecScan, data_format=data_format) if opt_dict['vib'] >= 0: which = opt_dict['vib'] print( " === computing eigenvectors of dynamical matix which=%i ddisp=%f" % (which, PPU.params['ddisp'])) evals, evecs = PPC.stiffnessMatrix(rTips.reshape((-1, 3)), rPPs.reshape((-1, 3)),
xTips,yTips,zTips,lvecScan = PPU.prepareScanGrids( ) for iq,Q in enumerate( Qs ): if ( charged_system == True): FF = FFLJ + FFel * Q else: FF = FFLJ if options.boltzmann : FF += FFboltz PPC.setFF_Fpointer( FF ) for ik,K in enumerate( Ks ): dirname = "Q%1.2fK%1.2f" %(Q,K) print " relaxed_scan for ", dirname if not os.path.exists( dirname ): os.makedirs( dirname ) PPC.setTip( kSpring = np.array((K,K,0.0))/-PPU.eVA_Nm ) Fs,rPPs,rTips = PPH.relaxedScan3D( xTips, yTips, zTips ) GU.save_scal_field( dirname+'/OutFz', Fs[:,:,:,2], lvecScan, data_format=data_format ) if opt_dict['vib'] >= 0: which = opt_dict['vib'] print " === computing eigenvectors of dynamical matix which=%i ddisp=%f" %(which,PPU.params['ddisp']) evals,evecs = PPC.stiffnessMatrix( rTips.reshape((-1,3)), rPPs.reshape((-1,3)), which=which, ddisp=PPU.params['ddisp'] ) GU.save_vec_field( dirname+'/eigvalKs', evals .reshape( rTips.shape ), lvecScan, data_format=data_format ) if which > 0: GU.save_vec_field( dirname+'/eigvecK1', evecs[0].reshape( rTips.shape ), lvecScan, data_format=data_format ) if which > 1: GU.save_vec_field( dirname+'/eigvecK2', evecs[1].reshape( rTips.shape ), lvecScan, data_format=data_format ) if which > 2: GU.save_vec_field( dirname+'/eigvecK3', evecs[2].reshape( rTips.shape ), lvecScan, data_format=data_format ) #print "SHAPE", PPpos.shape, xTips.shape, yTips.shape, zTips.shape if opt_dict['disp']: GU.save_vec_field( dirname+'/PPdisp', rPPs-rTips+PPU.params['r0Probe'][0], lvecScan, data_format=data_format ) if ( opt_dict['pos'] or opt_dict['stm']): GU.save_vec_field( dirname+'/PPpos', rPPs, lvecScan, data_format=data_format )
sys.path.append('../') #import pyProbeParticle as PPU import pyProbeParticle.core as PPC S = np.genfromtxt('TipRSpline.ini') print "TipRSpline.ini overrides harmonic tip" xs = S[:, 0].copy() print "xs: ", xs ydys = S[:, 1:].copy() print "ydys: ", ydys plt.plot(xs, ydys[:, 0], 'o') plt.plot(xs, ydys[:, 0] + ydys[:, 1], '.') PPC.setTipSpline(xs, ydys) PPC.setTip() fs = np.zeros((60, 3)) r0 = np.array([0.0, 0.0, 0.5]) dr = np.array([0.0, 0.0, 0.1]) R = np.array([0.0, 0.0, 0.0]) xs = np.array(range(len(fs))) * dr[2] + r0[2] #print "xs=",xs print ">>> PPC.test_force( 1, r0, dr, R, fs )" PPC.test_force(1, r0, dr, R, fs) plt.plot(xs, fs[:, 2]) print ">>> PPC.test_force( 2, r0, dr, R, fs )" PPC.test_force(2, r0, dr, R, fs) plt.plot(xs, fs[:, 2])
sys.path.append("../") # import pyProbeParticle as PPU import pyProbeParticle.core as PPC S = np.genfromtxt("TipRSpline.ini") print "TipRSpline.ini overrides harmonic tip" xs = S[:, 0].copy() print "xs: ", xs ydys = S[:, 1:].copy() print "ydys: ", ydys plt.plot(xs, ydys[:, 0], "o") plt.plot(xs, ydys[:, 0] + ydys[:, 1], ".") PPC.setTipSpline(xs, ydys) PPC.setTip() fs = np.zeros((60, 3)) r0 = np.array([0.0, 0.0, 0.5]) dr = np.array([0.0, 0.0, 0.1]) R = np.array([0.0, 0.0, 0.0]) xs = np.array(range(len(fs))) * dr[2] + r0[2] # print "xs=",xs print ">>> PPC.test_force( 1, r0, dr, R, fs )" PPC.test_force(1, r0, dr, R, fs) plt.plot(xs, fs[:, 2]) print ">>> PPC.test_force( 2, r0, dr, R, fs )" PPC.test_force(2, r0, dr, R, fs) plt.plot(xs, fs[:, 2])