madd has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Generating combinatorial strings
by Ratazong (Monsignor) on Jan 25, 2010 at 08:09 UTC | |
by madd (Acolyte) on Jan 25, 2010 at 08:49 UTC | |
by BrowserUk (Patriarch) on Jan 25, 2010 at 08:57 UTC | |
by Ratazong (Monsignor) on Jan 25, 2010 at 08:58 UTC | |
by Xiong (Hermit) on Jan 25, 2010 at 22:25 UTC | |
|
Re: Generating combinatorial strings
by moritz (Cardinal) on Jan 25, 2010 at 13:36 UTC | |
|
Re: Generating combinatorial strings
by johngg (Canon) on Jan 25, 2010 at 12:14 UTC | |
|
Re: Generating combinatorial strings
by Utilitarian (Vicar) on Jan 25, 2010 at 08:32 UTC | |
|
Re: Generating combinatorial strings
by jethro (Monsignor) on Jan 25, 2010 at 13:30 UTC | |
|
Re: Generating combinatorial strings
by gmargo (Hermit) on Jan 25, 2010 at 20:22 UTC |