Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#158)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](astral-sh/ruff-pre-commit@v0.5.7...v0.6.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci

* fix indent

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: chrisjonesBSU <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and chrisjonesBSU authored Aug 19, 2024
1 parent c74aa85 commit 46323ea
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:
submodules: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7 # Ruff version
rev: v0.6.1 # Ruff version
hooks:
- id: ruff
args: [--fix, --extend-ignore=E203]
Expand Down
34 changes: 22 additions & 12 deletions tutorials/1-flowerMD-basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')"
"\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
Expand All @@ -78,9 +79,7 @@
]
}
],
"source": [
"import flowermd"
]
"source": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -149,6 +148,7 @@
"outputs": [],
"source": [
"from flowermd.base import Pack\n",
"\n",
"system = Pack(molecules=molecules, density=0.5, packing_expand_factor=5)"
]
},
Expand Down Expand Up @@ -199,7 +199,9 @@
"source": [
"from flowermd.library import OPLS_AA_PPS\n",
"\n",
"system.apply_forcefield(r_cut=2.5, force_field=OPLS_AA_PPS(), auto_scale=True, scale_charges=True)"
"system.apply_forcefield(\n",
" r_cut=2.5, force_field=OPLS_AA_PPS(), auto_scale=True, scale_charges=True\n",
")"
]
},
{
Expand Down Expand Up @@ -358,7 +360,9 @@
"source": [
"from flowermd.base import Simulation\n",
"\n",
"sim = Simulation.from_system(system=system, gsd_write_freq=100, log_write_freq=100)"
"sim = Simulation.from_system(\n",
" system=system, gsd_write_freq=100, log_write_freq=100\n",
")"
]
},
{
Expand Down Expand Up @@ -390,7 +394,9 @@
"source": [
"from flowermd.utils import get_target_box_mass_density\n",
"\n",
"target_box = get_target_box_mass_density(density=system.density, mass=system.mass.to(\"g\"))\n",
"target_box = get_target_box_mass_density(\n",
" density=system.density, mass=system.mass.to(\"g\")\n",
")\n",
"print(target_box)"
]
},
Expand Down Expand Up @@ -446,7 +452,9 @@
}
],
"source": [
"sim.run_update_volume(n_steps=1000, period=1, kT=1, tau_kt=1, final_box_lengths=target_box)"
"sim.run_update_volume(\n",
" n_steps=1000, period=1, kT=1, tau_kt=1, final_box_lengths=target_box\n",
")"
]
},
{
Expand Down Expand Up @@ -483,6 +491,7 @@
"outputs": [],
"source": [
"import hoomd\n",
"\n",
"for writer in sim.operations.writers:\n",
" if isinstance(writer, hoomd.write.GSD):\n",
" writer.flush()"
Expand All @@ -508,9 +517,10 @@
"source": [
"from cmeutils.visualize import FresnelGSD\n",
"\n",
"sim_visualizer = FresnelGSD(gsd_file=\"trajectory.gsd\", frame=0, view_axis=(1, 1, 1))\n",
"sim_visualizer.view()\n",
" "
"sim_visualizer = FresnelGSD(\n",
" gsd_file=\"trajectory.gsd\", frame=0, view_axis=(1, 1, 1)\n",
")\n",
"sim_visualizer.view()"
]
},
{
Expand Down Expand Up @@ -614,7 +624,7 @@
}
],
"source": [
"sim_visualizer.frame=-1\n",
"sim_visualizer.frame = -1\n",
"sim_visualizer.view()"
]
},
Expand Down
42 changes: 31 additions & 11 deletions tutorials/2-flowerMD-advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')"
"\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
Expand Down Expand Up @@ -247,7 +248,9 @@
},
"outputs": [],
"source": [
"phenol_mol = Molecule(num_mols=20, file=\"../flowermd/assets/molecule_files/IPH.mol2\")"
"phenol_mol = Molecule(\n",
" num_mols=20, file=\"../flowermd/assets/molecule_files/IPH.mol2\"\n",
")"
]
},
{
Expand Down Expand Up @@ -361,7 +364,7 @@
"gmso_top = mb_compound.to_gmso()\n",
"\n",
"benzene_mol = Molecule(num_mols=20, compound=mb_compound)\n",
"benzene_mol = Molecule(num_mols=20, compound=gmso_top)\n"
"benzene_mol = Molecule(num_mols=20, compound=gmso_top)"
]
},
{
Expand Down Expand Up @@ -445,7 +448,9 @@
"source": [
"from flowermd.library import FF_from_file\n",
"\n",
"benzene_ff = FF_from_file(forcefield_files=\"../flowermd/assets/forcefields/benzene_opls.xml\")"
"benzene_ff = FF_from_file(\n",
" forcefield_files=\"../flowermd/assets/forcefields/benzene_opls.xml\"\n",
")"
]
},
{
Expand Down Expand Up @@ -484,8 +489,18 @@
"outputs": [],
"source": [
"from flowermd.base import BaseHOOMDForcefield\n",
"\n",
"\n",
"class BeadSpring(BaseHOOMDForcefield):\n",
" def __init__(self, r_cut, beads, bonds=None, angles=None, dihedrals=None,exclusions=[\"bond\", \"1-3\"]):\n",
" def __init__(\n",
" self,\n",
" r_cut,\n",
" beads,\n",
" bonds=None,\n",
" angles=None,\n",
" dihedrals=None,\n",
" exclusions=[\"bond\", \"1-3\"],\n",
" ):\n",
" # ...\n",
" hoomd_forces = self._create_forcefield()\n",
" super(BeadSpring, self).__init__(hoomd_forces)\n",
Expand All @@ -494,8 +509,7 @@
" hoomd_forces = []\n",
" # generate hoomd forces for pair interactions, bonds, angles, dihedrals, etc.\n",
" # ...\n",
" return hoomd_forces\n",
"\n"
" return hoomd_forces"
]
},
{
Expand Down Expand Up @@ -716,8 +730,12 @@
"\n",
"dimethylether_mol = Molecule(num_mols=20, smiles=\"COC\")\n",
"pps_mol = PPS(num_mols=10, lengths=4)\n",
"multi_type_system = Pack( molecules=[dimethylether_mol, pps_mol], density=0.8)\n",
"multi_type_system.apply_forcefield(r_cut=2.5, force_field=[OPLS_AA_DIMETHYLETHER(), OPLS_AA_PPS()], auto_scale=True)"
"multi_type_system = Pack(molecules=[dimethylether_mol, pps_mol], density=0.8)\n",
"multi_type_system.apply_forcefield(\n",
" r_cut=2.5,\n",
" force_field=[OPLS_AA_DIMETHYLETHER(), OPLS_AA_PPS()],\n",
" auto_scale=True,\n",
")"
]
},
{
Expand Down Expand Up @@ -899,10 +917,12 @@
"\n",
"molecule = Molecule(num_mols=30, smiles=\"c1ccccc1\")\n",
"\n",
"system = Pack(molecules=molecule, density=0.5 * unyt.g/unyt.cm**3)\n",
"system = Pack(molecules=molecule, density=0.5 * unyt.g / unyt.cm**3)\n",
"system.apply_forcefield(r_cut=2.5, force_field=OPLS_AA(), auto_scale=True)\n",
"\n",
"sim = Simulation(initial_state=system.hoomd_snapshot, forcefield=system.hoomd_forcefield)\n",
"sim = Simulation(\n",
" initial_state=system.hoomd_snapshot, forcefield=system.hoomd_forcefield\n",
")\n",
"\n",
"sim.run_NVE(n_steps=1e3)"
]
Expand Down
13 changes: 10 additions & 3 deletions tutorials/3-flowerMD-coarse-graining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"outputs": [],
"source": [
"import warnings\n",
"warnings.filterwarnings('ignore')"
"\n",
"warnings.filterwarnings(\"ignore\")"
]
},
{
Expand Down Expand Up @@ -571,7 +572,11 @@
}
],
"source": [
"cg_sim = Simulation(initial_state=cg_system.hoomd_snapshot, forcefield=ff.hoomd_forces, gsd_write_freq=int(2e5/10))"
"cg_sim = Simulation(\n",
" initial_state=cg_system.hoomd_snapshot,\n",
" forcefield=ff.hoomd_forces,\n",
" gsd_write_freq=int(2e5 / 10),\n",
")"
]
},
{
Expand Down Expand Up @@ -650,7 +655,9 @@
"source": [
"from cmeutils.visualize import FresnelGSD\n",
"\n",
"sim_visualizer = FresnelGSD(gsd_file=\"trajectory.gsd\", frame=-1, view_axis=(1, 1, 1))\n",
"sim_visualizer = FresnelGSD(\n",
" gsd_file=\"trajectory.gsd\", frame=-1, view_axis=(1, 1, 1)\n",
")\n",
"sim_visualizer.view()"
]
},
Expand Down
Loading

0 comments on commit 46323ea

Please sign in to comment.