#!/usr/bin/env python # # GRAIN BOUNDARY SYMMETRIC TILT ENERGY RELAXED CUBIC CRYSTAL # # Author: Brandon Runnels # Date: March 2016 # Institution: Department of Mechanical and Aerospace Engineering # University of Colorado Colorado Springs # Email: brunnels@uccs.edu # # Description: This file contains a test driver for generating GB # energy data given an arbitrary tilt axis, tilt range, # crystal structure, material, and potential. # The purpose of this file is to interface between the # OpenKIM framework and the compute_gb_tilt_energy python # script that generates LAMMPS input and runs the LAMMPS # tests. # Please see compute_gb_tilt_energy.py for additional # information. # # # Copyright: 2016 University of Colorado Colorado Springs # from numpy import sin, cos, tan, arctan2, radians, degrees, linspace, sqrt from fractions import Fraction from math import ceil import os, sys from compute_gb_tilt_energy import compute_gb_tilt_energy # # Import property defintion keys from test # model_name = sys.stdin.readline().replace('\n',''); print("model_name="+model_name) a1 = [int(x) for x in sys.stdin.readline().split(" ")] print("a1="+str(a1)) a2 = [int(x) for x in sys.stdin.readline().split(" ")] print("a2="+str(a2)) a3 = [int(x) for x in sys.stdin.readline().split(" ")] print("a3="+str(a3)) species = sys.stdin.readline().replace('\n','') print("species="+species) theta_min = float(sys.stdin.readline().replace('\n','')) print("theta_min="+str(theta_min)) theta_max = float(sys.stdin.readline().replace('\n','')) print("theta_max="+str(theta_max)) max_denominator = int(sys.stdin.readline().replace('\n','')) print("max_denominator="+str(max_denominator)) short_name = sys.stdin.readline().replace('\n','') print("short_name="+short_name) cutoff_distance = float(sys.stdin.readline()) print("cutoff_distance="+str(cutoff_distance)) x_repeat = int(sys.stdin.readline().replace('\n','')) print("x_repeat="+str(x_repeat)) z_repeat = int(sys.stdin.readline().replace('\n','')) print("x_repeat="+str(z_repeat)) min_cell_height = float(sys.stdin.readline()) print("min_cell_height="+str(min_cell_height)) offset_top = [float(x) for x in sys.stdin.readline().split(" ")] print("offset_top="+str(offset_top)) offset_bottom = [float(x) for x in sys.stdin.readline().split(" ")] print("offset_bottom="+str(offset_bottom)) intermdiate = sys.stdin.readline() cohesive_energy_a = [float(x) for x in intermdiate.replace('[','').replace(']','').replace(',','').split(" ")] a = cohesive_energy_a[0] * 1E10 # convert meters to angstroms print("a="+str(a)) cohesive_energy = cohesive_energy_a[1] * 6.242E18 # convert from joules to electron volts print("cohesive_energy="+str(cohesive_energy)) mass = float(sys.stdin.readline().replace('\n','')) print("mass="+str(mass)) # # Compute GB energy using comput_gb_tilt_energy python script # thetas, relaxed_energies, minimum_distances, sigmas = compute_gb_tilt_energy( output_dir='output', a1=a1, a2=a2, a3=a3, pair_style = 'kim LAMMPSvirial ' + model_name, pair_coeff = '* * ' + species + ' ' + species, theta_min = theta_min, theta_max = theta_max, max_denominator = max_denominator, lattice_style = short_name, lattice_constant = a, cutoff_distance = cutoff_distance, x_repeat = x_repeat, z_repeat = z_repeat, min_cell_height = min_cell_height, # offset_top = offset_top, # offset_bottom = offset_bottom, num_mpi_processors = 1, cohesive_energy = cohesive_energy, mass = mass, # dump_format = 'cfg', # return_positions = 'files', gzip=False, verbose = True) # # Export results to EDN file # edn_out = open('output/results.edn','w') edn_out.write('{\n') edn_out.write(' "property-id" "tag:brunnels@noreply.openkim.org,2016-02-18:property/grain-boundary-symmetric-tilt-energy-relaxed-relation-cubic-crystal" \n') edn_out.write(' "instance-id" 1 \n') # a edn_out.write(' "a" { \n') edn_out.write(' "source-value" '+str(a)+'\n') edn_out.write(' "source-unit" "angstrom"\n') edn_out.write(' }\n') # basis-atom-coordinates TODO edn_out.write(' "basis-atom-coordinates" { \n') if short_name == 'fcc': edn_out.write(' "source-value" [ [0 0 0] [0 0.5 0.5] [0.5 0 0.5] [0.5 0.5 0] ] \n') elif short_name == 'bcc': edn_out.write(' "source-value" [ [0 0 0] [0.5 0.5 0.5] ] \n') elif short_name == 'sc': edn_out.write(' "source-value" [ [0 0 0] ] \n') else: raise('short_name is not of type fcc, bcc, or sc') edn_out.write(' }\n') # interface-offset (ignored) # minimum-atom-separation edn_out.write(' "minimum-atom-separation" {\n') edn_out.write(' "source-value" [ ') for minimum_distance in minimum_distances: edn_out.write(str(minimum_distance) + " ") edn_out.write( '] \n') edn_out.write(' "source-unit" "angstrom"\n') edn_out.write(' }\n') # relaxed-grain-boundary-energy edn_out.write(' "relaxed-grain-boundary-energy" {\n') edn_out.write(' "source-value" [ ') for energy in relaxed_energies: edn_out.write(str(energy) + " ") edn_out.write( '] \n') edn_out.write(' "source-unit" "J/m^2"\n') edn_out.write(' }\n') # relaxed-interface-positions #edn_out.write(' "relaxed-interface-positions" { \n') #edn_out.write(' "source-value" [\n') #for f in files: # edn_out.write(' "'+f.split('output/')[1]+'"\n' ) #edn_out.write(' ]\n') #edn_out.write(' }\n') # short-name edn_out.write(' "short-name" {\n') edn_out.write(' "source-value" [ "'+short_name+'" ] \n') edn_out.write(' }\n') # sigma edn_out.write(' "sigma" {\n') edn_out.write(' "source-value" [ ') for sigma in sigmas: edn_out.write(str(sigma) + " ") edn_out.write( '] \n') edn_out.write(' }\n') # space-group (ignored) # species edn_out.write(' "species" {\n') edn_out.write(' "source-value" ["'+species+'" "'+species+'" "'+species+'" "'+species+'" ]\n') edn_out.write(' }\n') # tilt-angle edn_out.write(' "tilt-angle" {\n') edn_out.write(' "source-value" [ ') for theta in thetas: edn_out.write(str(theta) + " ") edn_out.write( '] \n') edn_out.write(' "source-unit" "degrees"\n') edn_out.write(' }\n') # tilt-axis edn_out.write(' "tilt-axis" {\n') edn_out.write(' "source-value" ['+str(a3[0])+' '+str(a3[1])+' '+str(a3[2])+']\n') edn_out.write(' }\n') edn_out.write('}\n') edn_out.close() # wyckoff-coordinates (ignored) # wyckoff-multiplicity-and-letter (ignored) # wyckoff-species exit(0)