Ejemplo n.º 1
0
void calc_aver(FILE *fp,int nframes,int npair,t_pair pair[],t_sij *spec,
	       real maxdist)
{
  int     i,j,m;
  real    nf_1,fac,md_6;
  complex c1,c2,dc2;
  
  md_6 = pow(maxdist,-6.0);
  fac  = 4*M_PI/5;
  nf_1 = 1.0/nframes;
  for(i=0; (i<npair); i++) {
    c2.re = 0;
    c2.im = 0;
    fprintf(fp,"%5d  %5d",pair[i].ai,pair[i].aj);
    for(m=0; (m<5); m++) {
      c1.re  = spec[i].Ylm[m].re*nf_1;
      c1.im  = spec[i].Ylm[m].im*nf_1;
      dc2    = c_sqr(c1);
      c2     = c_add(dc2,c2);
      
      if (c1.im > 0)
	fprintf(fp,"  %8.3f+i%8.3f",c1.re,c1.im);
      else
	fprintf(fp,"  %8.3f-i%8.3f",c1.re,-c1.im);
    }
    fprintf(fp,"\n");
    spec[i].rij_3 *= nf_1;
    spec[i].rij_6 *= nf_1;
    spec[i].y2.re  = fac*c2.re;
    spec[i].y2.im  = fac*c2.im;
    spec[i].bNOE   = (spec[i].rij_6 > md_6);
  }
}
Ejemplo n.º 2
0
int		fill_in(int **map, int position, int nb)
{
	int	i;
	int	j;

	if (position == 81)
	{
		ft_print_map(map);
		return (1);
	}
	i = position / 9;
	j = position % 9;
	if (map[i][j] != 0)
		return (fill_in(map, position + 1, nb));
	nb = 1;
	while (nb <= 9)
	{
		if (c_row(nb, map, i) && c_col(nb, map, j) && c_sqr(nb, map, i, j))
		{
			map[i][j] = nb;
			if (fill_in(map, position + 1, nb))
				return (1);
		}
		nb++;
	}
	map[i][j] = 0;
	return (0);
}
Ejemplo n.º 3
0
void small_Mie(double x,struct c_complex m,double*mu,
long nangles,struct c_complex*s1,
struct c_complex*s2,double*qext,double*qsca,
double*qback,double*g)

/*:22*/
#line 285 "./mie.w"


{
struct c_complex ahat1,ahat2,bhat1;
struct c_complex z0,m2,m4;
double x2,x3,x4;

if((s1==NULL)||(s2==NULL))nangles= 0;

m2= c_sqr(m);
m4= c_sqr(m2);
x2= x*x;
x3= x2*x;
x4= x2*x2;
z0.re= -m2.im;
z0.im= m2.re-1;

/*24:*/
#line 319 "./mie.w"

{struct c_complex z1,z2,z3,z4,D;

z1= c_smul(2.0/3.0,z0);
z2.re= 1.0-0.1*x2+(4.0*m2.re+5.0)*x4/1400.0;
z2.im= 4.0*x4*m2.im/1400.0;
z3= c_mul(z1,z2);

z4= c_smul(x3*(1.0-0.1*x2),z1);
D.re= 2.0+m2.re+(1-0.7*m2.re)*x2-(8.0*m4.re-385.0*m2.re+350.0)/1400.0*x4+z4.re;
D.im= m2.im+(-0.7*m2.im)*x2-(8.0*m4.im-385.0*m2.im)/1400.0*x4+z4.im;

ahat1= c_div(z3,D);

}

/*:24*/
#line 302 "./mie.w"

/*25:*/
#line 339 "./mie.w"

{
struct c_complex z2,z6,z7;
z2= c_smul(x2/45.0,z0);
z6.re= 1.0+(2.0*m2.re-5.0)*x2/70.0;
z6.im= m2.im*x2/35.0;
z7.re= 1.0-(2.0*m2.re-5.0)*x2/30.0;
z7.im= -m2.im*x2/15.0;
bhat1= c_mul(z2,c_div(z6,z7));
}

/*:25*/
#line 303 "./mie.w"

/*26:*/
#line 354 "./mie.w"

{struct c_complex z3,z8;

z3= c_smul((1.0-x2/14.0)*x2/15.0,z0);
z8.re= 2.0*m2.re+3.0-(m2.re/7.0-0.5)*x2;
z8.im= 2.0*m2.im-m2.im/7.0*x2;
ahat2= c_div(z3,z8);

}

/*:26*/
#line 304 "./mie.w"

/*28:*/
#line 396 "./mie.w"

{struct c_complex ss1;
double T;

T= c_norm(ahat1)+c_norm(bhat1)+(5.0/3.0)*c_norm(ahat2);
*qsca= 6.0*x4*T;
*qext= 6.0*x*(ahat1.re+bhat1.re+(5.0/3.0)*ahat2.re);
*g= (ahat1.re*(ahat2.re+bhat1.re)+ahat1.im*(ahat2.im+bhat1.im))/T;
ss1.re= 1.5*x2*(ahat1.re-bhat1.re-(5.0/3.0)*ahat2.re);
ss1.im= 1.5*x2*(ahat1.im-bhat1.im-(5.0/3.0)*ahat2.im);
*qback= 4*c_norm(ss1);
}

/*:28*/
#line 305 "./mie.w"

/*29:*/
#line 418 "./mie.w"

{
double muj,angle;
long j;
x3*= 1.5;
ahat1.re*= x3;
ahat1.im*= x3;
bhat1.re*= x3;
bhat1.im*= x3;
ahat2.re*= x3*(5.0/3.0);
ahat2.im*= x3*(5.0/3.0);
for(j= 0;j<nangles;j++){
muj= mu[j];
angle= 2.0*muj*muj-1.0;
s1[j].re= ahat1.re+(bhat1.re+ahat2.re)*muj;
s1[j].im= ahat1.im+(bhat1.im+ahat2.im)*muj;
s2[j].re= bhat1.re+ahat1.re*muj+ahat2.re*angle;
s2[j].im= bhat1.im+ahat1.im*muj+ahat2.im*angle;
}
}

/*:29*/
#line 306 "./mie.w"

}