26 #include "../include/VarData.h" 34 fprintf(stderr,
"VarData] ");
35 vfprintf(stderr, s, args);
36 fprintf(stderr,
"\n");
51 if( !Gen | !
Mat ){printf(
"Il costruttore non alloca\n");
return;}
57 for(
int d=0;d<3;d++)
ShiftPos[d] = 0.;
58 for(
int d=0;d<3;d++)
ScaleF[d] = 1.;
100 for(
int p=0;p<Gen->
NPart;p++)
110 VAR_REM_TYPE(
SysType,VAR_EDGE);
113 if((FileToRead = fopen(InFile,
"r"))==0){
114 printf(
"The file is missing %s \n",InFile);
118 if( !VAR_IF_TYPE(
SysType,VAR_OPEN_TRUST) )
128 if((FileToRead = fopen(InFile,
"r"))==0){
129 printf(
"The file is missing %s \n",InFile);
141 Result.RePhil = (this->RePhil + Pr.RePhil);
142 Result.VolPhob = (this->VolPhob + Pr.VolPhob);
143 Result.VolPhil = (this->VolPhil + Pr.VolPhil);
144 Result.FactPhob = (this->FactPhob + Pr.FactPhob);
145 Result.FactPhil = (this->FactPhil + Pr.FactPhil);
146 Result.GyrPhob = (this->GyrPhob + Pr.GyrPhob);
147 Result.GyrPhil = (this->GyrPhil + Pr.GyrPhil);
148 Result.ChDiff = (this->ChDiff + Pr.ChDiff);
151 Properties Properties::operator* (
const double& c)
const{
153 Result.
RePhob = (this->RePhob * c);
154 Result.RePhil = (this->RePhil * c);
155 Result.VolPhob = (this->VolPhob * c);
156 Result.VolPhil = (this->VolPhil * c);
157 Result.FactPhob = (this->FactPhob * c);
158 Result.FactPhil = (this->FactPhil * c);
159 Result.GyrPhob = (this->GyrPhob * c);
160 Result.GyrPhil = (this->GyrPhil * c);
161 Result.ChDiff = (this->ChDiff * c);
165 sprintf(cSystem,
"# NPart %d NType %d NChain %d NPCh %d Asymmetry %d Edge: [%.3g %.3g %.3g] rho %.0f chiN %.0f kappaN %.0f Nano %d (# %d) (%lf %lf %lf) NBlock %d",Gen->
NPart,Gen->
NType,Gen->
NChain,Gen->
NPCh,
Block[0].
Asym,Gen->
Edge[0],Gen->
Edge[1],Gen->
Edge[2],Gen->
rho,Gen->
chiN,Gen->
kappaN,
Nano->
Shape,Gen->NNano,
Nano->
Rad,
Nano->
Hamaker,
Nano->
Height,Gen->
NBlock);
168 sprintf(cSystem,
"# SysType) Edge %d Sys (Txvl %d Xvt %d) \n",
176 v2[1] = Gen->
chiN/Gen->
rho + .5*(v2[0]+v2[2]);
184 v3[0] = 1.5 * (Gen->
kappaN+2.)/QUAD(Gen->
rho);
218 int NMax = IntType(NType-1,NType-1)+1;
219 IntMatr2 =
new double[NMax];
222 int NMax = IntType(NType-1,NType-1,NType-1)+1;
223 IntMatr3 =
new double[NMax];
228 for(
int t=0;t<NType;t++){
229 for(
int tt=t;tt<NType;tt++){
230 int ttt = IntType(t,tt);
231 IntMatr2[ttt] = Matr[ttt];
236 for(
int t=0;t<NType;t++){
237 for(
int tt=t;tt<NType;tt++){
238 for(
int ttt=tt;ttt<NType;ttt++){
239 int tf = IntType(t,tt,ttt);
240 IntMatr3[tf] = Matr[tf];
247 return IntMatr2[IntType(t1,t2)];
250 return IntMatr3[IntType(t1,t2,t3)];
253 IntMatr2[NType*t1+t2] = Co;
254 IntMatr2[NType*t2+t1] = Co;
258 IntMatr3[(t1*NType+t2)*NType+t3] = Co;
259 IntMatr3[(t1*NType+t3)*NType+t2] = Co;
260 IntMatr3[(t2*NType+t1)*NType+t3] = Co;
261 IntMatr3[(t2*NType+t3)*NType+t1] = Co;
262 IntMatr3[(t3*NType+t2)*NType+t1] = Co;
263 IntMatr3[(t3*NType+t1)*NType+t2] = Co;
268 return NType*MIN(t1,t2)+MAX(t1,t2);
270 for(
int ta=0;ta<MIN(t1,t2);ta++){
271 for(
int tb=ta;tb<MAX(t1,t2);tb++){
278 return (t1*NType+t2)*NType+t3;
280 int tSort[3] = {t1,t2,t3};
281 for(
int d=1;d<3;d++){
282 if(tSort[d] < tSort[d-1]){
284 tSort[d] = tSort[d-1];
288 return (NType*tSort[0]+tSort[1])*NType+tSort[2];
292 for(
int tc=0;tc<NType;tc++)
293 printf(
"_____%d_____",tc);
295 for(
int tr=0;tr<NType;tr++){
297 for(
int tc=0;tc<NType;tc++){
298 printf(
"%lf ",Coeff(tr,tc));
303 for(
int t=0;t<NType;t++){
304 for(
int tt=t;tt<NType;tt++){
305 for(
int ttt=tt;ttt<NType;ttt++){
306 int tf = IntType(t,tt,ttt);
307 printf(
"%d%d%d) %lf\n",t,tt,ttt,Coeff(t,tt,ttt));
314 for(
int t1=0;t1<NType;t1++)
315 for(
int t2=0;t2<NType;t2++)
316 IntMatr2[(t1*NType+t2)] *= SFactor;
319 for(
int t1=0;t1<NType;t1++)
320 for(
int t2=0;t2<NType;t2++)
321 for(
int t3=0;t3<NType;t3++)
322 IntMatr3[(t1*NType+t2)*NType+t3] *= SFactor;
int ReadPart(FILE *FileToRead)
Reads particle type and position.
void SetNPCh(int NewNCh)
Set and reallocate the number of particles per chains.
CHAIN * Ch
Information on all chains.
Information about the nanoparticle.
double kappaN
Incompressibility.
General information of the system.
void SysDef(char *cSystem)
Print a string with the system definitions.
bool OpenRisk(char *InFile, int BF)
Opens a file without reallocationg.
BLOCK * Block
Information for every block.
void SysInfo(char *cSystem)
Print a string with the system information.
int NAddChol
Additional cholesterol chains into the membrane.
LINKS * Ln
Array of linking between the particles.
double ShiftPos[3]
Reference position.
NANO * Nano
Extra particle.
double chiN
Incompatibility.
Energy contribution from the density functional hamiltonian.
double Hamaker
Strength of the interaction.
double Edge[4]
xyzr edges of the simulation box
void SetCoeff(double Co, int t1, int t2)
Set the prefactor.
char cWhat2Draw[STRSIZE]
What to draw.
double WFuncStraight2
Weighting function straight length.
int Asym
Diblock limit of the chain.
double Height
Height of the cylinder.
Information for every soft object.
int NChType
Type of chain selected.
int CLat2
lateral coordinate
Information for every block.
int IfPlotMem
If PlotMem is allocated and filled.
int NLink
Maximum number of bonds.
Some calculated properties of the system.
bool Open(char *InFile, int BF)
Open the.
int NAddChain
Additional homopolymer chains into the membrane.
int SysCreate
Contains the information for the creation.
void Print()
Print the entries.
int Shape
0 none, 1 spherical, 2 cylindrical 3 wall
void ReadHeader(FILE *FileToRead)
Reads a header.
int NStuffing
Stuffing for the cylinder.
double vBB
Chemical potential of the water.
int NPType
Type of particle selected.
int NPartNearSphere
Number of particle to be considered in the radial density profile.
MatInt * MInt
Matrix of the prefactor of the interactions.
int NChain
Number of chain.
int IntType(int t1, int t2)
Matrix element of the two type interaction.
int NEdge
Number of particles per edge.
VarData()
Set the constants.
void Point2Shape(int iShape)
Point to the shape function.
int NPCh
Number of particle per chain.
void ShiftRef(int BackFold)
Backfold the system wrt the reference position.
int SysType
Contains the definition of the system.
double Coeff(int t1, int t2)
Prefactor of the force.
double ScaleF[3]
Scale factor.
void FillEntries(double *Matr, int Ord)
Fill all the entries.
int SysFormat
Contains the definition of the file format.
int NSolvent
Solvent molecules.
Matematica * Mat
Implementation of all usefull algorythms.
double WFuncStraight3
Weighting function straight length.
MatInt(int NType, int NOrd)
Creates and fill the matrix.
int NType
of types of the particle
double RePhob
End2End distance of the.
Implementation of useful algorythms.
int IfNormalize
If normalize the lateral dimensions to one.
int CLat1
lateral coordinate
int ReadPassThru(FILE *FileToRead)
Reads the information to alloc the structure.
int NSoft
Number of soft bodies.
void Rescale(double SFactor, int Order)
Rescale entries.
int NPart
Number of particle.
PART * Pm
Particle information of all particle.
int NBlock
Number of blocks.
void VarMessage(const char *s,...)
If enabled call the function position.
void SetCoeff()
Set the virial coefficients from the known values of density coex...
double rho
Density coexistence.
int CNorm
Normal coordinate.