Skip to content

Need software for generating self-avoiding random walks on a tetrahedral lattice

An answer to this question on the Scientific Computing Stack Exchange.

Question

I am looking for FOSS code that can generate self-avoiding random walk trajectories on a tetrahedral lattice. The purpose of the exercise is to create random conformations of model polymer chains that serve as input to a simulation protocol. It would be nice if the code satisfied the following criteria:

  • Implemented in C++ or C, or maybe Fortran, source code is available under a reasonable FOSS licence;
  • The code shall be reasonably portable (no reliance on e.g. GCC extensions);
  • As input it should take the length of the walk (chain length) and the length of the lattice edge ("bond length") and return one (or more) arrays of 3D coordinates;
  • Performance should be adequate up to about 1000 walk steps, I don't need very long trajectories/chains;
  • It has been used with success by the person who recommends it :-)

I have done my Googling homework and found one piece of software on GitHub. However, it has not been touched since 5 years and cannot be compiled with a modern compiler (GCC 10) any more.

For all hints, pointers etc. I would be grateful. Thanks!

Answer

I fixed the compilation issues in the Roulattice package you mentioned and it now compiles and seems to do stuff. Most of the issues were easily solvable, though there's an uninitialized memory error that occurs if you don't use the -torsion flag. Run it like below.

./roulattice -tetra_saw1 50 -num 1000 -torsion

The updated repo is available on my Github at: https://github.com/r-barnes/Roulattice. As of July 25, 2021 the changes are also available in Roulattice/master at https://github.com/Roulattice/Roulattice

I would comment that the code is a bit of a mess inside and doesn't include unit tests, so I recommend trying to do something to verify its outputs; I don't place high trust in the authors having done this right.