Skip to content

Commit

Permalink
Fix temperature units and add ASE-type functionality back into notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
hjstroud committed Aug 27, 2024
1 parent cc85812 commit d19d960
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions examples/ase/ase_openmm_graphene.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,43 @@
"graphene_ase_omm_sim = ASEOpenMMSimulation.from_simulation(simulation)\n",
"graphene_ase_omm_sim.time_step = 0.05\n",
"\n",
"# Pass the simulation to the OmniRunner\n",
"runner = OmniRunner.with_basic_server(graphene_ase_omm_sim, name=\"graphene-ase-omm-server\", port=0)"
"# Pass the simulation to the OmniRunner, load the simulation and pause it\n",
"runner = OmniRunner.with_basic_server(graphene_ase_omm_sim, name=\"graphene-ase-omm-server\", port=0)\n",
"runner.next()\n",
"runner.pause()"
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Let's run a few steps and check that everything is working as expected."
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "graphene_ase_omm_sim.dynamics.run(10)"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "graphene_ase_omm_sim.dynamics.get_number_of_steps()"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Let's check the potential energy too."
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "graphene_ase_omm_sim.atoms.get_potential_energy()"
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -249,7 +282,7 @@
"outputs": [],
"source": [
"# Start running the simulation\n",
"runner.next()"
"runner.play()"
]
},
{
Expand Down Expand Up @@ -319,7 +352,7 @@
"\n",
" if not temp_min_val <= temperature <= temp_max_val:\n",
" raise ValueError(f'Temperature must be in range {temp_min_val} - {temp_max_val} Kelvin.')\n",
" graphene_ase_omm_sim.dynamics.set_temperature(temperature_K=temperature * units.kB)\n",
" graphene_ase_omm_sim.dynamics.set_temperature(temperature_K=temperature)\n",
"\n",
"\n",
"def set_friction(friction=1):\n",
Expand Down Expand Up @@ -634,11 +667,9 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With this functionality, you could write your own UI in Unity with our [libraries](https://github.com/IRL2/NarupaUnityPlugin/blob/2f5565608d9c0e1e9366a61d7c146b34eae84231/Grpc/GrpcClient.cs#L54), a python web app, or even C++."
]
"cell_type": "markdown",
"source": "With this functionality, you could write your own UI in Unity with our [libraries](https://github.com/IRL2/NarupaUnityPlugin/blob/2f5565608d9c0e1e9366a61d7c146b34eae84231/Grpc/GrpcClient.cs#L54), a python web app, or even C++."
},
{
"cell_type": "markdown",
Expand Down

0 comments on commit d19d960

Please sign in to comment.