6 else if(VAR_IF_TYPE(
SysShape,SYS_2D)){
9 else if(VAR_IF_TYPE(
SysShape,SYS_3D)){
12 else if(VAR_IF_TYPE(
SysShape,SYS_STALK)){
15 else if(VAR_IF_TYPE(
SysShape,SYS_LEAVES)){
18 else if(VAR_IF_TYPE(
SysShape,SYS_PORE)){
21 else if(VAR_IF_TYPE(
SysShape,SYS_ROD)){
24 else if(VAR_IF_TYPE(
SysShape,SYS_RIGID)){
27 else if(VAR_IF_TYPE(
SysShape,SYS_MD)){
30 else if(VAR_IF_TYPE(
SysShape,SYS_MC)){
33 else if(VAR_IF_TYPE(
SysShape,SYS_ELECTRO)){
36 else if(VAR_IF_TYPE(
SysShape,SYS_TRIAL)){
40 Pos[d] = .5*
pEdge(d)/(double)NSect;
42 for(
int p=0;p<
pNPart();p++){
44 Pm[p].
Pos[d] = Pos[d];
47 Pos[0] +=
pEdge(0)/(double)NSect;
48 if(Pos[0] >
pEdge(0)){
49 Pos[0] = .5*
pEdge(0)/(double)NSect;
50 Pos[1] +=
pEdge(1)/(double)NSect;
51 if(Pos[1] >
pEdge(1)){
52 Pos[1] = .5*
pEdge(1)/(double)NSect;
53 Pos[2] +=
pEdge(2)/(double)NSect;
64 printf(
"System shape not recognized %d\n",
SysShape);
68 VAR_ADD_TYPE(
SysType,VAR_SYS_TXVL);
74 for(
int px=0;px<
nEdge[0];px++){
75 for(
int py=0;py<nEdge[1];py++){
76 int p = px*nEdge[1]+py;
78 Pm[p].
Pos[0] = Dx*(double)px + .5*Dx;
79 Pm[p].
Pos[1] = Dy*(double)py + .5*Dy;
83 if(px == 0 && BoundCond[0]){
86 if(px == nEdge[0]-1 && BoundCond[1]){
89 if(py == 0 && BoundCond[2]){
92 if(py == nEdge[1]-1 && BoundCond[3]){
97 if( py-1 < 0 ) pym1 += nEdge[1];
101 if( py+1 >= nEdge[1]) pyp1 -= nEdge[1];
102 if(pyp1 < 0) pyp1 +=
pNPart();
104 int pxm1 = p-nEdge[1];
105 if(pxm1 < 0) pxm1 +=
pNPart();
107 int pxp1 = p+nEdge[1];
126 for(
int px=0,ppp=0;px<
NEdge;px++){
127 for(
int py=0;py<
NEdge;py++){
128 for(
int pz=0;pz<
NEdge;pz++){
130 Pm[ppp].
Pos[0] = Dx*(double)px;
131 Pm[ppp].
Pos[1] = Dy*(double)py;
132 Pm[ppp].
Pos[2] = Dz*(double)pz;
137 Ln[ppp].
Link[link] = ppp+1;
141 Ln[ppp].
Link[link] = ppp-1;
161 if( (px == 0 || px == NEdge -1) &&
162 (py == 0 || py == NEdge -1) &&
163 (pz == 0 || pz == NEdge -1))
177 for(
int p=0;p<
NEdge;p++){
212 for(
int p=0;p<
NEdge;p++){
214 Pm[p].
Pos[0] = p*Dx*.5;
224 for(
int p=0;p<2;p++){
239 int NSegment = (int)(
NEdge/6.);
240 double AngleS = .25*DUE_PI/(double)NSegment;
246 if(p >= c*NEdge + 2*NSegment && p <= c*NEdge + 4*NSegment){
248 double pa = (double)(p-2*NSegment);
249 double x =
Kf.
Elong[2]*.5*sin(AngleS*pa);
250 double z =
Kf.
Elong[2]*.5*cos(AngleS*pa);
251 Pm[p].
Pos[0] = x + Dx*2*NSegment;
254 else if(p > c*NEdge + 4*NSegment){
255 Pm[p].
Pos[0] = Dx*(6*NSegment - p);
268 if(p == NEdge*(c+1) - 1){
273 Ln[p].
Link[2] = NEdge - p - 1;
276 int pHalf = (int)(
NEdge/2.);
295 int NSegment = (int)(
NEdge/3.);
296 double AngleS = .5*DUE_PI/(double)NSegment;
307 if(p > c*NEdge + NSegment && p <= c*NEdge + 2*NSegment ){
308 double x =
Kf.
Elong[2]*.5*sin(AngleS*(p-c*NEdge + NSegment));
309 double z =
Kf.
Elong[2]*.5*cos(AngleS*(p-c*NEdge + NSegment));
310 Pm[p].
Pos[0] = x + Dx*NSegment;
313 else if(p > c*NEdge + 2*NSegment ){
314 Pm[p].
Pos[0] = Dx*(NEdge*(c+1)-p);
319 if(p < c*NEdge + NSegment ){
320 Pm[p].
Pos[0] = 1. - Dx*(double)(p-c*NEdge);
323 else if(p >= c*NEdge + NSegment && p < c*NEdge + 2*NSegment ){
324 double x =
Kf.
Elong[2]*.5*sin(AngleS*(p-c*NEdge + NSegment));
325 double z =
Kf.
Elong[2]*.5*cos(AngleS*(p-c*NEdge + NSegment));
326 Pm[p].
Pos[0] = - x + 2*Dx*NSegment;
337 if(p == NEdge*(c+1) - 1){
347 if(p == c*NEdge + 1 || p == (c+1)*NEdge - 2)
359 for(
int p=0;p<
pNPart();p++){
361 Pm[p].
Pos[0] = Dx*(double)p;
388 for(
int n=0;n<
pNNano();n++){
389 for(
int d=0;d<3;d++){
405 for(
int d=0;d<3;d++){
411 int NSect[3] = {3,3,3};
412 StatFile1 = fopen(
"StatisticsMC1.dat",
"w");
413 StatFile2 = fopen(
"StatisticsMC2.dat",
"w");
420 OldNrgBead =
new double[
pNPart()];
421 OldNrgCh =
new double[
pNChain()];
423 for(
int d=0;d<3;d++) NSect[d] = (
int)(Edge[d]/(double)(2.*sqrt(
Kf.
CutOff2)));
427 for(
int p=0;p<
pNPart();p++){
428 for(
int d=0;d<3;d++){
436 int NSect[3] = {3,3,3};
440 for(
int d=0;d<3;d++)NSect[d] = (
int)(Edge[d]/(double)(2.*sqrt(
Kf.
CutOff2)));
444 while ((n3*n3*n3)<
pNPart()) n3++;
448 for(
int p=0;p<
pNPart();p++){
461 for(
int d=0;d<3;d++){
469 int NSect[3] = {3,3,3};
470 StatFile1 = fopen(
"StatisticsMC1.dat",
"w");
471 StatFile2 = fopen(
"StatisticsMC2.dat",
"w");
478 OldNrgBead =
new double[
pNPart()];
479 OldNrgCh =
new double[
pNChain()];
481 for(
int d=0;d<3;d++) NSect[d] = (
int)(Edge[d]/(double)(2.*sqrt(
Kf.
CutOff2)));
486 double *PCenter = (
double *)calloc(NCenter*2,
sizeof(
double));
488 for(
int c=0;c<NCenter;c++){
489 for(
int d=0;d<2;d++){
493 for(
int p=0;p<
NEdge;p++){
495 for(
int d=0;d<2;d++){
504 for(
int p=NEdge;p<NEdge+
NSpline;p++){
505 for(
int d=0;d<2;d++){
void SetNPCh(int NewNCh)
Set and reallocate the number of particles per chains.
void CreateRod()
Create a initial disposition of particle for a stiff rod.
int NLink
How many links per particle.
int NInsertion
Count accepted moves.
void Create2d()
Create a plane of connected beads.
BLOCK * Block
Information for every block.
double Vel[4]
xyzr Velocity of the particle
LINKS * Ln
Array of linking between the particles.
void AddRigid()
Add all rigid bodies as a boundary condition.
NANO * Nano
Extra particle.
int SetNChain(int NewNCh)
Set and reallocate the number of chains.
double Gamma
Friction term.
void CreateMC()
Create a initial disposition of particle for the MC sim.
double pInvEdge(int d)
Inverted xyzr edges of the simulation box.
double GaussVar
Standard deviation of the gaussian chain.
double Height
Height of the cylinder.
double El[3]
Elastic force.
double Pos[3]
xyz Position of the particle
void CreateRigid()
Create rigid bodies.
void CreatePore()
Create the 1d representation of a pore.
int NRemoval
Count accepted moves.
double pVol()
xyzr edges of the simulation box
void CreateInitial()
Create an initial configuration and an appropriate force field.
int CalcMode
Calculation mode.
int Shape
0 none, 1 spherical, 2 cylindrical 3 wall
void Create1d()
Create single line of connected monomers.
double pEdge(int d)
xyzr edges of the simulation box
int Idx
Particle identifier.
double Dx
Spatial separation between particles.
int * Link
with whom is bonded
int NEdge
Number of particles per edge.
double Casuale()
Random uniform number.
KFORCES Kf
Prefactor of the forces.
double Zeta
Stochastic term.
void CreateElectro()
Create a initial disposition of houses to collect on a line.
int Old2Move
Old part to move.
int SysShape
Shape of system.
int SysType
Contains the definition of the system.
void PrintForce()
Print the force and the potential.
int pNNano()
Number of nanoparticles.
int nEdge[3]
Number of particle per edge.
void CreateStalk()
Create the 1d representation of a stalk.
double Gaussiano(double Media, double Scarto)
Gaussian random number.
void CreateMD()
Create a initial disposition of particle for the MD sim.
double pReOverCutOff()
Re/CutOff.
Matematica * Mat
Implementation of all usefull algorythms.
void Create3d()
Create a lattice of connected beads.
int pNChain()
Number of chain.
double Elong[3]
Elongation of the springs.
double CutOff2
CutOff of the lennard jones.
double AVel[3]
Angular velocity.
double Axis[3]
Rotation axis.
int SetNNano(int Val)
Set NNano.
PART * Pm
Particle information of all particle.
void CreateLeaves()
Create two connected sheets and add a protein.
double SLap
Prefactor of the square laplacian.
void DefNanoForceParam()
Define the parameters for calculating the force.
int Bead2Move
Bead to move.
int pNPart()
Number of particle.
int NSpline
Total number of points for drawing a spline.
void SetkBen(double Val)
Bending coupling.