// File: Chrom3D[P]Chrom3D/src/Model.cpp
// Function: Model::writePDB(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Model::writePDB(string modelName) {
  stringstream res;

  vector<Chromosome>::iterator chriter;
  boost::container::static_vector<Bead,MAXSIZE>::iterator beaditer;
  std::ofstream myfile;

  uint counter;
  std::string filename; 
  for(chriter = chromosomes.begin(); chriter != chromosomes.end(); chriter++) {
    counter = 1;
    filename = modelName + "/" + chriter->getName() + ".pdb";
    myfile.open(filename.c_str());
    res.str(""); //Clearing the stringstream
    for(beaditer = chriter->begin(); beaditer != chriter->end(); beaditer++) {
      res << "ATOM" << std::setw(7) << counter << std::setw(4) << "CA" << std::setw(5) << "MET" << std::setw(6) << counter << std::setw(12) << std::setprecision(4) << beaditer->getX() << std::setw(8) << std::setprecision(4) <<  beaditer->getY() << std::setw(8) << std::setprecision(4) << beaditer->getZ() << std::setw(6) << "1.00" << std::setw(6) << "0.00" << std::setw(12) << "C" << endl;
      counter++;
      }
      for(uint i = 1;i<counter-1;i++)
	  res << "CONECT" << std::setw(5) << i << std::setw(5) << i+1 << endl;
      res << "END" << endl;
      myfile << res.str();
      myfile.close();  
    }
 }

