// File: 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
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3340
leaq -0x250(%rbp), %rdi
callq 0x32a0
jmp 0x5691
movq -0x2d8(%rbp), %rax
movq 0xb4e8c0(%rax), %rdi
addq $0x3230, %rdi           # imm = 0x3230
callq 0x3120
movq %rax, %rsi
leaq -0x250(%rbp), %rdi
movl $0x8, %edx
callq 0x3150
jmp 0x56c1
leaq -0x250(%rbp), %rdi
callq 0x33c0
movb %al, -0x2d9(%rbp)
jmp 0x56d5
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x56e4
jmp 0x5a51
leaq -0x250(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x30a0
jmp 0x56f6
leaq -0x48(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
callq 0x33b0
movq -0x2d8(%rbp), %rdi
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movq 0xb4e8c0(%rdi), %rax
movl %ecx, 0x3208(%rax)
movl -0x24(%rbp), %esi
callq 0x4a00
jmp 0x572b
leaq -0x250(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x30a0
jmp 0x573d
leaq -0x48(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x3120
movq %rax, %rdi
callq 0x32e0
movq -0x2d8(%rbp), %rax
movq -0x2e8(%rbp), %rsi
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3218(%rax)
leaq -0x250(%rbp), %rdi
callq 0x30a0
jmp 0x5780
leaq -0x48(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x3120
movq %rax, %rdi
callq 0x32e0
movq -0x2d8(%rbp), %rax
movq -0x2f0(%rbp), %rsi
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3220(%rax)
leaq -0x250(%rbp), %rdi
callq 0x30a0
jmp 0x57c3
leaq -0x48(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
callq 0x32e0
movq -0x2d8(%rbp), %rax
movq 0xb4e8c0(%rax), %rax
movsd %xmm0, 0x3228(%rax)
movl $0x0, -0x260(%rbp)
movl -0x260(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x5a4f
leaq -0x250(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x30a0
jmp 0x5815
leaq -0x48(%rbp), %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3310
movq %rax, -0x268(%rbp)
cmpq $-0x1, -0x268(%rbp)
jne 0x5877
jmp 0x5a4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x258(%rbp)
movl %eax, -0x25c(%rbp)
jmp 0x5ada
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x258(%rbp)
movl %eax, -0x25c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x30d0
jmp 0x5ada
movq -0x268(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x288(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3250
jmp 0x5894
leaq -0x288(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3190
movsd %xmm0, -0x10(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x34a8
movq -0x268(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x290(%rbp)
movq -0x290(%rbp), %rdx
leaq -0x48(%rbp), %rdi
movl $0x20, %esi
callq 0x3310
movq %rax, -0x268(%rbp)
cmpq $-0x1, -0x268(%rbp)
jne 0x58fa
jmp 0x5a4f
movq -0x290(%rbp), %rdx
movq -0x268(%rbp), %rcx
subq %rdx, %rcx
leaq -0x2b0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3250
jmp 0x591d
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0x3120
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3190
movq -0x308(%rbp), %rdi
movsd %xmm0, -0x18(%rbp)
callq 0x34a8
movq -0x268(%rbp), %rax
incq %rax
movq %rax, -0x290(%rbp)
movq -0x290(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x3390
movq -0x300(%rbp), %rsi
movq -0x2f8(%rbp), %rdx
movq %rax, %rcx
movq -0x290(%rbp), %rax
subq %rax, %rcx
leaq -0x2d0(%rbp), %rdi
callq 0x3250
jmp 0x59a5
leaq -0x2d0(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3190
movsd %xmm0, -0x20(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x34a8
movq -0x2d8(%rbp), %rax
movsd -0x10(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x260(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movsd %xmm0, 0x8(%rcx)
movsd -0x18(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x260(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movsd %xmm0, 0x10(%rcx)
movsd -0x20(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x260(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movl -0x260(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x260(%rbp)
jmp 0x57f4
jmp 0x5aae
movq 0x9598(%rip), %rdi      # 0xeff0
leaq 0x67f6(%rip), %rsi      # 0xc255
callq 0x3200
movq %rax, -0x310(%rbp)
jmp 0x5a6d
movq -0x310(%rbp), %rdi
movq -0x2d8(%rbp), %rax
movq 0xb4e8c0(%rax), %rsi
addq $0x3230, %rsi           # imm = 0x3230
callq 0x31e0
movq %rax, -0x318(%rbp)
jmp 0x5a97
movq -0x318(%rbp), %rdi
leaq 0x69e5(%rip), %rsi      # 0xc48a
callq 0x3200
jmp 0x5aac
jmp 0x5aae
movq -0x2d8(%rbp), %rdi
callq 0x5af0
jmp 0x5abc
leaq -0x250(%rbp), %rdi
callq 0x30d0
leaq -0x48(%rbp), %rdi
callq 0x34a8
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x34a8
movq -0x258(%rbp), %rdi
callq 0x3430
nop