 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
40 int h, i, j, k, ncomp;
43 for ( ncomp = 0, comp =
model->
comp; comp; comp = comp->
next ) ncomp++;
46 cout <<
"Cycle: Coverage" << endl;
47 for ( h=2; h<10 && s<ncomp*(ncomp-1); h++ ) {
48 for ( i=0; i<ncomp; i++ ) {
49 for ( j=0; j<ncomp; j++ ) {
50 if ( i!=j && mat[i][j] && mat[i][j]<h ) {
51 for ( k=0; k<ncomp; k++ ) {
52 s = mat[i][j] + mat[k][j];
53 if ( i!=k && j!=k && mat[k][j] && s==h && mat[k][i] == 0 )
59 for ( i=0, s=0; i<ncomp; i++ )
60 for ( j=0; j<ncomp; j++ )
if ( mat[i][j] ) s++;
62 cout << h <<
":\t" << s << endl;
91 cout <<
"Model\tWienerIndex" << endl;
92 for ( n=0, wia=0, mp =
model; mp; mp = mp->
next, n++ ) {
93 for ( ncomp = 0, comp = mp->
comp; comp; comp = comp->
next ) ncomp++;
96 for ( i=0, wi=0; i<ncomp; i++ )
97 for ( j=0; j<ncomp; j++ ) wi += (
long) mat[i][j];
102 cout << mp->
id <<
tab << wi << endl;
108 cout <<
"Avg:\t" << wia << endl << endl;
118 if ( comp->
link[j] == comp2 )
return 1;
127 for ( comp =
model->
comp; comp && comp->
id != id1; comp = comp->
next ) ;
129 for ( comp2 =
model->
comp; comp2 && comp2->
id != id2; comp2 = comp2->
next ) ;
138 for ( comp =
model->
comp; comp && comp->
id != id1; comp = comp->
next ) ;
140 for ( comp2 =
model->
comp; comp2 && comp2->
id != id2; comp2 = comp2->
next ) ;
151 for ( n=0, comp =
model->
comp; comp; comp = comp->
next ) n++;
153 for ( modpath =
model->
next; modpath && same<n; modpath = modpath->next ) {
154 for ( same=0, i=1; i<n; i++ )
159 if ( same < n )
return 1;
171 for ( n=0, comp =
model->
comp; comp; comp = comp->
next ) n++;
176 modpath->
link = NULL;
178 for ( i=1; i<n; i++ ) {
200 comp_link = comp->
link[j];
201 for (
use=1, k=0; k<i &&
use; k++ )
202 if ( comp_link == path[k] )
use = 0;
214 for ( k=0; k<=i; k++ ) cout <<
" " << path[k]->
id;
215 cout <<
" " << path[0]->
id;
216 cout <<
" " << len << endl;
245 for ( n=0, comp =
model->
comp; comp; comp = comp->
next ) n++;
246 for ( m=0, link =
model->
link; link; link = link->
next ) m++;
249 cout <<
"Finding Hamiltonian cycles:" << endl;
250 cout <<
"Components: " << n << endl;
251 cout <<
"Starting links: " << m << endl;
252 cout <<
"Paths:" << endl;
256 for ( i=0; i<n; i++ ) path[i] = NULL;
double model_wiener_index(Bmodel *model)
Calculates the Wiener index.
Matrix model_adjacency_matrix(Bmodel *model)
Constructs the adjacency matrix for a model.
Bmodel * model_hamiltonian_cycle(Bmodel *model)
Calculates the Hamiltonian cycles in a model.
Header file for general symmetry functions.
Header file for functions for creating random images.
Blink * link_add(Blink **link, Bcomponent *comp1, Bcomponent *comp2, double length, double radius)
Adds a component link to a linked list.
3x3 Matrix manipulation functions
Bmodel * model_copy(Bmodel *model)
Copies a model.
int comp_link_check(Bcomponent *comp, Bcomponent *comp2)
Functions to compare models and components.
Blink * model_link_add(Bmodel *model, Bstring &id1, Bstring &id2)
Header file for reading and writing atomic model files.
int comp_pick_next(int i, int n, Bcomponent *comp, Bcomponent **path, Bmodel *model)
Library routines used to compare sets of atomic coordinates.
Header file for general utilities.
ostream & tab(ostream &out)
int model_check_path(Bmodel *model, Bcomponent **path)
Header file for generalized linked list functions.
Library routines used for model processing.
Matrix model_shortest_path(Bmodel *model)
Calculates the shortest path between every pair of vertices.
int model_link_list_kill(Bmodel *model)
Deallocates memory for a list of component links.
Bcomponent * link[MAXLINK]
double model_add_path(Bmodel *model, Bcomponent **path)
Library routines used for atomic coordinates.