/*------------------------------------------------------------- Copyright (C) 2000 Sebastian Will. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. THE AUTHOR AND PUBLISHER MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -------------------------------------------------------------*/ /************************************************************ * * program to determine the distribution of the * mean square distances between random walks * either self avoiding or non self avoiding * ************************************************************/ #include #include #include /* parameters */ #define LENGTH 30 /* chain length */ #define SAMPLES 100000 /* number of samples to generate */ #define INIT_RANDOM 0 /* initialize random number generator with this value */ #define SELF_AVOIDING 1 /* generate only self avoiding walks */ #define DISTANCE_MATRIX 1 /* compute mean square dist from distance matrix */ /* type definitions */ typedef int point_t[3]; typedef point_t walk_t[LENGTH]; typedef double dist_mat_t[LENGTH][LENGTH]; /* convention: distance matrix is symmetric, i.e. one could use triangular matrix. ==> We use only entries m[i][j], where i