[gvd-devel] GVD dies upon opening source file
Maura Edelweiss
memonvil@artsci.wustl.edu
Sun, 27 Jan 2002 00:17:45 -0600
This is a multi-part message in MIME format.
--------------F619EEC86E7557089097B822
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Please, find attached my source C code and the GCD log file.
I simply edited my file off-line using "vi". I recreated the executable
code and start GVD again.
Upon opening the source code a message popped up requesting a bug
report. At this point GVD died when I selected "OK"
I restarted GVD again three times and repeated the same operations and
its behaviour was consistent.
Question: GVD allows for on-line source editing. Does it automatically
recreates the executable code upon saving the
buffer containing the modifications ???
Regards,
Maura E.M.
--------------F619EEC86E7557089097B822
Content-Type: text/plain; charset=us-ascii;
name="mdJan21.02.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="mdJan21.02.c"
/***************************************************************************/
/* mdJan21.02.c */
/********* MOLECULAR SIMULATION ... redo **********/
/* ------------------- */
/* begin : Mon Jan 21 2002 */
/* copyright : (C) 2002 by Maura Edelweiss Monville */
/* email : */
/***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>
#include <unistd.h>
/* position, velocities, forces components */
double *X; /* Record x-coordinate */
double *Y; /* Record y-coordinate */
double *Z; /* Record z-coordinate */
double *Vx; /* velocity x-coordinate */
double *Vy; /* velocity y-coordinate */
double *Vz; /* velocity z-coordinate */
double *Fx; /* cumulative force x-coordinate */
double *Fy; /* cumulative force y-coordinate */
double *Fz; /* cumulative force z-coordinate */
/* number-molecules, density, Temperature, time-step, CutOff, Nose's S and V */
double NumMol;
double Rho;
double KbT;
double Tau;
double CutOff;
double UniversalTime;
double S;
double V;
/* number-cycles, recording-frequency */
int NumIter;
int RecFrq;
/* programming variables */
double CutOff2;
double L;
double r2;
double r2i;
double r6i;
double tmp;
double ff;
double VV2;
int nr;
int nn;
int i;
int j;
int Nread;
char DirName[256] = "~/RedHatBackup/MD-Simulation-ReDo/CanonicalSimulation";
char ParamFileName[256] = "ThreeDMD.Parameters";
char * CurDir;
FILE *fpPar, *fpProp, *fopen();
main(argc, argv)
int argc;
char *argv[];
{
if(chdir(DirName) != 0) exit(99);
if((CurDir = getcwd(NULL,256)) == NULL) exit(1);
printf("CURRENT WORKING DIRECTORY: %s\n\n",CurDir);
/* read input configuration file */
fpPar = fopen("Pippo","r+");
printf("TRIED OPENING FILE !!! \n");
if(fpPar == NULL)
{
printf("Can't open Parameter File %s \n\n",ParamFileName);
perror("fopen failure");
exit(2);
}
fscanf(fpPar,"%lf ",&NumMol);
fscanf(fpPar,"%lf",&Rho);
fscanf(fpPar,"%lf",&KbT);
fscanf(fpPar,"%lf",&CutOff);
fscanf(fpPar,"%lf",&UniversalTime);
fscanf(fpPar,"%d",&NumIter);
fscanf(fpPar,"%lf",&Tau);
fscanf(fpPar,"%d",&RecFrq);
if((X = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Y = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Z = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Vx = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Vy = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Vz = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Fx = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Fy = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
if((Fz = (double *)calloc((int)NumMol,sizeof(double)))==NULL) exit(3);
nr=0;
while((Nread=fscanf(fpPar,"%lf %lf %lf %lf %lf %lf",&X[nr],&Y[nr],&Z[nr],&Vx[nr],&Vy[nr],&Vz[nr]))!=EOF) nr++;
if(nr != (int)NumMol) exit(4);
L= cbrt(NumMol/Rho);
CutOff2= CutOff*CutOff;
S=1;
V=0;
/*###########################################################################################*/
/*** update positions, S parameter, forces, velocities, V parameter ***/
/*--------------------------------------- Main Loop START ----------------------------------*/
for(nn=0; nn<NumIter; nn++)
{
UniversalTime += Tau;
for(i=0; i<(int)NumMol; i++)
{
X[i]+= Tau*Vx[i];
Y[i]+= Tau*Vy[i];
Z[i]+= Tau*Vz[i];
}
S += Tau*V;
for(i=0; i<(int)NumMol; i++)
{
Fx[i]=0;
Fy[i]=0;
Fz[i]=0;
}
for(i=0; i<(int)NumMol-1; i++)
for(j=i+1; j<(int)NumMol; j++)
{
tmp= (X[i]-X[j]) ? (X[i]-X[j]) - L*(int)((X[i]-X[j])/L) + 0.5 : (X[i]-X[j]) - L*(int)((X[i]-X[j])/L) - 0.5;
r2= tmp*tmp;
tmp= (Y[i]-Y[j]) ? (Y[i]-Y[j]) - L*(int)((Y[i]-Y[j])/L) + 0.5 : (Y[i]-Y[j]) - L*(int)((Y[i]-Y[j])/L) - 0.5;
r2+= tmp*tmp;
tmp= (Z[i]-Z[j]) ? (Z[i]-Z[j]) - L*(int)((Z[i]-Z[j])/L) + 0.5 : (Z[i]-Z[j]) - L*(int)((Z[i]-Z[j])/L) - 0.5;
r2+= tmp*tmp;
if(r2>=CutOff2) continue;
r2i=1.0/r2;
r6i=r2i*r2i*r2i;
ff=48*r2i*r6i*(r6i-0.5);
Fx[i]+=ff*(X[i]-X[j]);
Fy[i]+=ff*(Y[i]-Y[j]);
Fz[i]+=ff*(Z[i]-Z[j]);
Fx[j]-=ff*(X[i]-X[j]);
Fx[j]-=ff*(X[i]-X[j]);
Fx[j]-=ff*(X[i]-X[j]);
}
VV2=0;
for(i=0; i<(int)NumMol; i++)
{
Vx[i]= Vx[i]*(1- V*Tau/S)*(1- V*Tau/S) + Fx[i]*Tau/(S*S);
Vy[i]= Vy[i]*(1- V*Tau/S)*(1- V*Tau/S) + Fy[i]*Tau/(S*S);
Vz[i]= Vz[i]*(1- V*Tau/S)*(1- V*Tau/S) + Fz[i]*Tau/(S*S);
VV2+= Vx[i]*Vx[i] + Vy[i]*Vy[i] + Vz[i]*Vz[i];
}
V+= Tau*(S*VV2 - (3*NumMol +1)*KbT/S);
}
/*--------------------------------------- Main Loop END ------------------------------------*/
/*###########################################################################################*/
/* write output configuration file */
rewind(fpPar);
fprintf(fpPar,"%lf \n",NumMol);
fprintf(fpPar,"%lf \n",Rho);
fprintf(fpPar,"%lf \n",KbT);
fprintf(fpPar,"%lf \n",CutOff);
fprintf(fpPar,"%lf \n",UniversalTime);
fprintf(fpPar,"%d \n",NumIter);
fprintf(fpPar,"%lf \n",Tau);
fprintf(fpPar,"%d \n",RecFrq);
for(i=0; i<(int)NumMol; i++)
fprintf(fpPar,"%lf %lf %lf %lf %lf %lf \n",X[i],Y[i],Z[i],Vx[i],Vy[i],Vz[i]);
fclose(fpPar);
}
--------------F619EEC86E7557089097B822
Content-Type: text/plain; charset=us-ascii;
name="log"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="log"
[1] <- "(gdb) "
% netscape /usr/share/doc/packages/gvd/gvd.html
--------------F619EEC86E7557089097B822--