// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/grid.cc
// Function: GaussianCube::GaussianCube(ATOM_NETWORK*)
GaussianCube::GaussianCube(ATOM_NETWORK *atmnet){

 // calculate desired cube size
 na=(int)ceil(atmnet->a/GRIDRES)+1;
 nb=(int)ceil(atmnet->b/GRIDRES)+1;
 nc=(int)ceil(atmnet->c/GRIDRES)+1;

 // define the grid and allocate memory
 gridsize = na*nb*nc;

 if(gridsize<2)
    {
    cout << "Grid size is 1 or less. Aborting..." << "\n";
//    abort();
    } else
    {
    cout << "Gaussian cube grid - " << na << " x " << nb << " x " << nc << " = " << gridsize << " points.\n";
    };

 allocate(na, nb, nc);

 o = XYZ (0.0,0.0,0.0);
 va=atmnet->v_a;
 vb=atmnet->v_b;
 vc=atmnet->v_c;

 va=va.scale(1.0/(na-1.0)); // substracting 1.0 from na in denominator to make sure va reaches 1.0 after na steps (starting from 0)
 vb=vb.scale(1.0/(nb-1.0));
 vc=vc.scale(1.0/(nc-1.0));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r13
movq %rdi, %rbx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x85982
leaq 0x18(%rbx), %r12
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r12, %rdi
callq 0x85982
leaq 0x30(%rbx), %r15
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rdi
callq 0x85982
leaq 0x48(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0x8(%rsp)
callq 0x85982
leaq 0x60(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x85982
movsd 0x8(%r13), %xmm0
divsd 0xccacf(%rip), %xmm0    # 0x157680
callq 0x40d0
cvttsd2si %xmm0, %ebp
incl %ebp
movl %ebp, 0x78(%rbx)
movsd 0x10(%r13), %xmm0
divsd 0xccab3(%rip), %xmm0    # 0x157680
callq 0x40d0
cvttsd2si %xmm0, %r14d
incl %r14d
movl %r14d, 0x7c(%rbx)
movsd 0x18(%r13), %xmm0
divsd 0xcca94(%rip), %xmm0    # 0x157680
callq 0x40d0
cvttsd2si %xmm0, %eax
incl %eax
movl %eax, 0x80(%rbx)
imull %ebp, %r14d
imull %eax, %r14d
movl %r14d, 0x84(%rbx)
movq 0x10c3ad(%rip), %rbp    # 0x196fc0
cmpl $0x1, %r14d
jg 0x8ac41
leaq 0xccb35(%rip), %rsi     # 0x157755
movl $0x23, %edx
movq %rbp, %rdi
callq 0x44e0
leaq 0xca8fa(%rip), %rsi     # 0x15552e
movl $0x1, %edx
movq %rbp, %rdi
jmp 0x8acda
leaq 0xccb31(%rip), %rsi     # 0x157779
movl $0x15, %edx
movq %rbp, %rdi
callq 0x44e0
movl 0x78(%rbx), %esi
movq %rbp, %rdi
callq 0x4750
movq %rax, %rbp
leaq 0xccb25(%rip), %r14     # 0x15778f
movl $0x3, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
movl 0x7c(%rbx), %esi
movq %rbp, %rdi
callq 0x4750
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
movl 0x80(%rbx), %esi
movq %rbp, %rdi
callq 0x4750
movq %rax, %rbp
leaq 0xd4d33(%rip), %rsi     # 0x15f9e3
movl $0x3, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x84(%rbx), %esi
movq %rbp, %rdi
callq 0x4750
leaq 0xccac1(%rip), %rsi     # 0x157793
movl $0x9, %edx
movq %rax, %rdi
callq 0x44e0
movl 0x78(%rbx), %esi
movl 0x7c(%rbx), %edx
movl 0x80(%rbx), %ecx
movq %rbx, %rdi
callq 0x8ae1e
leaq 0x10(%rsp), %rbp
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rbp, %rdi
callq 0x85982
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rbx)
movups (%rbp), %xmm0
movups %xmm0, (%rbx)
movq 0x48(%r13), %rax
movq %rax, 0x10(%r12)
movups 0x38(%r13), %xmm0
movups %xmm0, (%r12)
movq 0x60(%r13), %rax
movq %rax, 0x10(%r15)
movups 0x50(%r13), %xmm0
movups %xmm0, (%r15)
movq 0x78(%r13), %rax
movq 0x8(%rsp), %r14
movq %rax, 0x10(%r14)
movups 0x68(%r13), %xmm0
movups %xmm0, (%r14)
xorps %xmm1, %xmm1
cvtsi2sdl 0x78(%rbx), %xmm1
addsd 0xc856d(%rip), %xmm1    # 0x1532d0
movsd 0xc42ed(%rip), %xmm0    # 0x14f058
divsd %xmm1, %xmm0
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x85a34
movq 0x10(%r13), %rax
movq %rax, 0x10(%r12)
movups (%r13), %xmm0
movups %xmm0, (%r12)
xorps %xmm1, %xmm1
cvtsi2sdl 0x7c(%rbx), %xmm1
addsd 0xc852e(%rip), %xmm1    # 0x1532d0
movsd 0xc42ae(%rip), %xmm0    # 0x14f058
divsd %xmm1, %xmm0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x85a34
movq 0x10(%r12), %rax
movq %rax, 0x10(%r15)
movups (%r12), %xmm0
movups %xmm0, (%r15)
xorps %xmm1, %xmm1
cvtsi2sdl 0x80(%rbx), %xmm1
addsd 0xc84ed(%rip), %xmm1    # 0x1532d0
movsd 0xc426d(%rip), %xmm0    # 0x14f058
divsd %xmm1, %xmm0
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x85a34
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r14)
movups (%rbx), %xmm0
movups %xmm0, (%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop