Hi,

Firstly I apologise for submitting a very similar question to one asked recently by my colleague. Here is a hopefully more refined version.

I have a molecule of arbitrary length, which we can measure by the number of bonds in the molecule. Each bond can be rotated independently of all others. It is common, but not absolute, that a given bond can be rotated into 3 distinct positions. And so we label each set of rotations with a string that indicates the position of each bond (i.e. normally the "1", "2" or "3" position).

I need to generate a list of all the possible molecule ID strings for a molecule that is read in. In most cases, all bond rotations will have the same degeneracy, but it would be useful to not make this assumption - i.e. bond a can rotate 3 ways, b also 3, c 2, d 3...

So for a molecule of length = 5, where all bonds can be rotated 3 ways, I need 3^5 strings of the form:

11111 11112 11113 .. 21111 21112 21113 .. 33333

Once I have the string, I need to do two things: Firstly the string will be used as a filename. Secondly I need to use each number in the string to generate the required rotation angle. This code works already, I just need to feed it.

Thanks


In reply to Generating combinatorial strings by madd

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.