def optimise(cluster_name): cluster = ASE_read(cluster_name + '.traj') cluster_optimised = RunMinimisation(cluster).get_cluster() cluster_optimised.set_calculator(None) cluster_name_opt = cluster_name + '_Opt' ASE_write(cluster_name_opt + '.traj', cluster_optimised) return cluster_name_opt, cluster_optimised
def rotate_top(angle,atom_to_remove,name,only_rotate_second_later=False,Optimise=False): angle = radians(float(angle)) angle = float(angle) if not Optimise: cluster = copy.deepcopy(cluster_main) else: cluster = copy.deepcopy(cluster_main_optimised) rotate_around_x = cluster[3].x; rotate_around_y = cluster[3].y; first_layer_to_rotate = [9,6,18,15,12] second_layer_to_rotate = [24,22,20,38,36,34,32,30,28,26] rotate_atoms = second_layer_to_rotate if not only_rotate_second_later: rotate_atoms += first_layer_to_rotate for atom in atom_to_remove: del cluster[atom] for index2 in range(len(rotate_atoms)): if atom < rotate_atoms[index2]: rotate_atoms[index2] -= 1 if Optimise: cluster = RunMinimisation(cluster).get_cluster() cluster.set_calculator(None) for index in rotate_atoms: old_x = cluster[index].x - rotate_around_x; old_y = cluster[index].y - rotate_around_y new_x = old_x*cos(angle) - old_y*sin(angle) + (rotate_around_x) new_y = old_x*sin(angle) + old_y*cos(angle) + (rotate_around_y) cluster[index].x = new_x; cluster[index].y = new_y #view(cluster) #import pdb; pdb.set_trace() if Optimise: name += '_Opt' ASE_write(name+'.traj',cluster,'traj')
print '---------------------------' def optimise(cluster_name): cluster = ASE_read(cluster_name + '.traj') cluster_optimised = RunMinimisation(cluster).get_cluster() cluster_name_opt = cluster_name + '_Opt' ASE_write(cluster_name_opt + '.traj', cluster_optimised) return cluster_name_opt symbol = 'Au' r0 = 2.8840 latticeconstant = r0 * (2.0)**0.5 cluster_main = Decahedron(symbol, 3, 3, 0, latticeconstant=latticeconstant) cluster_main_optimised = RunMinimisation(cluster_main).get_cluster() cluster_main_optimised.set_calculator(None) ''' def rotate_top(angle,atom_to_remove,name): angle = radians(float(angle)) angle = float(angle) cluster = copy.deepcopy(cluster_main) rotate_around_x = cluster[3].x; rotate_around_y = cluster[3].y; first_layer_to_rotate = [19,23,7,11,15] second_layer_to_rotate = [27,8,54,24,51,48,20,45,42,16,39,36,12,33,30] for index in (first_layer_to_rotate+second_layer_to_rotate): old_x = cluster[index].x - rotate_around_x; old_y = cluster[index].y - rotate_around_y new_x = old_x*cos(angle) - old_y*sin(angle) + (rotate_around_x) new_y = old_x*sin(angle) + old_y*cos(angle) + (rotate_around_y) cluster[index].x = new_x; cluster[index].y = new_y for index in atom_to_remove:
def optimise(cluster, cluster_name): cluster_optimised = RunMinimisation(cluster).get_cluster() cluster_name_opt = cluster_name + '_Opt' ASE_write(cluster_name_opt + '.traj', cluster_optimised) return cluster_name_opt