Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriedman22 committed Oct 7, 2024
1 parent 15c1fd2 commit b7abcdb
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions ensemble_md/utils/coordinate_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
The :obj:`.coordinate_swap` module provides functions for swapping coordinates
in a MT-REXEE simulation.
"""
import os
import re
import copy
import mdtraj as md
Expand Down Expand Up @@ -260,6 +259,7 @@ def perform_shift(mol, box_dimensions, broken_pairs_init, prev_shift_atom, num_s
prev_shift_atom : int
Which atoms have already been shifted so we don't undo what we've done.
num_shift_dimensions : int
Whether the shift should be attempted in 1, 2, or 3 dimensions
Returns
-------
Expand All @@ -278,21 +278,20 @@ def perform_shift(mol, box_dimensions, broken_pairs_init, prev_shift_atom, num_s
if num_shift_dimensions == 1:
shift_combos = np.concatenate((np.identity(3), -1*np.identity(3)), axis=0)
elif num_shift_dimensions == 2:
shift_combos = [[1, 1, 0],
shift_combos = [[1, 1, 0],
[1, -1, 0],
[-1, 1, 0],
[-1, -1, 0],
[0, 1, 1],
[0, 1, 1],
[0, 1, -1],
[0, -1, 1],
[0, -1, -1],
[1, 0, 1],
[1, 0, 1],
[1, 0, -1],
[-1, 0, 1],
[-1, 0, -1]]
else:
shift_combos = product([1, -1], [1, -1], [1, -1])

for shift_dir in shift_combos: # Try all combos of shift direction
mol.xyz[0, broken_atom, 0] = mol.xyz[0, broken_atom, 0] + (shift_dir[0] * box_dimensions[0])
mol.xyz[0, broken_atom, 1] = mol.xyz[0, broken_atom, 1] + (shift_dir[1] * box_dimensions[1])
Expand All @@ -309,6 +308,7 @@ def perform_shift(mol, box_dimensions, broken_pairs_init, prev_shift_atom, num_s
prev_shift_atom.append(broken_atom)
return mol, fixed, prev_shift_atom


def check_break(mol, atom_pairs):
"""
Determines whether a break is present between the atom pairs of interest.
Expand Down Expand Up @@ -374,7 +374,7 @@ def compute_angle(coords):
Parameters
----------
coords : list
A list of numpy arrays containing the XYZ coordinates of 3 points, for which the angle 1-2-3 is to be computed.
A list of numpy arrays containing the XYZ coordinates of 3 points, for which the angle 1-2-3 is to be computed. # noqa: E501
Returns
-------
Expand All @@ -387,7 +387,6 @@ def compute_angle(coords):
angle = np.arccos(np.dot(vec1, vec2) / (np.linalg.norm(vec1) * np.linalg.norm(vec2)))

return angle


# Create a new column for coordinates if one does not exist
if 'X Coordinates' not in df_atom_swap.columns:
Expand Down Expand Up @@ -920,9 +919,6 @@ def find_rotation_angle(initial_point, vertex, rotated_point, axis):
return angle





def add_or_swap(df_select, file_new, resnum, resname, vel, atom_num, orig_coor, skip_line, R_o_D_num, pick):
"""
Determine if the atom needs added or swapped between real and dummy state and then add the atom to the new file
Expand Down

0 comments on commit b7abcdb

Please sign in to comment.