Skip to content

Commit

Permalink
Run pre-commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Oct 24, 2023
1 parent 0682c70 commit 4e13f89
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 56 deletions.
12 changes: 6 additions & 6 deletions hoomd_validation/alj_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions hoomd_validation/hard_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions hoomd_validation/hard_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
24 changes: 12 additions & 12 deletions hoomd_validation/lj_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 12 additions & 12 deletions hoomd_validation/lj_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions hoomd_validation/patchy_particle_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions hoomd_validation/simple_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions hoomd_validation/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4e13f89

Please sign in to comment.