function [basis] = referenceAmber()
%
%  $BEGIN
%  $HEADER referenceAmber
%
%  Return an orthogonal basis set
%  based on the amber standard 
%  back bone atom coordinates
%
%  $HEADER REFERENCE
%
%  $HEADER PROGRAMMER
%  John W. Craft, Jr.
%  University of Houston, (2005)
%
%  $HEADER VERSION
%  1.0.0
%
%  Example
%  [basis] = referenceAmber()
%
%  See Also pdb2dyana pdb2amber
%  
%  $END
%

% some data from the amber library
anames = {'N';'HN';'CA';'C';'O'};

acorrds = [3.3257  1.5479   0; ...
          3.9094  0.7236   0; ...
          3.9700  2.8457   0; ...
          5.4855  2.705    0; ...
          6.0088  1.5932   0];

i_n = atomfind(anames,'N');
i_ca = atomfind(anames,'CA');
i_c = atomfind(anames,'C');
n = acorrds(i_n,:);
ca = acorrds(i_ca,:);
c = acorrds(i_c,:);

bond_n_ca = ca - n;
bond_n_ca_u = bond_n_ca ./ norm(bond_n_ca);
basis_x = bond_n_ca_u;
norm(basis_x)

bond_ca_c = c - ca;
bond_ca_c_u = bond_ca_c ./ norm(bond_ca_c);

cross_ca_c = cross(bond_n_ca_u,bond_ca_c_u);
cross1n = cross_ca_c ./ norm(cross_ca_c);
basis_z = cross1n;
norm(basis_z)

basis_y = cross(basis_z,basis_x);

basis = [basis_x;basis_y;basis_z]

return

