added structure to all functions of library

This commit is contained in:
arcan1s
2014-01-28 03:11:30 +04:00
parent 38eb392e32
commit d88f3b317f
44 changed files with 945 additions and 819 deletions

View File

@ -4,36 +4,20 @@
#include <stdio.h>
#include <mathmech/print_struct.h>
#include <mathmech/var_types.h>
/**
* @fn print_structure
*/
int print_structure (const char *output, const int num_needed_mol, const int *needed_mol,
const int num_atoms, const int *label_mol, const char *ch_type_atoms,
const float *coords)
/**
* @brief function that prints structure to pdb file
* @code
* print_structure (output, num_needed_mol, needed_mol, num_atoms, label_mol,
* char_type_atoms, coords);
* @endcode
*
* @param output output file name
* @param num_needed_mol number of needed molecules
* @param needed_mol massive of number of needed molecules
* @param num_atoms number of atoms
* @param label_mol massive of numbers of molecule for atoms
* @param ch_type_atoms massive of char atom types
* @param coords massive of coordinates
*
* @return 0 - exit without errors
*/
const system_info _system_info, const atom_info *_atom_info)
{
int cur_atom, cur_atom_num, cur_mol, i, j;
int cur_atom, cur_mol, i, j;
FILE *f_out;
/* cur_atom current atom
* cur_atom_num true atom number
* cur_mol current molecule
* f_out output file
*/
@ -42,23 +26,17 @@ int print_structure (const char *output, const int num_needed_mol, const int *ne
f_out = fopen (output, "w");
for (i=0; i<num_needed_mol; i++)
for (j=0; j<8*num_atoms; j++)
for (j=0; j<8*_system_info.num_atoms; j++)
{
if (j < num_atoms)
{
if (j < _system_info.num_atoms)
cur_mol = 0;
cur_atom_num = j;
}
else
{
cur_mol = ((j - num_atoms) % 7) + 1;
cur_atom_num = (j - num_atoms) / 7;
}
if (needed_mol[i] == (8*label_mol[j]+cur_mol))
cur_mol = ((j - _system_info.num_atoms) % 7) + 1;
if (needed_mol[i] == (8*_atom_info[j].label_mol+cur_mol))
{
fprintf(f_out, "ATOM %5i %c%c MOL %4i %8.3f%8.3f%8.3f\n", cur_atom,
ch_type_atoms[2*cur_atom_num+0], ch_type_atoms[2*cur_atom_num+1],
i+1, coords[3*j+0], coords[3*j+1], coords[3*j+2]);
_atom_info[j].ch_type_atoms[0], _atom_info[j].ch_type_atoms[1],
i+1, _atom_info[j].coords[0], _atom_info[j].coords[1], _atom_info[j].coords[2]);
cur_atom++;
}
}
@ -66,4 +44,4 @@ int print_structure (const char *output, const int num_needed_mol, const int *ne
fclose (f_out);
return 0;
}
}