Each atom has 3 positions.
You could use an associative array (i.e. hash) of positions (e.g. (x => $x, y => $y, z => $z)), but that's probably overkill.
Each atom can easily be represented by an array of positions (e.g. ($x, $y, $z)).

Each helix is made of atoms.
If you wish to name your atoms, a helix can easily be represented by an associative array (i.e. hash) of atom (e.g. (K => $atom0, L => $atom1, M => $atom2)).
If numerical indexes are sufficient identification for atoms, each helix can easily be represented by an array of atom (e.g. ($atom0, $atom1, $atom2)).
Let's go with names, since you already have names for them.

my %helix1 = ( A => [ -1.115, 8.537, 7.075 ], B => [ -2.745, 5.280, 7.165 ], C => [ -0.777, 3.267, 7.329 ], D => [ 1.610, 5.225, 10.885 ], E => [ 0.296, 5.263, 10.912 ], ); my %helix2 = ( K => [ -0.696, 13.041, 22.357 ], L => [ 1.152, 11.081, 23.082 ], M => [ 2.200, 17.590, 18.424 ], );

Each distance is has two index (the 'from' atom in the first helix and the 'to' atom in the second helix), so you'll need a 2D structure. We (I) decided above to use named atoms, so your distance map will be a 2D hash (e.g. $distance{A}{K} = distance($helix1{A}, $helix2{K});).

To populate %distance, think nested foreach loops. Good luck!


In reply to Re: confused with distances by ikegami
in thread confused with distances by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.