// File: WolfgangLechner[P]StructureAnalysis/molecular_system.cpp
// Function: CMolecularSystem::calculate_averagedqFromComplexVector()
void CMolecularSystem::calculate_averagedqFromComplexVector()
{
  int nop;
  nop = this->parameter->nop;
  double sumAQ4,sumAQ6;

  for (int ti= 0;ti<nop;ti++)
  {
    sumAQ4 = 0.0;
    for (int hi=0;hi<9;hi++)
    {
      sumAQ4 += this->molecules[ti].arealQ4[hi]*this->molecules[ti].arealQ4[hi]+ this->molecules[ti].aimgQ4[hi]*this->molecules[ti].aimgQ4[hi];
    }
    sumAQ4  = sumAQ4 * 4.0*pi/9.0;
    sumAQ4  = pow(sumAQ4 ,0.5);

    sumAQ6 = 0.0;
    for (int hi=0;hi<13;hi++)
    {
      sumAQ6 += this->molecules[ti].arealQ6[hi]*this->molecules[ti].arealQ6[hi]+ this->molecules[ti].aimgQ6[hi]*this->molecules[ti].aimgQ6[hi];
    }
    sumAQ6  = sumAQ6 * 4.0*pi/13.0;
    sumAQ6  = pow(sumAQ6 ,0.5);

    this->molecules[ti].AQ4 = sumAQ4;
    this->molecules[ti].AQ6 = sumAQ6;
  }

}

// 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 0x8039
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x9, -0x28(%rbp)
jge 0x7e9c
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 0x6b8(%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 0x6b8(%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 0x700(%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 0x700(%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 0x7de6
movsd 0x42fc(%rip), %xmm0     # 0xc1a0
mulsd -0x18(%rbp), %xmm0
movsd 0x42e7(%rip), %xmm1     # 0xc198
mulsd %xmm1, %xmm0
movsd 0x42d3(%rip), %xmm1     # 0xc190
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
movsd 0x42a5(%rip), %xmm1     # 0xc178
callq 0x3420
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0xd, -0x2c(%rbp)
jge 0x7fa2
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 0x748(%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 0x748(%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 0x7b0(%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 0x7b0(%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 0x7eec
movsd 0x41f6(%rip), %xmm0     # 0xc1a0
mulsd -0x20(%rbp), %xmm0
movsd 0x41e1(%rip), %xmm1     # 0xc198
mulsd %xmm1, %xmm0
movsd 0x41e5(%rip), %xmm1     # 0xc1a8
divsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x419f(%rip), %xmm1     # 0xc178
callq 0x3420
movq -0x38(%rbp), %rax
movsd %xmm0, -0x20(%rbp)
movsd -0x18(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x870, %rdx, %rdx      # imm = 0x870
addq %rdx, %rcx
movsd %xmm0, 0x840(%rcx)
movsd -0x20(%rbp), %xmm0
movq 0xb4e8b8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x870, %rcx, %rcx      # imm = 0x870
addq %rcx, %rax
movsd %xmm0, 0x838(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7dcb
addq $0x40, %rsp
popq %rbp
retq
nop