Allink  v0.1
VarData.h
00001 /***********************************************************************
00002 VarData: Header file for the VarData class.
00003  Copyright (C) 2008 by Giovanni Marelli <sabeiro@virgilio.it>
00004 
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ***********************************************************************/
00020 #ifndef VARDATA_H
00021 #define VARDATA_H
00022 
00023 #include "Matematica.h"
00024 #include <vector> 
00025 #include <list>
00026 
00027 #ifdef USE_BOOST
00028 #include <boost/iostreams/filtering_stream.hpp>
00029 #include <boost/iostreams/filter/bzip2.hpp>
00030 using namespace  boost::iostreams;
00031 #endif
00032 
00033 ;
00034 #define CHAIN_IF_TYPE(c,t) ( ((c)&(t))==(t) )
00035 #define VAR_IF_TYPE(c,t) ( ((c)&(t))==(t) )
00036 #define VAR_ADD_TYPE(c,t) ( (c)|=(t) )
00037 #define VAR_REM_TYPE(c,t) ( (c)&=(~t) )
00038 
00039 enum ShiftType{
00041   SHIFT_NO      =0,
00043   SHIFT_CM      =1,
00045   SHIFT_NANO    =2,
00047   SHIFT_CM_NANO =3,
00048 };
00050 enum BackFoldType{
00052   BF_NO       =0,
00054   BF_PART     =1,
00056   BF_CHAIN    =2,
00058   BF_NANO     =3,
00060   BF_SKIP     =4,
00062   BF_TILT     =5,
00063 };
00065 enum BeadType{
00067   BEAD_PHOB   =0,
00069   BEAD_PHIL   =1,
00071   BEAD_OIL    =2,
00073   BEAD_NANO   ,
00075   BEAD_EVERY  ,
00076 };
00078 enum ChainType{
00080   CHAIN_EVERY   =0x00000,
00082   CHAIN_POLY    =0x00001,
00084   CHAIN_HOMO    =0x00002,
00086   CHAIN_ADDED   =0x00006,
00088   CHAIN_UP      =0x00005,
00090   CHAIN_DOWN    =0x00009,
00092   CHAIN_INNER   =0x00011,
00094   CHAIN_OUTER   =0x00021,
00096   CHAIN_STRETCH =0x00200,
00098   CHAIN_FLABBY  =0x00400,
00100   CHAIN_TILTED  =0x00800,
00101 };
00103 enum VarFileFormat{
00105   VAR_SYS_XVT        =  0x0001,
00107   VAR_SYS_TXVL       =  0x0002,
00109   VAR_SYS_XYZ        =  0x0004,
00111   VAR_SYS_XYZT       =  0x0008,
00112 };
00114 enum VarSysPropr{
00116   VAR_EDGE           =  0x0001,
00118   VAR_PART_ALLOCATED =  0x0002,
00120   VAR_CH_ALLOCATED   =  0x0004,
00122   VAR_MEMBRANE       =  0x0008,
00124   VAR_OPEN_TRUST     =  0x0010,
00126   VAR_LINK_ALLOCATED =  0x0020,
00128   VAR_CHAIN_DEF      =  0x0040,
00130   VAR_NBLOCK_ALL     =  0x0080,
00131 };
00133 enum VarCreate{
00135   VAR_ABSORBING  =  0x0001,
00137   VAR_REFLECTING =  0x0002,
00139   VAR_ADDED      =  0x0004,
00141   VAR_DISTRIBUTED=  0x0008,
00143   VAR_SOLVENT    =  0x0010,
00145   VAR_PLANAR     =  0x0020,
00147   VAR_PLANAR_PE  =  0x0040,
00149   VAR_TUBE       =  0x0080,
00151   VAR_VESICLE    =  0x0100,
00153   VAR_COATING    =  0x0200,
00155   VAR_TWOTAILS   =  0x0400,
00157   VAR_OBSTACLE   =  0x0800,
00159   VAR_OPPOSED    =  0x0f00,
00160 };
00162 enum BlockArch{
00164   ARCH_POINTS   = 0x0001,
00166   ARCH_LINES    = 0x0002,
00168   ARCH_TWOTAILS = 0x0004,
00170   ARCH_CLUSTER  = 0x0008,
00171 };
00173 enum NanoShape{
00175   SHAPE_NONE    = 0x00001,
00177   SHAPE_SPH     = 0x00002,
00179   SHAPE_HEI     = 0x00004,
00181   SHAPE_CYL     = 0x00008,
00183   SHAPE_TILT    = 0x00010,
00185   SHAPE_PILL    = 0x00020,
00187   SHAPE_WALL    = 0x00040,
00189   SHAPE_PORE    = 0x00080,
00191   SHAPE_SMOOTH  = 0x00100,
00193   SHAPE_CLUSTER = 0x00200,
00195   SHAPE_EXT     = 0x00400,
00197   SHAPE_JANUS   = 0x00800,
00199   SHAPE_CLINKS  = 0x01000,
00201   SHAPE_STALK   = 0x02000,
00203   SHAPE_TIP     = 0x04000,
00205   SHAPE_TORUS   = 0x08000,
00207   SHAPE_HARM    = 0x10000,
00209   SHAPE_UMBR    = 0x20000,
00211   SHAPE_BOUND   = 0x40000,
00212 };
00214 typedef struct{
00216   double Pos[3];
00218   double Bkf[3];
00220   double Vel[4];
00222   int Idx;
00224   int CId;
00226   int Typ;
00227 }PART;
00229 typedef struct{
00231   int *Link;
00233   int NLink;
00234 }LINKS;
00236 typedef struct{
00238   double Pos[4];
00240   double Dir[3];
00242   double Vel[3];
00243   //  Angle with the normal;
00244   double Angle;
00246   int Type;
00248   int NPCh;
00250   int InitBead;
00252   int EndBead;
00253 }CHAIN;
00255 typedef struct{
00257   char Name[60];
00259   int NPCh;
00261   int NPart;
00263   int NChain;
00265   int InitIdx;
00267   int EndIdx;
00269   int Arch;
00271   int nNano;
00273   int Asym;
00274 } BLOCK;
00276 typedef struct{
00278   char Name[60];
00280   double Pos[3];
00282   double Vel[3];
00284   double Size[3];
00286   int Topology;
00288   int NPart;
00290   int NChain;
00292   int NPCh;
00294   int InitIdx;
00296   int EndIdx;
00297 } SOFT;
00299 typedef struct{
00301   double Time;
00303   double Temp;
00305   double Beta;
00307   double Energy[3];
00309   double Edge[4];
00311   double InvEdge[4];
00313   double Cm[3];
00315   double Vel[4];
00317   double Pre[3];
00319   double vBB;
00321   double SurfTens;
00323   double chiN;
00325   double kappaN;
00327   double rho;
00329   double kappaBend;
00331   double kappaSpring;
00333   double SpringRest;
00335   double ReOverCutOff;
00337   double Deltat;
00339   double WFuncStraight2;
00341   double WFuncStraight3;
00343   unsigned long Step;
00345   int NPart;
00347   int NChain;
00349   int NPCh;
00351   int NAllocP;
00353   int NAllocC;
00355   int NType;
00357   int NLink;
00359   int NBlock;
00360   //  Number of nanoparticles
00361   int NNano;
00362 }GENERAL;
00364 class Properties{
00365  public:
00367   Properties(){RePhob=0.;RePhil=0.;VolPhob=0.;VolPhil=0.;FactPhob=0.;FactPhil=0.;GyrPhob=0.;GyrPhil=0.;ChDiff=0.;};
00369   void Print(){printf("RePhob %lf RePhil %lf\n",RePhob,RePhil);
00370   printf("RadGyrPhob %lf RadGyrPhil %lf\n",GyrPhob,GyrPhil);
00371   printf("StructFactPhob %lf StructFactPhil %lf\n",FactPhob,FactPhil);
00372   printf("VolPhob %lf VolPhil %lf\n",VolPhob,VolPhil);
00373   printf("ChainDiff %lf\n",ChDiff);};
00375   double RePhob;//End to end distance
00376   double RePhil;
00377   double VolPhob;//volume fraction
00378   double VolPhil;
00379   double FactPhob;//structure factor
00380   double FactPhil;
00381   double GyrPhob;//radius of gyration
00382   double GyrPhil;
00383   double ChDiff;//lateral diffusion of the chains
00384   Properties operator+(const Properties&) const;
00385   Properties operator*(const double&) const;
00386 };
00388 class MatInt{
00389  private:
00391   double *IntMatr2;
00393   double *IntMatr3;
00395   int NType;
00397   int NOrd;
00398  public:
00400   MatInt(int NType,int NOrd);
00402   void FillEntries(double *Matr,int Ord);
00404   int IntType(int t1,int t2);
00406   int IntType(int t1,int t2,int t3);
00408   double Coeff(int t1,int t2);
00410   double Coeff(int t1,int t2,int t3);
00412   void SetCoeff(double Co,int t1,int t2);
00414   void SetCoeff(double Co,int t1,int t2,int t3);
00416   void Print();
00418   int pNType(){return NType;};
00420   void Rescale(double SFactor,int Order);
00421 };
00423 typedef struct{
00425   char ArchFile[60];
00427   double Pos[3];
00429   double Bkf[3];
00431   double Vel[3];
00433   double Force[3];
00435   double Axis[3];
00437   double AMom[3];
00439   double AMomTemp[3];
00441   double AVel[3];
00443   double Mass;
00445   double Rad;
00447   double Hamaker;
00449   double Height;
00451   double Gamma;
00453   double Zeta;
00455   double Viscosity;
00457   double OffSet;
00459   double CutOff;
00461   double Coating;
00463   double BaseLine;
00465   double DistThr;
00467   double ForThr;
00469   double PotThr;
00471   double Area;
00473   int Shape;
00475   int NLink;
00477   int NHeight;
00479   int NCircle;
00481   int nBlock;
00482 }NANO;
00484 typedef struct {
00486   double x[3];
00487 } XYZ;
00489 typedef struct {
00491   XYZ p[8];
00493   XYZ n[8];
00495   double val[8];
00496 } GRIDCELL;
00498 typedef struct {
00500   XYZ p[3];
00502   XYZ c;
00504   int v[3];
00506   XYZ n[3];
00507 } VAR_TRIANGLE;
00509 typedef struct {
00511   XYZ p[2];
00513   XYZ c;
00515   int v[2];
00517   XYZ n[2];
00518 } VAR_LINE;
00519 //-----------------Class-VarData----------------------------------
00521 class VarData{
00522  private:
00524   GENERAL *Gen;
00525  public:
00527   Matematica *Mat;
00529   MatInt *MInt;
00531   VarData();
00533   ~VarData();
00534   //-------------------------VarData.cpp-------------------
00536   void VarMessage(const char * s, ...);
00538   bool Open(char *InFile,int BF);
00540   bool OpenRisk(char *InFile,int BF);
00542   bool OpenTrust(char *InFile,int BF);
00544   void AllocPart();
00546   void AllocChain();
00548   Properties SysProperties();
00550   void SysInfo(char *cSystem);
00552   void SysDef(char *cSystem);
00554   char *SysState();
00556   void SetCoeff();
00558   void SetCoeff(double *v2,double *v3);
00560   double TwoPartDist(int p1,int p2,double *RelDist);
00562   double TwoPartDist(double *Pos,int p2,double *RelDist);
00564   double TwoPartDist2(int p1,int p2,double *RelDist);
00566   double TwoPartDist2(double *Pos,int p2,double *RelDist);
00568   int TwoPartDist(int p1,int p2,double *RelDist,double CutOff);
00570   int TwoPartDist(double *Pos,int p2,double *RelDist,double CutOff);
00571   //----------------------VarDataWrite.cpp-----------------
00573   bool Write(char *OutFile);
00575   bool WriteTxvl(char *OutFile);
00577   bool WriteXvt(char *OutFile);
00579   bool WriteXyz(char *OutFile);                  
00581   void HeaderInteraction(FILE *FileToWrite);
00583   void StringNano(char *NString,int n);
00585   int HeaderNano(FILE *FileToWrite);
00587   int HeaderSoft(char *Line);
00589   void WriteLinkedSurf(FILE *FWrite,double *Plot,int NSample,int NType,double *Bound,int *PId);
00591   void WriteSurf(FILE *F2Write,double **Plot,int NSample,int OffSet);
00593   void ShapeId(int iShape,char *Shape);
00594 #ifdef USE_BOOST
00595 
00596   void OpenComprWrite(char *FName,filtering_ostream ZipFile);
00598   void OpenComprRead(char *FName,filtering_istream ZipFile);
00600   void CloseCompr(filtering_istream ZipFile);
00602   void CloseCompr(filtering_ostream ZipFile);
00603 #endif
00604   //------------------------VarDataBackFold.cpp------------
00606   bool BackFold(int How);
00608   int BfDefChain();
00610   int BfEdge();
00612   void DistFromNp();
00614   void ShiftRef(int BackFold);
00616   int StalkPos(double *OldPos);
00618   void BfPep();
00620   void BackBone(double *Line,int NBin);
00622   void StalkLineProf(double *Line,int NBin);
00624   void StalkPos2(double *OldPos,double *CmStalk);
00626   void StalkPos3(double *OldPos,double *CmStalk);
00628   int StalkPos4(double *OldPos,double *CmStalk);
00630   double NormalWeight(VAR_TRIANGLE *Triang,double *Weight,int NGrid,int NTri);
00632   void ConnectLineChain(VAR_LINE *Triang,int NGrid,int NTri);
00634   void ConnectLineChain2(VAR_LINE *Triang,int NGrid,int NTri);
00636   void ConnectLineChain3(VAR_LINE *Triang,int NGrid,int NTri);
00638   double PorePos();
00639   //-----------------VarDataString.cpp------------------
00641   int Fetch(char *str,char *mask,char *fmt, ... );
00643   int BraketPos(char *str,char *mask,int *sPos,int *sLen);
00645   int Fetch(char *str,char *mask,int NArg,double *Val);
00647   bool ReadString(const char *String,char *cLine,double *Value);
00649   bool ReadString(const char *String,double *Value,char *line);
00651   bool ReadString(const char *String,char *cLine,int *Value);
00653   int  ReadVal(char *pLine,double *Value);
00654   //-----------------VarDataRead.cpp-------------------
00656   int ReadLineXvt(char *cLine,double *Pos,int *Type);
00658   bool ReadConf(char *InFile);
00660   void ReadHeader(FILE *FileToRead);
00662   void ReadHeaderTxvl(FILE *FileToRead);
00664   void ReadHeaderXvt(FILE *FileToRead);
00666   int ReadPart(FILE *FileToRead);
00668   int ReadPartTxvl(FILE *FileToRead);
00670   int ReadPartXvt(FILE *FileToRead);
00672   int ReadPartXyz(FILE *FileToRead);
00674   int ReadPartXyzt(FILE *FileToRead);
00676   int ReadPassThru(FILE *FileToRead);
00678   int ReadSoft(FILE *ConfFile);
00680   void ReadNano(FILE *ConfFile,int NCircle,int NHeight);
00682   int NanoString(char *cLine,int n);
00684   void SubNanoHeader(char *cFile);
00686   int ShapeId(char *Shape);
00687   //--------------------VarDataCreate.cpp------------------------
00689   int DefSoft(char *nome2,char *ConfF);
00691   int TrialSys();
00693   bool CreateSoft(int *arch,double Thickness,int s);
00695   void CreateTube(int *arch,double Thickness,int s);
00697   void CreatePlanar(int *arch,double Thickness,int s);
00699   void CreateVesicle(int *arch,double Thickness,int s);
00701   void CreateCoating(int *arch,double Thickness,int s);
00703   void CreateObstacle(int *arch,double Thickness,int s);
00705   int CheckNano(double *Pos,int s);
00707   void AddProtein(int NCircle,int NHeight,int nNano,char *filename);
00709   void CreateProtein(int nNano,int nStart);
00711   void AddStuffing(char *filename,int nStuffing,int nNano);
00713   void AddSolvent(char *filename,int nWater);
00715   void AddChains(char *filename,double Thickness);
00717   void AddCholesterol(char *filename,double Thickness,int s);
00719   void DefBlock(int *NChStep,int How);
00721   void DefRest(int *arch,int s);
00723   int PutPart(int j,int p,int HalfLim,double sigma);
00725   void FindNeighbours(char *FileName);
00726   //---------------------VarDataEl.cpp----------------------------
00728   void SwapChain(int c1,int c2,int b);
00730   void SwapChain(int c1,int c2);
00732   void SwapPart(int p1,int p2);
00734   void ChangeNChain(int NChain,int b);
00736   bool ShiftSys(int How);
00738   void SampleSurface(double *Plot,int NSample,int Type);
00740   MOMENTI SampleSurfacePart(double *Plot,int NSample,int Type);
00742   MOMENTI SampleSurface(Matrice *Plot,int NSample,int Type);
00744   MOMENTI SampleSurfaceMem(int NSample);
00746   void LoadDensFile(double **Plot,int NBin);
00748   int SpatialDerivative(Matrice *Surface,Matrice *Resp,SPLINE Weight,int NSample);
00750   void ShiftBlock(Vettore *Shift,int b);
00752   void RotateBlock(Vettore *Axis,Vettore *Origin,int b);
00754   void MirrorBlock(Vettore *Px1,Vettore *Px2,Vettore *Px3,int b);
00756   void Transform(int block);
00758   void Point2Shape(int iShape);
00760   typedef double(VarData::*NANO_DIST)(double *Pos,int n);
00762   NANO_DIST Nano_Dist;
00764   double NanoDist2(double *Pos,int n){return (*this.*Nano_Dist)(Pos,n);}
00766   double NanoDist2(double x,double y,double z,int n);
00768   double FieldNo(double *Pos,int n);
00770   double FieldSphere(double *Pos,int n);
00772   double FieldElips(double *Pos,int n);
00774   double FieldParab(double *Pos,int n);
00776   double FieldCyl(double *Pos,int n);
00778   double FieldTransMem(double *Pos,int n);
00780   double FieldJanus(double *Pos,int n);
00782   double FieldTorus(double *Pos,int n);
00784   double FieldTilt(double *Pos,int n);
00786   double FieldBound(double *Pos,int n);
00788   double FieldTiltWall(double *Pos,int n);
00789   //---------------------VarDataExp.cpp----------------------------
00791   int PairCorrelation(double *Point,int NSample,int How,int Type);
00793   int PairCorrelationRound(double **Point,int NSample,int Type);
00795   int PairCorrelationSquare(double **Point,int NSample,int Type);
00797   int PairCorrelationPep(double **Point,int NSample,int Type);
00799   int Scattering2d(double **Point,int NSample,int Type);
00801   int Scattering2D(double **Point,int NSample,int Type);
00803   void Spettro2d(double *Points,int NSample,int Type);
00805   void Spettro2d(double *Plot,int NSample);
00806   //---------------------VarDataContour.cpp------------------------
00808   int DensityProfile(int coord,int NSample,int NType,double *dDensity);
00810   int Core(double ***Plot,int NSample,double Border[3][2]);
00812   int RadDistr(int NSample,double *Plot,double Border[2],int How);
00814   int Worm(int Partition,int NSample,double *Border,double *dPoint);
00817   void VolumeCircSlab(double *VolContr,int NSample);
00819   void Stalk(int NSample,int NLevel,double **Plot,double Threshold);
00820   //---------------------VarDataPos.cpp----------------------------
00822   int Arrange(int **Triangle,int Vertex);
00824   int Folding();
00826   int OrderPos();
00828   int CalcnPos(double *Pos);
00830   int Neighbour(double *Pos);
00832   int NChainPSquare(double *Plot);
00834   int LateralFluctuation(double *Plot,int LatValue);
00836   int Voronoi();
00838   int PosVectInt(double *Pos);
00839   //------------------VarInterp.cpp----------------------------
00841   int InterParab(PART *PmIn,PART *PmOut,int NIn,int nOut);
00843   int InterParab2(PART *PmIn,PART *PmOut,int NIn,int NOut);
00845   int InterCubica(PART *PmIn,PART *PmOut,int NIn,int NOut);
00847   int InterForth(PART *PmIn,PART *PmOut,int NIn,int NOut);
00849   int InterSpline3(PART *PmIn,PART *PmOut,int NIn,int NOut);
00851   int InterSpline4(PART *PmIn,PART *PmOut,int NIn,int NOut);
00853   int InterBSpline(PART *PmIn,PART *PmOut,int NIn,int NOut);
00855   int InterBSpline2D(double **PlIn,double **PmOut,int NIn,int NOut);
00857   int InterBSpline2D(double *PlIn,double *PmOut,int NIn,int NOut);
00859   int InterBSpline1D(double *PlIn,double *PmOut,int NIn,int NOut);
00861   int InterPoly(PART *PmIn,PART *PmOut,int NIn,int nOut);
00863   int InterDerMatrix(PART *Pm, int NMass,SPLINE Weight,double Offset);
00865   void SmoothGrid(int NSample,char *FWrite);
00867   void SmoothGrid(int NSample);
00869   void ConvoluteMatrix(double *Plot,int NGrid,Matrice *Mask,int NDim);
00871   void ConvoluteMatrix1(double *Plot,int NGrid,Matrice *Mask);
00873   void ConvoluteMatrix2(double *Plot,int NGrid,Matrice *Mask);
00875   void ConvoluteMatrix3(double *Plot,int NGrid,Matrice *Mask);
00876   //-------------------VarDataComm.cpp----------------------
00878   int SetNPart(int NewNPart);
00880   int SetNChain(int NewNCh);
00882   int SetNLink(int NewNCh);
00884   void SetNPCh(int NewNCh);
00886   void SetNType(int NewNType);
00888   int AllocLinks(int NewNCh);
00890   int SetNBlock(int Val);
00892   int SetNNano(int Val);
00894   void Copy(PART *P1,PART *P2,int NPartOld);
00896   void Copy(CHAIN *C1,CHAIN *C2,int NChainOld);
00897   //-------------------VarDataMarchCubes.cpp----------------
00899   VAR_TRIANGLE *MarchingCubes(double *Plot,int NSample,double IsoLevel,int *NTri);
00901   VAR_LINE *MarchingSquares(double *Plot,int NSample,double IsoLevel,int *NTri);
00902   //-------------------VarDataCGAL.cpp----------------------
00903   //#ifdef __CGAL_h__
00905   void AreaDistr(double *Distr,double *RadDistr,int NSample);
00906   //#endif //CGAL
00908   double pTime(){return Gen->Time;};
00910   double pDeltat(){return Gen->Deltat;};
00912   double pTemp(){return Gen->Temp;};
00914   double pBeta(){return Gen->Beta;};
00916   double pEnergy(int d){return Gen->Energy[d];};
00918   double pEdge(int d){return Gen->Edge[d];};
00920   double pInvEdge(int d){return Gen->InvEdge[d];};
00922   double pVol(){return Gen->Edge[0]*Gen->Edge[1]*Gen->Edge[2];};
00924   double pCm(int d){return Gen->Cm[d];};
00926   double pVelMax(int d){return Gen->Vel[d];};
00928   double pchiN(){return Gen->chiN;};
00930   double pkappaN(){return Gen->kappaN;};
00932   double pkBen(){return Gen->kappaBend;};
00934   double pkSpr(){return Gen->kappaSpring;};
00936   void SetkBen(double Val){Gen->kappaBend = Val;};
00938   void SetkSpr(double Val){Gen->kappaSpring = Val;};
00940   void SetSprRest(double Val){Gen->SpringRest = Val;};
00942   double pSprRest(){return Gen->SpringRest;};
00944   double prho(){return Gen->rho;};
00946   double pReOverCutOff(){return Gen->ReOverCutOff;};
00948   double pWei2Par(){return Gen->WFuncStraight2;};
00950   double pWei3Par(){return Gen->WFuncStraight3;};
00952   int pStep();
00954   int pNPart();
00956   int pNChain();
00958   int pNChain(int b);
00960   int pNPCh();
00962   int pNPCh(int c);
00964   int pNType();
00966   int pNLink();
00968   int pNNano();
00970   int pNBlock();
00972   int pNAllocP();
00974   int pNAllocC();
00976   void SetEdge(double Val,int d){Gen->Edge[d] = Val;Gen->InvEdge[d] = 1./Val;};
00978   void SetCNorm(int d){
00979     if(d<0 || d > 2) return;
00980     CNorm = d;
00981     CLat1 = (d+1)%3;
00982     CLat2 = (d+2)%3;
00983   };
00985   void SetScaleF(double *Scale){
00986     for(int d=0;d<3;d++){
00987       ScaleF[d] = Scale[d];
00988     }
00989   }
00991   void SetShiftPos(double *RefPos){
00992     for(int d=0;d<3;d++){
00993       ShiftPos[d] = RefPos[d];
00994     }
00995   }
00996   void SetIfNormalize(int If){
00997     IfNormalize = If;
00998   }
01000   void SetDeltat(double Val){Gen->Deltat = Val;};
01002   void SetStep(int Val){Gen->Step = Val;};
01004   void SetTemp(double Val){Gen->Temp = Val;Gen->Beta = 1./Val;};
01006   void SetTime(double Val){Gen->Time = Val;};
01008   void IncrStep(){Gen->Step++;};
01010   double pPos(int p,int d);
01012   double pChPos(int p,int d);
01014   void pPos(int p,double *Pos);
01016   double *pPos(int p);
01018   double pPosNoBkf(int p,int d);
01020   double pVel(int p,int d);
01022   void SetPos(int p, double *Pos);
01024   void SetPos(int p,int d,double Pos);
01026   void SetVel(int p, double *Vel);
01028   void SetType(int p,int t);
01030   int pType(int p);
01032   int pChain(int p);
01034   double pNanoPos(int n,int d);
01036   void SetBkf(int p);
01038   void SetNanoBkf(int n);
01040   void pPos(double *Pos);
01042   char cWhat2Draw[STRSIZE];
01044   NANO *Nano;
01046   PART *Pm;
01048   LINKS *Ln;
01050   CHAIN *Ch;
01052   SOFT *Soft;
01054   BLOCK *Block;
01056   double *PlotMem;
01058   double ShiftPos[3];
01060   double ScaleF[3];
01062   int NSoft;
01064   int NPartNearSphere;
01066   int NAddChain;
01068   int NAddChol;
01070   int NSolvent;
01072   int NStuffing;
01074   int CNorm;
01076   int CLat1;
01078   int CLat2;
01080   int NChType;
01082   int NPType;
01084   int NEdge;
01086   int SysType;
01088   int SysFormat;
01090   int SysCreate;
01092   int IfNormalize;
01094   int IfPlotMem;
01095 };
01096 #endif //VARIABILI_H