// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x448, %rsp            # imm = 0x448
movq %rsi, 0xb8(%rsp)
movq %rdi, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x6260
leaq 0x248(%rsp), %rdi
callq 0x6540
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0xa78(%rbx), %rax
movq %rax, 0x28(%rsp)
cmpq 0xa80(%rbx), %rax
je 0x10cd6
movq %rbx, 0xb0(%rsp)
leaq 0x18(%rsp), %r15
leaq 0xd0(%rsp), %r13
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xb8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0xa4a2
movq %rbx, %rdi
leaq 0x1a039(%rip), %rsi     # 0x2a79b
callq 0x6630
leaq 0x70(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb140
movq 0x30(%rsp), %rcx
movl $0xf, %edi
leaq 0x40(%rsp), %rax
cmpq %rax, %rcx
je 0x1078f
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %r8
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x107c6
movl $0xf, %edi
leaq 0x80(%rsp), %r9
cmpq %r9, %rsi
je 0x107c1
movq 0x80(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x107d2
leaq 0x30(%rsp), %rdi
callq 0x6110
jmp 0x107e0
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6350
leaq 0x60(%rsp), %rsi
movq %rsi, 0x50(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x10805
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x1080b
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x50(%rsp), %rdi
leaq 0x19f69(%rip), %rsi     # 0x2a79d
callq 0x6630
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1085c
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x10863
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x90(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x63b0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x108a4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x108c0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x108e2
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x108fe
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x90(%rsp), %rsi
leaq 0x248(%rsp), %rdi
movl $0x10, %edx
callq 0x6050
movq %r15, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1b56f(%rip), %rdx     # 0x2be9b
movq %rdx, %rsi
callq 0xdf94
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
callq 0x6460
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1095b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6310
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb164
movq 0x8(%rsp), %r14
xorl %r12d, %r12d
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb170
cmpq 0x8(%rsp), %r14
je 0x10b60
movl $0x4, %edx
movq %r13, %rdi
leaq 0x19e07(%rip), %rsi     # 0x2a7a2
callq 0x6370
incl %r12d
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rax
movq $0x7, 0xe0(%rsp,%rax)
movl %r12d, %ebx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6230
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rax
movq $0x4, 0x10(%rbp,%rax)
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x19dbc(%rip), %rsi     # 0x2a7a7
callq 0x6370
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq $0x5, 0x10(%rbp,%rax)
movl $0x3, %edx
movq %rbp, %rdi
leaq 0x19d9a(%rip), %rsi     # 0x2a7aa
callq 0x6370
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq $0x6, 0x10(%rbp,%rax)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6230
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xc, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%rbx,%rax)
movq %r14, %rdi
callq 0xad6c
movq %rbx, %rdi
callq 0x64d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0x8, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%rbx,%rax)
movq %r14, %rdi
callq 0xad72
movq %rbx, %rdi
callq 0x64d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0x8, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%rbx,%rax)
movq %r14, %rdi
callq 0xad78
movq %rbx, %rdi
callq 0x64d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movq $0x6, 0x10(%rbx,%rax)
movl $0x4, %edx
movq %rbx, %rdi
leaq 0x19ccb(%rip), %rsi     # 0x2a7ae
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x6, 0x10(%rbx,%rax)
movl $0x4, %edx
movq %rbx, %rdi
leaq 0x19cac(%rip), %rsi     # 0x2a7b3
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xc, 0x10(%rbx,%rax)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x19c8d(%rip), %rsi     # 0x2a7b8
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6240
addq $0x60, %r14
jmp 0x10972
movl %r12d, %r12d
cmpq $0x1, %r12
adcq $0x0, %r12
movl $0x1, %r14d
cmpq %r14, %r12
je 0x10bfe
movl $0x6, %edx
movq %r13, %rdi
leaq 0x19c31(%rip), %rsi     # 0x2a7ba
callq 0x6370
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rax
movq $0x5, 0xe0(%rsp,%rax)
movq %r13, %rdi
movq %r14, %rsi
callq 0x6230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x5, 0x10(%rax,%rcx)
incq %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x6230
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x62f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6240
jmp 0x10b71
movl $0x3, %edx
movq %r13, %rdi
leaq 0x19bb4(%rip), %rsi     # 0x2a7c1
callq 0x6370
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x62f0
movsbl %al, %esi
movq %r13, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6240
leaq 0x8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x64b0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x248(%rsp), %rdi
callq 0x6370
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x10c7e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6310
leaq 0x248(%rsp), %rdi
callq 0x6410
movq 0x28(%rsp), %rcx
addq $0x75330, %rcx          # imm = 0x75330
movq 0xb0(%rsp), %rax
movq %rcx, 0x28(%rsp)
cmpq 0xa80(%rax), %rcx
jne 0x1072f
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x10cd6
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x2726b(%rip), %rax     # 0x37f48
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x250(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x248(%rsp,%rcx)
callq 0x62d0
leaq 0x340(%rsp), %rdi
callq 0x6120
movq 0x271fb(%rip), %rsi     # 0x37f10
leaq 0xc0(%rsp), %rdi
callq 0x6290
leaq 0x140(%rsp), %rdi
callq 0x6120
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x10e3b
jmp 0x10ddb
jmp 0x10d73
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x10d95
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0x10d95
jmp 0x10ddb
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x10dde
movq 0x18(%rsp), %rsi
jmp 0x10dcb
jmp 0x10ddb
jmp 0x10ddb
jmp 0x10d8d
movq %rax, %rbx
jmp 0x10db7
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x10db7
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10dde
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0x10dde
jmp 0x10ddb
jmp 0x10ddb
jmp 0x10ddb
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x10e03
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x2713e(%rip), %rax     # 0x37f48
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x250(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x248(%rsp,%rcx)
callq 0x62d0
leaq 0x340(%rsp), %rdi
callq 0x6120
movq 0x270ce(%rip), %rsi     # 0x37f10
leaq 0xc0(%rsp), %rdi
callq 0x6290
leaq 0x140(%rsp), %rdi
callq 0x6120
movq %rbx, %rdi
callq 0x65b0