tension_handler_data_t tdata;
int num_param_args; /* for INIT_MODEL() */
char **param_args; /* for INIT_MODEL() */
- get_options(argc, argv, &env, NUM_TENSION_MODELS, tension_models, &model, &flags);
+ double Fmax,Xmax;
+ get_options(argc, argv, &env, NUM_TENSION_MODELS, tension_models, &model,
+ &Fmax, &Xmax, &flags);
setup();
if (flags & VFLAG) {
printf("#initializing model %s with parameters %s\n", model->name, model->params);
exit(0);
}
{
- double dx=1e-10, x=0, F=0;
+ int i,N=200;
+ double x=0, F=0;
printf("#F (N)\tk (%% pop. per s)\n");
- while (F >= 0 && F < 1e5 && x < 1e-6) {
+ for (i=0; i<=N; i++) {
+ x = Xmax*i/(double)N;
F = (*model->handler)(x, &tdata);
+ if (F < 0 || F > Fmax) break;
printf("%g\t%g\n", x, F);
- x += dx;
}
}
params = pop(&tdata.group);
void help(char *prog_name,
environment_t *env,
int n_tension_models, tension_model_getopt_t *tension_models,
- int tension_model)
+ int tension_model, double Fmax, double Xmax)
{
int i, j;
printf("usage: %s [options]\n", prog_name);
printf(" #Distance (x)\tForce (N)\n");
printf(" 123.456\t7.89\n");
printf(" ...\n");
+ printf("-F\tSet the maximum F value for the standard mode F(x) output (currently %g)\n", Fmax);
+ printf("-X\tSet the maximum x value for the standart mode F(x) output (currently %g)\n", Xmax);
printf("-V\tChange output to verbose mode\n");
printf("-h\tPrint this help and exit\n");
printf("\n");
<<tension model utility get options>>=
void get_options(int argc, char **argv, environment_t *env,
int n_tension_models, tension_model_getopt_t *tension_models,
- tension_model_getopt_t **model,
+ tension_model_getopt_t **model, double *Fmax, double *Xmax,
unsigned int *flags)
{
char *prog_name = NULL;
- char c, options[] = "T:C:m:a:Vh";
+ char c, options[] = "T:C:m:a:F:X:Vh";
int tension_model=0, num_strings;
extern char *optarg;
extern int optind, optopt, opterr;
prog_name = argv[0];
env->T = 300.0; /* K */
+ *Fmax = 1e5;
+ *Xmax = 1e-6;
*flags = 0;
*model = tension_models;
case 'a':
tension_models[tension_model].params = optarg;
break;
- case 'V': *flags |= VFLAG; break;
+ case 'F': *Fmax = atof(optarg); break;
+ case 'X': *Xmax = atof(optarg); break;
+ case 'V': *flags |= VFLAG; break;
case '?':
fprintf(stderr, "unrecognized option '%c'\n", optopt);
/* fall through to default case */
default:
- help(prog_name, env, n_tension_models, tension_models, tension_model);
+ help(prog_name, env, n_tension_models, tension_models, tension_model, *Fmax, *Xmax);
exit(1);
}
}
void help(char *prog_name,
environment_t *env,
int n_k_models, k_model_getopt_t *k_models,
- int k_model)
+ int k_model, double Fmax, double special_xmin, double special_xmax)
{
int i, j;
printf("usage: %s [options]\n", prog_name);
printf(" ...\n");
printf("-m\tChange output to standard mode\n");
printf("-M\tChange output to special mode\n");
- printf("-F\tSet the maximum F value for the standard mode k(F) output\n");
- printf("-x\tSet the minimum x value for the special mode E(x) output\n");
- printf("-X\tSet the maximum x value for the special mode E(x) output\n");
+ printf("-F\tSet the maximum F value for the standard mode k(F) output (currently %g)\n", Fmax);
+ printf("-x\tSet the minimum x value for the special mode E(x) output (currently %g)\n", special_xmin);
+ printf("-X\tSet the maximum x value for the special mode E(x) output (currently %g)\n", special_xmax);
printf("-V\tChange output to verbose mode\n");
printf("-h\tPrint this help and exit\n");
printf("\n");
fprintf(stderr, "unrecognized option '%c'\n", optopt);
/* fall through to default case */
default:
- help(prog_name, env, n_k_models, k_models, k_model);
+ help(prog_name, env, n_k_models, k_models, k_model, *Fmax, *special_xmin, *special_xmax);
exit(1);
}
}