// Assembly:
subq $0x6c8, %rsp            # imm = 0x6C8
movq %rsi, 0x1a0(%rsp)
movq %rdi, 0x6c0(%rsp)
movq %rsi, 0x6b8(%rsp)
movq 0x6c0(%rsp), %rax
movq %rax, 0x1a8(%rsp)
leaq 0x530(%rsp), %rdi
callq 0x8380
leaq 0x528(%rsp), %rdi
callq 0x27c50
leaq 0x520(%rsp), %rdi
callq 0x16890
leaq 0x320(%rsp), %rdi
callq 0x8810
jmp 0x1f395
leaq 0x2f0(%rsp), %rdi
callq 0x8670
movq 0x1a8(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27be0
movq %rax, 0x2e8(%rsp)
movq 0x2e8(%rsp), %rax
movq %rax, 0x528(%rsp)
movq 0x1a8(%rsp), %rdi
addq $0xa78, %rdi            # imm = 0xA78
callq 0x27c10
movq %rax, 0x2e0(%rsp)
leaq 0x528(%rsp), %rdi
leaq 0x2e0(%rsp), %rsi
callq 0x27c70
testb $0x1, %al
jne 0x1f408
jmp 0x1fd7d
movq 0x1a0(%rsp), %rsi
movl $0x1, 0x310(%rsp)
leaq 0x3169b(%rip), %rdx     # 0x50abd
leaq 0x280(%rsp), %rdi
callq 0x28d20
jmp 0x1f431
leaq 0x528(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x260(%rsp), %rdi
callq 0x15510
jmp 0x1f450
leaq 0x2a0(%rsp), %rdi
leaq 0x280(%rsp), %rsi
leaq 0x260(%rsp), %rdx
callq 0x28c30
jmp 0x1f46f
leaq 0x31649(%rip), %rdx     # 0x50abf
leaq 0x2c0(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x28be0
jmp 0x1f48d
leaq 0x2f0(%rsp), %rdi
movq %rdi, 0x198(%rsp)
leaq 0x2c0(%rsp), %rsi
movq %rsi, 0x190(%rsp)
callq 0x85b0
movq 0x190(%rsp), %rdi
callq 0x8998
leaq 0x2a0(%rsp), %rdi
callq 0x8998
leaq 0x260(%rsp), %rdi
callq 0x8998
leaq 0x280(%rsp), %rdi
callq 0x8998
movq 0x198(%rsp), %rdi
callq 0x8220
movq %rax, %rsi
leaq 0x320(%rsp), %rdi
movl $0x10, %edx
callq 0x8070
jmp 0x1f50a
leaq 0x23f(%rsp), %rdi
movq %rdi, 0x188(%rsp)
callq 0x8880
movq 0x188(%rsp), %rdx
leaq 0x32b45(%rip), %rsi     # 0x52073
leaq 0x240(%rsp), %rdi
callq 0x1b100
jmp 0x1f53d
leaq 0x530(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x8550
jmp 0x1f554
leaq 0x240(%rsp), %rdi
callq 0x8998
leaq 0x23f(%rsp), %rdi
callq 0x8500
leaq 0x528(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x230(%rsp), %rdi
callq 0x15540
jmp 0x1f58d
leaq 0x520(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x16a00
leaq 0x528(%rsp), %rdi
callq 0x27cb0
movq %rax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x15570
jmp 0x1f5c1
leaq 0x520(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x16b40
testb $0x1, %al
jne 0x1f5df
jmp 0x1fbc2
leaq 0x540(%rsp), %rdi
leaq 0x314d6(%rip), %rsi     # 0x50ac4
callq 0x8480
movq %rax, 0x180(%rsp)
jmp 0x1f5fd
movl $0x7, %edi
callq 0x28db0
movl %eax, 0x17c(%rsp)
jmp 0x1f610
movq 0x180(%rsp), %rdi
movl 0x17c(%rsp), %eax
movl %eax, 0x224(%rsp)
movl 0x224(%rsp), %esi
callq 0x8560
movq %rax, 0x170(%rsp)
jmp 0x1f63c
movq 0x170(%rsp), %rdi
movl 0x310(%rsp), %esi
callq 0x8630
movq %rax, 0x168(%rsp)
jmp 0x1f65a
movl $0x4, %edi
callq 0x28db0
movl %eax, 0x164(%rsp)
jmp 0x1f66d
movq 0x168(%rsp), %rdi
movl 0x164(%rsp), %eax
movl %eax, 0x220(%rsp)
movl 0x220(%rsp), %esi
callq 0x8560
movq %rax, 0x158(%rsp)
jmp 0x1f699
movq 0x158(%rsp), %rdi
leaq 0x31421(%rip), %rsi     # 0x50ac9
callq 0x8480
movq %rax, 0x150(%rsp)
jmp 0x1f6b7
movl $0x5, %edi
callq 0x28db0
movl %eax, 0x14c(%rsp)
jmp 0x1f6ca
movq 0x150(%rsp), %rdi
movl 0x14c(%rsp), %eax
movl %eax, 0x21c(%rsp)
movl 0x21c(%rsp), %esi
callq 0x8560
movq %rax, 0x140(%rsp)
jmp 0x1f6f6
movq 0x140(%rsp), %rdi
leaq 0x313c7(%rip), %rsi     # 0x50acc
callq 0x8480
movq %rax, 0x138(%rsp)
jmp 0x1f714
movl $0x6, %edi
callq 0x28db0
movl %eax, 0x134(%rsp)
jmp 0x1f727
movq 0x138(%rsp), %rdi
movl 0x134(%rsp), %eax
movl %eax, 0x218(%rsp)
movl 0x218(%rsp), %esi
callq 0x8560
movq %rax, 0x128(%rsp)
jmp 0x1f753
movq 0x128(%rsp), %rdi
movl 0x310(%rsp), %esi
callq 0x8630
movq %rax, 0x120(%rsp)
jmp 0x1f771
movl $0xc, %edi
callq 0x28db0
movl %eax, 0x11c(%rsp)
jmp 0x1f784
movq 0x120(%rsp), %rdi
movl 0x11c(%rsp), %eax
movl %eax, 0x214(%rsp)
movl 0x214(%rsp), %esi
callq 0x8560
movq %rax, 0x110(%rsp)
jmp 0x1f7b0
movl $0x4, %edi
callq 0x28dd0
movl %eax, 0x10c(%rsp)
jmp 0x1f7c3
movq 0x110(%rsp), %rdi
movl 0x10c(%rsp), %eax
movl %eax, 0x210(%rsp)
movl 0x210(%rsp), %esi
callq 0x8730
movq %rax, 0x100(%rsp)
jmp 0x1f7ef
leaq 0x520(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e30
movsd %xmm0, 0xf8(%rsp)
jmp 0x1f80f
movsd 0xf8(%rsp), %xmm0
movq 0x100(%rsp), %rdi
callq 0x8910
movq %rax, 0xf0(%rsp)
jmp 0x1f82f
movl $0x8, %edi
callq 0x28db0
movl %eax, 0xec(%rsp)
jmp 0x1f842
movq 0xf0(%rsp), %rdi
movl 0xec(%rsp), %eax
movl %eax, 0x20c(%rsp)
movl 0x20c(%rsp), %esi
callq 0x8560
movq %rax, 0xe0(%rsp)
jmp 0x1f86e
movl $0x4, %edi
callq 0x28dd0
movl %eax, 0xdc(%rsp)
jmp 0x1f881
movq 0xe0(%rsp), %rdi
movl 0xdc(%rsp), %eax
movl %eax, 0x208(%rsp)
movl 0x208(%rsp), %esi
callq 0x8730
movq %rax, 0xd0(%rsp)
jmp 0x1f8ad
leaq 0x520(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e40
movsd %xmm0, 0xc8(%rsp)
jmp 0x1f8cd
movsd 0xc8(%rsp), %xmm0
movq 0xd0(%rsp), %rdi
callq 0x8910
movq %rax, 0xc0(%rsp)
jmp 0x1f8ed
movl $0x8, %edi
callq 0x28db0
movl %eax, 0xbc(%rsp)
jmp 0x1f900
movq 0xc0(%rsp), %rdi
movl 0xbc(%rsp), %eax
movl %eax, 0x204(%rsp)
movl 0x204(%rsp), %esi
callq 0x8560
movq %rax, 0xb0(%rsp)
jmp 0x1f92c
movl $0x4, %edi
callq 0x28dd0
movl %eax, 0xac(%rsp)
jmp 0x1f93f
movq 0xb0(%rsp), %rdi
movl 0xac(%rsp), %eax
movl %eax, 0x200(%rsp)
movl 0x200(%rsp), %esi
callq 0x8730
movq %rax, 0xa0(%rsp)
jmp 0x1f96b
leaq 0x520(%rsp), %rdi
callq 0x16ca0
movq %rax, %rdi
callq 0x14e50
movsd %xmm0, 0x98(%rsp)
jmp 0x1f98b
movsd 0x98(%rsp), %xmm0
movq 0xa0(%rsp), %rdi
callq 0x8910
movq %rax, 0x90(%rsp)
jmp 0x1f9ab
movl $0x6, %edi
callq 0x28db0
movl %eax, 0x8c(%rsp)
jmp 0x1f9be
movq 0x90(%rsp), %rdi
movl 0x8c(%rsp), %eax
movl %eax, 0x1fc(%rsp)
movl 0x1fc(%rsp), %esi
callq 0x8560
movq %rax, 0x80(%rsp)
jmp 0x1f9ea
movq 0x80(%rsp), %rdi
leaq 0x310d7(%rip), %rsi     # 0x50ad0
callq 0x8480
movq %rax, 0x78(%rsp)
jmp 0x1fa05
movl $0x6, %edi
callq 0x28db0
movl %eax, 0x74(%rsp)
jmp 0x1fa15
movq 0x78(%rsp), %rdi
movl 0x74(%rsp), %eax
movl %eax, 0x1f8(%rsp)
movl 0x1f8(%rsp), %esi
callq 0x8560
movq %rax, 0x68(%rsp)
jmp 0x1fa38
movq 0x68(%rsp), %rdi
leaq 0x31091(%rip), %rsi     # 0x50ad5
callq 0x8480
movq %rax, 0x60(%rsp)
jmp 0x1fa50
movl $0xc, %edi
callq 0x28db0
movl %eax, 0x5c(%rsp)
jmp 0x1fa60
movq 0x60(%rsp), %rdi
movl 0x5c(%rsp), %eax
movl %eax, 0x1f4(%rsp)
movl 0x1f4(%rsp), %esi
callq 0x8560
movq %rax, 0x50(%rsp)
jmp 0x1fa83
movq 0x50(%rsp), %rdi
leaq 0x3104b(%rip), %rsi     # 0x50ada
callq 0x8480
movq %rax, 0x48(%rsp)
jmp 0x1fa9b
movq 0x48(%rsp), %rdi
movq 0x4a489(%rip), %rsi     # 0x69f30
callq 0x84e0
jmp 0x1faae
movl 0x310(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x310(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x520(%rsp), %rsi
xorl %edx, %edx
callq 0x16b60
jmp 0x1f5a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x1fdc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x1fdac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x1fb67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x1fb5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0x8998
leaq 0x260(%rsp), %rdi
callq 0x8998
leaq 0x280(%rsp), %rdi
callq 0x8998
jmp 0x1fdac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x1fbb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x8998
leaq 0x23f(%rsp), %rdi
callq 0x8500
jmp 0x1fdac
movl $0x1, 0x1e4(%rsp)
movl 0x1e4(%rsp), %eax
movl 0x310(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x1fcc4
leaq 0x540(%rsp), %rdi
leaq 0x30ee7(%rip), %rsi     # 0x50adc
callq 0x8480
movq %rax, 0x40(%rsp)
jmp 0x1fc01
movl $0x5, %edi
callq 0x28db0
movl %eax, 0x3c(%rsp)
jmp 0x1fc11
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %eax
movl %eax, 0x1e0(%rsp)
movl 0x1e0(%rsp), %esi
callq 0x8560
movq %rax, 0x30(%rsp)
jmp 0x1fc34
movq 0x30(%rsp), %rdi
movl 0x1e4(%rsp), %esi
callq 0x8630
movq %rax, 0x28(%rsp)
jmp 0x1fc4c
movl $0x5, %edi
callq 0x28db0
movl %eax, 0x24(%rsp)
jmp 0x1fc5c
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %eax
movl %eax, 0x1dc(%rsp)
movl 0x1dc(%rsp), %esi
callq 0x8560
movq %rax, 0x18(%rsp)
jmp 0x1fc7f
movq 0x18(%rsp), %rdi
movl 0x1e4(%rsp), %esi
incl %esi
callq 0x8630
movq %rax, 0x10(%rsp)
jmp 0x1fc99
movq 0x10(%rsp), %rdi
movq 0x4a28b(%rip), %rsi     # 0x69f30
callq 0x84e0
jmp 0x1fcac
jmp 0x1fcae
movl 0x1e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e4(%rsp)
jmp 0x1fbcd
leaq 0x540(%rsp), %rdi
leaq 0x30e10(%rip), %rsi     # 0x50ae3
callq 0x8480
movq %rax, 0x8(%rsp)
jmp 0x1fcdf
movq 0x8(%rsp), %rdi
movq 0x4a245(%rip), %rsi     # 0x69f30
callq 0x84e0
jmp 0x1fcf2
leaq 0x1b8(%rsp), %rdi
leaq 0x530(%rsp), %rsi
callq 0x8470
jmp 0x1fd09
leaq 0x320(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x8450
jmp 0x1fd20
leaq 0x1b8(%rsp), %rdi
callq 0x8998
leaq 0x320(%rsp), %rdi
callq 0x8690
jmp 0x1fd3c
jmp 0x1fd3e
leaq 0x528(%rsp), %rdi
xorl %esi, %esi
callq 0x27db0
movq %rax, 0x1b0(%rsp)
jmp 0x1f3ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x8998
jmp 0x1fdac
leaq 0x2f0(%rsp), %rdi
callq 0x8998
leaq 0x320(%rsp), %rdi
callq 0x86e0
leaq 0x530(%rsp), %rdi
callq 0x83c0
addq $0x6c8, %rsp            # imm = 0x6C8
retq
leaq 0x2f0(%rsp), %rdi
callq 0x8998
leaq 0x320(%rsp), %rdi
callq 0x86e0
leaq 0x530(%rsp), %rdi
callq 0x83c0
movq 0x318(%rsp), %rdi
callq 0x8870