Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for hydrogen bonds #20

Open
jhrmnn opened this issue Oct 20, 2018 · 0 comments
Open

Check for hydrogen bonds #20

jhrmnn opened this issue Oct 20, 2018 · 0 comments

Comments

@jhrmnn
Copy link
Owner

jhrmnn commented Oct 20, 2018

The original matlab code:

% add hydrogen bonds to bond matrix. 12/04/09

function [bond,C] = addhydrogenbonds(bond,C,R,atoms,allowed)
	H = find(atoms==1); % H atoms
	O = find(atoms==8); % O atoms
	[Oi,Hi] = find(~C(O,H) & R(O,H)<2.0);
	                         % find O-H shorted than 2 angstroms
	if isempty(Hi), return, end
	H = H(Hi); % bonded H atoms
	O = O(Oi); % bonded H atoms
	for i = 1:length(H)
		if any(atoms(bond(H(i),:))==8) % if H covalently bonded to O
			bond(O(i),H(i)) = true; % make hydrogen bond
			bond(H(i),O(i)) = true;
		end
	end
	bond = onlyallowed(bond,allowed,atoms,R);
	C = conn(bond);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant