Hmmm. This is trickier than it appears at first glance. The SWIM User's Manual describes the relationship between soil "nodes" and soil "layers", but there are some ambiguities when starting with "layers", then trying to derive "nodes" from them. Treating these as 0-based arrays, the real trick is finding a suitable value for node[1] (or x(1) in the fortran source). The even-numbered nodes are well-defined, as are remaining odd-numbered nodes, once the first has been established.
Presumably the nodes should always be in ascending order (x(0) < x(1) < x(2) < x(3), etc.), so the challenge is finding a "reasonable" value for x(1) that also allows these inequalities to be met. That sounds simple, but it's easy to create pathological conditions where the inequalities fail. I'm testing an algorithm that tries to handle this, but I'm not entirely satisfied with it.
Are there good reasons why the nodes couldn't just be taken as 0 and the bottoms of the soil layers? This would make the node layer one element longer than the dlayer array.