// File: Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::resetAllChromosomes(unsigned int)
void Model::resetAllChromosomes(uint maxAttempts /*=1000*/) { //, bool updateClash /*=false*/) {
  vector<Chromosome>::iterator chriter;
  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;  
  double L = (this->getTotalChrLength() / this->numberOfChromosomes()) * 0.1;
  for(chriter = chromosomes.begin(); chriter != chromosomes.end(); chriter++) {
    vector<double> radii;
    Move mov(*chriter);
    boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;
    for(beaditer=chriter->begin(); beaditer!=chriter->end(); beaditer++) {
      radii.push_back(beaditer->getRadius());
    }
    mov.start = 0;
    mov.stop = chriter->size()-1;
    for(uint i=0; i!=maxAttempts; i++) {
      CoordinateVector origin(3);
      origin(0) = util::unif_real(-L, L, randEngine);
      origin(1) = util::unif_real(-L, L, randEngine);
      origin(2) = util::unif_real(-L, L, randEngine);
      CoordinateMatrix mat = util::createSelfAvoidingWalk(radii, origin, randEngine);
      
      if(mat.size1()!=0){
        mov.mat = mat;
        mov.validate();
        if (not isClashing(mov)) {
	  //cerr << "# " << chriter->getName() << " done!" << endl;
	  Move old = this->accept(mov); //, updateClash);
	  break;
        }
      }
    }
  }  
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, 0x1e0(%rsp)
movl %esi, 0x1dc(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x27c50
leaq 0x1c8(%rsp), %rdi
callq 0x16890
movq 0x60(%rsp), %rdi
callq 0x26c50
movq 0x60(%rsp), %rdi
movsd %xmm0, 0x58(%rsp)
callq 0x26d80
movsd 0x58(%rsp), %xmm0
movq 0x60(%rsp), %rdi
movl %eax, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd 0x29fb3(%rip), %xmm1    # 0x505e8
mulsd %xmm1, %xmm0
movsd %xmm0, 0x1c0(%rsp)
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27be0
movq %rax, 0x1b8(%rsp)
movq 0x1b8(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movq 0x60(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27c10
movq %rax, 0x1b0(%rsp)
leaq 0x1d0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x27c70
testb $0x1, %al
jne 0x2669d
jmp 0x26b7e
leaq 0x198(%rsp), %rdi
callq 0xc600
leaq 0x1d0(%rsp), %rdi
callq 0x28980
movq %rax, %rsi
leaq 0x160(%rsp), %rdi
callq 0x192f0
jmp 0x266c9
leaq 0x148(%rsp), %rdi
callq 0x16890
leaq 0x1d0(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x140(%rsp), %rdi
callq 0x15540
jmp 0x266f5
leaq 0x148(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x16a00
leaq 0x1d0(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x138(%rsp), %rdi
callq 0x15570
jmp 0x26729
leaq 0x148(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x26747
jmp 0x267da
leaq 0x148(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e60
movsd %xmm0, 0x50(%rsp)
jmp 0x26764
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x130(%rsp)
leaq 0x198(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0xc5d0
jmp 0x2678a
jmp 0x2678c
leaq 0x128(%rsp), %rdi
leaq 0x148(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x2670a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
jmp 0x26b6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
jmp 0x26b62
movl $0x0, 0x168(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x27cb0
movq %rax, %rdi
callq 0x154f0
movl %eax, 0x4c(%rsp)
jmp 0x26800
movl 0x4c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x16c(%rsp)
movl $0x0, 0x124(%rsp)
movl 0x124(%rsp), %eax
cmpl 0x1dc(%rsp), %eax
je 0x26b2f
leaq 0x108(%rsp), %rdi
movl $0x3, %esi
callq 0xbe30
jmp 0x26841
movq 0x60(%rsp), %rdi
movsd 0x1c0(%rsp), %xmm1
movaps %xmm1, %xmm0
movaps 0x287d7(%rip), %xmm2    # 0x4f030
pxor %xmm2, %xmm0
addq $0x20, %rdi
callq 0x9940
movsd %xmm0, 0x40(%rsp)
jmp 0x2686e
xorl %eax, %eax
movl %eax, %esi
leaq 0x108(%rsp), %rdi
callq 0xb270
movq %rax, 0x38(%rsp)
jmp 0x26886
movq 0x60(%rsp), %rdi
movq 0x38(%rsp), %rax
movsd 0x40(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x1c0(%rsp), %xmm1
movaps %xmm1, %xmm0
movaps 0x28783(%rip), %xmm2    # 0x4f030
pxor %xmm2, %xmm0
addq $0x20, %rdi
callq 0x9940
movsd %xmm0, 0x30(%rsp)
jmp 0x268c2
leaq 0x108(%rsp), %rdi
movl $0x1, %esi
callq 0xb270
movq %rax, 0x28(%rsp)
jmp 0x268db
movq 0x60(%rsp), %rdi
movq 0x28(%rsp), %rax
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x1c0(%rsp), %xmm1
movaps %xmm1, %xmm0
movaps 0x2872e(%rip), %xmm2    # 0x4f030
pxor %xmm2, %xmm0
addq $0x20, %rdi
callq 0x9940
movsd %xmm0, 0x20(%rsp)
jmp 0x26917
leaq 0x108(%rsp), %rdi
movl $0x2, %esi
callq 0xb270
movq %rax, 0x18(%rsp)
jmp 0x26930
movq 0x18(%rsp), %rax
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0xc8(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0xc2c0
jmp 0x26956
leaq 0xb0(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xb710
jmp 0x2696d
movq 0x60(%rsp), %rcx
addq $0x20, %rcx
leaq 0xe0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
movl $0x3e8, %r8d            # imm = 0x3E8
callq 0x9d20
jmp 0x2699b
leaq 0xb0(%rsp), %rdi
callq 0xb5b0
leaq 0xc8(%rsp), %rdi
callq 0xc3c0
leaq 0xe0(%rsp), %rdi
callq 0xb5e0
movq %rax, 0x10(%rsp)
jmp 0x269c9
movq 0x10(%rsp), %rax
cmpq $0x0, %rax
je 0x26ada
leaq 0x170(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x17400
jmp 0x269ef
leaq 0x160(%rsp), %rdi
callq 0x194e0
jmp 0x269fe
movq 0x60(%rsp), %rdi
leaq 0x160(%rsp), %rsi
xorl %edx, %edx
callq 0x1e470
movb %al, 0xf(%rsp)
jmp 0x26a18
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x26ad8
jmp 0x26a26
movq 0x60(%rsp), %rsi
leaq 0x78(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1efa0
jmp 0x26a3f
movl $0x8, 0x74(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x1a560
jmp 0x26ae2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
jmp 0x26b20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
jmp 0x26aa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0xb5b0
leaq 0xc8(%rsp), %rdi
callq 0xc3c0
jmp 0x26b20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0xb2d0
jmp 0x26b20
jmp 0x26ada
movl $0x0, 0x74(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0xb2d0
leaq 0x108(%rsp), %rdi
callq 0xb5b0
movl 0x74(%rsp), %eax
testl %eax, %eax
je 0x26b08
jmp 0x26b06
jmp 0x26b2f
jmp 0x26b0a
movl 0x124(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x124(%rsp)
jmp 0x26819
leaq 0x108(%rsp), %rdi
callq 0xb5b0
jmp 0x26b62
leaq 0x160(%rsp), %rdi
callq 0x1a560
leaq 0x198(%rsp), %rdi
callq 0xc3c0
leaq 0x1d0(%rsp), %rdi
xorl %esi, %esi
callq 0x27db0
movq %rax, 0x68(%rsp)
jmp 0x26666
leaq 0x160(%rsp), %rdi
callq 0x1a560
leaq 0x198(%rsp), %rdi
callq 0xc3c0
jmp 0x26b86
addq $0x1e8, %rsp            # imm = 0x1E8
retq
movq 0x158(%rsp), %rdi
callq 0x8870
nopw %cs:(%rax,%rax)