// File: /workspace/github_c_makefile_star2_O1/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 $0x118, %rsp            # imm = 0x118
movss %xmm1, 0x4(%rsp)
movl %edx, (%rsp)
movss %xmm0, 0x14(%rsp)
movq %rsi, %rcx
movq %rdi, %rdx
leaq 0x1b48f(%rip), %rsi     # 0x5ce61
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2260
leaq 0x15858(%rip), %rsi     # 0x57240
movq %rbx, %rdi
callq 0x2210
movq %rax, %r14
leaq 0x102e1(%rip), %rdi     # 0x51cdb
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
movq 0x178(%rsp), %r15
movslq 0x150(%rsp), %r13
movq %r15, %rdi
movl %r13d, %esi
callq 0x10ffa
cvtss2sd %xmm0, %xmm0
leaq 0x17891(%rip), %rsi     # 0x592bb
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
leaq 0x18d4c(%rip), %rsi     # 0x5a790
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
xorpd %xmm4, %xmm4
testq %r13, %r13
jle 0x41a6e
xorl %eax, %eax
xorps %xmm0, %xmm0
cvtss2sd (%r15,%rax,4), %xmm0
addsd %xmm0, %xmm4
incq %rax
cmpq %rax, %r13
jne 0x41a59
leaq 0x150(%rsp), %rbx
cmpl $0x0, (%rsp)
movsd %xmm4, 0x18(%rsp)
je 0x41ada
testl %r13d, %r13d
jle 0x41b43
movq 0x98(%rbx), %rax
movq 0xa0(%rbx), %rcx
xorpd %xmm5, %xmm5
xorl %edx, %edx
xorps %xmm1, %xmm1
xorps %xmm0, %xmm0
movss (%r15,%rdx,4), %xmm2
ucomiss %xmm1, %xmm2
jne 0x41ab2
jnp 0x41ad0
movss (%rax,%rdx,4), %xmm3
mulss %xmm2, %xmm3
cvtss2sd %xmm3, %xmm3
addsd %xmm3, %xmm0
mulss (%rcx,%rdx,4), %xmm2
cvtss2sd %xmm2, %xmm2
addsd %xmm2, %xmm5
incq %rdx
cmpq %rdx, %r13
jne 0x41aa5
jmp 0x41b4a
leaq 0x256bb(%rip), %rax     # 0x6719c
movss (%rax), %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd 0x18204(%rip), %xmm1    # 0x59cf8
divsd %xmm0, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
divsd 0x181f8(%rip), %xmm2    # 0x59d00
leaq 0x18c91(%rip), %rsi     # 0x5a7a0
movq %r14, %rdi
movb $0x3, %al
callq 0x2190
leaq 0x1b3ab(%rip), %rdi     # 0x5cecb
movl $0x15, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
leaq 0x18ce1(%rip), %rdi     # 0x5a81a
movl $0xb, %esi
jmp 0x41c05
xorps %xmm0, %xmm0
xorpd %xmm5, %xmm5
movsd %xmm5, 0x8(%rsp)
divsd %xmm4, %xmm0
leaq 0x1b310(%rip), %rsi     # 0x5ce6b
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
movsd 0x8(%rsp), %xmm0
divsd 0x18(%rsp), %xmm0
leaq 0x1b323(%rip), %rsi     # 0x5ce9b
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
leaq 0x25613(%rip), %rax     # 0x6719c
movss (%rax), %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
movsd 0x1815c(%rip), %xmm1    # 0x59cf8
divsd %xmm0, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
divsd 0x18150(%rip), %xmm2    # 0x59d00
leaq 0x18be9(%rip), %rsi     # 0x5a7a0
movq %r14, %rdi
movb $0x3, %al
callq 0x2190
leaq 0x1b303(%rip), %rdi     # 0x5cecb
movl $0x15, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
leaq 0x18c39(%rip), %rdi     # 0x5a81a
movl $0xb, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
cmpl $0x0, (%rsp)
je 0x41c12
leaq 0x18c26(%rip), %rdi     # 0x5a826
movl $0x16, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
leaq 0x18c26(%rip), %rdi     # 0x5a83f
movl $0x10, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
movq 0x78(%rbx), %rbp
testq %rbp, %rbp
je 0x41c4d
leaq 0x18c16(%rip), %rdi     # 0x5a851
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
movq 0x70(%rbx), %r12
testq %r12, %r12
je 0x41c6f
leaq 0x18bfe(%rip), %rdi     # 0x5a85b
movl $0xa, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
leaq 0x1b26b(%rip), %rdi     # 0x5cee1
movl $0xd, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
movl $0xa, %edi
movq %r14, %rsi
callq 0x2140
movq %r13, 0x48(%rsp)
testl %r13d, %r13d
jle 0x41e52
movq 0xc0(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x88(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rbx), %rax
movq %rax, 0x38(%rsp)
movq 0x68(%rbx), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rbx), %rax
movq %rax, 0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r13d, %r13d
leaq 0x18bf1(%rip), %rbx     # 0x5a8dd
movq 0x40(%rsp), %rax
cmpl $0x0, (%rax,%r13,4)
jne 0x41d05
movl $0x23, %edi
movq %r14, %rsi
callq 0x2140
xorps %xmm0, %xmm0
cvtss2sd (%r15,%r13,4), %xmm0
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
movsd %xmm1, 0x8(%rsp)
divsd %xmm2, %xmm1
movq %r14, %rdi
leaq 0x1b1b9(%rip), %rsi     # 0x5ceef
movl %r13d, %edx
movb $0x2, %al
callq 0x2190
xorps %xmm0, %xmm0
cvtss2sd (%r15,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x1b1af(%rip), %rsi     # 0x5cf02
movb $0x1, %al
callq 0x2190
cmpl $0x0, (%rsp)
je 0x41d8d
movq 0x20(%rsp), %rax
movss (%rax,%r13,4), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
mulss 0x4(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r14, %rdi
leaq 0x1b183(%rip), %rsi     # 0x5cf09
movb $0x2, %al
callq 0x2190
movq 0x38(%rsp), %rax
movss (%rax,%r13,4), %xmm0
mulss 0x14(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0xf293(%rip), %xmm0     # 0x51040
divsd %xmm1, %xmm0
movq %r14, %rdi
leaq 0x1b15c(%rip), %rsi     # 0x5cf17
movb $0x1, %al
callq 0x2190
movq 0x30(%rsp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r13,4), %xmm0
movq %r14, %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x2190
testq %rbp, %rbp
je 0x41dfd
xorps %xmm0, %xmm0
cvtss2sd (%rbp,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x18ae8(%rip), %rsi     # 0x5a8de
movb $0x1, %al
callq 0x2190
testq %r12, %r12
je 0x41e1c
xorps %xmm0, %xmm0
cvtss2sd (%r12,%r13,4), %xmm0
movq %r14, %rdi
leaq 0x18ac9(%rip), %rsi     # 0x5a8de
movb $0x1, %al
callq 0x2190
movq 0x28(%rsp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%r13,4), %xmm0
movq %r14, %rdi
movq %rbx, %rsi
movb $0x1, %al
callq 0x2190
movl $0xa, %edi
movq %r14, %rsi
callq 0x2140
incq %r13
cmpq %r13, 0x48(%rsp)
jne 0x41cec
movq %r14, %rdi
callq 0x20c0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq