// File: WolfgangLechner[P]StructureAnalysis/molecular_system.cpp
// Function: CMolecularSystem::calculate_qFromComplexVector()
void CMolecularSystem::calculate_qFromComplexVector()
{
  int nop;
  nop = this->parameter->nop;
  double sumQ6,sumQ4;
  for (int ti= 0;ti<nop;ti++)
  {
    sumQ6 = 0.0;
    sumQ4 = 0.0;
    for (int mi = 0;mi < 13;mi++)
    {
      sumQ6 += this->molecules[ti].realQ6[mi]*this->molecules[ti].realQ6[mi] + this->molecules[ti].imgQ6[mi]*this->molecules[ti].imgQ6[mi];
      //if (ti == 0) {cout << ti << " " << mi << " " << this->molecules[ti].realQ6[mi]*this->molecules[ti].realQ6[mi] + this->molecules[ti].imgQ6[mi]*this->molecules[ti].imgQ6[mi] << "\n";}
    }
    sumQ6 = pow(((4.0*pi/13.0) * sumQ6),0.5);
    this->molecules[ti].Q6 = sumQ6;

    for (int mi = 0;mi < 9;mi++)
    {
	sumQ4 += this->molecules[ti].realQ4[mi]*this->molecules[ti].realQ4[mi] + this->molecules[ti].imgQ4[mi]*this->molecules[ti].imgQ4[mi];
    }
    sumQ4 = pow(((4.0*pi/9.0) * sumQ4),0.5);
    this->molecules[ti].Q4 = sumQ4;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0xb4e8c0(%rax), %rax
movl 0x3208(%rax), %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7d99
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0xd, -0x28(%rbp)
jge 0x7c44
movq -0x38(%rbp), %rax
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x28(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x28(%rbp), %rdx
movsd 0x5e8(%rcx,%rdx,8), %xmm2
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x28(%rbp), %rdx
movsd 0x650(%rcx,%rdx,8), %xmm1
movq 0xb4e8b8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movslq -0x28(%rbp), %rcx
mulsd 0x650(%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7b8e
movsd 0x4534(%rip), %xmm0     # 0xc180
mulsd -0x18(%rbp), %xmm0
movsd 0x451f(%rip), %xmm1     # 0xc178
callq 0x3420
movq -0x38(%rbp), %rax
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movsd %xmm0, 0x818(%rax)
movl $0x0, -0x2c(%rbp)
cmpl $0x9, -0x2c(%rbp)
jge 0x7d46
movq -0x38(%rbp), %rax
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x2c(%rbp), %rdx
movsd 0x558(%rcx,%rdx,8), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x2c(%rbp), %rdx
movsd 0x558(%rcx,%rdx,8), %xmm2
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movslq -0x2c(%rbp), %rdx
movsd 0x5a0(%rcx,%rdx,8), %xmm1
movq 0xb4e8b8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movslq -0x2c(%rbp), %rcx
mulsd 0x5a0(%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x7c90
movsd 0x443a(%rip), %xmm0     # 0xc188
mulsd -0x20(%rbp), %xmm0
movsd 0x441d(%rip), %xmm1     # 0xc178
callq 0x3420
movq -0x38(%rbp), %rax
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movsd %xmm0, 0x820(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7b6b
addq $0x40, %rsp
popq %rbp
retq
nop