Skip to content

Commit

Permalink
Limit line length in formatted documentation examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Nov 27, 2024
1 parent 8c63de3 commit 9f72be8
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 34 deletions.
4 changes: 3 additions & 1 deletion hoomd/data/typeconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,9 @@ def to_type_converter(value):
Example::
# list take a list of tuples of 3 floats each
validation = to_type_converter({"str": str, "list": [(float, float, float)]})
validation = to_type_converter(
{"str": str, "list": [(float, float, float)]}
)
"""
if isinstance(value, tuple):
return TypeConverterFixedLengthSequence(value)
Expand Down
4 changes: 3 additions & 1 deletion hoomd/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ def message_filename(self):
communicator = hoomd.communicator.Communicator(ranks_per_partition=2)
filename = f"messages.{communicator.partition}"
device = hoomd.device.CPU(communicator=communicator, message_filename=filename)
device = hoomd.device.CPU(
communicator=communicator, message_filename=filename
)
"""
return self._message_filename

Expand Down
4 changes: 3 additions & 1 deletion hoomd/filter/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def __eq__(self, other):
def __call__(self, state):
with state.cpu_local_snapshot as snap:
masses = snap.particles.mass
indices = (masses > self.min_mass) & (masses < self.max_mass)
indices = (masses > self.min_mass) & (
masses < self.max_mass
)
return numpy.copy(snap.particles.tag[indices])
Expand Down
4 changes: 3 additions & 1 deletion hoomd/hpmc/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ class FreeVolume(Compute):
Examples::
fv = hoomd.hpmc.compute.FreeVolume(test_particle_type="B", num_samples=1000)
fv = hoomd.hpmc.compute.FreeVolume(
test_particle_type="B", num_samples=1000
)
{inherited}
Expand Down
8 changes: 6 additions & 2 deletions hoomd/hpmc/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,9 @@ class ConvexSpheropolygon(HPMCIntegrator):
Examples::
mc = hoomd.hpmc.integrate.ConvexSpheropolygon(default_d=0.3, default_a=0.4)
mc = hoomd.hpmc.integrate.ConvexSpheropolygon(
default_d=0.3, default_a=0.4
)
mc.shape["A"] = dict(
vertices=[
(-0.5, -0.5),
Expand Down Expand Up @@ -1592,7 +1594,9 @@ class Sphinx(HPMCIntegrator):
Example::
mc = hpmc.integrate.Sphinx(default_d=0.3, default_a=0.4)
mc.shape["A"] = dict(centers=[(0, 0, 0), (1, 0, 0)], diameters=[1, 0.25])
mc.shape["A"] = dict(
centers=[(0, 0, 0), (1, 0, 0)], diameters=[1, 0.25]
)
print("diameters = ", mc.shape["A"]["diameters"])
{inherited}
Expand Down
4 changes: 3 additions & 1 deletion hoomd/hpmc/pair/lj_gauss.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class LJGauss(Pair):
.. code-block:: python
lj_gauss = hoomd.hpmc.pair.LJGauss()
lj_gauss.params[("A", "A")] = dict(epsilon=1.0, sigma=0.02, r0=1.6, r_cut=2.5)
lj_gauss.params[("A", "A")] = dict(
epsilon=1.0, sigma=0.02, r0=1.6, r_cut=2.5
)
simulation.operations.integrator.pair_potentials = [lj_gauss]
{inherited}
Expand Down
12 changes: 9 additions & 3 deletions hoomd/md/methods/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,9 @@ class Langevin(Method):
.. code-block:: python
langevin.kT = hoomd.variant.Ramp(A=2.0, B=1.0, t_start=0, t_ramp=1_000_000)
langevin.kT = hoomd.variant.Ramp(
A=2.0, B=1.0, t_start=0, t_ramp=1_000_000
)
tally_reservoir_energy (bool): When True, track the energy exchange
between the thermal reservoir and the particles.
Expand Down Expand Up @@ -1050,7 +1052,9 @@ class Brownian(Method):
.. code-block:: python
brownian.kT = hoomd.variant.Ramp(A=2.0, B=1.0, t_start=0, t_ramp=1_000_000)
brownian.kT = hoomd.variant.Ramp(
A=2.0, B=1.0, t_start=0, t_ramp=1_000_000
)
gamma (TypeParameter[ ``particle type``, `float` ]): The drag
coefficient for each particle type
Expand Down Expand Up @@ -1193,7 +1197,9 @@ class OverdampedViscous(Method):
.. code-block:: python
overdamped_viscous = hoomd.md.methods.OverdampedViscous(filter=hoomd.filter.All())
overdamped_viscous = hoomd.md.methods.OverdampedViscous(
filter=hoomd.filter.All()
)
simulation.operations.integrator.methods = [overdamped_viscous]
{inherited}
Expand Down
8 changes: 6 additions & 2 deletions hoomd/md/methods/thermostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
.. code-block:: python
simulation.state.thermalize_particle_momenta(filter=hoomd.filter.All(), kT=1.5)
simulation.state.thermalize_particle_momenta(
filter=hoomd.filter.All(), kT=1.5
)
.. invisible-code-block: python
Expand Down Expand Up @@ -382,7 +384,9 @@ class Berendsen(Thermostat):
.. code-block:: python
berendsen.kT = hoomd.variant.Ramp(A=1.0, B=2.0, t_start=0, t_ramp=1_000_000)
berendsen.kT = hoomd.variant.Ramp(
A=1.0, B=2.0, t_start=0, t_ramp=1_000_000
)
tau (float): Time constant of thermostat. :math:`[time]`
"""
Expand Down
4 changes: 3 additions & 1 deletion hoomd/md/minimize/fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ class FIRE(_DynamicIntegrator):
fire = md.minimize.FIRE(dt=0.05)
fire.methods.append(
md.methods.ConstantPressure(hoomd.filter.All(), S=1, tauS=1, couple="none")
md.methods.ConstantPressure(
hoomd.filter.All(), S=1, tauS=1, couple="none"
)
)
sim.operations.integrator = fire
while not (fire.converged):
Expand Down
12 changes: 9 additions & 3 deletions hoomd/md/pair/aniso.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,9 @@ class PatchyLJ(Patchy):
lj_params = dict(epsilon=1, sigma=1)
envelope_params = dict(alpha=math.pi / 2, omega=20)
patchylj = hoomd.md.pair.aniso.PatchyLJ(nlist=neighbor_list, default_r_cut=3.0)
patchylj = hoomd.md.pair.aniso.PatchyLJ(
nlist=neighbor_list, default_r_cut=3.0
)
patchylj.params[("A", "A")] = dict(
pair_params=lj_params,
envelope_params=envelope_params,
Expand Down Expand Up @@ -925,7 +927,9 @@ class PatchyExpandedLJ(Patchy):
lj_params = dict(epsilon=1, sigma=1)
envelope_params = dict(alpha=math.pi / 2, omega=20)
patchylj = hoomd.md.pair.aniso.PatchyLJ(nlist=neighbor_list, default_r_cut=3.0)
patchylj = hoomd.md.pair.aniso.PatchyLJ(
nlist=neighbor_list, default_r_cut=3.0
)
patchylj.params[("A", "A")] = dict(
pair_params=lj_params,
envelope_params=envelope_params,
Expand Down Expand Up @@ -1114,7 +1118,9 @@ class PatchyMie(Patchy):
mie_params = dict(epsilon=1, sigma=1, n=15, m=10)
envelope_params = dict(alpha=math.pi / 3, omega=20)
patchy_mie = hoomd.md.pair.aniso.PatchyMie(nlist=neighbor_list, default_r_cut=3.0)
patchy_mie = hoomd.md.pair.aniso.PatchyMie(
nlist=neighbor_list, default_r_cut=3.0
)
patchy_mie.params[("A", "A")] = dict(
pair_params=mie_params,
envelope_params=envelope_params,
Expand Down
12 changes: 9 additions & 3 deletions hoomd/md/pair/pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ class ExpandedGaussian(Pair):
nl = nlist.Cell()
expanded_gauss = pair.ExpandedGaussian(default_r_cut=3.0, nlist=nl)
expanded_gauss.params[("A", "A")] = dict(epsilon=1.0, sigma=1.0, delta=0.5)
expanded_gauss.params[("A", "A")] = dict(
epsilon=1.0, sigma=1.0, delta=0.5
)
expanded_gauss.r_cut[("A", "B")] = 3.0
{inherited}
Expand Down Expand Up @@ -417,7 +419,9 @@ class ExpandedLJ(Pair):
nl = nlist.Cell()
expanded_lj = pair.ExpandedLJ(default_r_cut=3.0, nlist=nl)
expanded_lj.params[("A", "A")] = dict(epsilon=1.0, sigma=1.0, delta=1.0)
expanded_lj.params[("A", "B")] = dict(epsilon=2.0, sigma=1.0, delta=0.75)
expanded_lj.params[("A", "B")] = dict(
epsilon=2.0, sigma=1.0, delta=0.75
)
expanded_lj.params[("B", "B")] = dict(epsilon=1.0, sigma=1.0, delta=0.5)
{inherited}
Expand Down Expand Up @@ -1428,7 +1432,9 @@ class ReactionField(Pair):
nl = nlist.Cell()
reaction_field = pair.reaction_field(nl, default_r_cut=3.0)
reaction_field.params[("A", "B")] = dict(epsilon=1.0, eps_rf=1.0)
reaction_field.params[("B", "B")] = dict(epsilon=1.0, eps_rf=0.0, use_charge=True)
reaction_field.params[("B", "B")] = dict(
epsilon=1.0, eps_rf=0.0, use_charge=True
)
{inherited}
Expand Down
4 changes: 3 additions & 1 deletion hoomd/md/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class ZeroMomentum(Updater):
Examples::
zero_momentum = hoomd.md.update.ZeroMomentum(hoomd.trigger.Periodic(100))
zero_momentum = hoomd.md.update.ZeroMomentum(
hoomd.trigger.Periodic(100)
)
"""

__doc__ += Updater._doc_inherited
Expand Down
8 changes: 6 additions & 2 deletions hoomd/mpcd/collide.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ class AndersenThermostat(CollisionMethod):
.. code-block:: python
andersen_thermostat = hoomd.mpcd.collide.AndersenThermostat(period=1, kT=1.0)
andersen_thermostat = hoomd.mpcd.collide.AndersenThermostat(
period=1, kT=1.0
)
simulation.operations.integrator.collision_method = andersen_thermostat
Collision including embedded particles.
Expand Down Expand Up @@ -315,7 +317,9 @@ class StochasticRotationDynamics(CollisionMethod):
.. code-block:: python
srd = hoomd.mpcd.collide.StochasticRotationDynamics(period=1, angle=130, kT=1.0)
srd = hoomd.mpcd.collide.StochasticRotationDynamics(
period=1, angle=130, kT=1.0
)
simulation.operations.integrator.collision_method = srd
Collision including embedded particles.
Expand Down
4 changes: 3 additions & 1 deletion hoomd/mpcd/force.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ class SineForce(BodyForce):
.. code-block:: python
Ly = simulation.state.box.Ly
force = hoomd.mpcd.force.SineForce(amplitude=1.0, wavenumber=2 * numpy.pi / Ly)
force = hoomd.mpcd.force.SineForce(
amplitude=1.0, wavenumber=2 * numpy.pi / Ly
)
stream = hoomd.mpcd.stream.Bulk(period=1, mpcd_particle_force=force)
simulation.operations.integrator.streaming_method = stream
Expand Down
8 changes: 6 additions & 2 deletions hoomd/mpcd/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,19 @@ class ParallelPlates(Geometry):
.. code-block:: python
plates = hoomd.mpcd.geometry.ParallelPlates(separation=6.0, no_slip=False)
plates = hoomd.mpcd.geometry.ParallelPlates(
separation=6.0, no_slip=False
)
stream = hoomd.mpcd.stream.BounceBack(period=1, geometry=plates)
simulation.operations.integrator.streaming_method = stream
Moving parallel plates.
.. code-block:: python
plates = hoomd.mpcd.geometry.ParallelPlates(separation=6.0, speed=1.0, no_slip=True)
plates = hoomd.mpcd.geometry.ParallelPlates(
separation=6.0, speed=1.0, no_slip=True
)
stream = hoomd.mpcd.stream.BounceBack(period=1, geometry=plates)
simulation.operations.integrator.streaming_method = stream
Expand Down
12 changes: 9 additions & 3 deletions hoomd/mpcd/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class Integrator(_MDIntegrator):
.. code-block:: python
stream = hoomd.mpcd.stream.Bulk(period=1)
collide = hoomd.mpcd.collide.StochasticRotationDynamics(period=1, angle=130)
collide = hoomd.mpcd.collide.StochasticRotationDynamics(
period=1, angle=130
)
integrator = hoomd.mpcd.Integrator(
dt=0.1,
streaming_method=stream,
Expand All @@ -111,7 +113,9 @@ class Integrator(_MDIntegrator):
angle=130,
embedded_particles=hoomd.filter.All(),
)
solute_method = hoomd.md.methods.ConstantVolume(filter=collide.embedded_particles)
solute_method = hoomd.md.methods.ConstantVolume(
filter=collide.embedded_particles
)
integrator = hoomd.mpcd.Integrator(
dt=dt_md,
Expand All @@ -130,7 +134,9 @@ class Integrator(_MDIntegrator):
plates = hoomd.mpcd.geometry.ParallelPlates(separation=6.0)
stream = hoomd.mpcd.stream.BounceBack(period=1, geometry=plates)
collide = hoomd.mpcd.collide.StochasticRotationDynamics(period=1, angle=130, kT=1.0)
collide = hoomd.mpcd.collide.StochasticRotationDynamics(
period=1, angle=130, kT=1.0
)
filler = hoomd.mpcd.fill.GeometryFiller(
type="A", density=5.0, kT=1.0, geometry=plates
)
Expand Down
4 changes: 3 additions & 1 deletion hoomd/mpcd/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class BounceBack(Method):
.. code-block:: python
plates = hoomd.mpcd.geometry.ParallelPlates(separation=6.0)
nve = hoomd.mpcd.methods.BounceBack(filter=hoomd.filter.All(), geometry=plates)
nve = hoomd.mpcd.methods.BounceBack(
filter=hoomd.filter.All(), geometry=plates
)
simulation.operations.integrator.methods.append(nve)
{inherited}
Expand Down
4 changes: 3 additions & 1 deletion hoomd/mpcd/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ class BounceBack(StreamingMethod):
stream = hoomd.mpcd.stream.BounceBack(
period=1,
geometry=hoomd.mpcd.geometry.ParallelPlates(separation=6.0, no_slip=True),
geometry=hoomd.mpcd.geometry.ParallelPlates(
separation=6.0, no_slip=True
),
mpcd_particle_force=hoomd.mpcd.force.ConstantForce((1, 0, 0)),
)
simulation.operations.integrator.streaming_method = stream
Expand Down
4 changes: 3 additions & 1 deletion hoomd/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,9 @@ def thermalize_particle_momenta(self, filter, kT):
.. code-block:: python
simulation.state.thermalize_particle_momenta(filter=hoomd.filter.All(), kT=1.5)
simulation.state.thermalize_particle_momenta(
filter=hoomd.filter.All(), kT=1.5
)
"""
self._simulation._warn_if_seed_unset()
group = self._get_group(filter)
Expand Down
4 changes: 3 additions & 1 deletion hoomd/update/remove_drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class RemoveDrift(Updater):
.. code-block:: python
remove_drift = hoomd.update.RemoveDrift(reference_positions=[(0, 0, 0), (1, 0, 0)])
remove_drift = hoomd.update.RemoveDrift(
reference_positions=[(0, 0, 0), (1, 0, 0)]
)
simulation.operations.updaters.append(remove_drift)
{inherited}
Expand Down
8 changes: 6 additions & 2 deletions hoomd/variant/scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ class Ramp(_hoomd.VariantRamp, Variant):
.. code-block:: python
variant = hoomd.variant.Ramp(A=1.0, B=2.0, t_start=10_000, t_ramp=100_000)
variant = hoomd.variant.Ramp(
A=1.0, B=2.0, t_start=10_000, t_ramp=100_000
)
{inherited}
Expand Down Expand Up @@ -258,7 +260,9 @@ class Power(_hoomd.VariantPower, Variant):
.. code-block:: python
variant = hoomd.variant.Power(A=2, B=8, power=1 / 10, t_start=10, t_ramp=20)
variant = hoomd.variant.Power(
A=2, B=8, power=1 / 10, t_start=10, t_ramp=20
)
{inherited}
Expand Down
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ convention = "google"
[format]
indent-style = "space"
line-ending = "auto"
docstring-code-line-length = 72
docstring-code-format = true

0 comments on commit 9f72be8

Please sign in to comment.