// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/output_tnm.c
// Function: Print_mode_summary
void Print_mode_summary(char *nameout, char *label, struct Normal_Mode NM,
			float M_sqrt,int anharmonic,float xkappa)
{ 
  int i;
  FILE *file_out; char outfile[200];
  sprintf(outfile, "%s.%s.dat", nameout, label);
  file_out=fopen(outfile, "w");
  printf("Writing %s\n", outfile);
  float kappa=Collectivity_norm1(NM.sigma2, NM.N);
  fprintf(file_out, "# Reciprocal collectivity of fluctuations=  %.1f\n",kappa);
  fprintf(file_out, "# kappa=  %.3f\n",xkappa);
  //float N_sqrt=sqrt(NM.N_Cart/3);

  double norm=0; for(i=0; i<NM.N; i++)norm+=NM.sigma2[i];
  if(anharmonic){
    double Anhar_ene=0, Anhar_str=0;
    for(i=0; i<NM.N; i++){
      if(NM.sigma2[i]==0)continue;
      Anhar_ene+=NM.Anharmonicity[i]*NM.sigma2[i];
      Anhar_str+=NM.Anharm_struct[i]*NM.sigma2[i];
    }
    fprintf(file_out, "# Frequency weighted anharmonicity (ene)= %.3f\n",
	  Anhar_ene/norm);
    fprintf(file_out, "# Frequency weighted anharmonicity (str)= %.3f\n",
	    Anhar_str/norm);
  }

  fprintf(file_out, "# Frequency reported in internal units: %.3f ps^(-1),"
	  " kT/h/ is %.3g internal units (om-2)= %.3g\n",
	  Freq_unit, 0.385/Freq_unit, Freq_unit*Freq_unit/0.1482);
  fprintf(file_out,"#mode pc_therm cumul ");
  fprintf(file_out,"om-2(harm) ");
  if(anharmonic)fprintf(file_out, "om-2(corr) om-2(anha) ");
  fprintf(file_out," RMSD  Coll_cart");
  if(NM.MW_Tors_coll)fprintf(file_out, " Coll_MW");
  if(NM.Tors_coll)fprintf(file_out, " Coll_tors");
  fprintf(file_out, " Max_dev_atom");
  /*fprintf(file_out, " Anharmonicity_(ene) Anharmonicity_(str)");
    fprintf(file_out, " Max_RMSD(DE<E_THR*E_nat)"); //, E_THR*/
  fprintf(file_out, "\n");

  double sum=0;
  for(i=0; i<NM.N; i++){
    if(NM.select[i]==0)fprintf(file_out, "#");
    sum+=NM.sigma2[i];
    fprintf(file_out, "%5d  %6.4f %5.3f  ",i, NM.sigma2[i]/norm, sum/norm);
    fprintf(file_out, "%7.4g ",NM.sigma2[i]);
    if(anharmonic){
      fprintf(file_out,"%7.4g %7.4g  ",
	      xkappa*NM.sigma2_anhar[i],NM.sigma2_anhar[i]);
    }
    fprintf(file_out, " %7.3g", 1./(M_sqrt*NM.omega[i]));
    fprintf(file_out, "  %5.3f", NM.Cart_coll[i]);
    if(NM.MW_Tors_coll)fprintf(file_out, " %5.3f", NM.MW_Tors_coll[i]);
    if(NM.Tors_coll)fprintf(file_out, " %5.3f", NM.Tors_coll[i]);
    fprintf(file_out, "  %5.3f", NM.Max_dev[i]);
    /*fprintf(file_out, " %.3f", NM.Anharmonicity[i]);
    fprintf(file_out, " %.3f", NM.Anharm_struct[i]);
    fprintf(file_out, " %.3f", NM.Max_RMSD[i]);*/
    fprintf(file_out, "\n");
  }
  fclose(file_out);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movss %xmm1, 0x8(%rsp)
movl %edx, 0xc(%rsp)
movss %xmm0, 0x1c(%rsp)
movq %rsi, %rcx
movq %rdi, %rdx
leaq 0x160(%rsp), %r13
leaq 0x1a7fe(%rip), %rsi     # 0x56d91
xorl %ebp, %ebp
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2260
leaq 0x14ba5(%rip), %rsi     # 0x51150
movq %rbx, %rdi
callq 0x2210
movq %rax, %r14
leaq 0xf6ea(%rip), %rdi      # 0x4bca7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
movq 0x28(%r13), %r15
movl (%r13), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x10033
cvtss2sd %xmm0, %xmm0
leaq 0x16be3(%rip), %rsi     # 0x531c8
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
cvtss2sd 0x8(%rsp), %xmm0
leaq 0x18098(%rip), %rsi     # 0x54694
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
testl %r12d, %r12d
cmovlel %ebp, %r12d
xorpd %xmm4, %xmm4
cmpq %rbp, %r12
je 0x3c625
cvtss2sd (%r15,%rbp,4), %xmm0
addsd %xmm0, %xmm4
incq %rbp
jmp 0x3c611
cmpl $0x0, 0xc(%rsp)
movsd %xmm4, 0x10(%rsp)
je 0x3c733
movq 0x98(%r13), %rax
movq 0xa0(%r13), %rcx
xorpd %xmm5, %xmm5
xorl %edx, %edx
xorps %xmm0, %xmm0
cmpq %rdx, %r12
je 0x3c67f
movss (%r15,%rdx,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x3c65f
jnp 0x3c67a
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movss (%rcx,%rdx,4), %xmm2
movss (%rax,%rdx,4), %xmm3
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
mulps %xmm1, %xmm3
cvtps2pd %xmm3, %xmm1
addpd %xmm1, %xmm5
incq %rdx
jmp 0x3c64d
movapd %xmm5, %xmm0
divsd %xmm4, %xmm0
leaq 0x1a70d(%rip), %rsi     # 0x56d9b
movq %r14, %rdi
movb $0x1, %al
movapd %xmm5, 0x20(%rsp)
callq 0x2190
movapd 0x20(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
divsd 0x10(%rsp), %xmm0
leaq 0x1a716(%rip), %rsi     # 0x56dcb
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
leaq 0x25ad6(%rip), %rax     # 0x6219c
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm0
movsd 0x1752a(%rip), %xmm1    # 0x53c00
divsd %xmm0, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
divsd 0x1751e(%rip), %xmm2    # 0x53c08
leaq 0x17fb3(%rip), %rsi     # 0x546a4
movq %r14, %rdi
movb $0x3, %al
callq 0x2190
leaq 0x1a6f9(%rip), %rdi     # 0x56dfb
pushq $0x15
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x18004(%rip), %rdi     # 0x5471e
pushq $0xb
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x17ffb(%rip), %rdi     # 0x5472a
pushq $0x16
jmp 0x3c790
leaq 0x25a62(%rip), %rax     # 0x6219c
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm0
movsd 0x174b6(%rip), %xmm1    # 0x53c00
divsd %xmm0, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
divsd 0x174aa(%rip), %xmm2    # 0x53c08
leaq 0x17f3f(%rip), %rsi     # 0x546a4
movq %r14, %rdi
movb $0x3, %al
callq 0x2190
leaq 0x1a685(%rip), %rdi     # 0x56dfb
pushq $0x15
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x17f90(%rip), %rdi     # 0x5471e
pushq $0xb
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x17fa0(%rip), %rdi     # 0x54743
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x2280
movq 0x78(%r13), %rbx
testq %rbx, %rbx
je 0x3c7cf
leaq 0x17f94(%rip), %rdi     # 0x54755
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x2280
movq 0x70(%r13), %rbp
testq %rbp, %rbp
je 0x3c7ed
leaq 0x17f80(%rip), %rdi     # 0x5475f
pushq $0xa
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x1a61d(%rip), %rdi     # 0x56e11
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x2280
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x2140
movq 0xc0(%r13), %rax
movq %rax, 0x58(%rsp)
movq 0x88(%r13), %rax
movq %rax, 0x38(%rsp)
movq 0x18(%r13), %rax
movq %rax, 0x50(%rsp)
movq 0x68(%r13), %rax
movq %rax, 0x48(%rsp)
movq 0x80(%r13), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %r13d, %r13d
cmpq %r13, %r12
movsd 0x10(%rsp), %xmm2
je 0x3c9ab
movq 0x58(%rsp), %rax
cmpl $0x0, (%rax,%r13,4)
jne 0x3c87b
pushq $0x23
popq %rdi
movq %r14, %rsi
callq 0x2140
movsd 0x10(%rsp), %xmm2
cvtss2sd (%r15,%r13,4), %xmm0
movsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
divsd %xmm2, %xmm0
movsd %xmm1, 0x20(%rsp)
divsd %xmm2, %xmm1
movq %r14, %rdi
leaq 0x1a57c(%rip), %rsi     # 0x56e1f
movl %r13d, %edx
movb $0x2, %al
callq 0x2190
cvtss2sd (%r15,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x1a575(%rip), %rsi     # 0x56e32
movb $0x1, %al
callq 0x2190
cmpl $0x0, 0xc(%rsp)
je 0x3c8f5
movq 0x38(%rsp), %rax
movss (%rax,%r13,4), %xmm0
cvtss2sd %xmm0, %xmm1
mulss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r14, %rdi
leaq 0x1a54b(%rip), %rsi     # 0x56e39
movb $0x2, %al
callq 0x2190
movq 0x50(%rsp), %rax
movss (%rax,%r13,4), %xmm0
mulss 0x1c(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0xe736(%rip), %xmm0     # 0x4b048
divsd %xmm1, %xmm0
movq %r14, %rdi
leaq 0x1a527(%rip), %rsi     # 0x56e47
movb $0x1, %al
callq 0x2190
movq 0x48(%rsp), %rax
cvtss2sd (%rax,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x17ea5(%rip), %rsi     # 0x547e1
movb $0x1, %al
callq 0x2190
testq %rbx, %rbx
je 0x3c95f
cvtss2sd (%rbx,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x17e8a(%rip), %rsi     # 0x547e2
movb $0x1, %al
callq 0x2190
testq %rbp, %rbp
je 0x3c97c
cvtss2sd (%rbp,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x17e6d(%rip), %rsi     # 0x547e2
movb $0x1, %al
callq 0x2190
movq 0x40(%rsp), %rax
cvtss2sd (%rax,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x17e50(%rip), %rsi     # 0x547e1
movb $0x1, %al
callq 0x2190
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x2140
incq %r13
jmp 0x3c84f
movq %r14, %rdi
callq 0x20c0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq