// File: /workspace/github_cpp_makefile_star2_O1/WolfgangLechner[P]StructureAnalysis/molecular_system.cpp
// Function: CMolecularSystem::readParticleFile()
void CMolecularSystem::readParticleFile()
{
  double posx,posy,posz;
  int nop;
  string line;
  ifstream confFile;
  confFile.open(this->parameter->xyzFile.c_str(),ifstream::in);
  if (confFile.is_open())
  {
    //the first line contains the number of particles
    getline(confFile,line);
    nop = atoi(line.c_str());
    this->parameter->nop = nop;
    this->initializeMolecules(nop);

    //Followed by boxx,boxy,boxz
    getline(confFile,line);
    this->parameter->boxx = atof(line.c_str());
    getline(confFile,line);
    this->parameter->boxy = atof(line.c_str());
    getline(confFile,line);
    this->parameter->boxz = atof(line.c_str());

    //so lets read the particles positions
    for (int ti = 0;ti<nop;ti++)
    {
      getline(confFile,line);
      string::size_type pos  = line.find(' ');
      if (pos == string::npos) break;
      posx = strtod(line.substr(0, pos ).c_str(),NULL);

      string::size_type lpos = pos + 1;
      pos  = line.find(' ', lpos);
      if (pos == string::npos) break;
      posy = strtod(line.substr(lpos, pos - lpos).c_str(),NULL);
      lpos = pos+1;

      posz = strtod(line.substr(lpos, line.length() - lpos).c_str(),NULL);

      this->molecules[ti].posx = posx;
      this->molecules[ti].posy = posy;
      this->molecules[ti].posz = posz;
    }
  }
  else
  {
    cerr << "Fatal Error : cannot open the file " <<  this->parameter->xyzFile << "\n";
  }
  setNumberOfCells();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdi, %rbx
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x298(%rbp), %rdi
callq 0x21e0
movq %rbx, -0x30(%rbp)
movq 0xb4e8c0(%rbx), %rax
movq 0x3230(%rax), %rsi
leaq -0x298(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x2130
leaq -0x220(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3ea9
movq -0x298(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
leaq -0x298(%rbp), %r14
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x2370
movq -0x50(%rbp), %rdi
callq 0x22c0
movl %eax, %r15d
movq -0x30(%rbp), %rdi
movq 0xb4e8c0(%rdi), %rax
movl %r15d, 0x3208(%rax)
movl %r15d, %esi
callq 0x3230
movq -0x298(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
leaq -0x298(%rbp), %r14
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x2370
movq -0x50(%rbp), %rdi
callq 0x2220
movq -0x30(%rbp), %rax
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3218(%rax)
movq -0x298(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
leaq -0x298(%rbp), %r14
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x2370
movq -0x50(%rbp), %rdi
callq 0x2220
movq -0x30(%rbp), %rax
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3220(%rax)
movq -0x298(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
leaq -0x298(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2370
movq -0x50(%rbp), %rdi
callq 0x2220
movq -0x30(%rbp), %rax
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3228(%rax)
testl %r15d, %r15d
jle 0x3efa
movl %r15d, %eax
imulq $0x870, %rax, %rax      # imm = 0x870
movq %rax, -0x78(%rbp)
xorl %ebx, %ebx
leaq -0x50(%rbp), %r15
leaq -0x70(%rbp), %r12
movq -0x298(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x298(%rbp), %r14
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2370
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x2250
cmpq $-0x1, %rax
je 0x3efa
movq %rax, %r13
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x21d0
movq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x2140
movsd %xmm0, -0x90(%rbp)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3dbf
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
incq %r13
movq %r15, %rdi
movl $0x20, %esi
movq %r13, %rdx
callq 0x2250
cmpq $-0x1, %rax
je 0x3efa
movq %rax, %r14
movq %rax, %rcx
subq %r13, %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x21d0
movq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x2140
movsd %xmm0, -0x88(%rbp)
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3e1f
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
incq %r14
movq -0x48(%rbp), %rcx
subq %r14, %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x21d0
movq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x2140
movapd %xmm0, %xmm1
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3e69
movq -0x60(%rbp), %rsi
incq %rsi
movsd %xmm1, -0x80(%rbp)
callq 0x21c0
movsd -0x80(%rbp), %xmm1
movq -0x30(%rbp), %rax
movq 0xb4e8b8(%rax), %rax
movsd -0x90(%rbp), %xmm0
movsd %xmm0, 0x8(%rax,%rbx)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, 0x10(%rax,%rbx)
movsd %xmm1, 0x18(%rax,%rbx)
addq $0x870, %rbx            # imm = 0x870
cmpq %rbx, -0x78(%rbp)
jne 0x3d3a
jmp 0x3efa
movq 0x7140(%rip), %rdi      # 0xaff0
leaq 0x428e(%rip), %rsi      # 0x8145
movl $0x23, %edx
callq 0x21f0
movq -0x30(%rbp), %rax
movq 0xb4e8c0(%rax), %rax
movq 0x3230(%rax), %rsi
movq 0x3238(%rax), %rdx
movq 0x710f(%rip), %rdi      # 0xaff0
callq 0x21f0
leaq 0x448d(%rip), %rsi      # 0x837a
movl $0x1, %edx
movq %rax, %rdi
callq 0x21f0
movq -0x30(%rbp), %rax
movq 0xb4e8c0(%rax), %rbx
cmpl $0x0, 0x3214(%rbx)
jns 0x3f3b
movsd 0x3218(%rbx), %xmm0
divsd 0x3250(%rbx), %xmm0
callq 0x2300
cvttsd2si %xmm0, %eax
cmpl $0x6, %eax
movl $0x5, %ecx
cmovgel %eax, %ecx
addl $-0x2, %ecx
movl %ecx, 0x3214(%rbx)
leaq -0x298(%rbp), %rdi
callq 0x20a0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3f60
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3f8e
jmp 0x3f7f
jmp 0x3f7f
jmp 0x3f7f
jmp 0x3f7f
movq %rax, %rbx
leaq -0x298(%rbp), %rdi
callq 0x20a0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3fa7
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2350
nop