29 void keyboard(
unsigned char key,
int x,
int y);
32 static volatile int IfExit = 0;
33 static int IfUser = 1;
35 static void StopLoop(
int sig)
38 printf(
"Loop stopped\n");
40 int main(
int argc,
char **argv){
43 signal(SIGTSTP,StopLoop);
44 signal(SIGSTOP,StopLoop);
45 signal(SIGSTOP,StopLoop);
49 if(argc <2){ printf(
"ConfFile not specified\n");
return 1;}
52 int *FilePos = (
int *)calloc(argc,
sizeof(
int));
58 for(
int i=1;i<argc;i++){
59 if(argv[i][0] !=
'-'){
63 else if(!strcmp(*(argv+i),
"-d")){
67 else if(!strcmp(*(argv+i),
"-r")){
71 else if(!strcmp(*(argv+i),
"-s")){
75 else if(!strcmp(*(argv+i),
"-c")){
77 sprintf(ConfFile,
"%s",argv[i+1]);
81 printf(
"Missing config file\n");
84 else if(!strcmp(*(argv+i),
"-i")){
86 sprintf(Snapshot,
"%s",*(argv+i+1));
90 printf(
"Snapshot file missing\n");
93 else if(!strncmp(*(argv+i),
"--",2)){
94 sprintf(Comando,
"%s",argv[i]+2);
99 Fm =
new Forces(argc,argv,ConfFile,argv[InitFile]);
101 Fm =
new Forces(argc,argv,NEdge,ConfFile);
102 fedisableexcept(FE_ALL_EXCEPT);
103 char cSystem1[STRSIZE];
104 char cSystem2[STRSIZE];
107 printf(
"------------------------------------------------------\n");
108 printf(
"%s NFile %d\n%s\n",cSystem1,NFile,cSystem2);
109 printf(
"------------------------------------------------------\n");
110 while(strcmp(Comando,
"q")){
112 printf(
"Dinamica> ");
115 if(!strcmp(Comando,
"d")){
119 printf(
"Graphics libraries (GL/glut.h) not supplied\n");
121 if(!IfUser)
return 0;
123 else if(!strcmp(Comando,
"s")){
125 if(!IfUser)
return 0;
127 else if(!strcmp(Comando,
"r")){
129 if(!IfUser)
return 0;
131 else if(!strcmp(Comando,
"nrg")){
132 for(
int f=0;f<NFile;f++){
133 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
136 if(!IfUser)
return 0;
138 else if(!strcmp(Comando,
"PepNrg")){
139 for(
int f=0;f<NFile;f++){
140 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
143 if(!IfUser)
return 0;
145 else if(!strcmp(Comando,
"ExpPep")){
147 if(!IfUser)
return 0;
149 else if(!strcmp(Comando,
"ExpPep2d")){
151 if(!IfUser)
return 0;
153 else if(!strcmp(Comando,
"ExpDist")){
155 if(!IfUser)
return 0;
157 else if(!strcmp(Comando,
"Widom")){
158 for(
int f=0;f<NFile;f++){
159 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
162 if(!IfUser)
return 0;
164 else if(!strcmp(Comando,
"WidomChIn")){
165 for(
int f=0;f<NFile;f++){
166 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
170 if(!IfUser)
return 0;
172 else if(!strcmp(Comando,
"WidomChOut")){
173 for(
int f=0;f<NFile;f++){
174 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
178 if(!IfUser)
return 0;
180 else if(!strcmp(Comando,
"Rosenbluth")){
182 for(
int f=0;f<NFile;f++){
183 sprintf(File2Write,
"Rosenbluth%05d.dat",f);
184 FILE *WidomIn = fopen(File2Write,
"w");
185 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
186 Fm->
ReOpen(argv[FilePos[f]],BF_PART);
191 if(!IfUser)
return 0;
193 else if(!strcmp(Comando,
"RosenOut")){
195 for(
int f=0;f<NFile;f++){
196 sprintf(File2Write,
"RosenOut%05d.dat",f);
197 FILE *WidomIn = fopen(File2Write,
"w");
198 fprintf(stderr,
"Elaborating file %s %.3f %%\r",argv[FilePos[f]],f/(
double)NFile*100.);
199 Fm->
ReOpen(argv[FilePos[f]],BF_PART);
204 if(!IfUser)
return 0;
206 else if(!strcmp(Comando,
"Tens")){
208 if(!IfUser)
return 0;
210 else if(!strcmp(Comando,
"AvForces")){
212 if(!IfUser)
return 0;
214 else if(!strcmp(Comando,
"Trial")){
216 if(!IfUser)
return 0;
218 else if(!strcmp(Comando,
"?") ){
221 else if(!strcmp(Comando,
"!") ){
222 printf(
"Insert a shell command: ");
226 else if(!strcmp(Comando,
"info")){
227 printf(
"------------------------------------------------------\n");
230 else if(!strcmp(Comando,
"write") ){
231 Fm->
Write(
"ciccia.dat");
233 else if(!strcmp(Comando,
"q") );
236 printf(
"Comando non valido, scrivere ? per la lista dei comandi\n");
239 printf(
"Te se qe te ve be te ne?\n");
252 void keyboard(
unsigned char key,
int x,
int y){
258 void DynamicsMotion(){
264 *****************************************************************\n\ 266 ) Program that reads and elaborate a spefic file format (\n\ 267 ( the option are the following, Needs a input file )\n\ 269 (-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-)\n\ 270 ( d draw the 3D position of the particle )\n\ 271 ( ! execute a shell command )\n\ 273 ( dens density of the [coord] coordinate for the [file] )\n\ 274 ( pro calculate the projection long [coord] )\n\ 275 ( threshold set how many particle per cell will be considered )\n\ 276 ( surf ratio between the actual surcafe and the circular )\n\ 277 ( core three dimentional sampled average of the system )\n\ 278 ( diff diffusivity of the extra particle )\n\ 279 ( > < open the file form the list position )\n\ 280 ( cm movement of the center of mass of the system )\n\ 281 ( file number of file to use from the list )\n\ 283 ( chbf change backfold )\n\ 284 ( val number of values for the density profile )\n\ 285 *****************************************************************\n");
void RunDynamics()
Run a step further.
void CalcTens()
Calculate the forces for the tension profile.
void ExplorePepSize2d()
Find the minimun bilayer thickness for different peptide sizes.
void keyboard(unsigned char key, int x, int y)
Additional key bindings.
void CalcTotNrg(char *FName, int nFile)
Total energy of the system.
void SysDef(char *cSystem)
Print a string with the system definitions.
void SysInfo(char *cSystem)
Print a string with the system information.
void RunWidom(char *File2Read, int f)
Build the widom histograms.
bool Write(char *OutFile)
Writes a "system-file" or a "x y z" file".
void DrawScene()
Draw the scene.
void RunWidomChIn(char *File2Read, int f)
Build the widom histograms.
void CalcNrgPep(char *File2Open, int f)
Exchange energy of the protein.
void ExploreDoubleMin()
Find the minimum for different interpeptide distances.
void RosenOut(FILE *WidomIn)
Rosenbluth histograms for deletion.
void ReOpen(char *FName, int Bf)
Open a new file.
void ExplorePepSize()
Find the minimun bilayer thickness for different peptide sizes.
void RosenIn(FILE *WidomIn)
Rosenbluth weights for insertion.
void RunWidomChOut(char *File2Read, int f)
Build the widom histograms.
int Graphics(int argc, char **argv)
Initialize the scene.
This class performs the different steps to solve the equations of motion via molecular dynamics simul...
void DynamicsView()
Idle function to run the dynamics.
void AvForces(char **argv, int *FilePos, int NFile)
Average of the forces.