Go to the documentation of this file.
2 #include "bioworld.h"
3 #include "parameters.h"
5 #include "defines.h"
6 #include "error.h"
7 #include "filename.h"
8 #include "atlasrrt.h"
9 #include "random.h"
10 #include "geom.h"
11 #include "chart.h"
12 #include "samples.h"
13 #include "averages.h"
15 #include <stdlib.h>
16 #include <string.h>
17 #include <time.h>
84 int main(int argc, char **arg)
85 {
86  if (argc>1)
87  {
88  TBioWorld bioWorld; /* The molecular information. */
89  Tatlas atlas; /* The atlas defined during minimization. */
90  Tparameters parameters; /* Parameters used in the Cuik process. */
92  Tfilename fparam;
93  Tfilename fatlas;
95  double *s1; /* Starting point for the minimization. */
97  TAtlasBase ab;
99  /*Init parameters*/
100  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
101  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
102  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
104  InitBioWorld(&parameters,arg[1],NO_UINT,&s1,&bioWorld);
105  free(s1);
106  CS_WD_FROM_WORLD(BioWorldWorld(&bioWorld),&ab);
108  /* Read the start sample */
109  ReadOneSample(&parameters,arg[1],CS_WD_GET_NUM_SYSTEM_VARS(&ab),&s1);
111  /* Minimize */
112  MinimizeOnAtlas(&parameters,arg[1],s1,&ab,
113  BioWorldEnergy,(void *)(&bioWorld),&atlas);
116  /* Save the results (the tracked paths are already saved in MinimizeOnAtlas) */
117  CreateFileName(NULL,arg[1],NULL,ATLAS_EXT,&fatlas);
118  fprintf(stderr,"Writing atlas to : %s\n",GetFileFullName(&fatlas));
119  SaveAtlas(&parameters,&fatlas,&atlas);
121  /* Release memory */
122  free(s1);
123  DeleteAtlas(&atlas);
124  DeleteParameters(&parameters);
125  DeleteBioWorld(&bioWorld);
127  DeleteFileName(&fparam);
128  DeleteFileName(&fatlas);
129  }
130  else
131  {
132  fprintf(stderr," Wrong number of parameters.\n");
133  fprintf(stderr," Use:\n");
134  fprintf(stderr," cuikbiominimize <problem filename>.pdb\n");
135  fprintf(stderr," where <problem filename>.pdb contains the molecular information\n");
136  fprintf(stderr," The extension for the problem file (ex. pdb) is required.\n");
137  fprintf(stderr," All the extensions managed by OpenBabel can be used\n");
138  }
139  return(EXIT_SUCCESS);
140 }
void InitBioWorld(Tparameters *p, char *filename, unsigned int maxAtomsLink, double **conformation, TBioWorld *bw)
Initializes a world form a biomolecule.
Definition: bioworld.c:1394
Definition of the combination of an atlas with a RRT.
Definition of basic functions.
void DeleteBioWorld(TBioWorld *bw)
Definition: bioworld.c:1918
double BioWorldEnergy(Tparameters *p, boolean simp, double *conformation, void *bw)
Computes the energy of a given configuration.
Definition: bioworld.c:1896
Data structure to hold the information about the name of a file.
Definition: filename.h:248
Definition of the Tfilename type and the associated functions.
void DeleteAtlas(Tatlas *a)
Definition: atlas.c:4561
#define PARAM_EXT
File extension for parameter files.
Definition: filename.h:131
boolean MinimizeOnAtlas(Tparameters *pr, char *fname, double *p, TAtlasBase *w, double(*costF)(Tparameters *, boolean, double *, void *), void *costData, Tatlas *a)
Gradient minimization on an manifold.
Definition: atlas.c:3106
Error and warning functions.
void DeleteFileName(Tfilename *fn)
Definition: filename.c:205
#define ATLAS_EXT
File extension for files storing atlas.
Definition: filename.h:199
int main(int argc, char **arg)
Main body of the cuikbiominimize application.
Definitions of constants and macros used in several parts of the cuik library.
Auxiliary functions to deal averages of path planner executions.
A table of parameters.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn)
Definition: filename.c:22
A bridge between world structures and biological information.
void InitParametersFromFile(char *file, Tparameters *p)
Constructor from a file.
Definition: parameters.c:51
Type defining the equations on which the atlas is defined.
Definition: wcs.h:30
Definition of a local chart on a manifold.
char * GetFileFullName(Tfilename *fn)
Gets the file full name (paht+name+extension).
Definition: filename.c:151
A atlas on a manifold.
Definition: atlas.h:289
#define NO_UINT
Used to denote an identifier that has not been initialized.
Definition: defines.h:435
void DeleteParameters(Tparameters *p)
Definition: parameters.c:295
void SaveAtlas(Tparameters *pr, Tfilename *fname, Tatlas *a)
Stores the atlas information on a file.
Definition: atlas.c:3842
Structure with the molecular and the mechanical information.
Definition: bioworld.h:28
Gets the number of system variables.
Definition: wcs.h:250
Auxiliary functions to deal with sets of samples.
#define CS_WD_FROM_WORLD(ptr, wcs)
Initializes the equations from a world structure.
Definition: wcs.h:108
Definition of basic randomization functions.
Definition of the Tparameters type and the associated functions.
Tworld * BioWorldWorld(TBioWorld *bw)
Returns a pointer to the world generated from the bio-information.
Definition: bioworld.c:1802
unsigned int ReadOneSample(Tparameters *p, char *fname, unsigned int nvs, double **s)
Reads one sample from a file.
Definition: samples.c:1216