Skip to content

Commit

Permalink
lazy commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dehe1011 committed Jan 13, 2025
1 parent 035974d commit 6f5e725
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 53 deletions.
22 changes: 0 additions & 22 deletions qDNA/data/logs/qDNA.log
Original file line number Diff line number Diff line change
@@ -1,22 +0,0 @@
2024-12-03 18:01:43,681 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-03 18:01:43,681 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-03 18:02:09,739 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-03 18:02:09,739 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 10:46:07,160 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 10:46:07,160 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:03:14,362 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:03:14,362 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:10:22,405 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:10:22,405 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:12:41,336 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:12:41,337 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:15:02,788 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:15:02,788 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:45:08,931 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:45:08,931 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:45:21,520 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:45:21,520 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:47:37,380 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:47:37,380 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
2024-12-04 11:47:49,433 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\config.json
2024-12-04 11:47:49,433 - qDNA.tools.save_load - INFO - Data loaded from C:\Users\Dennis Herb\OneDrive\2_Uni\Doktor\python_projects\QuantumDNA\qDNA\data\raw\tb_models.json
3 changes: 2 additions & 1 deletion qDNA/data/raw/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
"exciton"
],
"SOURCES": [
"Endres2002",
"Bittner2007",
"Hawke2010",
"Simserides2014",
"Mantela2021",
"Simserides2024",
"Herb2024",
"Bittner2007",
"1BNA"
],
"SPECTRAL_DENSITIES": [
Expand Down
19 changes: 19 additions & 0 deletions qDNA/data/raw/tb_params/Endres2002_electron_WM copy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"data": {
"E_A": -4.2,
"E_C": -4.6,
"E_G": -4.0,
"E_T": -4.6,
"t_AA": 0.1054,
"t_AG": 0.1124,
"t_GA": 0.0472,
"t_GG": 0.0525
},
"metadata": {
"notes": "Calculated with SIESTA and DZP basis set",
"particle": "hole",
"source": "Endres2002",
"tb_model_name": "WM",
"unit": "eV"
}
}
19 changes: 19 additions & 0 deletions qDNA/data/raw/tb_params/Endres2002_hole_WM.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"data": {
"E_A": -7.95,
"E_C": -8.3,
"E_G": -7.75,
"E_T": -8.3,
"t_AA": -0.0695,
"t_AG": -0.071,
"t_GA": -0.1871,
"t_GG": -0.1409
},
"metadata": {
"notes": "Calculated with SIESTA and DZP basis set",
"particle": "hole",
"source": "Endres2002",
"tb_model_name": "WM",
"unit": "eV"
}
}
2 changes: 2 additions & 0 deletions qDNA/dna_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class DNA_Seq:

def __init__(self, upper_strand, tb_model_name, methylated=True, lower_strand=None):
# Initialize the DNA sequence
if isinstance(upper_strand, str):
upper_strand = list(upper_strand)
self.upper_strand = upper_strand
self.lower_strand = lower_strand
self.methylated = methylated
Expand Down
7 changes: 4 additions & 3 deletions qDNA/gui/diss_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ def __init__(self, master, configs, **kwargs):
self.diss_relax_rate_label.grid(row=4, column=0, padx=10, pady=10)

self.diss_relax_rate_entry = ctk.CTkEntry(self)
self.diss_relax_rate_entry.insert(
0, str(self.diss_kwargs_default["relax_rate"])
)
# self.diss_relax_rate_entry.insert(
# 0, str(self.diss_kwargs_default["relax_rate"])
# )
self.diss_relax_rate_entry.insert(0, 3.0)
self.diss_relax_rate_entry.grid(row=4, column=1, padx=10, pady=10)

# -----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion qDNA/gui/initial_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self, master, **kwargs):

self.tb_model_combo = ctk.CTkComboBox(self, values=master.configs["TB_MODELS"])
self.tb_model_combo.grid(row=7, column=0, pady=10, padx=10)
self.tb_model_combo.set("WM")
self.tb_model_combo.set("ELM")

self.grid_rowconfigure(8, weight=1)

Expand Down
17 changes: 7 additions & 10 deletions qDNA/gui/plot_options_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# --------------------------------------------------


class LifetimeFrame(ctk.CTkFrame):
class ExcitonFrame(ctk.CTkFrame):
def __init__(self, master, **kwargs):
"""
Notes:
Expand Down Expand Up @@ -59,23 +59,19 @@ def _calc_lifetime(self):
if isinstance(lifetime, str):
print("---------------------------")
print(f"Exciton Lifetime: {lifetime}")
print("---------------------------")
else:
print("---------------------------")
print(f"Exciton Lifetime: {lifetime} fs")
print("---------------------------")

def _calc_dipole(self):
dipole = calc_dipole(**self.kwargs)
print("---------------------------")
print(f"Charge Separation: {dipole} A")
print("---------------------------")

def _calc_dipole_moment(self):
dipole_moment = calc_dipole_moment(**self.kwargs)
print("---------------------------")
print(f"Dipole Moment: {dipole_moment} D")
print("---------------------------")

def _calc_exciton_transfer(self):
avg_pop_upper_strand, avg_pop_lower_strand = calc_exciton_transfer(
Expand All @@ -88,7 +84,6 @@ def _calc_exciton_transfer(self):
print("---------------------------")
print(f"Average Exciton Population (upper strand): {avg_pop_upper_strand}")
print(f"Average Exciton Population (lower strand): {avg_pop_lower_strand}")
print("---------------------------")


# --------------------------------------------------
Expand All @@ -113,9 +108,11 @@ def __init__(self, master, tb_basis, **kwargs):
self.tb_site_label = ctk.CTkLabel(self, text="TB site:")
self.tb_site_label.grid(row=1, column=0, padx=10, pady=10)

self.tb_site_combo = ctk.CTkComboBox(self, values=["All DNA Bases"] + tb_basis)
self.tb_site_combo = ctk.CTkComboBox(
self, values=["Heatmap", "All DNA Bases"] + tb_basis
)
self.tb_site_combo.grid(row=1, column=1, padx=10, pady=10)
self.tb_site_combo.set("All DNA Bases")
self.tb_site_combo.set("Heatmap")

def get_pop_kwargs(self):
"""Returns the values of widgets with get() method in dictionary format."""
Expand Down Expand Up @@ -236,7 +233,7 @@ def __init__(self, master, tb_basis, **kwargs):
self.pop_frame = PopFrame(self.pop_tab, tb_basis, **kwargs)
self.coh_frame = CohFrame(self.coh_tab, **kwargs)
self.fourier_frame = FourierFrame(self.fourier_tab, tb_basis, **kwargs)
self.lifetime_frame = LifetimeFrame(self.lifetime_tab, **kwargs)
self.exciton_frame = ExcitonFrame(self.lifetime_tab, **kwargs)


class PlotOptionsFrame(ctk.CTkFrame):
Expand Down Expand Up @@ -272,6 +269,6 @@ def change_state(self, state):
change_state_all_widgets(self.plot_options_tab.pop_frame, state=state)
change_state_all_widgets(self.plot_options_tab.coh_frame, state=state)
change_state_all_widgets(self.plot_options_tab.fourier_frame, state=state)
change_state_all_widgets(self.plot_options_tab.lifetime_frame, state=state)
change_state_all_widgets(self.plot_options_tab.exciton_frame, state=state)
self.submit_button.configure(state=state)
self.back_button.configure(state=state)
19 changes: 15 additions & 4 deletions qDNA/gui/plotting_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg

from ..visualization import plot_pop, plot_pops, plot_coh, plot_fourier
from ..visualization import (
plot_pop,
plot_pops,
plot_coh,
plot_fourier,
plot_pops_heatmap,
)
from ..tools import save_figure

# -----------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -73,7 +79,9 @@ def __init__(self, master, **kwargs):

if self.plot_option == "Population":
self.init_tb_site = self.plot_options_kwargs["init_tb_site"]
if self.init_tb_site == "All DNA Bases":
if self.init_tb_site == "Heatmap":
self.plot_pops_heatmap()
elif self.init_tb_site == "All DNA Bases":
self.plot_pops()
else:
self.plot_pop()
Expand Down Expand Up @@ -103,16 +111,19 @@ def plot_pop(self):
def plot_pops(self):
self.fig, self.axes = plot_pops(self.me_solver)

def plot_pops_heatmap(self):
self.fig, self.ax = plot_pops_heatmap(self.me_solver)

def plot_coh(self):
self.fig, self.ax = plt.subplots()
plot_coh(self.ax, self.me_solver)
self.ax = plot_coh(self.ax, self.me_solver)

def plot_fourier(self):
self.fig, self.ax = plt.subplots()
init_state = self.plot_options_kwargs["init_state"]
end_state = self.plot_options_kwargs["end_state"]
x_axis = self.plot_options_kwargs["x_axis"]
plot_fourier(self.ax, self.tb_ham, init_state, end_state, x_axis)
self.ax = plot_fourier(self.ax, self.tb_ham, init_state, end_state, x_axis)

def save(self):
self.filename = self.plotting_frame.filename_entry.get()
Expand Down
14 changes: 8 additions & 6 deletions qDNA/gui/qdna_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def __init__(self):
# initialization of the ctk.CTk class
super().__init__()

# self.tk.call('tk', 'scaling', 1.0)

self.title("QuantumDNA")
self.configs = CONFIG
self.kwargs = dict()
Expand Down Expand Up @@ -213,15 +215,15 @@ def submit(self):

def enable_initial_frame(self):
self.initial_frame.change_state("normal")
self.options_frame.change_state("disabled")
self.plot_options_frame.change_state("disabled")
self.options_frame.change_state("normal")
self.plot_options_frame.change_state("normal")

def enable_options_frame(self):
self.initial_frame.change_state("disabled")
self.initial_frame.change_state("normal")
self.options_frame.change_state("normal")
self.plot_options_frame.change_state("disabled")
self.plot_options_frame.change_state("normal")

def enable_plotting_frame(self):
self.initial_frame.change_state("disabled")
self.options_frame.change_state("disabled")
self.initial_frame.change_state("normal")
self.options_frame.change_state("normal")
self.plot_options_frame.change_state("normal")
44 changes: 39 additions & 5 deletions qDNA/qDNA-default.mplstyle
Original file line number Diff line number Diff line change
@@ -1,39 +1,73 @@
# QuantumDNA Custom Matplotlib Stylefile
# --------------------------------------

# Improting qDNA saves this Matplotlib style file in the directory specified by
# `import matplotlib as mpl; mpl.get_configdir()`
# >>> 'C:\\Users\\<username>\\.matplotlib'
# Once saved, it becomes globally accessible and can be applied using
# `import matplotlib.pyplot as plt; plt.style.use('qDNA-default')`.


# LaTeX rendering
# ---------------
# Note: Latex must be installed locally

# text.usetex: True
# text.latex.preamble: \usepackage{amsmath}\usepackage{siunitx}


# Font settings
font.family: serif
# font.serif: Times New Roman # Used in elsarticle (Elsevier)
font.serif: Computer Modern Roman # Used in revtex4-2 (APS)
# -------------
# View all available fonts by running
# `import matplotlib.font_manager as fm; sorted([f.name for f in fm.fontManager.ttflist])`
# Use serif font Latex, e.g. Times New Roman for elsarticle (Elsevier) and revtex4-2 (APS)
# DejaVu fonts are matplotlib default and therefore always available

# font.family: serif
# font.serif: DejaVu Serif, Times New Roman, cmr10
# mathtext.fontset: dejavuserif
font.family: sans-serif
font.sans-serif: DejaVu Sans, Calibri, Arial
mathtext.fontset: dejavusans
font.size: 15


# Figure size
# -----------
# revtex4-2 (APS) one-column: [8.64468/2.54, 8.64468/2.54 * 3/4]
# elsarticle (Elsevier) one-column: [8.85553/2.54, 8.85553/2.54 * 3/4]
figure.figsize: 6.4, 4.8 # Default ratio 4:3


# Axes, labels, and legend
# ------------------------
axes.titlesize: large # Font size for title
axes.labelsize: medium # Font size for axis labels
legend.fontsize: small # Font size for legend
xtick.labelsize: small # Font size for x-tick labels
ytick.labelsize: small # Font size for y-tick labels


# Lines and markers
# -----------------
lines.linewidth: 2.0 # Default line width
lines.markersize: 8.0 # Default marker size


# Grid and layout
# ---------------
axes.grid: True # Always show grid
grid.linestyle: -- # Grid line style
# grid.color: lightgray
grid.alpha: 0.7 # Grid transparency
figure.autolayout: True # Automatically apply tight_layout

# Define the color cycle using the full seaborn deep palette

# Colors
# ------

# Color cycle using the full seaborn deep palette
axes.prop_cycle: cycler('color', ['4C72B0', '55A868', 'C44E52', '8172B2', 'CCB974', '64B5CD'])

# Define the color cycle using the tab10 palette
# Color cycle using the matplotlib default tab10 palette
# axes.prop_cycle: cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])
Loading

0 comments on commit 6f5e725

Please sign in to comment.