#include <stdlib.h>#include <ctype.h>#include <string.h>#include <math.h>#include <float.h>#include <limits.h>#include "mode.h"#include "mol_fmt.h"#include "ichierr.h"#include "util.h"#include "ichi_io.h"#include "ichimain.h"#include "bcf_s.h"
Include dependency graph for mol_fmt4.c:Macros | |
| #define | ALIASED_AT(i) (0 < NUM_ISO_H(at, i)) |
| #define | IS_DEUTERIUM(i) (!strcmp(at[i].elname, "D") || at[i].iso_atw_diff == 2 && !strcmp(at[i].elname, "H")) |
| #define | IS_TRITIUM(i) (!strcmp(at[i].elname, "T") || at[i].iso_atw_diff == 3 && !strcmp(at[i].elname, "H")) |
| #define | ABNORMAL_ISO(i) (at[i].iso_atw_diff == 1 || at[i].iso_atw_diff < -3 || at[i].iso_atw_diff > 5) |
| #define | ABNORMAL_CHG(i) (abs(at[i].charge) > 3) |
| #define | ABNORMAL_RAD(i) (RADICAL_SINGLET <= at[i].radical && at[i].radical <= RADICAL_TRIPLET) |
| #define | ANY_ISO(i, X) |
| #define | ANY_CHG(i) (0 != at[i].charge) |
| #define | ANY_RAD(i) (RADICAL_SINGLET <= at[i].radical && at[i].radical <= RADICAL_TRIPLET) |
| #define | NORMAL_ISO(i, X) (ANY_ISO(i, X) && !ABNORMAL_ISO(i)) |
| #define | ABNORMAL_AT(i) |
| #define | ADD_LINE_AT(i) |
Enumerations | |
| enum | { SDF_START , SDF_DATA_HEADER , SDF_DATA_HEADER_NAME , SDF_DATA_HEADER_COMMENT , SDF_DATA_HEADER_CAS , SDF_DATA_HEADER_USER , SDF_DATA_LINE , SD_FMT_END_OF_DATA_ITEM , SDF_EMPTY_LINE , SD_FMT_END_OF_DATA_BLOCK } |
Functions | |
| int | OrigAtData_WriteToSDfileHeaderAndCountThings (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, int bChiralFlag, int bAtomsDT, const char *szLabel, const char *szValue, int *nNumAliasLines, int *nNumChargeLines, int *nNumRadicalLines, int *nNumIsoLines, int *nNumAddLines, int *num_bonds) |
| int | OrigAtData_WriteToSDfileAtomsBlock (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, int bAtomsDT, const char *szLabel, const char *szValue) |
| int | OrigAtData_WriteToSDfileBondsBlock (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, const char *szLabel, const char *szValue, INT_ARRAY *written_bond_ends) |
| int | OrigAtData_WriteToSDfileAdditionalLines (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, int bAtomsDT, const char *szLabel, const char *szValue, int nNumAliasLines, int nNumChargeLines, int nNumRadicalLines, int nNumIsoLines, INT_ARRAY *written_bond_ends) |
| int | OrigAtData_WriteToSDfilePolymerData (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, const char *szLabel, const char *szValue, INT_ARRAY *written_bond_ends) |
| int | SDFileSkipExtraData (INCHI_IOSTREAM *inp_file, unsigned long *CAS_num, char *comment, int lcomment, char *name, int lname, int prev_err, const char *pSdfLabel, char *pSdfValue, char *pStrErr, int bNoWarnings) |
| Skip extra data in SDF file after the MOL file data. | |
| int | SDFileIdentifyLabel (char *inp_line, const char *pSdfLabel) |
| Identify if the given line matches the specified SDF label. | |
| unsigned long | SDFileExtractCASNo (char *line) |
| Extract CAS number from the given line. | |
| int | NumLists_Alloc (NUM_LISTS *num_lists, int nlists) |
| Allocates memory for a specified number of numeric lists. | |
| int | NumLists_ReAlloc (NUM_LISTS *num_lists) |
| Reallocates memory for the numeric lists. | |
| int | NumLists_Append (NUM_LISTS *num_lists, int *list) |
| Push new item to the end of array. | |
| void | NumLists_Free (NUM_LISTS *num_lists) |
| Frees the memory allocated for the numeric list. | |
| int | IntArray_Alloc (INT_ARRAY *items, int nitems) |
| Initializes an INT_ARRAY structure. | |
| int | IntArray_ReAlloc (INT_ARRAY *items) |
| Reallocates memory for the INT_ARRAY structure. | |
| int | IntArray_Append (INT_ARRAY *items, int new_item) |
| Appends a new item to the INT_ARRAY structure. | |
| int | IntArray_AppendIfAbsent (INT_ARRAY *items, int new_item) |
| Appends a new item to the INT_ARRAY structure if it is not already present. | |
| void | IntArray_DebugPrint (INT_ARRAY *items) |
| Prints the contents of the INT_ARRAY structure for debugging purposes. | |
| void | IntArray_Reset (INT_ARRAY *items) |
| Resets the INT_ARRAY structure to its initial state. | |
| void | IntArray_Free (INT_ARRAY *items) |
| Frees the memory allocated for the INT_ARRAY structure. | |
| int | MolFmtSgroup_Create (MOL_FMT_SGROUP **sgroup, int id, int type) |
| Allocate new array Sgroup. | |
| void | MolFmtSgroup_Free (MOL_FMT_SGROUP *sgroup) |
| Frees the memory allocated for the Sgroup. | |
| int | MolFmtSgroups_Alloc (MOL_FMT_SGROUPS *sgroups, int nsgroups) |
| Allocates memory for a specified number of Sgroup objects. | |
| int | MolFmtSgroups_ReAlloc (MOL_FMT_SGROUPS *sgroups) |
| Expand array of Sgroups. | |
| int | MolFmtSgroups_Append (MOL_FMT_SGROUPS *sgroups, int id, int type) |
| Appends a new Sgroup to the array. | |
| void | MolFmtSgroups_Free (MOL_FMT_SGROUPS *sgroups) |
| Frees the memory allocated for the MOL_FMT_SGROUPS list. | |
| int | MolFmtSgroups_GetIndexBySgroupId (int id, MOL_FMT_SGROUPS *sgroups) |
| Gets the index of a Sgroup by its ID. | |
| int | OrigAtData_WriteToSDfile (const ORIG_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, int bChiralFlag, int bAtomsDT, const char *szLabel, const char *szValue) |
| Write original atom data to SD file. | |
Variables | |
| static const char | sdf_data_hdr_name [] = "NAME" |
| static const char | sdf_data_hdr_comm [] = "COMMENT" |
| #define ABNORMAL_AT | ( | i | ) |
| #define ABNORMAL_CHG | ( | i | ) | (abs(at[i].charge) > 3) |
| #define ABNORMAL_ISO | ( | i | ) | (at[i].iso_atw_diff == 1 || at[i].iso_atw_diff < -3 || at[i].iso_atw_diff > 5) |
| #define ABNORMAL_RAD | ( | i | ) | (RADICAL_SINGLET <= at[i].radical && at[i].radical <= RADICAL_TRIPLET) |
| #define ADD_LINE_AT | ( | i | ) |
| #define ALIASED_AT | ( | i | ) | (0 < NUM_ISO_H(at, i)) |
| #define ANY_CHG | ( | i | ) | (0 != at[i].charge) |
| #define ANY_ISO | ( | i, | |
| X | |||
| ) |
| #define ANY_RAD | ( | i | ) | (RADICAL_SINGLET <= at[i].radical && at[i].radical <= RADICAL_TRIPLET) |
| #define IS_DEUTERIUM | ( | i | ) | (!strcmp(at[i].elname, "D") || at[i].iso_atw_diff == 2 && !strcmp(at[i].elname, "H")) |
| #define IS_TRITIUM | ( | i | ) | (!strcmp(at[i].elname, "T") || at[i].iso_atw_diff == 3 && !strcmp(at[i].elname, "H")) |
| #define NORMAL_ISO | ( | i, | |
| X | |||
| ) | (ANY_ISO(i, X) && !ABNORMAL_ISO(i)) |
| anonymous enum |
| int IntArray_Alloc | ( | INT_ARRAY * | items, |
| int | nitems | ||
| ) |
Initializes an INT_ARRAY structure.
| items | Pointer to the INT_ARRAY structure to initialize. |
| nitems | Initial number of items to allocate. |
Here is the caller graph for this function:| int IntArray_Append | ( | INT_ARRAY * | items, |
| int | new_item | ||
| ) |
Appends a new item to the INT_ARRAY structure.
| items | Pointer to the INT_ARRAY structure to modify. |
| new_item | The new item to append. |
Here is the call graph for this function:
Here is the caller graph for this function:| int IntArray_AppendIfAbsent | ( | INT_ARRAY * | items, |
| int | new_item | ||
| ) |
Appends a new item to the INT_ARRAY structure if it is not already present.
| items | Pointer to the INT_ARRAY structure to modify. |
| new_item | The new item to append. |
Here is the call graph for this function:
Here is the caller graph for this function:| void IntArray_DebugPrint | ( | INT_ARRAY * | items | ) |
Prints the contents of the INT_ARRAY structure for debugging purposes.
| items | Pointer to the INT_ARRAY structure to print. |
Here is the caller graph for this function:| void IntArray_Free | ( | INT_ARRAY * | items | ) |
Frees the memory allocated for the INT_ARRAY structure.
| items | Pointer to the INT_ARRAY structure to free. |
Here is the caller graph for this function:| int IntArray_ReAlloc | ( | INT_ARRAY * | items | ) |
Reallocates memory for the INT_ARRAY structure.
| items | Pointer to the INT_ARRAY structure to reallocate. |
Here is the caller graph for this function:| void IntArray_Reset | ( | INT_ARRAY * | items | ) |
Resets the INT_ARRAY structure to its initial state.
| items | Pointer to the INT_ARRAY structure to reset. |
Here is the caller graph for this function:| int MolFmtSgroup_Create | ( | MOL_FMT_SGROUP ** | sgroup, |
| int | id, | ||
| int | type | ||
| ) |
Allocate new array Sgroup.
| sgroup | Pointer to the Sgroup structure to allocate. |
| id | Sgroup ID. |
| type | Sgroup type. |
Here is the call graph for this function:
Here is the caller graph for this function:| void MolFmtSgroup_Free | ( | MOL_FMT_SGROUP * | sgroup | ) |
Frees the memory allocated for the Sgroup.
| sgroup | Pointer to the Sgroup structure to free. |
Here is the call graph for this function:
Here is the caller graph for this function:| int MolFmtSgroups_Alloc | ( | MOL_FMT_SGROUPS * | items, |
| int | nitems | ||
| ) |
Allocates memory for a specified number of Sgroup objects.
| items | Pointer to the MOL_FMT_SGROUPS structure. |
| nitems | Number of Sgroup objects to allocate. |
Here is the caller graph for this function:| int MolFmtSgroups_Append | ( | MOL_FMT_SGROUPS * | items, |
| int | id, | ||
| int | type | ||
| ) |
Appends a new Sgroup to the array.
| items | Pointer to the MOL_FMT_SGROUPS structure. |
| id | Sgroup ID. |
| type | Sgroup type. |
Here is the call graph for this function:
Here is the caller graph for this function:| void MolFmtSgroups_Free | ( | MOL_FMT_SGROUPS * | items | ) |
Frees the memory allocated for the MOL_FMT_SGROUPS list.
| items | Pointer to the MOL_FMT_SGROUPS structure. |
Here is the call graph for this function:
Here is the caller graph for this function:| int MolFmtSgroups_GetIndexBySgroupId | ( | int | id, |
| MOL_FMT_SGROUPS * | items | ||
| ) |
Gets the index of a Sgroup by its ID.
| id | Sgroup ID. |
| items | Pointer to the MOL_FMT_SGROUPS structure. |
Here is the caller graph for this function:| int MolFmtSgroups_ReAlloc | ( | MOL_FMT_SGROUPS * | items | ) |
Expand array of Sgroups.
| items | Pointer to the MOL_FMT_SGROUPS structure. |
Here is the caller graph for this function:| int NumLists_Alloc | ( | NUM_LISTS * | num_lists, |
| int | nlists | ||
| ) |
Allocates memory for a specified number of numeric lists.
| num_lists | Pointer to the NUM_LISTS structure. |
| nlists | Number of lists to allocate. |
Here is the caller graph for this function:| int NumLists_Append | ( | NUM_LISTS * | num_lists, |
| int * | list | ||
| ) |
Push new item to the end of array.
| num_lists | Pointer to the NUM_LISTS structure. |
| list | Pointer to the list of integers to append. |
Here is the call graph for this function:
Here is the caller graph for this function:| void NumLists_Free | ( | NUM_LISTS * | num_lists | ) |
Frees the memory allocated for the numeric list.
| num_lists | Pointer to the NUM_LISTS structure. |
Here is the caller graph for this function:| int NumLists_ReAlloc | ( | NUM_LISTS * | num_lists | ) |
Reallocates memory for the numeric lists.
| num_lists | Pointer to the NUM_LISTS structure. |
Here is the caller graph for this function:| int OrigAtData_WriteToSDfile | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| int | bChiralFlag, | ||
| int | bAtomsDT, | ||
| const char * | szLabel, | ||
| const char * | szValue | ||
| ) |
Write original atom data to SD file.
| inp_at_data | Pointer to original atom data structure |
| fcb | File stream to write to |
| name | Name of the structure |
| comment | Comment to include |
| bChiralFlag | Flag indicating for chiral information |
| bAtomsDT | Flag indicating how H isotopes (D/T) are represented in the SD output |
| szLabel | SDF label |
| szValue | SDF value |
Here is the call graph for this function:
Here is the caller graph for this function:| int OrigAtData_WriteToSDfileAdditionalLines | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| int | bAtomsDT, | ||
| const char * | szLabel, | ||
| const char * | szValue, | ||
| int | nNumAliasLines, | ||
| int | nNumChargeLines, | ||
| int | nNumRadicalLines, | ||
| int | nNumIsoLines, | ||
| INT_ARRAY * | written_bond_ends | ||
| ) |
Here is the call graph for this function:
Here is the caller graph for this function:| int OrigAtData_WriteToSDfileAtomsBlock | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| int | bAtomsDT, | ||
| const char * | szLabel, | ||
| const char * | szValue | ||
| ) |
Here is the call graph for this function:
Here is the caller graph for this function:| int OrigAtData_WriteToSDfileBondsBlock | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| const char * | szLabel, | ||
| const char * | szValue, | ||
| INT_ARRAY * | written_bond_ends | ||
| ) |
Here is the call graph for this function:
Here is the caller graph for this function:| int OrigAtData_WriteToSDfileHeaderAndCountThings | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| int | bChiralFlag, | ||
| int | bAtomsDT, | ||
| const char * | szLabel, | ||
| const char * | szValue, | ||
| int * | nNumAliasLines, | ||
| int * | nNumChargeLines, | ||
| int * | nNumRadicalLines, | ||
| int * | nNumIsoLines, | ||
| int * | nNumAddLines, | ||
| int * | num_bonds | ||
| ) |
Important: Atoms with alias cannot have charge, radical
isotope differences are allowed
Atoms with alias cannot be abnormal.
Abnormal atoms are atoms which need M CHG, M RAD, M ISO
Output aliased atoms if they have implicit D or T
Here is the call graph for this function:
Here is the caller graph for this function:| int OrigAtData_WriteToSDfilePolymerData | ( | const ORIG_ATOM_DATA * | inp_at_data, |
| INCHI_IOSTREAM * | fcb, | ||
| const char * | name, | ||
| const char * | comment, | ||
| const char * | szLabel, | ||
| const char * | szValue, | ||
| INT_ARRAY * | written_bond_ends | ||
| ) |
Here is the call graph for this function:
Here is the caller graph for this function:| unsigned long SDFileExtractCASNo | ( | char * | line | ) |
Extract CAS number from the given line.
| line | Pointer to the line containing the CAS number. |
Here is the caller graph for this function:| int SDFileIdentifyLabel | ( | char * | inp_line, |
| const char * | pSdfLabel | ||
| ) |
Identify if the given line matches the specified SDF label.
| inp_line | Pointer to the input line. |
| pSdfLabel | Pointer to the SDF label to match. |
Here is the call graph for this function:
Here is the caller graph for this function:| int SDFileSkipExtraData | ( | INCHI_IOSTREAM * | inp_file, |
| unsigned long * | CAS_num, | ||
| char * | comment, | ||
| int | lcomment, | ||
| char * | name, | ||
| int | lname, | ||
| int | prev_err, | ||
| const char * | pSdfLabel, | ||
| char * | pSdfValue, | ||
| char * | pStrErr, | ||
| int | bNoWarnings | ||
| ) |
Skip extra data in SDF file after the MOL file data.
| inp_file | Pointer to the input file stream. |
| CAS_num | Pointer to the variable to store the CAS number. |
| comment | Pointer to the buffer to store the comment. |
| lcomment | Length of the comment buffer. |
| name | Pointer to the buffer to store the name. |
| lname | Length of the name buffer. |
| prev_err | Previous error code. |
| pSdfLabel | Pointer to the SDF label buffer. |
| pSdfValue | Pointer to the SDF value buffer. |
| pStrErr | Pointer to the error string buffer. |
| bNoWarnings | Flag indicating whether to suppress warnings. |
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |