-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
123 lines (99 loc) · 6.21 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Matplot uses the QtAgg backend by default to display plotting windows.
# That backend is based the Qt cross-platform GUI framework.
# OVITO too uses the Qt framework internally.
# The Qt framework relies on the creation of a global “application” object 1, which exists in two flavors:
# a GUI-based application object and a non-GUI one (used in terminal programs).
# Only a single global application object can exist at a time.
# The OVITO module creates a non-GUI object during import.
# Matplotlib’s QtAgg backend, however, requires a GUI application object
# (which it cannot create anymore, because of the already existing app object from OVITO).
# That’s why you are getting the error message.
# Solution:
# You can request OVITO to create a GUI application object
# by setting the environment variable OVITO_GUI_MODE=1 before importing the module.
# Then OVITO and Matplotlib will share the same application object.
import os
os.environ['OVITO_GUI_MODE'] = '1'
from functions import *
from functionsFeO import *
# from simulation_analysis import *
# dist_ends = get_distance_between_nanoparticle_ends(simulation_path='sftp://eytangf@dtn.sherlock.stanford.edu/scratch/groups/leoradm/yfwang09/NP_sintering/Temperature400_nstep200000_d3_r25_azimuth10pi_elevation10pi_azimuth20pi_elevation20pi/dump/md.nvt.200000.dump.gz')
# print(f"neck area: {dist_ends}")
# neck_area_arr = []
# time_step_arr = []
# for i in range(0,210000, 10000):
# neck_area = get_neck_area(simulation_path=f'sftp://eytangf@dtn.sherlock.stanford.edu/scratch/groups/leoradm/yfwang09/NP_sintering/Temperature400_nstep200000_d3_r25_azimuth10pi_elevation10pi_azimuth20pi_elevation20pi/dump/md.nvt.{i}.dump.gz', nanoparticle_radius=25, distance=3)
# neck_area_arr.append(neck_area)
# time_step_arr.append(i)
# print(f"neck area: {neck_area}")
# plt.plot(time_step_arr, neck_area_arr)
# # Naming the x-axis, y-axis and the whole graph
# plt.xlabel("Time Step")
# plt.ylabel("Neck Area (Angstrom^2)")
# plt.title("Neck Area v Time Step")
# plt.ylim(bottom=0)
# plt.xticks(np.arange(start=0,stop=220000,step=20000))
# plt.show()
# dist_ends_arr = []
# time_step_arr = np.arange(0, 210000, 10000)
# for i in range(0,210000, 10000):
# dist_ends = get_distance_between_nanoparticle_ends(simulation_path=f'sftp://eytangf@dtn.sherlock.stanford.edu/scratch/groups/leoradm/yfwang09/NP_sintering/Temperature400_nstep200000_d3_r25_azimuth10pi_elevation10pi_azimuth20pi_elevation20pi/dump/md.nvt.{i}.dump.gz')
# dist_ends_arr.append(dist_ends)
# print(f"neck area: {dist_ends}")
# plt.plot(time_step_arr, dist_ends_arr)
# # Naming the x-axis, y-axis and the whole graph
# plt.xlabel("Time Step")
# plt.ylabel("Dist Ends (Angstrom)")
# plt.title("Dist Ends v Time Step")
# plt.xticks(np.arange(start=0,stop=220000,step=20000))
# plt.show()
# FeOset_up_two_nanoparticles(path="/Users/eytangf/Desktop/Internship/Nanoparticle Simulations/standard cif files/FeO.cif",
# radius=25, distance=5, azimuth1 = 0, elevation1=0, azimuth2=0,
# elevation2=0, first_sphere_file_name="first_sphere.lmp",
# second_sphere_file_name="second_sphere.lmp", specific_simulation_directory_path="test folder")
# simulation_directory_path = automate_simulation(path="/Users/eytangf/Desktop/Internship/Nanoparticle Simulations/standard cif files/Fe2O3.cif",
# radius=25, distance=5, azimuth1 = 0, elevation1=0, azimuth2=0,
# elevation2=0, first_sphere_file_name="first_sphere.lmp",
# second_sphere_file_name="second_sphere.lmp", temperature=1300, nstep=200000)
# simulation_num = 0
# for azimuth1,elevation1,azimuth2,elevation2 in [(0,0,0,0), (0,0,math.pi/4,math.pi/4), (math.pi/4,math.pi/4, math.pi/4,math.pi/4)]:
# for temp in range(300,1400,100):
# for d in range (1,11):
# simulation_num += 1
# print(f"simulation num: {simulation_num}")
# print(f"temp: {temp}")
# print(f"d: {d}")
# simulation_directory_path = FeOautomate_simulation(path="/Users/eytangf/Desktop/Internship/Nanoparticle Simulations/standard cif files/FeO.cif",
# radius=25, distance=d, azimuth1 = azimuth1, elevation1=elevation1, azimuth2=azimuth2,
# elevation2=elevation2, first_sphere_file_name="first_sphere.lmp",
# second_sphere_file_name="second_sphere.lmp", temperature=temp, nstep=200000)
# sphere = FeOunit_cell_to_sphere("/Users/eytangf/Desktop/Internship/Nanoparticle Simulations/standard cif files/FeO.cif", radius=25, distance=0)
# print("SPHERE")
# sphere_net_charge = FeOcalculate_net_charge(sphere)
# FeOsave_lmp_data(sphere, "sphere.lmp")
# neutralized_sphere = FeOneutralize_charge(sphere, sphere_net_charge)
# print("\n")
# print("NEUTRALIZED SPHERE")
# FeOcalculate_net_charge(neutralized_sphere)
# FeOsave_lmp_data(neutralized_sphere, "neutralized_feo_nanoparticle_radius_25.lmp")
# neutralized_sphere_charge_density_check, charge_max, charge_min = FeOcheck_charge_density(neutralized_sphere, num_particles=60)
# print("\n")
# print("CHARGE DENSITY CHECK")
# FeOsave_lmp_dump(neutralized_sphere_charge_density_check, "neutralized_sphere_charge_density_check.lmp")
# charge_max_arr = np.zeros(12)
# charge_min_arr = np.zeros(12)
# num_particles_arr = np.zeros(12)
# for i in range(5,65,5):
# arr_index = int(i/5) - 1
# neutralized_sphere_charge_density_check, charge_max, charge_min = check_charge_density(neutralized_sphere, num_particles=i)
# charge_max_arr[arr_index] = charge_max
# charge_min_arr[arr_index] = charge_min
# num_particles_arr[arr_index] = i
# plt.plot(num_particles_arr, charge_max_arr, color='b', label = "charge max", marker = 'o')
# plt.plot(num_particles_arr, charge_min_arr, color='r', label = "charge_min", marker = 'o')
# # Naming the x-axis, y-axis and the whole graph
# plt.xlabel("Number of Neighboring Particles")
# plt.ylabel("Charge Density")
# plt.title("Charge Max and Min Density v Number of Neighboring Particles")
# plt.legend()
# plt.show()