I need to run a public domain code in Molecular Dynamics

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 1822 Views - Last Post: 21 August 2014 - 08:40 AM Rate Topic: -----

#1 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 03:26 AM

Hi, everyone!
I just joined this forum. I need to run a public domain code in Molecular Dynamics. I have a Knoppix 7.2 system with Geany and gcc 4.7.2-5 and g++ 4:4.7.2-1 .
I need to compile this code and create a binary but can't.
The output:
gcc -o md md.c
/tmp/ccODg4eA.o: In function `compute':
md.c:(.text+0x718): undefined reference to `sin'
md.c:(.text+0x72a): undefined reference to `pow'
md.c:(.text+0x794): undefined reference to `sin'
/tmp/ccODg4eA.o: In function `dist':
md.c:(.text+0x8f9): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status



Please note that since this is a Public Domain code, I have not altered it. The main code:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <string.h>

int main ( int argc, char *argv[] );
void compute ( int np, int nd, double pos[], double vel[], 
  double mass, double f[], double *pot, double *kin );
double cpu_time ( void );
double dist ( int nd, double r1[], double r2[], double dr[] );
void initialize ( int np, int nd, double box[], int *seed, double pos[], 
  double vel[], double acc[] );
double r8_uniform_01 ( int *seed );
void timestamp ( void );
void update ( int np, int nd, double pos[], double vel[], double f[], 
  double acc[], double mass, double dt );

/******************************************************************************/

int main ( int argc, char *argv[] )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for MD.

  Discussion:

    MD implements a simple molecular dynamics simulation.

    The velocity Verlet time integration scheme is used. 

    The particles interact with a central pair potential.

  Usage:

    md nd np step_num
    where
    * nd is the spatial dimension (2 or 3);
    * np is the number of particles (500, for instance);
    * step_num is the number of time steps (500, for instance).

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    05 November 2010

  Author:

    Original FORTRAN90 version by Bill Magro.
    C version by John Burkardt.

  Parameters:

    None
*/
{
  double *acc;
  double *box;
  double ctime;
  double ctime1;
  double ctime2;
  double dt = 0.0001;
  double e0;
  double *force;
  int i;
  int id;
  double kinetic;
  double mass = 1.0;
  int nd;
  int np;
  double *pos;
  double potential;
  int seed = 123456789;
  int step;
  int step_num;
  int step_print;
  int step_print_index;
  int step_print_num;
  double *vel;

  timestamp ( );
  printf ( "\n" );
  printf ( "MD\n" );
  printf ( "  C version\n" );
  printf ( "  A molecular dynamics program.\n" );
/*
  Get the spatial dimension.
*/
  if ( 1 < argc )
  {
    nd = atoi ( argv[1] );
  }
  else
  {
    printf ( "\n" );
    printf ( "  Enter ND, the spatial dimension (2 or 3).\n" );
    scanf ( "%d", &nd );
  }
//
//  Get the number of points.
//
  if ( 2 < argc )
  {
    np = atoi ( argv[2] );
  }
  else
  {
    printf ( "\n" );
    printf ( "  Enter NP, the number of points (500, for instance).\n" );
    scanf ( "%d", &np );
  }
//
//  Get the number of time steps.
//
  if ( 3 < argc )
  {
    step_num = atoi ( argv[3] );
  }
  else
  {
    printf ( "\n" );
    printf ( "  Enter ND, the number of time steps (500 or 1000, for instance).\n" );
    scanf ( "%d", &step_num );
  }
/*
  Report.
*/
  printf ( "\n" );
  printf ( "  ND, the spatial dimension, is %d\n", nd );
  printf ( "  NP, the number of particles in the simulation, is %d\n", np );
  printf ( "  STEP_NUM, the number of time steps, is %d\n", step_num );
  printf ( "  DT, the size of each time step, is %f\n", dt );
/*
  Allocate memory.
*/
  acc = ( double * ) malloc ( nd * np * sizeof ( double ) );
  box = ( double * ) malloc ( nd * sizeof ( double ) );
  force = ( double * ) malloc ( nd * np * sizeof ( double ) );
  pos = ( double * ) malloc ( nd * np * sizeof ( double ) );
  vel = ( double * ) malloc ( nd * np * sizeof ( double ) );
/*
  Set the dimensions of the box.
*/
  for ( i = 0; i < nd; i++ )
  {
    box[i] = 10.0;
  }

  printf ( "\n" );
  printf ( "  Initializing positions, velocities, and accelerations.\n" );
/*
  Set initial positions, velocities, and accelerations.
*/
  initialize ( np, nd, box, &seed, pos, vel, acc );
/*
  Compute the forces and energies.
*/
  printf ( "\n" );
  printf ( "  Computing initial forces and energies.\n" );

  compute ( np, nd, pos, vel, mass, force, &potential, &kinetic );

  e0 = potential + kinetic;
/*
  This is the main time stepping loop:
    Compute forces and energies,
    Update positions, velocities, accelerations.
*/
  printf ( "\n" );
  printf ( "  At each step, we report the potential and kinetic energies.\n" );
  printf ( "  The sum of these energies should be a constant.\n" );
  printf ( "  As an accuracy check, we also print the relative error\n" );
  printf ( "  in the total energy.\n" );
  printf ( "\n" );
  printf ( "      Step      Potential       Kinetic        (P+K-E0)/E0\n" );
  printf ( "                Energy P        Energy K       Relative Energy Error\n" );
  printf ( "\n" );

  step_print = 0;
  step_print_index = 0;
  step_print_num = 10;
  
  step = 0;
  printf ( "  %8d  %14f  %14f  %14e\n",
    step, potential, kinetic, ( potential + kinetic - e0 ) / e0 );
  step_print_index = step_print_index + 1;
  step_print = ( step_print_index * step_num ) / step_print_num;

  ctime1 = cpu_time ( );

  for ( step = 1; step <= step_num; step++ )
  {
    compute ( np, nd, pos, vel, mass, force, &potential, &kinetic );

    if ( step == step_print )
    {
      printf ( "  %8d  %14f  %14f  %14e\n", step, potential, kinetic,
       ( potential + kinetic - e0 ) / e0 );
      step_print_index = step_print_index + 1;
      step_print = ( step_print_index * step_num ) / step_print_num;
    }
    update ( np, nd, pos, vel, force, acc, mass, dt );
  }
  ctime2 = cpu_time ( );
  ctime = ctime2 - ctime1;

  printf ( "\n" );
  printf ( "  Elapsed cpu time for main computation:\n" );
  printf ( "  %f seconds.\n", ctime );

  free ( acc );
  free ( box );
  free ( force );
  free ( pos );
  free ( vel );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "MD\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
/******************************************************************************/

void compute ( int np, int nd, double pos[], double vel[], 
  double mass, double f[], double *pot, double *kin )

/******************************************************************************/
/*
  Purpose:

    COMPUTE computes the forces and energies.

  Discussion:

    The computation of forces and energies is fully parallel.

    The potential function V(X) is a harmonic well which smoothly
    saturates to a maximum value at PI/2:

      v(x) = ( sin ( min ( x, PI2 ) ) )^2

    The derivative of the potential is:

      dv(x) = 2.0 * sin ( min ( x, PI2 ) ) * cos ( min ( x, PI2 ) )
            = sin ( 2.0 * min ( x, PI2 ) )

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    21 November 2007

  Author:

    Original FORTRAN90 version by Bill Magro.
    C version by John Burkardt.

  Parameters:

    Input, int NP, the number of particles.

    Input, int ND, the number of spatial dimensions.

    Input, double POS[ND*NP], the position of each particle.

    Input, double VEL[ND*NP], the velocity of each particle.

    Input, double MASS, the mass of each particle.

    Output, double F[ND*NP], the forces.

    Output, double *POT, the total potential energy.

    Output, double *KIN, the total kinetic energy.
*/
{
  double d;
  double d2;
  int i;
  int j;
  int k;
  double ke;
  double pe;
  double PI2 = 3.141592653589793 / 2.0;
  double rij[3];

  pe = 0.0;
  ke = 0.0;

  for ( k = 0; k < np; k++ )
  {
/*
  Compute the potential energy and forces.
*/
    for ( i = 0; i < nd; i++ )
    {
      f[i+k*nd] = 0.0;
    }

    for ( j = 0; j < np; j++ )
    {
      if ( k != j )
      {
        d = dist ( nd, pos+k*nd, pos+j*nd, rij );
/*
  Attribute half of the potential energy to particle J.
*/
        if ( d < PI2 )
        {
          d2 = d;
        }
        else
        {
          d2 = PI2;
        }

        pe = pe + 0.5 * pow ( sin ( d2 ), 2 );

        for ( i = 0; i < nd; i++ )
        {
          f[i+k*nd] = f[i+k*nd] - rij[i] * sin ( 2.0 * d2 ) / d;
        }
      }
    }
/*
  Compute the kinetic energy.
*/
    for ( i = 0; i < nd; i++ )
    {
      ke = ke + vel[i+k*nd] * vel[i+k*nd];
    }
  }

  ke = ke * 0.5 * mass;
  
  *pot = pe;
  *kin = ke;

  return;
}
/*******************************************************************************/

double cpu_time ( void )

/*******************************************************************************/
/*
  Purpose:
 
    CPU_TIME reports the total CPU time for a program.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    27 September 2005

  Author:

    John Burkardt

  Parameters:

    Output, double CPU_TIME, the current total elapsed CPU time in second.
*/
{
  double value;

  value = ( double ) clock ( ) / ( double ) CLOCKS_PER_SEC;

  return value;
}
/******************************************************************************/

double dist ( int nd, double r1[], double r2[], double dr[] )

/******************************************************************************/
/*
  Purpose:

    DIST computes the displacement (and its norm) between two particles.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    21 November 2007

  Author:

    Original FORTRAN90 version by Bill Magro.
    C version by John Burkardt.

  Parameters:

    Input, int ND, the number of spatial dimensions.

    Input, double R1[ND], R2[ND], the positions of the particles.

    Output, double DR[ND], the displacement vector.

    Output, double D, the Euclidean norm of the displacement.
*/
{
  double d;
  int i;

  d = 0.0;
  for ( i = 0; i < nd; i++ )
  {
    dr[i] = r1[i] - r2[i];
    d = d + dr[i] * dr[i];
  }
  d = sqrt ( d );

  return d;
}
/******************************************************************************/

void initialize ( int np, int nd, double box[], int *seed, double pos[], 
  double vel[], double acc[] )

/******************************************************************************/
/*
  Purpose:

    INITIALIZE initializes the positions, velocities, and accelerations.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    20 July 2008

  Author:

    Original FORTRAN90 version by Bill Magro.
    C version by John Burkardt.

  Parameters:

    Input, int NP, the number of particles.

    Input, int ND, the number of spatial dimensions.

    Input, double BOX[ND], specifies the maximum position
    of particles in each dimension.

    Input, int *SEED, a seed for the random number generator.

    Output, double POS[ND*NP], the position of each particle.

    Output, double VEL[ND*NP], the velocity of each particle.

    Output, double ACC[ND*NP], the acceleration of each particle.
*/
{
  int i;
  int j;
/*
  Give the particles random positions within the box.
*/
  for ( j = 0; j < np; j++ )
  {
    for ( i = 0; i < nd; i++ )
    {
      pos[i+j*nd] = box[i] * r8_uniform_01 ( seed );
      vel[i+j*nd] = 0.0;
      acc[i+j*nd] = 0.0;
    }
  }
  return;
}
/******************************************************************************/

double r8_uniform_01 ( int *seed )

/******************************************************************************/
/*
  Purpose:

    R8_UNIFORM_01 is a unit pseudorandom R8.

  Discussion:

    This routine implements the recursion

      seed = 16807 * seed mod ( 2^31 - 1 )
      unif = seed / ( 2^31 - 1 )

    The integer arithmetic never requires more than 32 bits,
    including a sign bit.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    11 August 2004

  Author:

    John Burkardt

  Reference:

    Paul Bratley, Bennett Fox, Linus Schrage,
    A Guide to Simulation,
    Springer Verlag, pages 201-202, 1983.

    Bennett Fox,
    Algorithm 647:
    Implementation and Relative Efficiency of Quasirandom
    Sequence Generators,
    ACM Transactions on Mathematical Software,
    Volume 12, Number 4, pages 362-376, 1986.

  Parameters:

    Input/output, int *SEED, a seed for the random number generator.

    Output, double R8_UNIFORM_01, a new pseudorandom variate, strictly between
    0 and 1.
*/
{
  int k;
  double r;

  k = *seed / 127773;

  *seed = 16807 * ( *seed - k * 127773 ) - k * 2836;

  if ( *seed < 0 )
  {
    *seed = *seed + 2147483647;
  }

  r = ( double ) ( *seed ) * 4.656612875E-10;

  return r;
}
/******************************************************************************/

void timestamp ( void )

/******************************************************************************/
/*
  Purpose:

    TIMESTAMP prints the current YMDHMS date as a time stamp.

  Example:

    31 May 2001 09:45:54 AM

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    24 September 2003

  Author:

    John Burkardt

  Parameters:

    None
*/
{
# define TIME_SIZE 40

  static char time_buffer[TIME_SIZE];
  const struct tm *tm;
  size_t len;
  time_t now;

  now = time ( NULL );
  tm = localtime ( &now );

  len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm );

  printf ( "%s\n", time_buffer );

  return;
# undef TIME_SIZE
}
/******************************************************************************/

void update ( int np, int nd, double pos[], double vel[], double f[], 
  double acc[], double mass, double dt )

/******************************************************************************/
/*
  Purpose:

    UPDATE updates positions, velocities and accelerations.

  Discussion:

    The time integration is fully parallel.

    A velocity Verlet algorithm is used for the updating.

    x(t+dt) = x(t) + v(t) * dt + 0.5 * a(t) * dt * dt
    v(t+dt) = v(t) + 0.5 * ( a(t) + a(t+dt) ) * dt
    a(t+dt) = f(t) / m

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    21 November 2007

  Author:

    Original FORTRAN90 version by Bill Magro.
    C version by John Burkardt.

  Parameters:

    Input, int NP, the number of particles.

    Input, int ND, the number of spatial dimensions.

    Input/output, double POS[ND*NP], the position of each particle.

    Input/output, double VEL[ND*NP], the velocity of each particle.

    Input, double F[ND*NP], the force on each particle.

    Input/output, double ACC[ND*NP], the acceleration of each particle.

    Input, double MASS, the mass of each particle.

    Input, double DT, the time step.
*/
{
  int i;
  int j;
  double rmass;

  rmass = 1.0 / mass;

  for ( j = 0; j < np; j++ )
  {
    for ( i = 0; i < nd; i++ )
    {
      pos[i+j*nd] = pos[i+j*nd] + vel[i+j*nd] * dt + 0.5 * acc[i+j*nd] * dt * dt;
      vel[i+j*nd] = vel[i+j*nd] + 0.5 * dt * ( f[i+j*nd] * rmass + acc[i+j*nd] );
      acc[i+j*nd] = f[i+j*nd] * rmass;
    }
  }

  return;
}


Please help.

Is This A Good Question/Topic? 0
  • +

Replies To: I need to run a public domain code in Molecular Dynamics

#2 Salem_c   User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2555
  • View blog
  • Posts: 4,740
  • Joined: 30-May 10

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 03:33 AM

Type
gcc -o md md.c -lm

That's lower-case LM

-l tells the linker to use this library (in this case, the math library).
Was This Post Helpful? 1
  • +
  • -

#3 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 03:38 AM

Thank you. How do I read gcc option codes? I tried man gcc, but doesn't work.
Was This Post Helpful? 0
  • +
  • -

#4 Salem_c   User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2555
  • View blog
  • Posts: 4,740
  • Joined: 30-May 10

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 04:22 AM

"man gcc" typed into google perhaps?
Was This Post Helpful? 0
  • +
  • -

#5 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 06:16 AM

Thank you. I am sorry I couldn't explain myself properly. I meant in my system is there a possibility to install the man relavant man page, viz., similar to the page available at http://www.manpages....inux/gcc.1.html, without reinstalling gcc?
I found that gcc stores its man page in /usr/share/man/man1, viz.,
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/c89-gcc.1.gz
/usr/share/man/man1/c99-gcc.1.gz


I entered at a terminal:
man gcc- with tab and the following options were provided by the system:
gcc-ar-4.7 gcc-nm-4.7 gcc-ranlib-4.7

and man c89 with tab and the following options were given:
c89 c89-gcc

But none of these are the usual man files. So how can I have the relavant files in the system so that I could read the man page for gcc from the terminal itself.
Was This Post Helpful? 0
  • +
  • -

#6 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 06:36 AM

I have attached the code and a header file to compile the program as:
 gcc -o bms brownian_motion_simulation.c -lm
, as guided.
I get the output:
/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status


I replaced the line
 # include "brownian_motion_simulation.h"

 # include <brownian_motion_simulation.h>
but this change outputs fatal error.
Has it anything to do with the particular header file?
Was This Post Helpful? 0
  • +
  • -

#7 jimblumberg   User is offline

  • member icon

Reputation: 5916
  • View blog
  • Posts: 17,932
  • Joined: 25-December 09

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 07:17 AM

Quote

Has it anything to do with the particular header file?

No, your error message is telling you one of two things.

1. Your program doesn't have the required function named main. Every executable program must have a function named main().
2. You're not compiling the program as a library as you intended. You should check the documentation for your compiler to see how to generate a library instead of an executable.


Jim
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 07:21 AM

** Topics Merged **
Was This Post Helpful? 0
  • +
  • -

#9 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 09:05 AM

Firstly, regarding merging topics: The two are separate programs on single topic. To me merging will not cause any problem, but to others it might.
But thank you for acting on the posts.

Secondly, I have tried both:
int main(int argc, char **argv);
and
int main(void);

But I am still getting the same error messages.
Was This Post Helpful? 0
  • +
  • -

#10 jimblumberg   User is offline

  • member icon

Reputation: 5916
  • View blog
  • Posts: 17,932
  • Joined: 25-December 09

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 09:55 AM

The function main() doesn't need a prototype, it needs to be implemented.

int main()
{
   // Do something useful.
   return 0;
}




That is of course if you're trying to create an executable, not a library.

Jim
Was This Post Helpful? 0
  • +
  • -

#11 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 10:14 AM

Thank you. I made the executable. It doesn't seem to do anything. I will check and get back.
# include <stdlib.h>
# include <stdio.h>
# include <math.h>
# include <time.h>
# include <string.h>

# include "brownian_motion_simulation.h"
/* int main(int argc, char **argv); */
/* int main(void); */
int main()
{
/******************************************************************************/

void brownian_displacement_display ( int k, int n, double d, double t, 
  double dsq[], char *header )

/******************************************************************************/
/*
  Purpose:

    BROWNIAN_DISPLACEMENT_DISPLAY displays average Brownian motion displacement.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    01 October 2012

  Author:

    John Burkardt

  Parameters:

    Input, int K, the number of repetitions.

    Input, int N, the number of time steps.  

    Input, double D, the diffusion coefficient.

    Input, double T, the total time.

    Input, double DSQ[K*N], the displacements over time for 
    each repetition.

    Input, char *HEADER, an identifier for the output files.
*/
{
  char command_filename[80];
  FILE *command;
  char data_filename[80];
  FILE *data;
  double dsq_ave;
  double dsq_ideal;
  int i;
  int *ii;
  int j;
  int seed;
  double ti;

  seed = 123456789;
/*
  Choose 5 paths at random.
*/
  ii = i4vec_uniform_new ( 5, 0, k - 1, &seed );
/*
  Create the data file.
*/
  strcpy ( data_filename, header );
  strcat ( data_filename, "_data.txt" );

  data = fopen ( data_filename, "wt" );

  for ( j = 0; j < n; j++ )
  {
    ti = ( double ) ( j ) * t / ( double ) ( n - 1 );
    dsq_ave = 0.0;
    for ( i = 0; i < k; i++ )
    {
      dsq_ave = dsq_ave + dsq[i+j*k];
    }
    dsq_ave = dsq_ave / ( double ) k;
    dsq_ideal = d * ti;
    fprintf ( data, "  %g  %g  %g  %g  %g  %g  %g  %g\n",
      ti, dsq[ii[0]+j*k], dsq[ii[1]+j*k], dsq[ii[2]+j*k], dsq[ii[3]+j*k],
      dsq[ii[3]+j*k], dsq_ave, dsq_ideal );
  }

  fclose ( data );

  printf ( "\n" );
  printf ( "  BROWNIAN_DISPLACEMENT data stored in \"%s\".\n", data_filename );
/*
  Create the command file.
*/
  strcpy ( command_filename, header );
  strcat ( command_filename, "_commands.txt" );

  command = fopen ( command_filename, "wt" );

  fprintf ( command, "# %s\n", command_filename );
  fprintf ( command, "#\n" );
  fprintf ( command, "# Usage:\n" );
  fprintf ( command, "#  gnuplot < %s\n", command_filename );
  fprintf ( command, "#\n" );
  fprintf ( command, "set term png\n" );
  fprintf ( command, "set output '%s.png'\n", header );
  fprintf ( command, "set xlabel 'T'\n" );
  fprintf ( command, "set ylabel 'D^2'\n" );
  fprintf ( command, "set title 'Squared displacement (Red), Predicted (Black), Samples (Blue)'\n" );
  fprintf ( command, "set grid\n" );
  fprintf ( command, "set style data lines\n" );
  fprintf ( command, "plot '%s' using 1:2 title 'sample 1' linecolor rgb 'blue', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:3 title 'sample 2' linecolor rgb 'blue', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:4 title 'sample 3' linecolor rgb 'blue', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:5 title 'sample 4' linecolor rgb 'blue', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:6 title 'sample 5' linecolor rgb 'blue', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:7 title 'Averaged' lw 3 linecolor rgb 'red', \\\n", data_filename );
  fprintf ( command, "     '%s' using 1:8 title 'Ideal' lw 3 linecolor rgb 'black'\n", data_filename );
  fprintf ( command, "quit\n" );

  fclose ( command );

  printf ( "  BROWNIAN_DISPLACEMENT plot commands stored in \"%s\".\n", 
    command_filename );

  free ( ii );

  return;
}
/******************************************************************************/

double *brownian_displacement_simulation ( int k, int n, int m, double d, 
  double t, int *seed )

/******************************************************************************/
/*
  Purpose:

    BROWNIAN_DISPLACEMENT_SIMULATION simulates Brownian displacement.

  Discussion:

    This function computes the square of the distance of the Brownian
    particle from the starting point, repeating this calculation 
    several times.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    01 October 2012

  Author:

    John Burkardt

  Parameters:

    Input, int K, the number of repetitions.

    Input, int N, the number of time steps to take, plus 1.

    Input, int M, the spatial dimension.

    Input, double D, the diffusion coefficient.
    Computationally, this is simply a scale factor between time and space.

    Input, double T, the total time.

    Input/output, int *SEED, a seed for the random
    number generator.

    Output, double BROWNIAN_DISPLACEMENT_SIMULATION[K*N], the displacements 
    over time for each repetition. 
*/
{
  double *dsq;
  int i;
  int i2;
  int j;
  double temp;
  double *x;

  dsq = ( double * ) malloc ( k * n * sizeof ( double ) );

  for ( i = 0; i < k; i++ )
  {
    x = brownian_motion_simulation ( m, n, d, t, seed );

    for ( j = 0; j < n; j++ )
    {
      temp = 0.0;
      for ( i2 = 0; i2 < m; i2++ )
      {
        temp = temp + pow ( x[i2+j*m], 2 );
      }
      dsq[i+j*k] = temp;
    }
    free ( x );
  }

  return dsq;
}
/******************************************************************************/

void brownian_motion_display ( int m, int n, double x[], char *header )

/******************************************************************************/
/*
  Purpose:

    BROWNIAN_MOTION_DISPLAY displays successive Brownian motion positions.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    01 October 2012

  Author:

    John Burkardt

  Parameters:

    Input, int M, the spatial dimension.
    M should be 1 or 2.

    Input, int N, the number of time steps. 

    Input, double X[M*N], the particle positions.

    Input, char *HEADER, an identifier for the output files.
*/
{
  char command_filename[80];
  FILE *command;
  char data_filename[80];
  FILE *data;
  int i;
  double t;

  if ( m != 1 && m != 2 )
  {
    fprintf ( stderr, "\n" );
    fprintf ( stderr, "BROWNIAN_MOTION_DISPLAY - Fatal error!\n" );
    fprintf ( stderr, "  This routine can only handle M = 1 or 2.\n" );
    exit ( 1 );
  }
/*
  Create the data file.
*/
  strcpy ( data_filename, header );
  strcat ( data_filename, "_data.txt" );

  data = fopen ( data_filename, "wt" );

  if ( m == 1 )
  {
    for ( i = 0; i < n; i++ )
    {
      t = ( double ) ( i - 1 ) / ( double ) ( n - 1 );
      fprintf ( data, "  %g  %g\n", t, x[0+i*m] );
    }
  }
  else if ( m == 2 )
  {
    for ( i = 0; i < n; i++ )
    {
      fprintf ( data, "  %g  %g\n", x[0+i*m], x[1+i*m] );
    }
  }

  fclose ( data );

  printf ( "\n" );
  printf ( "  BROWNIAN_MOTION data stored in \"%s\".\n", data_filename );
/*
  Create the command file.
*/
  strcpy ( command_filename, header );
  strcat ( command_filename, "_commands.txt" );

  command = fopen ( command_filename, "wt" );

  fprintf ( command, "# %s\n", command_filename );
  fprintf ( command, "#\n" );
  fprintf ( command, "# Usage:\n" );
  fprintf ( command, "#  gnuplot < %s\n", command_filename );
  fprintf ( command, "#\n" );
  fprintf ( command, "set term png\n" );
  fprintf ( command, "set output '%s.png'\n", header );
  fprintf ( command, "set xlabel 'X'\n" );
  fprintf ( command, "set ylabel 'T'\n" );
  fprintf ( command, "set title 'Brownian motion in 1D'\n" );
  fprintf ( command, "set grid\n" );
  fprintf ( command, "set style data lines\n" );
  fprintf ( command, "plot '%s' using 1:2\n", data_filename );
  fprintf ( command, "quit\n" );

  fclose ( command );

  printf ( "  BROWNIAN_MOTION plot commands stored in \"%s\".\n", command_filename );

  return;
}
/******************************************************************************/

double *brownian_motion_simulation ( int m, int n, double d, double t, 
  int *seed )

/******************************************************************************/
/*
  Purpose:

    BROWNIAN_MOTION_SIMULATION simulates Brownian motion.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    01 October 2012

  Author:

    John Burkardt

  Parameters:

    Input, int M, the spatial dimension.

    Input, int N, the number of time steps to take, plus 1. 

    Input, double D, the diffusion coefficient.  

    Input, double T, the total time.

    Input/output, int *SEED, a seed for the random
    number generator.

    Output, double BROWNIAN_MOTION_SIMULATION[M*N], the initial position at 
    time 0.0, and the N-1 successive locations of the particle.
*/
{
  double dt;
  double *dx;
  int i;
  int j;
  double norm_dx;
  double s;
  double *x;

  x = ( double * ) malloc ( m * n * sizeof ( double ) );
/*
  Set the time step.
*/
  dt = t / ( double ) ( n - 1 );
/*
  Start at the origin.
*/
  for ( i = 0; i < m; i++ )
  {
    x[i+0*m] = 0.0;
  }
/*
  Take N - 1 steps.
*/
  for ( j = 1; j < n; j++ )
  {
/*
  S is the stepsize.
*/
    s = sqrt ( d * dt ) * r8_normal_01 ( seed );
/*
  Direction DX is random, unit norm.
*/
    dx = r8vec_normal_01_new ( m, seed );
    norm_dx = 0.0;
    for ( i = 0; i < m; i++ )
    {
      norm_dx = norm_dx + pow ( dx[i], 2 );
    }
    norm_dx = sqrt ( norm_dx );
    for ( i = 0; i < m; i++ )
    {
      dx[i] = s * dx[i] / norm_dx;
    }
/*
  Add the step to the current position.
*/
    for ( i = 0; i < m; i++ )
    {
      x[i+j*m] = x[i+(j-1)*m] + dx[i];
    }
  }
  return x;
}
/******************************************************************************/

int *i4vec_uniform_new ( int n, int a, int b, int *seed )

/******************************************************************************/
/*
  Purpose:

    I4VEC_UNIFORM_NEW returns a scaled pseudorandom I4VEC.

  Discussion:

    The pseudorandom numbers should be uniformly distributed
    between A and B.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    24 May 2012

  Author:

    John Burkardt

  Reference:

    Paul Bratley, Bennett Fox, Linus Schrage,
    A Guide to Simulation,
    Second Edition,
    Springer, 1987,
    ISBN: 0387964673,
    LC: QA76.9.C65.B73.

    Bennett Fox,
    Algorithm 647:
    Implementation and Relative Efficiency of Quasirandom
    Sequence Generators,
    ACM Transactions on Mathematical Software,
    Volume 12, Number 4, December 1986, pages 362-376.

    Pierre L'Ecuyer,
    Random Number Generation,
    in Handbook of Simulation,
    edited by Jerry Banks,
    Wiley, 1998,
    ISBN: 0471134031,
    LC: T57.62.H37.

    Peter Lewis, Allen Goodman, James Miller,
    A Pseudo-Random Number Generator for the System/360,
    IBM Systems Journal,
    Volume 8, Number 2, 1969, pages 136-143.

  Parameters:

    Input, integer N, the dimension of the vector.

    Input, int A, B, the limits of the interval.

    Input/output, int *SEED, the "seed" value, which should NOT be 0.
    On output, SEED has been updated.

    Output, int I4VEC_UNIFORM_NEW[N], a vector of random values between A and B.
*/
{
  int c;
  int i;
  int i4_huge = 2147483647;
  int k;
  float r;
  int value;
  int *x;

  if ( *seed == 0 )
  {
    fprintf ( stderr, "\n" );
    fprintf ( stderr, "I4VEC_UNIFORM_NEW - Fatal error!\n" );
    fprintf ( stderr, "  Input value of SEED = 0.\n" );
    exit ( 1 );
  }
/*
  Guaranteee A <= B.
*/
  if ( b < a )
  {
    c = a;
    a = b;
    b = c;
  }

  x = ( int * ) malloc ( n * sizeof ( int ) );

  for ( i = 0; i < n; i++ )
  {
    k = *seed / 127773;

    *seed = 16807 * ( *seed - k * 127773 ) - k * 2836;

    if ( *seed < 0 )
    {
      *seed = *seed + i4_huge;
    }

    r = ( float ) ( *seed ) * 4.656612875E-10;
/*
  Scale R to lie between A-0.5 and B+0.5.
*/
    r = ( 1.0 - r ) * ( ( float ) a - 0.5 ) 
      +         r   * ( ( float ) b + 0.5 );
/*
  Use rounding to convert R to an integer between A and B.
*/
    value = round ( r );
/*
  Guarantee A <= VALUE <= B.
*/
    if ( value < a )
    {
      value = a;
    }
    if ( b < value )
    {
      value = b;
    }

    x[i] = value;
  }

  return x;
}
/******************************************************************************/

double r8_normal_01 ( int *seed )

/******************************************************************************/
/*
  Purpose:

    R8_NORMAL_01 samples the standard normal probability distribution.

  Discussion:

    The standard normal probability distribution function (PDF) has
    mean 0 and standard deviation 1.

    The Box-Muller method is used, which is efficient, but
    generates two values at a time.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    01 July 2008

  Author:

    John Burkardt

  Parameters:

    Input/output, int *SEED, a seed for the random number generator.

    Output, double R8_NORMAL_01, a normally distributed random value.
*/
{
  double pi = 3.141592653589793;
  double r1;
  double r2;
  static int used = -1;
  double x;
  static double y = 0.0;

  if ( used == -1 )
  {
    used = 0;
  }
/*
  If we've used an even number of values so far, generate two more, return one,
  and save one.
*/
  if ( ( used % 2 )== 0 )
  {
    for ( ; ; )
    {
      r1 = r8_uniform_01 ( seed );
      if ( r1 != 0.0 )
      {
        break;
      }
    }

    r2 = r8_uniform_01 ( seed );

    x = sqrt ( -2.0 * log ( r1 ) ) * cos ( 2.0 * pi * r2 );
    y = sqrt ( -2.0 * log ( r1 ) ) * sin ( 2.0 * pi * r2 );
  }
  else
  {

    x = y;

  }

  used = used + 1;

  return x;
}
/******************************************************************************/

double r8_uniform_01 ( int *seed )

/******************************************************************************/
/*
  Purpose:

    R8_UNIFORM_01 returns a unit pseudorandom R8.

  Discussion:

    This routine implements the recursion

      seed = 16807 * seed mod ( 2^31 - 1 )
      r8_uniform_01 = seed / ( 2^31 - 1 )

    The integer arithmetic never requires more than 32 bits,
    including a sign bit.

    If the initial seed is 12345, then the first three computations are

      Input     Output      R8_UNIFORM_01
      SEED      SEED

         12345   207482415  0.096616
     207482415  1790989824  0.833995
    1790989824  2035175616  0.947702

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    11 August 2004

  Author:

    John Burkardt

  Reference:

    Paul Bratley, Bennett Fox, Linus Schrage,
    A Guide to Simulation,
    Springer Verlag, pages 201-202, 1983.

    Pierre L'Ecuyer,
    Random Number Generation,
    in Handbook of Simulation
    edited by Jerry Banks,
    Wiley Interscience, page 95, 1998.

    Bennett Fox,
    Algorithm 647:
    Implementation and Relative Efficiency of Quasirandom
    Sequence Generators,
    ACM Transactions on Mathematical Software,
    Volume 12, Number 4, pages 362-376, 1986.

    P A Lewis, A S Goodman, J M Miller,
    A Pseudo-Random Number Generator for the System/360,
    IBM Systems Journal,
    Volume 8, pages 136-143, 1969.

  Parameters:

    Input/output, int *SEED, the "seed" value.  Normally, this
    value should not be 0.  On output, SEED has been updated.

    Output, double R8_UNIFORM_01, a new pseudorandom variate, strictly between
    0 and 1.
*/
{
  int k;
  double r;

  k = *seed / 127773;

  *seed = 16807 * ( *seed - k * 127773 ) - k * 2836;

  if ( *seed < 0 )
  {
    *seed = *seed + 2147483647;
  }

  r = ( ( double ) ( *seed ) ) * 4.656612875E-10;

  return r;
}
/******************************************************************************/

double *r8vec_normal_01_new ( int n, int *seed )

/******************************************************************************/
/*
  Purpose:

    R8VEC_NORMAL_01_NEW returns a unit pseudonormal R8VEC.

  Discussion:

    The standard normal probability distribution function (PDF) has
    mean 0 and standard deviation 1.

    This routine can generate a vector of values on one call.  It
    has the feature that it should provide the same results
    in the same order no matter how we break up the task.

    Before calling this routine, the user may call RANDOM_SEED
    in order to set the seed of the random number generator.

    The Box-Muller method is used, which is efficient, but
    generates an even number of values each time.  On any call
    to this routine, an even number of new values are generated.
    Depending on the situation, one value may be left over.
    In that case, it is saved for the next call.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    18 February 2012

  Author:

    John Burkardt

  Parameters:

    Input, int N, the number of values desired.  If N is negative,
    then the code will flush its internal memory; in particular,
    if there is a saved value to be used on the next call, it is
    instead discarded.  This is useful if the user has reset the
    random number seed, for instance.

    Input/output, int *SEED, a seed for the random number generator.

    Output, double R8VEC_NORMAL_01_NEW[N], a sample of the standard normal PDF.

  Local parameters:

    Local, int MADE, records the number of values that have
    been computed.  On input with negative N, this value overwrites
    the return value of N, so the user can get an accounting of
    how much work has been done.

    Local, double R[N+1], is used to store some uniform random values.
    Its dimension is N+1, but really it is only needed to be the
    smallest even number greater than or equal to N.

    Local, int SAVED, is 0 or 1 depending on whether there is a
    single saved value left over from the previous call.

    Local, int X_LO, X_HI, records the range of entries of
    X that we need to compute.  This starts off as 1:N, but is adjusted
    if we have a saved value that can be immediately stored in X(1),
    and so on.

    Local, double Y, the value saved from the previous call, if
    SAVED is 1.
*/
{
# define R8_PI 3.141592653589793

  int i;
  int m;
  static int made = 0;
  double *r;
  static int saved = 0;
  double *x;
  int x_hi;
  int x_lo;
  static double y = 0.0;

  x = ( double * ) malloc ( n * sizeof ( double ) );
/*
  I'd like to allow the user to reset the internal data.
  But this won't work properly if we have a saved value Y.
  I'm making a crock option that allows the user to signal
  explicitly that any internal memory should be flushed,
  by passing in a negative value for N.
*/
  if ( n < 0 )
  {
    made = 0;
    saved = 0;
    y = 0.0;
    return NULL;
  }
  else if ( n == 0 )
  {
    return NULL;
  }
/*
  Record the range of X we need to fill in.
*/
  x_lo = 1;
  x_hi = n;
/*
  Use up the old value, if we have it.
*/
  if ( saved == 1 )
  {
    x[0] = y;
    saved = 0;
    x_lo = 2;
  }
/*
  Maybe we don't need any more values.
*/
  if ( x_hi - x_lo + 1 == 0 )
  {
  }
/*
  If we need just one new value, do that here to avoid null arrays.
*/
  else if ( x_hi - x_lo + 1 == 1 )
  {
    r = r8vec_uniform_01_new ( 2, seed );

    x[x_hi-1] = sqrt ( - 2.0 * log ( r[0] ) ) * cos ( 2.0 * R8_PI * r[1] );
    y =         sqrt ( - 2.0 * log ( r[0] ) ) * sin ( 2.0 * R8_PI * r[1] );

    saved = 1;

    made = made + 2;

    free ( r );
  }
/*
  If we require an even number of values, that's easy.
*/
  else if ( ( x_hi - x_lo + 1 ) % 2 == 0 )
  {
    m = ( x_hi - x_lo + 1 ) / 2;

    r = r8vec_uniform_01_new ( 2*m, seed );

    for ( i = 0; i <= 2*m-2; i = i + 2 )
    {
      x[x_lo+i-1] = sqrt ( - 2.0 * log ( r[i] ) ) * cos ( 2.0 * R8_PI * r[i+1] );
      x[x_lo+i  ] = sqrt ( - 2.0 * log ( r[i] ) ) * sin ( 2.0 * R8_PI * r[i+1] );
    }
    made = made + x_hi - x_lo + 1;

    free ( r );
  }
/*
  If we require an odd number of values, we generate an even number,
  and handle the last pair specially, storing one in X(N), and
  saving the other for later.
*/
  else
  {
    x_hi = x_hi - 1;

    m = ( x_hi - x_lo + 1 ) / 2 + 1;

    r = r8vec_uniform_01_new ( 2*m, seed );

    for ( i = 0; i <= 2*m-4; i = i + 2 )
    {
      x[x_lo+i-1] = sqrt ( - 2.0 * log ( r[i] ) ) * cos ( 2.0 * R8_PI * r[i+1] );
      x[x_lo+i  ] = sqrt ( - 2.0 * log ( r[i] ) ) * sin ( 2.0 * R8_PI * r[i+1] );
    }

    i = 2*m - 2;

    x[x_lo+i-1] = sqrt ( - 2.0 * log ( r[i] ) ) * cos ( 2.0 * R8_PI * r[i+1] );
    y           = sqrt ( - 2.0 * log ( r[i] ) ) * sin ( 2.0 * R8_PI * r[i+1] );

    saved = 1;

    made = made + x_hi - x_lo + 2;

    free ( r );
  }

  return x;
# undef R8_PI
}
/******************************************************************************/

double *r8vec_uniform_01_new ( int n, int *seed )

/******************************************************************************/
/*
  Purpose:

    R8VEC_UNIFORM_01_NEW returns a unit pseudorandom R8VEC.

  Discussion:

    This routine implements the recursion

      seed = 16807 * seed mod ( 2^31 - 1 )
      unif = seed / ( 2^31 - 1 )

    The integer arithmetic never requires more than 32 bits,
    including a sign bit.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    19 August 2004

  Author:

    John Burkardt

  Reference:

    Paul Bratley, Bennett Fox, Linus Schrage,
    A Guide to Simulation,
    Second Edition,
    Springer, 1987,
    ISBN: 0387964673,
    LC: QA76.9.C65.B73.

    Bennett Fox,
    Algorithm 647:
    Implementation and Relative Efficiency of Quasirandom
    Sequence Generators,
    ACM Transactions on Mathematical Software,
    Volume 12, Number 4, December 1986, pages 362-376.

    Pierre L'Ecuyer,
    Random Number Generation,
    in Handbook of Simulation,
    edited by Jerry Banks,
    Wiley, 1998,
    ISBN: 0471134031,
    LC: T57.62.H37.

    Peter Lewis, Allen Goodman, James Miller,
    A Pseudo-Random Number Generator for the System/360,
    IBM Systems Journal,
    Volume 8, Number 2, 1969, pages 136-143.

  Parameters:

    Input, int N, the number of entries in the vector.

    Input/output, int *SEED, a seed for the random number generator.

    Output, double R8VEC_UNIFORM_01_NEW[N], the vector of pseudorandom values.
*/
{
  int i;
  int i4_huge = 2147483647;
  int k;
  double *r;

  if ( *seed == 0 )
  {
    fprintf ( stderr, "\n" );
    fprintf ( stderr, "R8VEC_UNIFORM_01_NEW - Fatal error!\n" );
    fprintf ( stderr, "  Input value of SEED = 0.\n" );
    exit ( 1 );
  }

  r = ( double * ) malloc ( n * sizeof ( double ) );

  for ( i = 0; i < n; i++ )
  {
    k = *seed / 127773;

    *seed = 16807 * ( *seed - k * 127773 ) - k * 2836;

    if ( *seed < 0 )
    {
      *seed = *seed + i4_huge;
    }

    r[i] = ( double ) ( *seed ) * 4.656612875E-10;
  }

  return r;
}
/******************************************************************************/

void timestamp ( void )

/******************************************************************************/
/*
  Purpose:

    TIMESTAMP prints the current YMDHMS date as a time stamp.

  Example:

    31 May 2001 09:45:54 AM

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    24 September 2003

  Author:

    John Burkardt

  Parameters:

    None
*/
{
# define TIME_SIZE 40

  static char time_buffer[TIME_SIZE];
  const struct tm *tm;
  size_t len;
  time_t now;

  now = time ( NULL );
  tm = localtime ( &now );

  len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm );

  fprintf ( stdout, "%s\n", time_buffer );

  return;
# undef TIME_SIZE
}
return 0;
}


Was This Post Helpful? 0
  • +
  • -

#12 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 10:20 AM

No, not working as intended. The main() and return 0 have stopped the intended function, it appears.
Was This Post Helpful? 0
  • +
  • -

#13 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 10:26 AM

The header file, to be saved as

Quote

brownian_motion_simulation.h


void brownian_displacement_display ( int k, int n, double d, double t, 
  double dsq[], char *header );
double *brownian_displacement_simulation ( int k, int n, int m, double d, 
  double t, int *seed );
void brownian_motion_display ( int m, int n, double x[], char *header );
double *brownian_motion_simulation ( int m, int n, double d, double t, 
  int *seed );
int *i4vec_uniform_new ( int n, int a, int b, int *seed );
double r8_normal_01 ( int *seed );
double r8_uniform_01 ( int *seed );
double *r8vec_normal_01_new ( int n, int *seed );
double *r8vec_uniform_01_new ( int n, int *seed );
void timestamp ( void );


Was This Post Helpful? 0
  • +
  • -

#14 jimblumberg   User is offline

  • member icon

Reputation: 5916
  • View blog
  • Posts: 17,932
  • Joined: 25-December 09

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 10:31 AM

That mess shouldn't even compile, unless you happen to be using compiler specific hacks.

Can you tell me what you intend with the following snippet:

int main()
{
   void brownian_displacement_display ( int k, int n, double d, double t, 
          double dsq[], char *header )
   {
      char command_filename[80];
...



Note that I removed most of your comments and reformatted the snippet properly.

Perhaps you should review your documentation on how to create and use functions. Perhaps study the function tutorials contained in my signature. Functions should not be implemented inside another function.

Jim
Was This Post Helpful? 0
  • +
  • -

#15 bkpsusmitaa   User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 12
  • Joined: 27-July 14

Re: I need to run a public domain code in Molecular Dynamics

Posted 27 July 2014 - 11:00 AM

The script is not mine, it is from the public domain, as written in the comments. I am helpless, because I am trying to run a program not created by me. The script has been verbatim copied and pasted. Only the Main() has been added according to your suggestion.
Was This Post Helpful? -1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2