Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AIASSE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cprutean
AIASSE
Commits
17692469
Commit
17692469
authored
1 week ago
by
adaramo2
Browse files
Options
Downloads
Patches
Plain Diff
Edit glass.py
parent
6d14a8fb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/glass.py
+21
-7
21 additions, 7 deletions
src/glass.py
with
21 additions
and
7 deletions
src/glass.py
+
21
−
7
View file @
17692469
...
@@ -23,7 +23,19 @@ plt.rcParams.update({
...
@@ -23,7 +23,19 @@ plt.rcParams.update({
'
axes.labelweight
'
:
'
bold
'
'
axes.labelweight
'
:
'
bold
'
})
})
######################################
# Helper Function to Get Project Root
######################################
def
get_project_root
():
"""
Returns the project root directory.
Assumes this file is in a container inside the project.
"""
return
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"
..
"
))
######################################
# --- Utility Functions for GR Files ---
# --- Utility Functions for GR Files ---
######################################
def
read_gr_file
(
file_path
):
def
read_gr_file
(
file_path
):
"""
"""
Read a GR file and return:
Read a GR file and return:
...
@@ -54,7 +66,9 @@ def find_cutoff_distance(r, gr):
...
@@ -54,7 +66,9 @@ def find_cutoff_distance(r, gr):
return
r
[
i
]
return
r
[
i
]
return
3.0
return
3.0
######################################
# --- Helper Function to Draw a Closed Cube ---
# --- Helper Function to Draw a Closed Cube ---
######################################
def
draw_closed_cube
(
ax
,
x_min
,
x_max
,
y_min
,
y_max
,
z_min
,
z_max
):
def
draw_closed_cube
(
ax
,
x_min
,
x_max
,
y_min
,
y_max
,
z_min
,
z_max
):
"""
"""
Draw a closed cube (with 12 edges) on the given 3D axis.
Draw a closed cube (with 12 edges) on the given 3D axis.
...
@@ -80,16 +94,19 @@ def draw_closed_cube(ax, x_min, x_max, y_min, y_max, z_min, z_max):
...
@@ -80,16 +94,19 @@ def draw_closed_cube(ax, x_min, x_max, y_min, y_max, z_min, z_max):
[
p1
[
2
],
p2
[
2
]],
[
p1
[
2
],
p2
[
2
]],
color
=
'
black
'
,
linestyle
=
'
-
'
,
linewidth
=
2
)
color
=
'
black
'
,
linestyle
=
'
-
'
,
linewidth
=
2
)
######################################
# --- Main Application Class ---
# --- Main Application Class ---
######################################
class
SilicaNetworkAnalyzer
(
QMainWindow
):
class
SilicaNetworkAnalyzer
(
QMainWindow
):
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
self
.
setWindowTitle
(
"
Silica Glass Network Analyzer
"
)
self
.
setWindowTitle
(
"
Silica Glass Network Analyzer
"
)
self
.
setGeometry
(
100
,
100
,
500
,
800
)
# reduced width since plot area is removed
self
.
setGeometry
(
100
,
100
,
500
,
800
)
# reduced width since plot area is removed
# Directories for GR and XYZ files:
# Directories for GR and XYZ files are now built relative to the project root.
self
.
gr_directory
=
"
Large_box/Large/Accumulation_dependence/
"
root
=
get_project_root
()
self
.
xyz_directory
=
"
Large_box/Large/Accumulation_dependence/DFT_box/
"
self
.
gr_directory
=
os
.
path
.
join
(
root
,
"
Large_box
"
,
"
Large
"
,
"
Accumulation_dependence
"
)
self
.
xyz_directory
=
os
.
path
.
join
(
root
,
"
Large_box
"
,
"
Large
"
,
"
Accumulation_dependence
"
,
"
DFT_box
"
)
# Data storage
# Data storage
self
.
atoms
=
[]
# List of tuples: (element, np.array([x,y,z]))
self
.
atoms
=
[]
# List of tuples: (element, np.array([x,y,z]))
...
@@ -144,8 +161,6 @@ class SilicaNetworkAnalyzer(QMainWindow):
...
@@ -144,8 +161,6 @@ class SilicaNetworkAnalyzer(QMainWindow):
self
.
ring_example_btn
.
clicked
.
connect
(
self
.
show_ring_example
)
self
.
ring_example_btn
.
clicked
.
connect
(
self
.
show_ring_example
)
control_layout
.
addWidget
(
self
.
ring_example_btn
)
control_layout
.
addWidget
(
self
.
ring_example_btn
)
# Removed the "Save Current Plot" button since plots are external
# Input for maximum number of Si atoms to plot (to avoid overcrowding)
# Input for maximum number of Si atoms to plot (to avoid overcrowding)
control_layout
.
addWidget
(
QLabel
(
"
Max Si atoms to plot:
"
))
control_layout
.
addWidget
(
QLabel
(
"
Max Si atoms to plot:
"
))
self
.
max_atoms_input
=
QLineEdit
(
"
500
"
)
self
.
max_atoms_input
=
QLineEdit
(
"
500
"
)
...
@@ -613,5 +628,4 @@ if __name__ == "__main__":
...
@@ -613,5 +628,4 @@ if __name__ == "__main__":
app
=
QApplication
(
sys
.
argv
)
app
=
QApplication
(
sys
.
argv
)
window
=
SilicaNetworkAnalyzer
()
window
=
SilicaNetworkAnalyzer
()
window
.
show
()
window
.
show
()
sys
.
exit
(
app
.
exec_
())
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment