-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cb1ccf
commit 9bf99ae
Showing
1 changed file
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,297 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from qha.calculator import Calculator, SamePhDOSCalculator, DifferentPhDOSCalculator\n", | ||
"from qha.basic_io.out import (\n", | ||
" save_x_tp,\n", | ||
" save_x_tv,\n", | ||
" save_to_output,\n", | ||
" make_starting_string,\n", | ||
" make_tp_info,\n", | ||
" make_ending_string,\n", | ||
")\n", | ||
"from qha.settings import from_yaml\n", | ||
"from qha.thermodynamics import *" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"user_settings = {}\n", | ||
"file_settings = \"settings.yaml\"\n", | ||
"settings = from_yaml(file_settings)\n", | ||
"\n", | ||
"for key in (\n", | ||
" \"input\",\n", | ||
" \"calculation\",\n", | ||
" \"thermodynamic_properties\",\n", | ||
" \"static_only\",\n", | ||
" \"energy_unit\",\n", | ||
" \"T_MIN\",\n", | ||
" \"NT\",\n", | ||
" \"DT\",\n", | ||
" \"DT_SAMPLE\",\n", | ||
" \"P_MIN\",\n", | ||
" \"NTV\",\n", | ||
" \"DELTA_P\",\n", | ||
" \"DELTA_P_SAMPLE\",\n", | ||
" \"volume_ratio\",\n", | ||
" \"order\",\n", | ||
" \"p_min_modifier\",\n", | ||
" \"T4FV\",\n", | ||
" \"output_directory\",\n", | ||
" \"high_verbosity\",\n", | ||
"):\n", | ||
" try:\n", | ||
" user_settings.update({key: settings[key]})\n", | ||
" except KeyError:\n", | ||
" continue" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">You have single-configuration calculation assumed.\n", | ||
"</pre>\n" | ||
], | ||
"text/plain": [ | ||
"You have single-configuration calculation assumed.\n" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"calculation_type = user_settings[\"calculation\"].lower()\n", | ||
"if calculation_type == \"single\":\n", | ||
" calc = Calculator(user_settings)\n", | ||
" print(\"You have single-configuration calculation assumed.\")\n", | ||
"elif calculation_type == \"same phonon dos\":\n", | ||
" calc = SamePhDOSCalculator(user_settings)\n", | ||
" print(\"You have multi-configuration calculation with the same phonon DOS assumed.\")\n", | ||
"elif calculation_type == \"different phonon dos\":\n", | ||
" calc = DifferentPhDOSCalculator(user_settings)\n", | ||
" print(\"You have multi-configuration calculation with different phonon DOS assumed.\")\n", | ||
"else:\n", | ||
" raise ValueError(\n", | ||
" \"The 'calculation' in your settings in not recognized! It must be one of:\"\n", | ||
" \"'single', 'same phonon dos', 'different phonon dos'!\"\n", | ||
" )" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"calc.read_input()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2.88 ms ± 95.3 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.vib_ry()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"3.99 ms ± 83.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.refine_grid()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"182 µs ± 5.4 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.thermodynamic_potentials()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"246 µs ± 11.8 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.cv_tv_au()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"175 ms ± 485 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.cp_tp_jmolk()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"29.1 ms ± 214 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.f_tp_ry()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"129 µs ± 2.23 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.bt_tv_au()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"30.3 ms ± 505 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.bt_tp_au()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"29.8 ms ± 137 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.bt_tp_gpa()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"29.2 ms ± 496 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%timeit calc.alpha_tp()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |