// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq 0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movss %xmm1, -0x1c(%rbp)
leaq -0xf0(%rbp), %rdi
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x245dc(%rip), %rsi     # 0x8219d
movb $0x0, %al
callq 0x1200
leaq -0xf0(%rbp), %rdi
leaq 0x1e79c(%rip), %rsi     # 0x7c372
callq 0x11b0
movq %rax, -0x28(%rbp)
leaq -0xf0(%rbp), %rsi
leaq 0x19901(%rip), %rdi     # 0x774ee
movb $0x0, %al
callq 0x10d0
movq -0x120(%rbp), %rax
movq 0x28(%rax), %rdi
movl (%rax), %esi
callq 0x15c80
movss %xmm0, -0xf4(%rbp)
movq -0x28(%rbp), %rdi
movss -0xf4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x20855(%rip), %rsi     # 0x7e47a
movb $0x1, %al
callq 0x1150
movq -0x28(%rbp), %rdi
movss -0x1c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21d7c(%rip), %rsi     # 0x7f9bc
movb $0x1, %al
callq 0x1150
xorps %xmm0, %xmm0
movsd %xmm0, -0x100(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x120(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jge 0x5dc9a
movq -0x120(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5dc59
cmpl $0x0, -0x18(%rbp)
je 0x5ddae
xorps %xmm0, %xmm0
movsd %xmm0, -0x108(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x110(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x120(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jge 0x5dd6a
movq -0x120(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x5dcf3
jp 0x5dcf3
jmp 0x5dd5c
movq -0x120(%rbp), %rax
movq 0x98(%rax), %rcx
movslq -0x20(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
movq 0x28(%rax), %rcx
movslq -0x20(%rbp), %rdx
mulss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x108(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movq 0xa0(%rax), %rcx
movslq -0x20(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5dcc1
movq -0x28(%rbp), %rdi
movsd -0x108(%rbp), %xmm0
divsd -0x100(%rbp), %xmm0
leaq 0x24422(%rip), %rsi     # 0x821a7
movb $0x1, %al
callq 0x1150
movq -0x28(%rbp), %rdi
movsd -0x110(%rbp), %xmm0
divsd -0x100(%rbp), %xmm0
leaq 0x24430(%rip), %rsi     # 0x821d7
movb $0x1, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x2c3a3(%rip), %rax     # 0x8a15c
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x2c394(%rip), %rax     # 0x8a15c
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm2
movsd 0x20f60(%rip), %xmm1    # 0x7ed38
divsd %xmm2, %xmm1
leaq 0x2c379(%rip), %rax     # 0x8a15c
movss (%rax), %xmm2
leaq 0x2c36e(%rip), %rax     # 0x8a15c
mulss (%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movsd 0x20f32(%rip), %xmm3    # 0x7ed30
divsd %xmm3, %xmm2
leaq 0x21bc3(%rip), %rsi     # 0x7f9cc
movb $0x3, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x243ec(%rip), %rsi     # 0x82207
movb $0x0, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x21c19(%rip), %rsi     # 0x7fa46
movb $0x0, %al
callq 0x1150
cmpl $0x0, -0x18(%rbp)
je 0x5de4c
movq -0x28(%rbp), %rdi
leaq 0x21c0d(%rip), %rsi     # 0x7fa52
movb $0x0, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x21c14(%rip), %rsi     # 0x7fa6b
movb $0x0, %al
callq 0x1150
movq -0x120(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x5de7e
movq -0x28(%rbp), %rdi
leaq 0x21c06(%rip), %rsi     # 0x7fa7d
movb $0x0, %al
callq 0x1150
movq -0x120(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x5de9e
movq -0x28(%rbp), %rdi
leaq 0x21bf0(%rip), %rsi     # 0x7fa87
movb $0x0, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x24374(%rip), %rsi     # 0x8221d
movb $0x0, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x201bd(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
xorps %xmm0, %xmm0
movsd %xmm0, -0x118(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x120(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl (%rcx), %eax
jge 0x5e10e
movq -0x120(%rbp), %rax
movq 0xc0(%rax), %rax
movslq -0x20(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x5df10
movq -0x28(%rbp), %rdi
leaq 0x2380e(%rip), %rsi     # 0x81717
movb $0x0, %al
callq 0x1150
movq -0x120(%rbp), %rax
movq 0x28(%rax), %rcx
movslq -0x20(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0x28(%rbp), %rdi
movl -0x20(%rbp), %edx
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
divsd -0x100(%rbp), %xmm0
movsd -0x118(%rbp), %xmm1
divsd -0x100(%rbp), %xmm1
leaq 0x242bc(%rip), %rsi     # 0x8222b
movb $0x2, %al
callq 0x1150
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x242a5(%rip), %rsi     # 0x8223e
movb $0x1, %al
callq 0x1150
cmpl $0x0, -0x18(%rbp)
je 0x5dfec
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movss -0x1c(%rbp), %xmm0
movq 0x88(%rax), %rcx
movslq -0x20(%rbp), %rdx
mulss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x88(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x24260(%rip), %rsi     # 0x82245
movb $0x2, %al
callq 0x1150
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movss -0x14(%rbp), %xmm0
movq 0x18(%rax), %rax
movslq -0x20(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x18033(%rip), %xmm0    # 0x76048
divsd %xmm1, %xmm0
leaq 0x24233(%rip), %rsi     # 0x82253
movb $0x1, %al
callq 0x1150
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x68(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21abf(%rip), %rsi     # 0x7fb09
movb $0x1, %al
callq 0x1150
movq -0x120(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x5e089
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x78(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21a88(%rip), %rsi     # 0x7fb0a
movb $0x1, %al
callq 0x1150
movq -0x120(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x5e0c1
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x70(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21a50(%rip), %rsi     # 0x7fb0a
movb $0x1, %al
callq 0x1150
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x80(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x21a22(%rip), %rsi     # 0x7fb09
movb $0x1, %al
callq 0x1150
movq -0x28(%rbp), %rdi
leaq 0x1ff7f(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5ded4
movq -0x28(%rbp), %rdi
callq 0x10a0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq