InChI
 
Loading...
Searching...
No Matches
mol_fmt3.c File Reference
#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 "bcf_s.h"
#include "stb_sprintf.h"
+ Include dependency graph for mol_fmt3.c:

Functions

static int get_actual_atom_number (int index, int n, int *orig, int *fin)
 
int MolfileV3000Init (MOL_FMT_CTAB *ctab, char *pStrErr)
 Initialize V3000 connection table in MOL file data structure.
 
int DeleteMolfileV3000Info (MOL_FMT_v3000 *v3000)
 Free memory allocated for V3000 specific data in the MOL file data structure.
 
char * inchi_fgetsLf_V3000 (char *line, INCHI_IOSTREAM *inp_stream)
 Read a line from the input file stream, handling V3000 line continuations: Extended version of inchi_fgetsLf which is able of reading concatenated lines (ending with '-') of V3000 Molfile. Also removes "M V30 " prefix" and normalizes the rest of string.
 
int MolfileV3000ReadField (void *data, int data_type, char **line_ptr)
 Extract the 'data' in specified mol file field at given text position 'line_ptr'.
 
int MolfileV3000ReadKeyword (char *key, char **line_ptr)
 Read keyword from the specified line.
 
int MolfileV3000ReadCTABBeginAndCountsLine (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, char *pStrErr)
 Read V3000 head (begin and counts line) of in MOL file data structure from input file stream.
 
int MolfileV3000ReadSGroup (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 Sgroup information from the input file stream into the MOL file data structure.
 
int MolfileV3000Read3DBlock (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 3D constraints block in MOL file data structure from input file stream.
 
int MolfileV3000ReadCollections (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 collections block in MOL file data structure from input file stream.
 
int MolfileV3000ReadAtomsBlock (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 atoms block in MOL file data structure from input file stream.
 
int MolfileV3000ReadBondsBlock (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 bonds block in MOL file data structure from input file stream.
 
int MolfileV3000ReadTailOfCTAB (MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
 Read V3000 tail (haptic bonds, stereo collections, Sgroups, 3D constraints, collections, end line) in to the MOL file data structure from input file stream.
 
int MolfileV3000ReadHapticBond (MOL_FMT_CTAB *ctab, char **line_ptr, int **num_list, char *pStrErr)
 Read V3000 haptic bond information from the input line.
 
int MolfileV3000ReadStereoCollection (MOL_FMT_CTAB *ctab, char **line_ptr, int **num_list, char *pStrErr)
 Read V3000 stereo collection information from the input line.
 
int get_V3000_input_line_to_strbuf (INCHI_IOS_STRING *buf, INCHI_IOSTREAM *inp_stream)
 Get a V3000 input line and store it in a string buffer.
 

Function Documentation

◆ DeleteMolfileV3000Info()

int DeleteMolfileV3000Info ( MOL_FMT_v3000 v3000)

Free memory allocated for V3000 specific data in the MOL file data structure.

Parameters
v3000Pointer to the V3000 specific data structure to free.
Returns
0.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_actual_atom_number()

int get_actual_atom_number ( int  index,
int  n,
int *  orig,
int *  fin 
)
static
+ Here is the caller graph for this function:

◆ get_V3000_input_line_to_strbuf()

int get_V3000_input_line_to_strbuf ( INCHI_IOS_STRING buf,
INCHI_IOSTREAM inp_stream 
)

Get a V3000 input line and store it in a string buffer.

Parameters
bufPointer to the string buffer to store the line.
inp_streamPointer to the input file stream.
Returns
Length of buffer stored on success, -1 on failure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ inchi_fgetsLf_V3000()

char * inchi_fgetsLf_V3000 ( char *  line,
INCHI_IOSTREAM inp_stream 
)

Read a line from the input file stream, handling V3000 line continuations: Extended version of inchi_fgetsLf which is able of reading concatenated lines (ending with '-') of V3000 Molfile. Also removes "M V30 " prefix" and normalizes the rest of string.

Parameters
linePointer to the buffer to store the read line.
inp_streamPointer to the input file stream.
Returns
Pointer to the read line, or NULL on end of file or error.
+ Here is the call graph for this function:

◆ MolfileV3000Init()

int MolfileV3000Init ( MOL_FMT_CTAB ctab,
char *  pStrErr 
)

Initialize V3000 connection table in MOL file data structure.

Parameters
ctabPointer to the connection table data structure.
pStrErrPointer to the error string buffer.
Returns
0 on success, -1 on failure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000Read3DBlock()

int MolfileV3000Read3DBlock ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 3D constraints block in MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0: Success (no error encountered, 3D block read correctly) 1: Error (e.g., missing "END 3D" marker, or other parsing errors)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadAtomsBlock()

int MolfileV3000ReadAtomsBlock ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 atoms block in MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0 on success, -1 on failure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadBondsBlock()

int MolfileV3000ReadBondsBlock ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 bonds block in MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0: Success (no error, bonds block read correctly), 1: Error: No V3000 Bond block start marker ("BEGIN BOND" missing), 2: Error: Cannot read V3000 bond block line (input line missing or unreadable), 4: Error: Cannot interpret V3000 bond block line (parsing failure) Negative values: If the end-of-data marker ($$$$) is encountered, err is set to -abs(err) (e.g., -1, -2, -4) Other values: If the end marker ("END BOND") is missing, err is set to 1
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadCollections()

int MolfileV3000ReadCollections ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 collections block in MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0: Success (collections block read and parsed correctly) 7: Error in reading or interpreting V3000 collection lines (parsing failure, unexpected format, missing required fields, etc.)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadCTABBeginAndCountsLine()

int MolfileV3000ReadCTABBeginAndCountsLine ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
char *  pStrErr 
)

Read V3000 head (begin and counts line) of in MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
pStrErrPointer to the error string buffer.
Returns
0 on success, -1 on failure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadField()

int MolfileV3000ReadField ( void *  data,
int  data_type,
char **  line_ptr 
)

Extract the 'data' in specified mol file field at given text position 'line_ptr'.

Parameters
dataPointer to the destination buffer.
data_typeType of the data to read. E.g. MOL_FMT_STRING_DATA, MOL_FMT_CHAR_INT_DATA, etc.
line_ptrPointer to the line buffer.
Returns
for MOL_FMT_STRING_DATA: number of bytes excluding trailing zero for all others: 1=success; 0 = empty
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadHapticBond()

int MolfileV3000ReadHapticBond ( MOL_FMT_CTAB ctab,
char **  line_ptr,
int **  num_list,
char *  pStrErr 
)

Read V3000 haptic bond information from the input line.

Parameters
ctabPointer to the connection table data structure.
line_ptrPointer to the line buffer.
num_listPointer to the list of numbers.
pStrErrPointer to the error string buffer.
Returns
Positive integer (nread > 0): Success; number of bytes/fields read from the haptic bond block. 0: No data read (rare, usually means nothing was parsed). -1: Error; parsing failed at any step (missing '(', invalid count, allocation failure, field read error, missing "ATTACH=ALL", etc.).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadKeyword()

int MolfileV3000ReadKeyword ( char *  key,
char **  line_ptr 
)

Read keyword from the specified line.

Parameters
keyPointer to the buffer to store the keyword.
line_ptrPointer to the line buffer.
Returns
Length of the keyword on success, -1 on failure.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadSGroup()

int MolfileV3000ReadSGroup ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 Sgroup information from the input file stream into the MOL file data structure.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0: Success (no error encountered, SGroup read correctly) 1: Error (e.g., missing "END SGROUP" marker, or other parsing errors)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadStereoCollection()

int MolfileV3000ReadStereoCollection ( MOL_FMT_CTAB ctab,
char **  line_ptr,
int **  num_list,
char *  pStrErr 
)

Read V3000 stereo collection information from the input line.

Parameters
ctabPointer to the connection table data structure.
line_ptrPointer to the line buffer.
num_listPointer to the list of numbers.
pStrErrPointer to the error string buffer.
Returns
Positive integer (nread > 0): Success; number of bytes/fields read from the stereo collection block. 0: No data read (rare, usually means nothing was parsed). -1: Error; parsing failed at any step (missing '(', invalid count, allocation failure, field read error, missing "ATTACH=ALL", etc.).
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MolfileV3000ReadTailOfCTAB()

int MolfileV3000ReadTailOfCTAB ( MOL_FMT_CTAB ctab,
INCHI_IOSTREAM inp_file,
int  err,
char *  pStrErr 
)

Read V3000 tail (haptic bonds, stereo collections, Sgroups, 3D constraints, collections, end line) in to the MOL file data structure from input file stream.

Parameters
ctabPointer to the connection table data structure.
inp_filePointer to the input file stream.
errError code.
pStrErrPointer to the error string buffer.
Returns
0: Success (no error encountered, tail of CTAB read correctly) 1: Error (e.g., missing "END CTAB" marker, or other parsing errors) 7: Error in reading or interpreting V3000 collection lines 71, 77, etc.: Error codes from sub-blocks (e.g., SGroup, 3DBlock, Collection) plus 70, indicating which sub-block failed Other positive values: Error codes from called functions (e.g., MolfileV3000ReadSGroup, MolfileV3000Read3DBlock, MolfileV3000ReadCollections) plus 70 Negative values: If an end-of-data marker ($$$$) is encountered during an error, the error code may be returned as a negative value (e.g., -1, -7, -71, etc.)
+ Here is the call graph for this function:
+ Here is the caller graph for this function: