// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/networkstorage.cc
// Function: ATOM_NETWORK::randomlyAdjustCoordsAndCell()
void ATOM_NETWORK::randomlyAdjustCoordsAndCell() {
  double shiftMagnitude = TOLERANCE;
  printf("NOTICE: attempting random vector shift of all atom coordinates by %e (and unit cell parameters by up to this amount) to overcome Voronoi volume check failure (this option can be disabled by not using the -allowAdjustCoordsAndCell flag)\n", shiftMagnitude);
  printf("NOTICE: original cell dimensions and angles: %e %e %e; %e %e %e\n", a, b, c, alpha, beta, gamma);
  make(
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+a,
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+b,
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+c,
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+alpha,
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+beta,
(((rand()*1.0/RAND_MAX)-0.5)*2.0*shiftMagnitude)+gamma
);
  printf("NOTICE: randomly adjusted cell dimensions and angles: %e %e %e; %e %e %e\n", a, b, c, alpha, beta, gamma);
  for(int at=0; at<numAtoms; at++) {
    //shift each Cartesian coord in some direction, by distance TOLERANCE
    Point smallShift = genRandomVec().scale(shiftMagnitude);
    Point resultOfShiftInABCNoPBC = xyz_to_abc(Point(
      atoms.at(at).x+smallShift[0],
      atoms.at(at).y+smallShift[1],
      atoms.at(at).z+smallShift[2]
    ));
//    Point resultOfShiftInABC = Point(trans_to_origuc(resultOfShiftInABCNoPBC[0]),trans_to_origuc(resultOfShiftInABCNoPBC[1]),trans_to_origuc(resultOfShiftInABCNoPBC[2]));
    Point resultOfShiftInABC = resultOfShiftInABCNoPBC;
    Point resultOfShiftInXYZ = abc_to_xyz(resultOfShiftInABC);
    //now write the new coords to the atmnet
//printf("DEBUG: atom %d was at %e %e %e, now at %e %e %e\n", at, atoms.at(at).x, atoms.at(at).y, atoms.at(at).z, resultOfShiftInXYZ[0], resultOfShiftInXYZ[1], resultOfShiftInXYZ[2]);
    atoms.at(at).x = resultOfShiftInXYZ[0];
    atoms.at(at).y = resultOfShiftInXYZ[1];
    atoms.at(at).z = resultOfShiftInXYZ[2];
    atoms.at(at).a_coord = resultOfShiftInABC[0];
    atoms.at(at).b_coord = resultOfShiftInABC[1];
    atoms.at(at).c_coord = resultOfShiftInABC[2];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq 0x102c0b(%rip), %rdi    # 0x154758
movsd 0x102b4b(%rip), %xmm0   # 0x1546a0
movb $0x1, %al
callq 0x4060
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
movsd 0x28(%rbx), %xmm4
movsd 0x30(%rbx), %xmm5
leaq 0x102cc4(%rip), %rdi    # 0x154845
movb $0x6, %al
callq 0x4060
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1019c4(%rip), %xmm0   # 0x153560
addsd 0x102b04(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x102af0(%rip), %xmm0   # 0x1546a0
addsd 0x8(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x101991(%rip), %xmm0   # 0x153560
addsd 0x102ad1(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x102abd(%rip), %xmm0   # 0x1546a0
addsd 0x10(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10195e(%rip), %xmm0   # 0x153560
addsd 0x102a9e(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x102a8a(%rip), %xmm0   # 0x1546a0
addsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x10192b(%rip), %xmm0   # 0x153560
addsd 0x102a6b(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x102a57(%rip), %xmm0   # 0x1546a0
addsd 0x20(%rbx), %xmm0
movsd %xmm0, 0x40(%rsp)
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1018f8(%rip), %xmm0   # 0x153560
addsd 0x102a38(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x102a24(%rip), %xmm0   # 0x1546a0
addsd 0x28(%rbx), %xmm0
movsd %xmm0, 0x38(%rsp)
callq 0x4150
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x1018c5(%rip), %xmm0   # 0x153560
addsd 0x102a05(%rip), %xmm0   # 0x1546a8
addsd %xmm0, %xmm0
mulsd 0x1029f1(%rip), %xmm0   # 0x1546a0
addsd 0x30(%rbx), %xmm0
movsd 0x28(%rsp), %xmm1
movsd %xmm1, 0x8(%rbx)
movsd 0x20(%rsp), %xmm1
movsd %xmm1, 0x10(%rbx)
movsd 0x30(%rsp), %xmm1
movsd %xmm1, 0x18(%rbx)
movsd 0x40(%rsp), %xmm1
movsd %xmm1, 0x20(%rbx)
movsd 0x38(%rsp), %xmm1
movsd %xmm1, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
movq %rbx, %rdi
callq 0x521f4
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
movsd 0x28(%rbx), %xmm4
movsd 0x30(%rbx), %xmm5
leaq 0x102b69(%rip), %rdi    # 0x154886
movb $0x6, %al
callq 0x4060
cmpl $0x0, 0x110(%rbx)
jle 0x5203b
xorl %r15d, %r15d
leaq 0xb0(%rsp), %rbp
xorl %r14d, %r14d
movq %rbp, %r13
leaq 0x98(%rsp), %rbp
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x4c7ad
movq %rbp, %rdi
movq %r12, %rsi
movsd 0x10293b(%rip), %xmm0   # 0x1546a0
callq 0x85590
movq 0x2f0(%rbx), %rax
movq 0x2f8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x79435e50d79435e5, %r12 # imm = 0x86BCA1AF286BCA1B
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd (%rax,%r15), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbp, %rdi
xorl %esi, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd 0x28(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x8(%rcx,%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x98(%rsp), %rdi
movl $0x1, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movq %r13, %rbp
movsd 0x20(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rcx,%r15), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x98(%rsp), %rdi
movl $0x2, %esi
callq 0x85478
movsd 0x30(%rsp), %xmm2
addsd (%rax), %xmm2
leaq 0x80(%rsp), %rdi
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
callq 0x85436
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x80(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x52082
movq 0x58(%rsp), %rax
movq %rax, 0x70(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x52144
movq %r13, %rdi
xorl %esi, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movq %r12, %r13
movsd (%rax), %xmm0
movsd %xmm0, (%rcx,%r15)
movq %rbp, %rdi
movl $0x1, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %r14, %rdx
leaq 0x60(%rsp), %r12
jbe 0x5204d
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rcx,%r15)
movq %rbp, %rdi
movl $0x2, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rcx,%r15)
movq %r12, %rdi
xorl %esi, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rcx,%r15)
movq %r12, %rdi
movl $0x1, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rcx,%r15)
movq %r12, %rdi
movl $0x2, %esi
callq 0x85478
movq 0x2f0(%rbx), %rcx
movq 0x2f8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x5204d
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rcx,%r15)
incq %r14
movslq 0x110(%rbx), %rax
addq $0x98, %r15
cmpq %rax, %r14
jl 0x51d3f
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfd651(%rip), %rdi     # 0x14f6a5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630