Skip to content

Commit

Permalink
Created plotly apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ahurta92 committed Nov 28, 2023
1 parent 0234662 commit d066213
Show file tree
Hide file tree
Showing 4 changed files with 116,308 additions and 152,480 deletions.
14 changes: 3 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 10 additions & 16 deletions examples/PolarizabilityPaper/DataAnalysisClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import matplotlib as mpl
import os

from quantumresponsepro.BasisMRADataAssembler import *
from quantumresponsepro.BasisMRADataCollection import get_quad_df, get_polar_df

Expand All @@ -22,7 +21,7 @@ def __init__(self, mols, basis_sets, xc, op, freq, database, overwrite=False):
self.vector_basis_set_error_df = None
self.beta_hrs_df = None
self.bhrs_basis_set_error_df = None
self.pq_df=None
self.pq_df = None
self.freq = freq
self.molecules = mols
self.basis_sets = basis_sets
Expand All @@ -34,7 +33,7 @@ def __init__(self, mols, basis_sets, xc, op, freq, database, overwrite=False):
self.initialize_dfs()

def initialize_dfs(self):
data_frame_attributes = ['q_df', 'vector_q_df','pq_df', ]
data_frame_attributes = ['q_df', 'vector_q_df', 'pq_df', ]

for attr_name in data_frame_attributes:
try:
Expand Down Expand Up @@ -65,7 +64,7 @@ def generate_df(self, attr_name):
return self.__generate_processed_quad_df()

def save_dfs(self):
data_frame_attributes = ['q_df', 'vector_q_df','pq_df'
data_frame_attributes = ['q_df', 'vector_q_df', 'pq_df'
]

for attr_name in data_frame_attributes:
Expand All @@ -80,9 +79,9 @@ def __generate_quad_df(self):
q_df_i = q_df.copy()
# truncate the Afreq Bfreq and Cfreq to 3 decimal places

q_df_i['Afreq'] = q_df_i['Afreq'].apply(lambda x: round(x, 3))
q_df_i['Bfreq'] = q_df_i['Bfreq'].apply(lambda x: round(x, 3))
q_df_i['Cfreq'] = q_df_i['Cfreq'].apply(lambda x: round(x, 3))
q_df_i['Afreq'] = q_df_i['Afreq'].apply(lambda x: round(x, 4))
q_df_i['Bfreq'] = q_df_i['Bfreq'].apply(lambda x: round(x, 4))
q_df_i['Cfreq'] = q_df_i['Cfreq'].apply(lambda x: round(x, 4))

# Function to round to n significant figures

Expand All @@ -95,20 +94,16 @@ def __generate_quad_df(self):
for mol in self.molecules:
mol_data = q_df_i.query('molecule==@mol').copy()
freq_map = mol_data.query('basis=="MRA"').Afreq.unique()
print(mol, len(freq_map), freq_map)
# create a column representing the index of the frequency
freq_dict = {freq_map[i]: i for i in range(len(freq_map))}
mol_data['a'] = mol_data.Afreq.map(freq_dict)
mol_data['b'] = mol_data.Bfreq.map(freq_dict)
mol_data['c'] = mol_data.Cfreq.map(freq_dict)
mol_data['a'] = mol_data.Afreq.map(lambda x: mol_data.Afreq.unique().tolist().index(x))
mol_data['b'] = mol_data.Bfreq.map(lambda x: mol_data.Afreq.unique().tolist().index(x))
mol_data['c'] = mol_data.Cfreq.map(lambda x: mol_data.Afreq.unique().tolist().index(x))
f.append(mol_data)
q_df_i = pd.concat(f)

return q_df_i.copy()

def __generate_processed_quad_df(self):


sample = self.q_df
index = ['a', 'b', 'c', 'basis', 'molecule']
sample = sample.set_index(index)
Expand Down Expand Up @@ -156,8 +151,7 @@ def __generate_processed_quad_df(self):
new_sample = pd.concat([new_sample, df])
new_sample.reset_index(inplace=True)
return new_sample
# q_df_i['Beta'] = q_df_i['Beta'].apply(lambda x: round(x, 2))

# q_df_i['Beta'] = q_df_i['Beta'].apply(lambda x: round(x, 2))

def __generate_basis_error_df(self):

Expand Down
297 changes: 213 additions & 84 deletions examples/PolarizabilityPaper/august_convergence_presentation.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit d066213

Please sign in to comment.