From 4e13f89e1b322120c2e48b1073fb380d030f35fc Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 24 Oct 2023 11:23:25 -0400 Subject: [PATCH] Run pre-commit. --- hoomd_validation/alj_2d.py | 12 +++++----- hoomd_validation/hard_disk.py | 12 +++++----- hoomd_validation/hard_sphere.py | 12 +++++----- hoomd_validation/lj_fluid.py | 24 ++++++++++---------- hoomd_validation/lj_union.py | 24 ++++++++++---------- hoomd_validation/patchy_particle_pressure.py | 12 +++++----- hoomd_validation/simple_polygon.py | 12 +++++----- hoomd_validation/util.py | 4 ++-- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/hoomd_validation/alj_2d.py b/hoomd_validation/alj_2d.py index 8fb49a3c..97a2be53 100644 --- a/hoomd_validation/alj_2d.py +++ b/hoomd_validation/alj_2d.py @@ -89,9 +89,9 @@ def alj_2d_create_initial_state(*jobs): init_diameter = CIRCUMCIRCLE_RADIUS * 2 * 1.15 - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) num_particles = job.statepoint['num_particles'] density = job.statepoint['density'] @@ -320,9 +320,9 @@ def alj_2d_nve_md_job(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{sim_mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{sim_mode}_{device_name}.log')) run_nve_md_sim(job, device, complete_filename=f'{sim_mode}_{device_name}_complete') diff --git a/hoomd_validation/hard_disk.py b/hoomd_validation/hard_disk.py index 2e252f31..1a895b26 100644 --- a/hoomd_validation/hard_disk.py +++ b/hoomd_validation/hard_disk.py @@ -99,9 +99,9 @@ def hard_disk_create_initial_state(*jobs): position_2d = list(itertools.product(x, repeat=2))[:num_particles] # create snapshot - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) snap = hoomd.Snapshot(communicator) if communicator.rank == 0: @@ -564,9 +564,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{mode}_{device_name}.log')) globals().get(f'run_{mode}_sim')( job, device, complete_filename=f'{mode}_{device_name}_complete') diff --git a/hoomd_validation/hard_sphere.py b/hoomd_validation/hard_sphere.py index 93e3680d..01327f49 100644 --- a/hoomd_validation/hard_sphere.py +++ b/hoomd_validation/hard_sphere.py @@ -94,9 +94,9 @@ def hard_sphere_create_initial_state(*jobs): position = list(itertools.product(x, repeat=3))[:num_particles] # create snapshot - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) snap = hoomd.Snapshot(device.communicator) if device.communicator.rank == 0: @@ -443,9 +443,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'run_{mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'run_{mode}_{device_name}.log')) globals().get(f'run_{mode}_sim')( job, device, complete_filename=f'{mode}_{device_name}_complete') diff --git a/hoomd_validation/lj_fluid.py b/hoomd_validation/lj_fluid.py index 026081d4..e51ba2e7 100644 --- a/hoomd_validation/lj_fluid.py +++ b/hoomd_validation/lj_fluid.py @@ -109,9 +109,9 @@ def lj_fluid_create_initial_state(*jobs): print('starting lj_fluid_create_initial_state:', job) sp = job.sp - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) box_volume = sp["num_particles"] / sp["density"] L = box_volume**(1 / 3.) @@ -407,9 +407,9 @@ def md_sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{sim_mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{sim_mode}_{device_name}.log')) run_md_sim(job, device, @@ -806,9 +806,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{mode}_mc_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{mode}_mc_{device_name}.log')) globals().get(f'run_{mode}_mc_sim')( job, device, complete_filename=f'{mode}_mc_{device_name}_complete') @@ -1339,9 +1339,9 @@ def lj_fluid_nve_md_job(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{sim_mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{sim_mode}_{device_name}.log')) run_nve_md_sim(job, device, run_length=run_length, diff --git a/hoomd_validation/lj_union.py b/hoomd_validation/lj_union.py index bcfd713b..64b0d218 100644 --- a/hoomd_validation/lj_union.py +++ b/hoomd_validation/lj_union.py @@ -97,9 +97,9 @@ def lj_union_create_initial_state(*jobs): print('starting lj_union_create_initial_state:', job) sp = job.sp - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) box_volume = sp["num_particles"] / sp["density"] L = box_volume**(1 / 3.) @@ -437,9 +437,9 @@ def md_sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{sim_mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{sim_mode}_{device_name}.log')) run_md_sim(job, device, @@ -864,9 +864,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{mode}_mc_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{mode}_mc_{device_name}.log')) globals().get(f'run_{mode}_mc_sim')( job, device, complete_filename=f'{mode}_mc_{device_name}_complete') @@ -1419,9 +1419,9 @@ def lj_union_nve_md_job(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{sim_mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{sim_mode}_{device_name}.log')) run_nve_md_sim(job, device, run_length=run_length, diff --git a/hoomd_validation/patchy_particle_pressure.py b/hoomd_validation/patchy_particle_pressure.py index 47647eab..d8300057 100644 --- a/hoomd_validation/patchy_particle_pressure.py +++ b/hoomd_validation/patchy_particle_pressure.py @@ -190,9 +190,9 @@ def patchy_particle_pressure_create_initial_state(*jobs): position = list(itertools.product(x, repeat=3))[:num_particles] # create snapshot - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) snap = hoomd.Snapshot(communicator) if communicator.rank == 0: @@ -600,9 +600,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{mode}_{device_name}.log')) globals().get(f'run_{mode}_sim')( job, device, complete_filename=f'{mode}_{device_name}_complete') diff --git a/hoomd_validation/simple_polygon.py b/hoomd_validation/simple_polygon.py index 3d1eeb6a..af1a61e8 100644 --- a/hoomd_validation/simple_polygon.py +++ b/hoomd_validation/simple_polygon.py @@ -110,9 +110,9 @@ def simple_polygon_create_initial_state(*jobs): position_2d = list(itertools.product(x, repeat=2))[:num_particles] # create snapshot - device = hoomd.device.CPU( - communicator=communicator, - message_filename=util.get_message_filename(job, 'create_initial_state.log')) + device = hoomd.device.CPU(communicator=communicator, + message_filename=util.get_message_filename( + job, 'create_initial_state.log')) snap = hoomd.Snapshot(communicator) if communicator.rank == 0: @@ -486,9 +486,9 @@ def sampling_operation(*jobs): elif device_name == 'cpu': device_cls = hoomd.device.CPU - device = device_cls( - communicator=communicator, - message_filename=util.get_message_filename(job, f'{mode}_{device_name}.log')) + device = device_cls(communicator=communicator, + message_filename=util.get_message_filename( + job, f'{mode}_{device_name}.log')) globals().get(f'run_{mode}_sim')( job, device, complete_filename=f'{mode}_{device_name}_complete') diff --git a/hoomd_validation/util.py b/hoomd_validation/util.py index e39f60e4..f442eb7f 100644 --- a/hoomd_validation/util.py +++ b/hoomd_validation/util.py @@ -30,14 +30,14 @@ def get_job_filename(sim_mode, device, name, type): def get_message_filename(job, filename): - """Get a cluster job unique message filename. - """ + """Get a cluster job unique message filename.""" cluster_id = os.environ.get('SLURM_JOB_ID', None) if cluster_id is not None: return job.fn(f'{cluster_id}-{filename}') else: return job.fn(filename) + def run_up_to_walltime(sim, end_step, steps, walltime_stop): """Run a simulation, stopping early if a walltime limit is reached.