{ "cells": [ { "cell_type": "markdown", "id": "d13af192", "metadata": {}, "source": [ "# Ensembles and the thermodynamic limit\n", "\n", "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/sandialabs/Polymers/main?labpath=docs%2Fsource%2F%2Fphysics%2Fsingle_chain%2Ffjc%2Fthermodynamics%2Fexample_thermodynamic_limit.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "id": "f57cf5ea", "metadata": {}, "outputs": [], "source": [ "from polymers import physics\n", "FJC = physics.single_chain.fjc.thermodynamics.FJC" ] }, { "cell_type": "markdown", "id": "47ce8f2b", "metadata": {}, "source": [ "## Isometric versus isotensional" ] }, { "cell_type": "code", "execution_count": null, "id": "0d41d285", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "N_b_list = [6, 12, 24]\n", "gamma = np.linspace(1e-3, 99e-2, 100)\n", "for N_b in N_b_list:\n", " fjc = FJC(N_b, 1, 1)\n", " eta_isometric = fjc.isometric.nondimensional_force(gamma)\n", " plt.plot(gamma, eta_isometric, label=r'$N_b=$' + str(N_b))\n", "gamma_isotensional = fjc.isotensional.nondimensional_end_to_end_length_per_link(eta_isometric)\n", "plt.plot(gamma_isotensional, eta_isometric, 'k--', label='isotensional')\n", "plt.legend()\n", "plt.xlim([0, 1])\n", "plt.ylim([0, 12])\n", "plt.xlabel(r'$\\gamma$')\n", "plt.ylabel(r'$\\eta$')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "a85500fd", "metadata": {}, "outputs": [], "source": [ "for N_b in N_b_list:\n", " fjc = FJC(N_b, 1, 1)\n", " Delta_vartheta = fjc.isometric.nondimensional_relative_helmholtz_free_energy_per_link(gamma)\n", " plt.plot(gamma, Delta_vartheta, label=r'$N_b=$' + str(N_b))\n", "Delta_vartheta_legendre = fjc.isometric.legendre.nondimensional_relative_helmholtz_free_energy_per_link(gamma)\n", "plt.plot(gamma, Delta_vartheta_legendre, 'k--', label='legendre')\n", "plt.legend()\n", "plt.xlim([0, 1])\n", "plt.ylim([0, 3])\n", "plt.xlabel(r'$\\gamma$')\n", "plt.ylabel(r'$\\Delta\\vartheta$')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "818fe14b", "metadata": {}, "outputs": [], "source": [ "for N_b in N_b_list:\n", " fjc = FJC(N_b, 1, 1)\n", " P_eq = fjc.isometric.nondimensional_equilibrium_distribution(gamma)\n", " plt.plot(gamma, P_eq, label=r'$N_b=$' + str(N_b))\n", "P_eq_legendre = fjc.isometric.legendre.nondimensional_equilibrium_distribution(gamma)\n", "plt.plot(gamma, P_eq_legendre, 'k--', label='legendre')\n", "plt.legend()\n", "plt.xlim([0, 1])\n", "plt.xlabel(r'$\\gamma$')\n", "plt.ylabel(r'$\\mathscr{P}_\\mathrm{eq}$')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "6bc47eeb", "metadata": {}, "outputs": [], "source": [ "for N_b in N_b_list:\n", " fjc = FJC(N_b, 1, 1)\n", " g_eq = fjc.isometric.nondimensional_equilibrium_radial_distribution(gamma)\n", " plt.plot(gamma, g_eq, label=r'$N_b=$' + str(N_b))\n", "g_eq_legendre = fjc.isometric.legendre.nondimensional_equilibrium_radial_distribution(gamma)\n", "plt.plot(gamma, g_eq_legendre, 'k--', label='legendre')\n", "plt.legend()\n", "plt.xlim([0, 1])\n", "plt.xlabel(r'$\\gamma$')\n", "plt.ylabel(r'$\\mathscr{g}_\\mathrm{eq}$')\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.4" }, "vscode": { "interpreter": { "hash": "29648422c0d902cf9c24b20050e753f73190aa38c818f5e77c552519555ba69b" } } }, "nbformat": 4, "nbformat_minor": 5 }