def Minimisation_Function(cluster): cluster.pbc = False # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] #Au_parameters = {'Au': [10.229, 4.0360, 0.2061, 1.7900, 2.884]} r0 = 4.07/(2.0 ** 0.5) Au_parameters = {'Au': [10.53, 4.30, 0.2197, 1.855, r0]} # Baletto Gupta_parameters = Au_parameters cutoff = 1000 calculator = Gupta(Gupta_parameters, cutoff=cutoff, debug=False) cluster.set_calculator(calculator) original_cluster = cluster.copy() dyn = FIRE(cluster,logfile=None) converged = False try: dyn.run(fmax=0.01,steps=5000) converged = dyn.converged() if not converged: cluster_name = 'issue_cluster.xyz' errorMessage = 'The optimisation of cluster ' + str(original_cluster) + ' did not optimise completely.\n' errorMessage += 'The cluster of issue before optimisation has been saved as: '+str(cluster_name) write(cluster_name,original_cluster) raise Exception(errorMessage) except Exception as exception_message: cluster_name = 'issue_cluster.xyz' errorMessage = 'The optimisation of cluster ' + str(original_cluster) + ' did not optimise completely.\n' errorMessage += 'The cluster of issue before optimisation has been saved as: '+str(cluster_name)+'\n' errorMessage += exception_message write(cluster_name,original_cluster) raise Exception(errorMessage) return cluster
def Minimisation_Function(cluster): cluster.pbc = False # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] Pt_parameters = {'Pt': [10.71, 3.845, 0.27443, 2.6209, 2.77]} Gupta_parameters = Pt_parameters cutoff = 1000 calculator = Gupta(Gupta_parameters, cutoff=cutoff, debug=False) cluster.set_calculator(calculator) original_cluster = cluster.copy() dyn = FIRE(cluster, logfile=None) #startTime = time.time(); converged = False try: dyn.run(fmax=0.01, steps=5000) converged = dyn.converged() if not converged: cluster_name = 'issue_cluster.xyz' errorMessage = 'The optimisation of cluster ' + str( original_cluster) + ' did not optimise completely.\n' errorMessage += 'The cluster of issue before optimisation has been saved as: ' + str( cluster_name) write(cluster_name, original_cluster) raise Exception(errorMessage) except Exception as exception_message: cluster_name = 'issue_cluster.xyz' errorMessage = 'The optimisation of cluster ' + str( original_cluster) + ' did not optimise completely.\n' errorMessage += 'The cluster of issue before optimisation has been saved as: ' + str( cluster_name) + '\n' errorMessage += exception_message write(cluster_name, original_cluster) raise Exception(errorMessage) #endTime = time.time() return cluster
def Minimisation_Function(cluster, collection, cluster_name): cluster.pbc = False #################################################################################################################### # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] Gupta_parameters = {'Cu': [10.960, 2.2780, 0.0855, 1.224, 2.556]} cluster.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) dyn = FIRE(cluster, logfile=None) startTime = time.time() converged = False try: dyn.run(fmax=0.01, steps=5000) converged = dyn.converged() if not converged: errorMessage = 'The optimisation of cluster ' + str( cluster_name) + ' did not optimise completely.' print(errorMessage, file=sys.stderr) print(errorMessage) except: print('Local Optimiser Failed for some reason.') endTime = time.time() #################################################################################################################### # Write information about the algorithm Info = {} Info["INFO.txt"] = '' Info["INFO.txt"] += ("No of Force Calls: " + str(dyn.get_number_of_steps()) + '\n') Info["INFO.txt"] += ("Time (s): " + str(endTime - startTime) + '\n') #Info["INFO.txt"] += ("Cluster converged?: " + str(dyn.converged()) + '\n') #################################################################################################################### return cluster, converged, Info
def Minimisation_Function(cluster,collection,cluster_name): #################################################################################################################### cluster.pbc = False #################################################################################################################### # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] #Gupta_parameters = {'Au': [10.529999999999999, 4.2999999999999998, 0.21970000000000001, 1.855, 2.8779245994292486]} Gupta_parameters = {'Pd': [10.867, 3.742, 0.1746, 1.718, 2.7485], 'Au': [10.229, 4.036, 0.2061, 1.79, 2.884], ('Au','Pd'): [10.54, 3.89, 0.19, 1.75, 2.816]} cluster.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) dyn = FIRE(cluster,logfile=None) startTime = time.time(); converged = False try: dyn.run(fmax=0.01,steps=5000) converged = dyn.converged() if not converged: errorMessage = 'The optimisation of cluster ' + str(cluster_name) + ' did not optimise completely.' print(errorMessage, file=sys.stderr) print(errorMessage) except Exception: print('Local Optimiser Failed for some reason.') endTime = time.time() #################################################################################################################### # Write information about the algorithm Info = {} Info["INFO.txt"] = '' Info["INFO.txt"] += ("No of Force Calls: " + str(dyn.get_number_of_steps()) + '\n') Info["INFO.txt"] += ("Time (s): " + str(endTime - startTime) + '\n') #Info["INFO.txt"] += ("Cluster converged?: " + str(dyn.converged()) + '\n') #################################################################################################################### return cluster, converged, Info
def optimse_Cu(cluster): Cu_parameters = {'Cu': [10.960, 2.2780, 0.0855, 1.2240, 2.556]} cluster.set_calculator(Gupta(Cu_parameters, cutoff=1000, debug=True)) dyn = FIRE(cluster) try: import time startTime = time.time() dyn.run(fmax=0.01, steps=5000) endTime = time.time() if not dyn.converged(): import os name = os.path.basename(os.getcwd()) errorMessage = 'The optimisation of cluster ' + name + ' did not optimise completely.' print >> sys.stderr, errorMessage print errorMessage except: print('Local Optimiser Failed for some reason.')
def Minimisation_Function(cluster, collection, cluster_dir): #################################################################################################################### # Read the BeforeOpt file and record the elements, the # number of each element in the cluster and their positions #cluster = ase_read("BeforeOpt",format='vasp') cluster.pbc = False #################################################################################################################### #Construct atoms using the ASE class "Atoms". #################################################################################################################### # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] Gupta_parameters = {'Cu': [10.960, 2.2780, 0.0855, 1.224, 2.556]} cluster.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) dyn = FIRE(cluster, logfile=None) startTime = time.time() converged = False try: dyn.run(fmax=0.01, steps=5000) converged = dyn.converged() if not converged: import os name = os.path.basename(os.getcwd()) errorMessage = 'The optimisation of cluster ' + name + ' did not optimise completely.' #print sys.stderr >> errorMessage print(errorMessage) except: print('Local Optimiser Failed for some reason.') endTime = time.time() #ase_write('AfterOpt.traj',cluster) #################################################################################################################### # Write information about the algorithm Info = {} Info["INFO.txt"] = '' Info["INFO.txt"] += ("No of Force Calls: " + str(dyn.get_number_of_steps()) + '\n') Info["INFO.txt"] += ("Time (s): " + str(endTime - startTime) + '\n') #Info.write("Cluster converged?: " + str(dyn.converged()) + '\n') #################################################################################################################### return cluster, converged, Info
def Minimisation_Function(cluster, collection, cluster_name): ####################################################################################### cluster.pbc = False # make sure that the periodic boundry conditions are set off ####################################################################################### # Perform the local optimisation method on the cluster. # Parameter sequence: [p, q, a, xi, r0] # # RGL parameters below from: # Crossover among structural motifs in transition and noble-metal clusters # F. Baletto, R. Ferrando, A. Fortunelli, F. Montalenti and C. Mottet, J. Chem. Phys., 2002, 116, 3856–3863. # https://doi.org/10.1063/1.1448484 r0 = 4.07 / (2.0**0.5) Gupta_parameters = {'Au': [10.53, 4.30, 0.2197, 1.855, r0]} cluster.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) dyn = FIRE(cluster, logfile=None) startTime = time.time() converged = False try: dyn.run(fmax=0.01, steps=5000) converged = dyn.converged() if not converged: errorMessage = 'The optimisation of cluster ' + str( cluster_name) + ' did not optimise completely.' print(errorMessage, file=sys.stderr) print(errorMessage) except Exception: print('Local Optimiser Failed for some reason.') endTime = time.time() #################################################################################################################### # Write information about the algorithm Info = {} Info["INFO.txt"] = '' Info["INFO.txt"] += ("No of Force Calls: " + str(dyn.get_number_of_steps()) + '\n') Info["INFO.txt"] += ("Time (s): " + str(endTime - startTime) + '\n') #Info["INFO.txt"] += ("Cluster converged?: " + str(dyn.converged()) + '\n') #################################################################################################################### return cluster, converged, Info
#plt.savefig('CNA_plot_over_rCut.eps') plt.savefig('CNA_plot_over_rCut.svg') #################################################################################################################### #################################################################################################################### #################################################################################################################### #################################################################################################################### #################################################################################################################### #################################################################################################################### #################################################################################################################### cluster_1 = get_cluster('1149.xyz') cluster_2 = get_cluster('2619.xyz') Gupta_parameters = {'Cu': [10.960, 2.2780, 0.0855, 1.224, 2.556]} cluster_1.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) cluster_1.get_potential_energy() cluster_2.set_calculator(Gupta(Gupta_parameters, cutoff=1000, debug=False)) cluster_2.get_potential_energy() lattice_constant = 3.62 r_eq = lattice_constant / (2.0**0.5) r_high = lattice_constant r_low = r_eq r_nums = 1000 rCuts = np.linspace(r_low, r_high, num=r_nums, endpoint=True) name_1, cluster_1_CNA_profile = get_CNA_profile((cluster_1, rCuts)) name_2, cluster_2_CNA_profile = get_CNA_profile((cluster_2, rCuts))