mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-10 04:15:53 +00:00
Added lib 'stat_sort.c'
This commit is contained in:
BIN
stat_new/stat
BIN
stat_new/stat
Binary file not shown.
@ -18,7 +18,7 @@ float radii (const float *a, const float *b)
|
||||
|
||||
int create_matrix (int num_mol, int num_atoms, const int *label_mol,
|
||||
const int *type_atoms, const float *coords, int num_of_inter,
|
||||
const float *crit, int *connect, int *num_bonds)
|
||||
const float *crit, int *connect)
|
||||
{
|
||||
float x[2][3];
|
||||
int cur_num_inter, i, j, k, l, num_inter, ***label_inter;
|
||||
@ -56,11 +56,8 @@ int create_matrix (int num_mol, int num_atoms, const int *label_mol,
|
||||
}
|
||||
|
||||
for (i=0; i<num_mol; i++)
|
||||
{
|
||||
num_bonds[i] = 0;
|
||||
for (j=0; j<num_mol; j++)
|
||||
connect[i*num_mol+j] = 0;
|
||||
}
|
||||
|
||||
// processing of initial connectivity matrix
|
||||
for (k=0; k<num_of_inter; k++)
|
||||
@ -82,8 +79,6 @@ int create_matrix (int num_mol, int num_atoms, const int *label_mol,
|
||||
{
|
||||
connect[i*num_mol+j] = 1;
|
||||
connect[j*num_mol+i] = 1;
|
||||
num_bonds[i]++;
|
||||
num_bonds[j]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,67 @@
|
||||
/* Library for processing connectivity matrix
|
||||
*
|
||||
* Usage:
|
||||
* proc_matrix (number_of_molecules, connect_matrix, max_size_of_aglomerates,
|
||||
* num_of_molecules_in_aglomerates, aglomerates, statistic)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int proc_matrix (int num_mol, const int *connect, const int *num_bond, int *num_mol_agl, int *agl, int *stat)
|
||||
int proc_matrix (int num_mol, const int *connect, int max_size, int *num_mol_agl, int *agl, int *stat)
|
||||
{
|
||||
int i, j, p, *bin;
|
||||
int i, j, k, p, *bin;
|
||||
|
||||
// definition and zeroing
|
||||
bin = (int *) malloc (num_mol * sizeof (int));
|
||||
for (i=0; i<num_mol; i++)
|
||||
bin[i] = 0;
|
||||
for (i=0; i<5000; i++)
|
||||
for (i=0; i<max_size; i++)
|
||||
{
|
||||
stat[i] = 0;
|
||||
num_mol_agl[i] = 0;
|
||||
for (j=0; j<5000; j++)
|
||||
agl[5000*i+j] = 0;
|
||||
for (j=0; j<max_size; j++)
|
||||
agl[max_size*i+j] = 0;
|
||||
}
|
||||
|
||||
p = num_mol;
|
||||
// select non-bonded molecules
|
||||
for (i=0; i<num_mol; i++)
|
||||
if (num_bond[i] == 0)
|
||||
{
|
||||
p = 0;
|
||||
for (j=0; j<num_mol; j++)
|
||||
p += connect[i*num_mol+j];
|
||||
if (p == 0)
|
||||
{
|
||||
bin[i] = 0;
|
||||
stat[0]++;
|
||||
p--;
|
||||
}
|
||||
}
|
||||
|
||||
// unwraping of connectivity matrix
|
||||
p = 0;
|
||||
for (i=0; i<num_mol; i++)
|
||||
if (bin[i] == 1)
|
||||
{
|
||||
agl[max_size*p+num_mol_agl[p]] = i;
|
||||
num_mol_agl[p]++;
|
||||
bin[i] = 0;
|
||||
|
||||
for (j=0; j<num_mol_agl[p]; j++)
|
||||
for (k=0; k<num_mol; k++)
|
||||
if ((connect[agl[max_size*p+j]*num_mol+k] == 1) && (bin[k] == 1))
|
||||
{
|
||||
agl[max_size*p+num_mol_agl[p]] = k;
|
||||
num_mol_agl[p]++;
|
||||
bin[k] = 0;
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
while (p > 0)
|
||||
{
|
||||
|
||||
}
|
||||
// filling statistic array
|
||||
for (i=0; i<max_size; i++)
|
||||
stat[num_mol_agl[i]-1]++;
|
||||
|
||||
free (bin);
|
||||
|
||||
|
Reference in New Issue
Block a user