22 #include "../include/VarData.h" 27 double dNSample = 1./(double)NSample;
28 for(
int v=0;v<NSample;v++)
31 for(
int p=0;p<Gen->
NPart;p++){
32 if(
Pm[p].Typ != Type)
continue;
34 for(
int pp=0;pp<Gen->
NPart;pp++){
35 if(
Pm[pp].Typ != Type)
continue;
37 double Dist2 = QUAD(
Pm[p].Pos[0] -
Pm[pp].Pos[0]);
38 Dist2 += QUAD(
Pm[p].Pos[1] -
Pm[pp].Pos[1]);
39 Dist2 += QUAD(
Pm[p].Pos[2] -
Pm[pp].Pos[2]);
40 Dist2 = pow(Dist2,.5);
41 int v = (int)(Dist2*
pInvEdge(3)*NSample);
42 if( v < 0 || v >= NSample)
continue;
47 for(
int v=0;v<NSample;v++){
53 for(
int c=0;c<Gen->
NChain;c++){
55 if(
Ch[c].Type != Type)
continue;
56 for(
int cc=0;cc<Gen->
NChain;cc++){
57 if(
Ch[cc].Type != Type)
continue;
63 int v = (int)(
Ch[c].Pos[3] / Gen->
Edge[3]*NSample);
64 if( v < 0 || v >= NSample)
continue;
68 for(
int v=0;v<NSample;v++){
69 dPoint[v] /= DUE_PI*( QUAD((Gen->
Edge[3]*(v+1)*dNSample)) - QUAD((Gen->
Edge[3]*v*dNSample)) );
75 double dNSample = 1./(double)NSample;
76 double InvNChain=1./(double)Gen->
NChain;
77 int vRef = (
int)(NSample/2.);
78 for(
int c=0;c<Gen->
NChain;c++){
79 if(!CHAIN_IF_TYPE(
Ch[c].Type,
NChType))
continue;
82 int vx1 = (int)(ChX1 / (Gen->
Edge[
CLat1])*NSample);
83 int vy1 = (int)( (ChY1) / (Gen->
Edge[
CLat2])*NSample);
84 for(
int cc=0;cc<Gen->
NChain;cc++){
85 if(!CHAIN_IF_TYPE(
Ch[cc].Type,
NChType))
continue;
86 if( c == cc)
continue;
89 int vx2 = (int)(ChX2 / (Gen->
Edge[
CLat1])*NSample);
90 int vy2 = (int)( (ChY2) / (Gen->
Edge[
CLat2])*NSample);
94 if( vx + vRef < 0 || vx+vRef >= NSample)
continue;
98 if( vy + vRef < 0 || vy+vRef >= NSample)
continue;
100 dPoint[vx+vRef][vy+vRef] += InvNChain;
107 double dNSample = 1./(double)NSample;
108 double InvNChain=1./(double)Gen->
NChain;
109 int vRef = (
int)(NSample/2.);
110 for(
int c=0;c<Gen->
NChain;c++){
111 if(!CHAIN_IF_TYPE(
Ch[c].Type,
NChType))
continue;
114 int vx = (int)(ChX/Gen->
Edge[
CLat1]*NSample);
115 int vy = (int)(ChY/Gen->
Edge[
CLat2]*NSample);
116 if( vx + vRef < 0 || vx+vRef >= NSample)
continue;
117 if( vy + vRef < 0 || vy+vRef >= NSample)
continue;
118 dPoint[vx+vRef][vy+vRef] += InvNChain;
124 double dNSample = 1./(double)NSample;
125 double InvNChain=1./(double)Gen->
NChain;
126 for(
int c=0;c<Gen->NChain;c++){
129 if(!CHAIN_IF_TYPE(
Ch[c].Type,
NChType))
continue;
130 for(
int cc=0;cc<Gen->
NChain;cc++){
131 if(!CHAIN_IF_TYPE(
Ch[cc].Type,
NChType))
continue;
132 if( c == cc)
continue;
143 ChRad = sqrt( QUAD((ChX)) + QUAD((ChY)) );
144 ChAngle = acos(ChX / ChRad);
146 ChAngle = DUE_PI - ChAngle;
147 int v = (int)(ChRad / (Gen->
Edge[3])*NSample);
148 if( v < 0 || v >= NSample)
continue;
149 int vv = (int)( (ChAngle) / (DUE_PI)*NSample);
150 if( vv < 0 || vv >= NSample)
continue;
152 dPoint[v][vv] += InvNChain;
159 double dNSample = 1./(double)NSample;
160 double InvNChain=1./(double)Gen->
NChain;
161 int vRef = (
int)(NSample/2.);
162 double *CosSin = (
double *)calloc(2*SQR(NSample),
sizeof(double));
163 for(
int p=0;p<
pNPart();p++){
174 for(
int vx=0;vx<NSample;vx++){
175 for(
int vy=0;vy<NSample;vy++){
176 double qx = vx*dNSample;
177 double qy = vy*dNSample;
178 CosSin[(vx*NSample+vy)*2 ] += cos( (qx*ChX+qy*ChY)*DUE_PI );
179 CosSin[(vx*NSample+vy)*2+1] += sin( (qx*ChX+qy*ChY)*DUE_PI );
183 for(
int vx=0;vx<NSample;vx++){
184 for(
int vy=0;vy<NSample;vy++){
185 Plot[vx][vy] = (SQR(CosSin[(vx*NSample+vy)*2 ]) + SQR(CosSin[(vx*NSample+vy)*2+1]))*SQR(InvNChain);
192 double dNSample = 1./(double)NSample;
193 double InvNChain=1./(double)Gen->
NChain;
194 for(
int c=0;c<Gen->NChain;c++){
195 if(!CHAIN_IF_TYPE(
Ch[c].Type,
NChType))
continue;
196 for(
int cc=0;cc<Gen->
NChain;cc++){
197 if(!CHAIN_IF_TYPE(
Ch[cc].Type,
NChType))
continue;
198 if( c == cc)
continue;
205 int v = NSample/2 + (int)( 2.*(ChX / Gen->
Edge[CLat1])*(NSample/2) );
206 int vv = NSample/2 + (int)(2.*ChY / (Gen->
Edge[CLat2])*(NSample/2));
209 if( vv < 0 || vv >= NSample)
continue;
210 if( v < 0 || v >= NSample)
continue;
211 dPoint[vv][v] += InvNChain;
217 double *Plot = (
double *)calloc(SQR(NSample),
sizeof(double));
218 double *InPoints = (
double *)calloc(NSample*NSample,
sizeof(
double));
220 for(
int v=0;v<SQR(NSample);v++){
221 InPoints[v] = Plot[v];
228 double *Points = (
double *)calloc(NSample*NSample,
sizeof(
double));
229 for(
int v=0;v<SQR(NSample);v++){
CHAIN * Ch
Information on all chains.
int PairCorrelationPep(double **Point, int NSample, int Type)
2-d pair correlation on a square fererring to the pep position
double Edge[4]
xyzr edges of the simulation box
int BfDefChain()
Definition of the chain.
double pInvEdge(int d)
Inverted xyzr edges of the simulation box.
int Scattering2d(double **Point, int NSample, int Type)
2-d Scattering
int NChType
Type of chain selected.
int CLat2
lateral coordinate
double Pos[3]
xyz Position of the particle
double pNanoPos(int n, int d)
Return back folded nano position.
double pEdge(int d)
xyzr edges of the simulation box
int NChain
Number of chain.
void Spettro2d(double *st, double *sw, int NMass)
Compute the 2d spectrum of.
double Pos[4]
xyzr Postion of the chain
int PairCorrelation(double *Point, int NSample, int How, int Type)
1-d pair correlation
void Spettro2d(double *Points, int NSample, int Type)
1-d spectrum of a surface
Matematica * Mat
Implementation of all usefull algorythms.
int Scattering2D(double **Point, int NSample, int Type)
2-d scattering
int CLat1
lateral coordinate
int PairCorrelationSquare(double **Point, int NSample, int Type)
2-d pair correlation on a square
int NPart
Number of particle.
PART * Pm
Particle information of all particle.
void SampleSurface(double *Plot, int NSample, int Type)
Define a normal coordinate for every patch.
int PairCorrelationRound(double **Point, int NSample, int Type)
Circular 2-d pair correlation.
int pNPart()
Number of particle.