// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
movq %rdi, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x6290
andq $0x0, 0x8(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x6570
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rbx, 0x18(%rsp)
movq 0xa78(%rbx), %r15
leaq 0xd0(%rsp), %r13
leaq 0x20(%rsp), %r14
leaq 0x8(%rsp), %rbp
movq 0x18(%rsp), %rax
cmpq 0xa80(%rax), %r15
je 0xefb7
leaq 0x60(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x12c78(%rip), %rdx     # 0x218fb
callq 0x132d4
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa766
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
leaq 0x60(%rsp), %rsi
movq %rbx, %rdx
callq 0x1326d
movq %r14, %rdi
movq %r12, %rsi
leaq 0x12c3d(%rip), %rdx     # 0x218fd
callq 0x1324e
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x63d0
movq %r14, %rdi
callq 0x66d0
movq %r12, %rdi
callq 0x66d0
leaq 0x80(%rsp), %rdi
callq 0x66d0
leaq 0x60(%rsp), %rdi
callq 0x66d0
movq 0x40(%rsp), %rsi
leaq 0x248(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x6040
movq %r14, %rdi
leaq 0x14163(%rip), %rsi     # 0x22e7b
leaq 0xa0(%rsp), %rdx
callq 0xcaa6
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x6490
movq %r14, %rdi
callq 0x66d0
movq %r14, %rdi
movq %r15, %rsi
callq 0xa778
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
callq 0xa784
movq 0x8(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0xef04
movq %r13, %rdi
leaq 0x12b89(%rip), %rsi     # 0x21902
callq 0x6330
incl %ebx
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x7, 0x10(%rax,%rcx)
movl %ebx, %r12d
movq %rax, %rdi
movq %r12, %rsi
callq 0x6270
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x12b4f(%rip), %rsi     # 0x21907
callq 0x6330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x5, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x12b33(%rip), %rsi     # 0x2190a
callq 0x6330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x6, 0x10(%rax,%rcx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6270
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0xc, 0x10(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%r12,%rax)
movq 0x8(%rsp), %rdi
callq 0xa3d6
movq %r12, %rdi
callq 0x6500
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0x8, 0x10(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%r12,%rax)
movq 0x8(%rsp), %rdi
callq 0xa3dc
movq %r12, %rdi
callq 0x6500
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0x8, 0x10(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x4, 0x8(%r12,%rax)
movq 0x8(%rsp), %rdi
callq 0xa3e2
movq %r12, %rdi
callq 0x6500
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x6, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x12a67(%rip), %rsi     # 0x2190e
callq 0x6330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x6, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x12a4d(%rip), %rsi     # 0x21913
callq 0x6330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0xc, 0x10(%rax,%rcx)
movq %rax, %rdi
leaq 0x12a33(%rip), %rsi     # 0x21918
callq 0x6330
movq %rax, %rdi
callq 0x61d0
movq %r14, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xb1ee
jmp 0xed54
movl %ebx, %ebx
pushq $0x1
popq %r12
cmpq %rbx, %r12
jae 0xef61
movq %r13, %rdi
leaq 0x12a01(%rip), %rsi     # 0x2191a
callq 0x6330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x5, 0x10(%rax,%rcx)
movq %rax, %rdi
movq %r12, %rsi
callq 0x6270
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x5, 0x10(%rax,%rcx)
incq %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x6270
movq %rax, %rdi
callq 0x61d0
jmp 0xef0a
movq %r13, %rdi
leaq 0x129b6(%rip), %rsi     # 0x21921
callq 0x6330
movq %rax, %rdi
callq 0x61d0
movq %r14, %rdi
leaq 0xd8(%rsp), %rsi
callq 0x64d0
leaq 0x248(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6320
movq %r14, %rdi
callq 0x66d0
movq %rbx, %rdi
callq 0x6450
addq $0x75330, %r15          # imm = 0x75330
jmp 0xec60
leaq 0x40(%rsp), %rdi
callq 0x66d0
leaq 0x248(%rsp), %rdi
callq 0x6480
leaq 0xc0(%rsp), %rdi
callq 0x62d0
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xf059
jmp 0xf03f
jmp 0xf02a
jmp 0xf03f
jmp 0xf03f
movq %rax, %rbx
jmp 0xf021
movq %rax, %rbx
jmp 0xf014
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x66d0
leaq 0x80(%rsp), %rdi
callq 0x66d0
leaq 0x60(%rsp), %rdi
jmp 0xf032
jmp 0xf03f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x66d0
jmp 0xf042
jmp 0xf03f
jmp 0xf03f
jmp 0xf03f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x66d0
leaq 0x248(%rsp), %rdi
callq 0x6480
leaq 0xc0(%rsp), %rdi
callq 0x62d0
movq %rbx, %rdi
callq 0x65d0