Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Aug 16, 2024
1 parent 3c967af commit 8f5d3e6
Showing 1 changed file with 28 additions and 33 deletions.
61 changes: 28 additions & 33 deletions doc/tutorials/mlip/mlip.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,17 @@
"metadata": {},
"outputs": [],
"source": [
"from rdkit2ase import smiles2atoms\n",
"from mace.calculators import mace_mp\n",
"import numpy as np\n",
"from espressomd.zn import Visualizer\n",
"import espressomd\n",
"from espressomd.plugins.ase import ASEInterface\n",
"import ase.io\n",
"import tqdm\n",
"import pint\n",
"import ipsuite as ips\n",
"from rdkit2ase import smiles2atoms\n",
"from mace.calculators import mace_mp\n",
"import espressomd\n",
"from espressomd.plugins.ase import ASEInterface\n",
"import ase.io\n",
"import tqdm\n",
"import numpy as np\n",
"from espressomd.zn import Visualizer\n",
"import pandas as pd\n",
"import pint\n",
"import plotly.express as px\n",
"import pandas as pd"
"import tqdm\n",
"from espressomd.plugins.ase import ASEInterface\n",
"from espressomd.zn import Visualizer\n",
"from mace.calculators import mace_mp\n",
"from rdkit2ase import smiles2atoms"
]
},
{
Expand All @@ -69,8 +60,8 @@
"outputs": [],
"source": [
"ureg = pint.UnitRegistry()\n",
"boltmk=1.380649e-23*ureg.J/ureg.K\n",
"boltmk = boltmk.to(ureg.eV/ureg.K)"
"boltmk = 1.380649e-23 * ureg.J / ureg.K\n",
"boltmk = boltmk.to(ureg.eV / ureg.K)"
]
},
{
Expand Down Expand Up @@ -165,7 +156,7 @@
],
"source": [
"print(etoh.get_potential_energy() * ureg.eV)\n",
"print(etoh.get_forces() * ureg.eV/ureg.angstrom)"
"print(etoh.get_forces() * ureg.eV / ureg.angstrom)"
]
},
{
Expand All @@ -182,7 +173,11 @@
"outputs": [],
"source": [
"system = espressomd.System(box_l=[16] * 3)\n",
"system.time_step = (0.05 * ureg.fs).to(((1 * ureg.u * ureg.angstrom**2) / ureg.electron_volt)**0.5).magnitude\n",
"system.time_step = (\n",
" (0.05 * ureg.fs)\n",
" .to(((1 * ureg.u * ureg.angstrom**2) / ureg.electron_volt) ** 0.5)\n",
" .magnitude\n",
")\n",
"system.cell_system.skin = 0.4"
]
},
Expand Down Expand Up @@ -287,11 +282,7 @@
"metadata": {},
"outputs": [],
"source": [
"system.integrator.set_steepest_descent(\n",
" f_max=0.1,\n",
" gamma=4, \n",
" max_displacement=0.001\n",
" )"
"system.integrator.set_steepest_descent(f_max=0.1, gamma=4, max_displacement=0.001)"
]
},
{
Expand Down Expand Up @@ -371,7 +362,9 @@
"source": [
"water = smiles2atoms(\"O\")\n",
"sulfuric_acid = smiles2atoms(\"OS(=O)(=O)O\")\n",
"packmol = ips.nodes.Packmol(data=[[water], [sulfuric_acid]], count=[100, 1], density=1000)"
"packmol = ips.nodes.Packmol(\n",
" data=[[water], [sulfuric_acid]], count=[100, 1], density=1000\n",
")"
]
},
{
Expand Down Expand Up @@ -624,7 +617,11 @@
"outputs": [],
"source": [
"system.box_l = packmol.atoms[0].get_cell().diagonal()\n",
"system.time_step = (0.05 * ureg.fs).to(((1 * ureg.u * ureg.angstrom**2) / ureg.electron_volt)**0.5).magnitude\n",
"system.time_step = (\n",
" (0.05 * ureg.fs)\n",
" .to(((1 * ureg.u * ureg.angstrom**2) / ureg.electron_volt) ** 0.5)\n",
" .magnitude\n",
")\n",
"system.cell_system.skin = 0.4"
]
},
Expand All @@ -637,11 +634,7 @@
"system.ase = ASEInterface(type_mapping={x: x for x in set(packmol.atoms[0].numbers)})\n",
"for atom in packmol.atoms[0]:\n",
" system.part.add(pos=atom.position, type=atom.number, mass=atom.mass)\n",
"system.integrator.set_steepest_descent(\n",
" f_max=0.1,\n",
" gamma=4, \n",
" max_displacement=0.001\n",
" )"
"system.integrator.set_steepest_descent(f_max=0.1, gamma=4, max_displacement=0.001)"
]
},
{
Expand Down Expand Up @@ -703,7 +696,9 @@
" system.part.all().ext_force = atoms.get_forces()\n",
" vis.zndraw.append(atoms)\n",
" system.integrator.run(1)\n",
" tbar.set_description(f\"fmax: {np.linalg.norm(atoms.get_forces(), axis=0).max():.3f}\")"
" tbar.set_description(\n",
" f\"fmax: {np.linalg.norm(atoms.get_forces(), axis=0).max():.3f}\"\n",
" )"
]
},
{
Expand Down

0 comments on commit 8f5d3e6

Please sign in to comment.