diff --git a/hoomd/data/typeconverter.py b/hoomd/data/typeconverter.py index 0e72da4b99..618d8408e1 100644 --- a/hoomd/data/typeconverter.py +++ b/hoomd/data/typeconverter.py @@ -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) diff --git a/hoomd/device.py b/hoomd/device.py index cf537ff689..f662b6e046 100644 --- a/hoomd/device.py +++ b/hoomd/device.py @@ -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 diff --git a/hoomd/filter/custom.py b/hoomd/filter/custom.py index 8e83d08c37..dbb3ef684a 100644 --- a/hoomd/filter/custom.py +++ b/hoomd/filter/custom.py @@ -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]) diff --git a/hoomd/hpmc/compute.py b/hoomd/hpmc/compute.py index efc71bba01..b1361aefdf 100644 --- a/hoomd/hpmc/compute.py +++ b/hoomd/hpmc/compute.py @@ -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} diff --git a/hoomd/hpmc/integrate.py b/hoomd/hpmc/integrate.py index 69c706e2f6..ffadcd42a0 100644 --- a/hoomd/hpmc/integrate.py +++ b/hoomd/hpmc/integrate.py @@ -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), @@ -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} diff --git a/hoomd/hpmc/pair/lj_gauss.py b/hoomd/hpmc/pair/lj_gauss.py index 2bd5f59705..ec6e935844 100644 --- a/hoomd/hpmc/pair/lj_gauss.py +++ b/hoomd/hpmc/pair/lj_gauss.py @@ -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} diff --git a/hoomd/md/methods/methods.py b/hoomd/md/methods/methods.py index 2c80de97d8..297c31fc1b 100644 --- a/hoomd/md/methods/methods.py +++ b/hoomd/md/methods/methods.py @@ -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. @@ -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 @@ -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} diff --git a/hoomd/md/methods/thermostats.py b/hoomd/md/methods/thermostats.py index b9b92e9335..3aafbcf38b 100644 --- a/hoomd/md/methods/thermostats.py +++ b/hoomd/md/methods/thermostats.py @@ -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 @@ -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]` """ diff --git a/hoomd/md/minimize/fire.py b/hoomd/md/minimize/fire.py index 9c1f8014af..ebb8ef1b5e 100644 --- a/hoomd/md/minimize/fire.py +++ b/hoomd/md/minimize/fire.py @@ -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): diff --git a/hoomd/md/pair/aniso.py b/hoomd/md/pair/aniso.py index 0215b64948..69421a49b6 100644 --- a/hoomd/md/pair/aniso.py +++ b/hoomd/md/pair/aniso.py @@ -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, @@ -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, @@ -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, diff --git a/hoomd/md/pair/pair.py b/hoomd/md/pair/pair.py index 672c927910..8b7ce9e33c 100644 --- a/hoomd/md/pair/pair.py +++ b/hoomd/md/pair/pair.py @@ -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} @@ -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} @@ -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} diff --git a/hoomd/md/update.py b/hoomd/md/update.py index 7cbda72136..75042c8b8b 100644 --- a/hoomd/md/update.py +++ b/hoomd/md/update.py @@ -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 diff --git a/hoomd/mpcd/collide.py b/hoomd/mpcd/collide.py index 9d8e903112..abb171a956 100644 --- a/hoomd/mpcd/collide.py +++ b/hoomd/mpcd/collide.py @@ -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. @@ -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. diff --git a/hoomd/mpcd/force.py b/hoomd/mpcd/force.py index ee6bab520e..874f0f2083 100644 --- a/hoomd/mpcd/force.py +++ b/hoomd/mpcd/force.py @@ -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 diff --git a/hoomd/mpcd/geometry.py b/hoomd/mpcd/geometry.py index a74cec18ac..00abc9e002 100644 --- a/hoomd/mpcd/geometry.py +++ b/hoomd/mpcd/geometry.py @@ -322,7 +322,9 @@ 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 @@ -330,7 +332,9 @@ class ParallelPlates(Geometry): .. 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 diff --git a/hoomd/mpcd/integrate.py b/hoomd/mpcd/integrate.py index 80d27a3f8b..10793d3eba 100644 --- a/hoomd/mpcd/integrate.py +++ b/hoomd/mpcd/integrate.py @@ -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, @@ -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, @@ -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 ) diff --git a/hoomd/mpcd/methods.py b/hoomd/mpcd/methods.py index 1d88afd03a..14e523adbd 100644 --- a/hoomd/mpcd/methods.py +++ b/hoomd/mpcd/methods.py @@ -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} diff --git a/hoomd/mpcd/stream.py b/hoomd/mpcd/stream.py index 83cce18064..8a2dfc0e8c 100644 --- a/hoomd/mpcd/stream.py +++ b/hoomd/mpcd/stream.py @@ -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 diff --git a/hoomd/state.py b/hoomd/state.py index 3ccfcb9965..68992d9674 100644 --- a/hoomd/state.py +++ b/hoomd/state.py @@ -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) diff --git a/hoomd/update/remove_drift.py b/hoomd/update/remove_drift.py index d04ec112ef..1b59e3c632 100644 --- a/hoomd/update/remove_drift.py +++ b/hoomd/update/remove_drift.py @@ -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} diff --git a/hoomd/variant/scalar.py b/hoomd/variant/scalar.py index 4cf3125b9d..cdb7ec6ee7 100644 --- a/hoomd/variant/scalar.py +++ b/hoomd/variant/scalar.py @@ -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} @@ -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} diff --git a/ruff.toml b/ruff.toml index e2193959f8..b40187cf9a 100644 --- a/ruff.toml +++ b/ruff.toml @@ -46,4 +46,5 @@ convention = "google" [format] indent-style = "space" line-ending = "auto" +docstring-code-line-length = 72 docstring-code-format = true