// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx, 0xb0(%rsp)
movq %rax, 0x28(%rsp)
cmpq 0xa80(%rbx), %rax
je 0x10dab
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 0xa53a
movq %rbx, %rdi
leaq 0x19f41(%rip), %rsi     # 0x2a79b
callq 0x6630
leaq 0x70(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb1e4
movq 0x30(%rsp), %rcx
movl $0xf, %esi
leaq 0x40(%rsp), %rax
cmpq %rax, %rcx
je 0x10887
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %r8
movq 0x78(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x108bb
movl $0xf, %esi
leaq 0x80(%rsp), %rdi
cmpq %rdi, 0x70(%rsp)
je 0x108b6
movq 0x80(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x108cc
movq 0x70(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x6110
jmp 0x108da
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 0x108ff
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x10905
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 0x19e6f(%rip), %rsi     # 0x2a79d
callq 0x6630
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10956
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x1095d
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 0x1099e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x109ba
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x109dc
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x109f8
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 0x1b475(%rip), %rdx     # 0x2be9b
movq %rdx, %rsi
callq 0xe03a
leaq 0xd8(%rsp), %rdi
movq %rbx, %rsi
callq 0x6460
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x10a55
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6310
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb208
movq 0x8(%rsp), %r14
xorl %r12d, %r12d
leaq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xb214
cmpq 0x8(%rsp), %r14
je 0x10c5a
movl $0x4, %edx
movq %r13, %rdi
leaq 0x19d0d(%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 0x19cc2(%rip), %rsi     # 0x2a7a7
callq 0x6370
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq $0x5, 0x10(%rbp,%rax)
movl $0x3, %edx
movq %rbp, %rdi
leaq 0x19ca0(%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 0xae00
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 0xae06
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 0xae0c
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 0x19bd1(%rip), %rsi     # 0x2a7ae
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x6, 0x10(%rbx,%rax)
movl $0x4, %edx
movq %rbx, %rdi
leaq 0x19bb2(%rip), %rsi     # 0x2a7b3
callq 0x6370
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xc, 0x10(%rbx,%rax)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x19b93(%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 0x10a6c
movl %r12d, %r12d
cmpq $0x1, %r12
adcq $0x0, %r12
movl $0x1, %r14d
cmpq %r14, %r12
je 0x10cf8
movl $0x6, %edx
movq %r13, %rdi
leaq 0x19b37(%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 0x10c6b
movl $0x3, %edx
movq %r13, %rdi
leaq 0x19aba(%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 0x10d78
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 0x10827
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x10dd0
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x27171(%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 0x27101(%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 0x10f35
jmp 0x10ed5
jmp 0x10e6d
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x10e8f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0x10e8f
jmp 0x10ed5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x10ed8
movq 0x18(%rsp), %rsi
jmp 0x10ec5
jmp 0x10ed5
jmp 0x10ed5
jmp 0x10e87
movq %rax, %rbx
jmp 0x10eb1
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x10eb1
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10ed8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6310
jmp 0x10ed8
jmp 0x10ed5
jmp 0x10ed5
jmp 0x10ed5
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x10efd
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x6310
movq 0x27044(%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 0x26fd4(%rip), %rsi     # 0x37f10
leaq 0xc0(%rsp), %rdi
callq 0x6290
leaq 0x140(%rsp), %rdi
callq 0x6120
movq %rbx, %rdi
callq 0x65b0