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([
PP.params['gridA'],
PP.params['gridB'],
PP.params['gridC'],
]).copy() 

gridN = PP.params['gridN']

FF   = np.zeros( (gridN[2],gridN[1],gridN[0],3) )

#quit()
Esempio n. 2
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([
    PP.params['gridA'],
    PP.params['gridB'],
    PP.params['gridC'],
]).copy()

gridN = PP.params['gridN']

FF = np.zeros((gridN[2], gridN[1], gridN[0], 3))

#quit()
#   The costly part of simulation starts here
# ==============================================

print(" # =========== Sample LenardJones ")

#xsfLJ       = True
xsfLJ = False
recomputeLJ = True

if (xsfLJ and os.path.isfile('FFLJ_x.xsf')):
    recomputeLJ = False
if ((not xsfLJ) and os.path.isfile('FFLJ_y.npy')):
    recomputeLJ = False

if recomputeLJ:
    FFparams = PP.loadSpecies('atomtypes.ini')
    C6, C12 = PP.getAtomsLJ(PP.params['probeType'], iZs, FFparams)
    PP.setFF(FFLJ, cell)
    PP.setFF_Pointer(FFLJ)
    PP.getLenardJonesFF(Rs, C6, C12)
    if xsfLJ:
        PP.saveXSF('FFLJ_x.xsf', head, lvec, FFLJ[:, :, :, 0])
        PP.saveXSF('FFLJ_y.xsf', head, lvec, FFLJ[:, :, :, 1])
        PP.saveXSF('FFLJ_z.xsf', head, lvec, FFLJ[:, :, :, 2])
    else:
        np.save('FFLJ_x.npy', FFLJ[:, :, :, 0])
        np.save('FFLJ_y.npy', FFLJ[:, :, :, 1])
        np.save('FFLJ_z.npy', FFLJ[:, :, :, 2])
else:
    if xsfLJ:
        FFLJ[:, :, :, 0], lvec, nDim, head = PP.loadXSF('FFLJ_x.xsf')
#   The costly part of simulation starts here
# ==============================================

print " # =========== Sample LenardJones "

#xsfLJ       = True
xsfLJ       = False
recomputeLJ = True

if (     xsfLJ  and os.path.isfile('FFLJ_x.xsf')):
	recomputeLJ = False
if ((not xsfLJ) and os.path.isfile('FFLJ_y.npy')):
	recomputeLJ = False

if recomputeLJ:
	FFparams = PP.loadSpecies        ( 'atomtypes.ini'  )
	C6,C12   = PP.getAtomsLJ( PP.params['probeType'], iZs, FFparams )
	PP.setFF( FFLJ, cell  )
	PP.setFF_Pointer( FFLJ )
	PP.getLenardJonesFF( Rs, C6, C12 )
	if xsfLJ:
		PP.saveXSF('FFLJ_x.xsf', head, lvec, FFLJ[:,:,:,0] )
		PP.saveXSF('FFLJ_y.xsf', head, lvec, FFLJ[:,:,:,1] )
		PP.saveXSF('FFLJ_z.xsf', head, lvec, FFLJ[:,:,:,2] )
	else:
		np.save('FFLJ_x.npy', FFLJ[:,:,:,0] )
		np.save('FFLJ_y.npy', FFLJ[:,:,:,1] )
		np.save('FFLJ_z.npy', FFLJ[:,:,:,2] )
else:
	if xsfLJ:
		FFLJ[:,:,:,0],lvec,nDim,head=PP.loadXSF('FFLJ_x.xsf')
# ============== load reference grid

V, lvec, nDim, head = GU.loadXSF(WORK_DIR + 'LOCPOT.xsf')

cell = np.array([lvec[1], lvec[2], lvec[3]])

MP.setGrid(V, cell)

# ============== prepare atoms

atom_types, atom_pos = GU.getFromHead_PRIMCOORD(
    head)  # load atoms from header of xsf file

# set sample region around atom atom_Rmin, atom_Rmax
spacies = PP.loadSpecies('./defaults/atomtypes.ini')
R_type = spacies[:, 0]
atom_Rmin, atom_Rmax = MP.make_Ratoms(atom_types, R_type)

# mask atoms which should not to be included into the expansion
natoms = len(atom_types)
atom_mask = np.array([True] * natoms)
atom_mask[2:] = False

# set basiset for each atom
atom_basis = MP.make_bas_list([len(atom_pos)], basis=[['s', 'px', 'py', 'pz']])

#print "atom_pos:   ", atom_pos
#print "atom_Rmin:  ", atom_Rmin
#print "atom_Rmax:  ", atom_Rmax
#print "atom_mask:  ", atom_mask
# NOTE: Data for COCu4 tip example are on tarkil  /auto/praha1/prokop/STHM/vasp/COCu4

# ============== load reference grid

V, lvec, nDim, head = GU.loadXSF( WORK_DIR + 'LOCPOT.xsf' )

cell = np.array( [ lvec[1], lvec[2], lvec[3] ]); 

MP.setGrid( V, cell );

# ============== prepare atoms

atom_types,atom_pos = GU.getFromHead_PRIMCOORD( head )   # load atoms from header of xsf file

# set sample region around atom atom_Rmin, atom_Rmax
spacies              = PP.loadSpecies( './defaults/atomtypes.ini' )
R_type               = spacies[:,0]
atom_Rmin, atom_Rmax = MP.make_Ratoms( atom_types, R_type ) 

# mask atoms which should not to be included into the expansion 
natoms          = len( atom_types )
atom_mask       = np.array( [ True ] * natoms ); 
atom_mask[ 2: ] = False

# set basiset for each atom 
atom_basis = MP.make_bas_list( [ len( atom_pos ) ],  basis=[ ['s','px','py','pz'] ] )

#print "atom_pos:   ", atom_pos
#print "atom_Rmin:  ", atom_Rmin
#print "atom_Rmax:  ", atom_Rmax
#print "atom_mask:  ", atom_mask