Refactor the crosslink class and add tests to better generate simple randomwalkpaths using iterative methods#1314
Refactor the crosslink class and add tests to better generate simple randomwalkpaths using iterative methods#1314CalCraven wants to merge 12 commits intomosdef-hub:developfrom
Conversation
| elif radius and spacing: | ||
| N = int((2 * np.pi * radius) / spacing) | ||
| else: | ||
| spacing = (2 * np.pi * radius) / N |
Check notice
Code scanning / CodeQL
Unused local variable Note
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| def get_second_point(state, existing_points, check_path, first_point): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
chrisjonesBSU
left a comment
There was a problem hiding this comment.
Working my way through this. Here are some things I noticed so far.
…sts to test path, add path__eq__ and __add__ class functions
for more information, see https://pre-commit.ci
| pos1[:, 1] = np.arange(10) | ||
| path.append_coordinates(pos1) | ||
| path.form_linear_bond_graph() | ||
|
|
Check failure
Code scanning / CodeQL
Potentially uninitialized local variable Error test
| assert path.bond_graph.number_of_nodes() == 10 | ||
|
|
||
| def test_init_positions(self): | ||
|
|
||
| # Random point | ||
| path = hard_sphere_random_walk( | ||
| radius=1.0, | ||
| bond_length=1.5, |
Check failure
Code scanning / CodeQL
Wrong name for an argument in a call Error test
| tolerance=1e-5, | ||
| trial_batch_size=20, | ||
| chunk_size=512, | ||
| run_on_gpu=False, |
Check failure
Code scanning / CodeQL
Potentially uninitialized local variable Error
mbuild/tests/test_path.py
Outdated
Check warning
Code scanning / CodeQL
Redundant comparison Warning test
| ) | ||
| is_inside_mask = state.volume_constraint.is_inside( | ||
| points=xyzs, buffer=state.radius | ||
| ) |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
| state.gpu_static_points = cuda.to_device(static_points) | ||
|
|
||
| # Main random walk loop | ||
| walk_finished = False |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
|
|
||
| # Prepare GPU static points if using GPU | ||
| if state.run_on_gpu: | ||
| from numba import cuda |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
| The Path object to populate with coordinates | ||
| N : int, required | ||
| Number of sites in the path | ||
| spacing : float, default = 1.0 nm |
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
|
|
||
| def visualize(self, radius=0.1): | ||
| """Visualize in 3D space using py3Dmol of the Path as a Compound. | ||
|
|
Check warning
Code scanning / CodeQL
Variable defined multiple times Warning
| indices[0], | ||
| name=self.beads[indices[0]], | ||
| xyz=self.coordinates[indices[0]], |
Check warning
Code scanning / CodeQL
Unreachable code Warning
No description provided.