print options data_format = "npy" if options.npy else "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 "--- Compute Lennard-Jones Force-filed ---" atoms, lvec = PPH.importGeometries(options.input) FFparams = None if os.path.isfile('atomtypes.ini'): print ">> LOADING LOCAL atomtypes.ini" FFparams = PPU.loadSpecies('atomtypes.ini') else: FFparams = PPU.loadSpecies(cpp_utils.PACKAGE_PATH + '/defaults/atomtypes.ini') PBC = False if not options.noPBC else PPU.params['PBC'] iZs, Rs, Qs = PPH.parseAtoms(atoms, autogeom=False, PBC=options.noPBC, FFparams=FFparams)
atoms_str = "" atoms = None bonds = None if opt_dict['atoms'] or opt_dict['bonds']: atoms_str = "_atoms" atoms, tmp1, tmp2 = basUtils.loadAtoms('input_plot.xyz') del tmp1, tmp2 # print "atoms ", atoms if os.path.isfile('atomtypes.ini'): print(">> LOADING LOCAL atomtypes.ini") FFparams = PPU.loadSpecies('atomtypes.ini') else: FFparams = PPU.loadSpecies(cpp_utils.PACKAGE_PATH + '/defaults/atomtypes.ini') iZs, Rs, Qstmp = PPH.parseAtoms(atoms, autogeom=False, PBC=False, FFparams=FFparams) atom_colors = basUtils.getAtomColors(iZs, FFparams=FFparams) Rs = Rs.transpose().copy() atoms = [iZs, Rs[0], Rs[1], Rs[2], atom_colors] #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 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: k=0
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)), which=which, ddisp=PPU.params['ddisp']) GU.save_vec_field(dirname + '/eigvalKs', evals.reshape(rTips.shape),
else: sys.exit("ERROR!!! Unknown format of geometry system. Supported " "formats are: .xyz, .cube, .xsf \n\n") FFparams=None if os.path.isfile( 'atomtypes.ini' ): print ">> LOADING LOCAL atomtypes.ini" FFparams=PPU.loadSpecies( 'atomtypes.ini' ) else: FFparams = PPU.loadSpecies( cpp_utils.PACKAGE_PATH+'/defaults/atomtypes.ini' ) iZs,Rs,Qs=PPH.parseAtoms(atoms, autogeom = False, PBC = options.noPBC, FFparams=FFparams ) # This function returns the following information: # 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
xTips,yTips,zTips,lvecScan = PPU.prepareScanGrids( ) extent = ( xTips[0], xTips[-1], yTips[0], yTips[-1] ) atoms_str="" atoms = None bonds = None if opt_dict['atoms'] or opt_dict['bonds']: atoms_str="_atoms" atoms = basUtils.loadAtoms( 'input_plot.xyz' ) # print "atoms ", atoms if os.path.isfile( 'atomtypes.ini' ): print ">> LOADING LOCAL atomtypes.ini" FFparams=PPU.loadSpecies( 'atomtypes.ini' ) else: FFparams = PPU.loadSpecies( cpp_utils.PACKAGE_PATH+'/defaults/atomtypes.ini' ) iZs,Rs,Qstmp=PPH.parseAtoms(atoms, autogeom = False,PBC = options.noPBC, FFparams=FFparams) atom_colors = basUtils.getAtomColors(iZs,FFparams=FFparams) Rs=Rs.transpose().copy() atoms= [iZs,Rs[0],Rs[1],Rs[2],atom_colors] #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 ):