Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions examples/example_07/analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"cells": [
{
"cell_type": "markdown",
"id": "organized-shakespeare",
"id": "bf354e59",
"metadata": {},
"source": [
"# Example 07: Upsampling calculations"
]
},
{
"cell_type": "markdown",
"id": "9dd01e04-93a1-4219-923f-08904414f558",
"id": "f397582d",
"metadata": {},
"source": [
"In this example, upsampling calculations which can be used to switch a system between two different interatomic potentials is illustrated. \n",
Expand All @@ -33,18 +33,18 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "satisfactory-kinase",
"id": "7d67fceb",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from calphy.input import read_report"
"from calphy.postprocessing import read_report"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "conditional-colombia",
"id": "84a4c423",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -54,13 +54,13 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "established-vienna",
"id": "72532dbd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-3.4389380251304913"
"-3.440051166622059"
]
},
"execution_count": 3,
Expand All @@ -74,7 +74,7 @@
},
{
"cell_type": "markdown",
"id": "5485eee8-5448-43b7-8376-22164d54a294",
"id": "134dc9f1",
"metadata": {},
"source": [
"Now we can transform FS to EAM potential (see input file above). After running the calculation, we can check the free energy of this alchemical transformation."
Expand All @@ -83,7 +83,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "alive-farming",
"id": "c21e8e87",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -93,13 +93,13 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "gorgeous-sunglasses",
"id": "4845b921",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-0.25451608590151586"
"-0.2544850177491684"
]
},
"execution_count": 5,
Expand All @@ -113,7 +113,7 @@
},
{
"cell_type": "markdown",
"id": "0d933ab0-bb82-4dcd-b307-03fd8e062c74",
"id": "252cb4a4",
"metadata": {},
"source": [
"The free energy of the EAM potential, $F_\\mathrm{EAM} = F_\\mathrm{FS} + F_\\mathrm{upsampling}$"
Expand All @@ -122,13 +122,13 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "ec362ea8-cc19-4ff9-9462-d2335fdece19",
"id": "8241e478",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-3.693454111032007"
"-3.694536184371227"
]
},
"execution_count": 6,
Expand All @@ -142,7 +142,7 @@
},
{
"cell_type": "markdown",
"id": "51730d0f-d51c-495d-8c0d-8600f8034410",
"id": "b728a4bd",
"metadata": {},
"source": [
"We can verify this calculation by directly computing the free energy of the EAM potential. The input file is available at `pot2/input-fe.yaml`. "
Expand All @@ -151,7 +151,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "opened-gates",
"id": "e73096cb",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -161,13 +161,13 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "differential-robert",
"id": "6a0ee06c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-3.6923377327832667"
"-3.694201038169466"
]
},
"execution_count": 8,
Expand All @@ -181,7 +181,7 @@
},
{
"cell_type": "markdown",
"id": "d79e509b-f0ac-4900-b5e3-18a343e7030d",
"id": "b89d91c1",
"metadata": {},
"source": [
"We can see that the directly calculation is in meV agreement with the upsampling calculations."
Expand All @@ -190,9 +190,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "pyiron",
"language": "python",
"name": "python3"
"name": "pyiron"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -204,7 +204,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
25 changes: 25 additions & 0 deletions tests/test_ex07.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def test_ex07():
import calphy
from calphy.postprocessing import read_report

# def test_example07_first_cell_runs():
# notebook_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../examples/example_07/analysis.ipynb'))

# with open(notebook_path, "r", encoding="utf-8") as f:
# nb = nbformat.read(f, as_version=4)

# # Filter just the first code cell
# first_code_cell = next((cell for cell in nb.cells if cell.cell_type == "code"), None)

# if not first_code_cell:
# pytest.fail("No code cell found in example07.ipynb")

# # Create a minimal notebook with only the first cell
# nb_single = nbformat.v4.new_notebook()
# nb_single.cells = [first_code_cell]

# try:
# client = NotebookClient(nb_single, timeout=60, kernel_name="pyiron")
# client.execute()
# except Exception as e:
# pytest.fail(f"First code cell in example07.analysis.ipynb failed: {e}")
85 changes: 85 additions & 0 deletions tests/tests_NB.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'SocketInterface' from 'pympipool' (/Users/varunnair/opt/anaconda3/lib/python3.7/site-packages/pympipool/__init__.py)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-0422ff8f98f0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;31m# import test_integrators\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# import test_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mtest_solid_methods\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/Desktop/ICAMS_HIWI/calphy/calphy/tests/test_solid_methods.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpytest\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minput\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mread_inputfile\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msolid\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSolid\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mliquid\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mLiquid\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/calphy/__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minput\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mCalculation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mliquid\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mLiquid\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msolid\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSolid\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0malchemy\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mAlchemy\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroutines\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMeltingTemp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/calphy/liquid.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mintegrators\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpyscal\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtraj_process\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mptp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlattice\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhelpers\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mph\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mcalphy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mphase\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mcph\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/calphy/lattice.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmendeleev\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0melement\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 26\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpylammpsmpi\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mLammpsLibrary\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 27\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpyscal\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcore\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mpc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/pylammpsmpi/__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpylammpsmpi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlammps_wrapper\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mLammpsLibrary\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_version\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_versions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0m__version__\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_versions\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"version\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/pylammpsmpi/lammps_wrapper.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpylammpsmpi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommands\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mcommand_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mthermo_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprop_list\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpylammpsmpi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlammps\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mLammpsBase\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0m__author__\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"Sarath Menon, Jan Janssen\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/pylammpsmpi/utils/lammps.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpympipool\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSocketInterface\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mImportError\u001b[0m: cannot import name 'SocketInterface' from 'pympipool' (/Users/varunnair/opt/anaconda3/lib/python3.7/site-packages/pympipool/__init__.py)"
]
}
],
"source": [
"import test_helpers as th"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'pyscal'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-e8e6f8f7118e>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mpyscal\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pyscal'"
]
}
],
"source": [
"th.test_nones()\n",
"th.test_replace_nones()\n",
"th.test_validate_spring_constants()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading