Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
stkroe committed Sep 2, 2024
1 parent c9054f5 commit fd14fae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 41 deletions.
3 changes: 0 additions & 3 deletions PQAnalysis/analysis/thermal_expansion/thermal_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from PQAnalysis.utils import timeit_in_class
from PQAnalysis.utils.custom_logging import setup_logger
from PQAnalysis import __package_name__
from PQAnalysis.core.cell import Cells

from PQAnalysis.type_checking import runtime_type_checking
# local relative imports
Expand Down Expand Up @@ -104,8 +103,6 @@ def __init__(
)

if boxes_avg is not None:
# reshape the boxes data so that the columns are the temperature points and the rows are the boxes data
# if the boxes data is not in the correct format, transpose it
boxes_avg = np.array(boxes_avg)
if np.shape(boxes_avg)[0] == 4:
self._boxes_avg = boxes_avg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ThermalExpansionInputFileReader(Reader):

#: List[str]: The optional keys of the input file
optional_keys = required_keys + [
Reader.unit_key,
Reader.log_file_key,
]

Expand Down Expand Up @@ -97,7 +96,6 @@ def read(self):
They are optional in the input file, but they might be required for
the analysis. This means that if an optional keyword is specified
other keywords might be required.
- :code:`{Reader.unit_key}` is optional for the analysis.
- :code:`{Reader.log_file_key}` is optional for the analysis.
(for more information see
:py:class:`~PQAnalysis.io.input_file_reader.pq_analysis.thermal_expansion.thermal_expansion.ThermalExpansion`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ def write(
file=self.file
)
print(
f"T a_avg a_std b_avg b_std c_avg c_std V_avg V_std thermal_expansion_a thermal_expansion_b thermal_expansion_c volumetric_expansion",
"T a_avg a_std b_avg b_std c_avg c_std V_avg V_std "
"thermal_expansion_a thermal_expansion_b "
"thermal_expansion_c volumetric_expansion",
file=self.file
)

for i, temperature in enumerate(temperature_points):
print(
f"{temperature:16.16f} {boxes_avg_data[0,i]:16.16f} {boxes_std_data[0,i]:16.16f} {boxes_avg_data[1,i]:16.16f} {boxes_std_data[1,i]:16.16f} {boxes_avg_data[2,i]:16.16f} {boxes_std_data[2,i]:16.16f} {boxes_avg_data[3,i]:16.16f} {boxes_std_data[3,i]:16.16f} {thermal_expansion_data_mega[0]:16.16f} {thermal_expansion_data_mega[1]:16.16f} {thermal_expansion_data_mega[2]:16.16f} {thermal_expansion_data_mega[3]:16.16f}",
f"{temperature:16.16f} "
f"{boxes_avg_data[0,i]:16.16f} {boxes_std_data[0,i]:16.16f} "
f"{boxes_avg_data[1,i]:16.16f} {boxes_std_data[1,i]:16.16f} "
f"{boxes_avg_data[2,i]:16.16f} {boxes_std_data[2,i]:16.16f} "
f"{boxes_avg_data[3,i]:16.16f} {boxes_std_data[3,i]:16.16f} "
f"{thermal_expansion_data_mega[0]:16.16f} {thermal_expansion_data_mega[1]:16.16f} "
f"{thermal_expansion_data_mega[2]:16.16f} {thermal_expansion_data_mega[3]:16.16f}",
file=self.file
)

Expand Down Expand Up @@ -181,40 +189,7 @@ def write_after_run(self, thermal_expansion: ThermalExpansion) -> None:
the linear thermal expansion coefficient object
"""
super().open()
# angstrom = "\u212B".encode('utf-8')
# for i, box in enumerate(thermal_expansion.boxes_avg):
# print(
# (
# f" a : {box}{angstrom} +/- "
# f"{thermal_expansion.boxes_std[0,i]}{angstrom} at "
# f"{thermal_expansion.temperature_points[i]} K"
# ),
# file=self.file
# )
# print(
# (
# f" b: {thermal_expansion.boxes_avg[i,1]}{angstrom} +/- "
# f"{thermal_expansion.boxes_std[i,1]}{angstrom} at "
# f"{thermal_expansion.temperature_points[i]} K"
# ),
# file=self.file
# )
# print(
# (
# f" c: {thermal_expansion.boxes_avg[i,2]}{angstrom} +/- "
# f"{thermal_expansion.boxes_std[i,2]}{angstrom} at "
# f"{thermal_expansion.temperature_points[i]} K"
# ),
# file=self.file
# )
# print(
# (
# f" Volume: {thermal_expansion.boxes_avg[i,3]}{angstrom}³ +/- "
# f"{thermal_expansion.boxes_std[i,3]}{angstrom}³ at "
# f"{thermal_expansion.temperature_points[i]} K"
# ),
# file=self.file
# )

print(
f" Linear thermal expansion a: {thermal_expansion.thermal_expansions[0]} 1/K",
file=self.file
Expand Down

0 comments on commit fd14fae

Please sign in to comment.