GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SSEPathSampling/PathCheckerUmbrella.m at main · rchristie95/SSEPathSampling

Expand file tree

/

PathCheckerUmbrella.m

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
41 lines (34 loc) · 1.69 KB
/

PathCheckerUmbrella.m

Copy path

File metadata and controls

41 lines (34 loc) · 1.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function [choice, ns] = PathCheckerUmbrella(path, A, windowMat)
% This function checks the validity of a given path in an umbrella sampling context and assigns a choice.
% Inputs:
% path - The given trajectory path
% A - Boundaries defining state A
% windowMat - Matrix defining window boundaries for umbrella sampling
% Outputs:
% choice - Selected choice based on path validation (0 if invalid)
% ns - Number of valid states (non-zero elements in Pdist)
% Initialize probability distribution for path choices
Pdist = [0, 0, 0, 0];
trajectorySteps = length(path);
% Check if the path is valid in different contexts
if path(1) < A(2) && path(1) > A(1) && windowMat(1) < path(trajectorySteps) && path(trajectorySteps) < windowMat(2)
Pdist(1) = 1; % Forward path within the window
end
if path(trajectorySteps) < A(2) && path(trajectorySteps) > A(1) && windowMat(1) < path(1) && path(1) < windowMat(2)
Pdist(2) = 1; % Reversed path within the window
end
if path(1) > -A(2) && path(1) < -A(1) && -windowMat(1) > path(trajectorySteps) && path(trajectorySteps) > -windowMat(2)
Pdist(3) = 1; % Mirrored forward path within the window
end
if path(trajectorySteps) > -A(2) && path(trajectorySteps) < -A(1) && -windowMat(1) > path(1) && path(1) > -windowMat(2)
Pdist(4) = 1; % Mirrored reversed path within the window
end
% Count the number of valid states
ns = length(nonzeros(Pdist));
% Determine the choice
if ns == 0
choice = 0; % No valid choice
else
choice = randsample(1:4, 1, true, Pdist); % Randomly sample a valid choice based on Pdist
end
end
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.