Skip to content

Commit

Permalink
Merge pull request #10 from maximilian-tech/Fix_string_compare_and_nu…
Browse files Browse the repository at this point in the history
…mpy_value_extraction

Fix wrong string compare and deprecated numpy array value extraction …
  • Loading branch information
taylor-a-barnes authored Nov 7, 2023
2 parents d3c821a + dedd10c commit 7bb1d76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/mpi4py/example3/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def generate_initial_state(method='random', file_name=None, num_particles=None,
"""


if method is 'random':
if method == 'random':

np.random.seed(seed=1)
coordinates = (0.5 - np.random.rand(num_particles, 3)) * box_length

elif method is 'file':
elif method == 'file':

coordinates = np.loadtxt(file_name, skiprows=2, usecols=(1,2,3))

Expand Down Expand Up @@ -320,7 +320,7 @@ def main():

total_energy = (total_pair_energy + tail_correction) / num_particles

energy_array[i_step] = total_energy
energy_array[i_step] = total_energy.item()

if np.mod(i_step + 1, freq) == 0:
if my_rank == 0:
Expand Down
6 changes: 3 additions & 3 deletions examples/mpi4py/example3/final/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def generate_initial_state(method='random', file_name=None, num_particles=None,
"""


if method is 'random':
if method == 'random':

np.random.seed(seed=1)
coordinates = (0.5 - np.random.rand(num_particles, 3)) * box_length

elif method is 'file':
elif method == 'file':

coordinates = np.loadtxt(file_name, skiprows=2, usecols=(1,2,3))

Expand Down Expand Up @@ -342,7 +342,7 @@ def main():

total_energy = (total_pair_energy + tail_correction) / num_particles

energy_array[i_step] = total_energy
energy_array[i_step] = total_energy.item()

if np.mod(i_step + 1, freq) == 0:

Expand Down

0 comments on commit 7bb1d76

Please sign in to comment.