68#define SD_FMT_END_OF_DATA "$$$$"
70#define MOL_FMT_INPLINELEN 204
71#ifndef MOL_FMT_MAXLINELEN
72#define MOL_FMT_MAXLINELEN 200
75#define MOL_FMT_PRESENT 1
76#define MOL_FMT_ABSENT 0
79#define MOL_FMT_QUERY MOL_FMT_ABSENT
80#define MOL_FMT_CPSS MOL_FMT_ABSENT
81#define MOL_FMT_REACT MOL_FMT_ABSENT
83#define MOL_FMT_STRING_DATA 'S'
84#define MOL_FMT_CHAR_INT_DATA 'C'
85#define MOL_FMT_SHORT_INT_DATA 'N'
86#define MOL_FMT_LONG_INT_DATA 'L'
87#define MOL_FMT_DOUBLE_DATA 'D'
88#define MOL_FMT_FLOAT_DATA 'F'
89#define MOL_FMT_JUMP_TO_RIGHT 'J'
90#define MOL_FMT_INT_DATA 'I'
92#define MOL_FMT_MAX_VALUE_LEN 32
94#define MOL_FMT_M_STY_NON 0
95#define MOL_FMT_M_STY_SRU 1
96#define MOL_FMT_M_STY_MON 2
97#define MOL_FMT_M_STY_COP 3
98#define MOL_FMT_M_STY_MOD 4
99#define MOL_FMT_M_STY_CRO 5
100#define MOL_FMT_M_STY_MER 6
102#define MOL_FMT_M_SST_NON 0
103#define MOL_FMT_M_SST_ALT 1
104#define MOL_FMT_M_SST_RAN 2
105#define MOL_FMT_M_SST_BLK 3
107#define MOL_FMT_M_CONN_NON 0
108#define MOL_FMT_M_CONN_HT 1
109#define MOL_FMT_M_CONN_HH 2
110#define MOL_FMT_M_CONN_EU 3
113#define MOL_FMT_V3000_STENON -1
114#define MOL_FMT_V3000_STEABS 1
115#define MOL_FMT_V3000_STEREL 2
116#define MOL_FMT_V3000_STERAC 3
119#define MOL_FMT_V3000_INPLINELEN 32004
120#ifndef MOL_FMT_V3000_MAXLINELEN
121#define MOL_FMT_V3000_MAXLINELEN 32000
123#define MOL_FMT_V3000_MAXFIELDLEN 4096
126#ifndef ISOTOPIC_SHIFT_FLAG
127#define ISOTOPIC_SHIFT_FLAG 10000
135#ifndef INCHI_US_CHAR_DEF
138#define INCHI_US_CHAR_DEF
456#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
468#if (MOL_FMT_CPSS == MOL_FMT_PRESENT)
470 char reaction_component_type;
474 char reaction_component_num;
476#if (MOL_FMT_REACT == MOL_FMT_PRESENT)
477 short atom_atom_mapping_num;
478 char cInversionRetentionFlag;
482#if (MOL_FMT_REACT == MOL_FMT_PRESENT || MOL_FMT_QUERY == MOL_FMT_PRESENT)
483 char exact_change_flag;
527#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
532#if (MOL_FMT_REACT == MOL_FMT_PRESENT)
622#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
628#if (MOL_FMT_CPSS == MOL_FMT_PRESENT)
629 short n_reaction_components_plus_1;
632 short n_intermediates;
677 int* err,
char* pStrErr,
int bNoWarnings);
708 int err,
char* pStrErr);
720 int err,
char* pStrErr);
760 const char *pSdfLabel,
850 int find_norm_factors,
1101 unsigned long *CAS_num,
1107 const char *pSdfLabel,
char MOL_COORD[LEN_COORD *NUM_COORD+NUM_COORD - 1]
Definition ichisize.h:64
int MolFmtSgroups_GetIndexBySgroupId(int id, MOL_FMT_SGROUPS *items)
Gets the index of a Sgroup by its ID.
Definition mol_fmt4.c:769
struct A_MOL_FMT_SGROUP MOL_FMT_SGROUP
Data structure for Sgroup data (substance group data).
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.
Definition mol_fmt3.c:608
signed char S_CHAR
Definition mol_fmt.h:136
struct A_MOL_FMT_DATA MOL_FMT_DATA
Data structure for a MOL file.
int IntArray_Append(INT_ARRAY *items, int new_item)
Appends a new item to the INT_ARRAY structure.
Definition mol_fmt4.c:550
int MolfileSaveCopy(INCHI_IOSTREAM *inp_file, long fPtrStart, long fPtrEnd, FILE *outfile, long num)
Copy MOL-formatted data of SDF record or Molfile to another file.
Definition mol_fmt2.c:385
unsigned long SDFileExtractCASNo(char *line)
Extract CAS number from the given line.
Definition mol_fmt4.c:407
static MOL_FMT_DATA * MolfileReadDataLines(INCHI_IOSTREAM *inp_file, MOL_FMT_HEADER_BLOCK *OnlyHeaderBlock, MOL_FMT_CTAB *OnlyCTab, int bGetOrigCoord, int treat_polymers, int *err, char *pStrErr, int bNoWarnings)
Reads header lines and connection table block from input SD or MOL file, ignore STEXT block,...
Definition mol_fmt1.c:165
int MolfileGetXYZDimAndNormFactors(MOL_FMT_DATA *mfdata, int find_norm_factors, double *x0, double *y0, double *z0, double *xmin, double *ymin, double *zmin, double *scaler, int *err, char *pStrErr)
Get xyz dimensionality and normalization factors in the MOL file.
Definition mol_fmt2.c:474
int NumLists_Append(NUM_LISTS *num_lists, int *list)
Push new item to the end of array.
Definition mol_fmt4.c:471
int NumLists_ReAlloc(NUM_LISTS *num_lists)
Reallocates memory for the numeric lists.
Definition mol_fmt4.c:449
static int MolfileReadCountsLine(MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, char *pStrErr)
Reads counts line from input MOL file, includes information about the number of atoms,...
Definition mol_fmt1.c:568
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.
Definition mol_fmt3.c:862
static int MolfileReadAtomsBlock(MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
Reads an atom block from input MOL file (V2000).
Definition mol_fmt1.c:658
int MolfileV3000ReadField(void *data, int data_type, char **line_ptr)
Extract the 'data' in specified mol file field at given text position 'line_ptr'.
Definition mol_fmt3.c:257
int MolfileHasNoChemStruc(MOL_FMT_DATA *mfdata)
Check if the MOL file has no chemical structure.
Definition mol_fmt2.c:362
int NumLists_Alloc(NUM_LISTS *num_lists, int nlists)
Allocates memory for a specified number of numeric lists.
Definition mol_fmt4.c:433
void MolFmtSgroup_Free(MOL_FMT_SGROUP *sgroup)
Frees the memory allocated for the Sgroup.
Definition mol_fmt4.c:658
unsigned char U_CHAR
Definition mol_fmt.h:137
int MolfileV3000ReadStereoCollection(MOL_FMT_CTAB *ctab, char **line_ptr, int **num_list, char *pStrErr)
Read V3000 stereo collection information from the input line.
Definition mol_fmt3.c:1817
int MolFmtSgroup_Create(MOL_FMT_SGROUP **sgroup, int id, int type)
Allocate new array Sgroup.
Definition mol_fmt4.c:634
#define MOL_FMT_MAXLINELEN
Definition mol_fmt.h:72
int MolfileV3000ReadKeyword(char *key, char **line_ptr)
Read keyword from the specified line.
Definition mol_fmt3.c:410
void IntArray_DebugPrint(INT_ARRAY *items)
Prints the contents of the INT_ARRAY structure for debugging purposes.
Definition mol_fmt4.c:582
int SDFileIdentifyLabel(char *inp_line, const char *pSdfLabel)
Identify if the given line matches the specified SDF label.
Definition mol_fmt4.c:346
struct A_MOL_FMT_v3000 MOL_FMT_v3000
Data structure for V3000 representation in the MOL format.
void IntArray_Reset(INT_ARRAY *items)
Resets the INT_ARRAY structure to its initial state.
Definition mol_fmt4.c:603
void MolFmtSgroups_Free(MOL_FMT_SGROUPS *items)
Frees the memory allocated for the MOL_FMT_SGROUPS list.
Definition mol_fmt4.c:751
MOL_FMT_DATA * ReadMolfile(INCHI_IOSTREAM *inp_file, MOL_FMT_HEADER_BLOCK *OnlyHeaderBlock, MOL_FMT_CTAB *OnlyCTab, int bGetOrigCoord, int treat_polymers, int pseudos_allowed, char *pname, int lname, unsigned long *Id, const char *pSdfLabel, char *pSdfValue, int *err, char *pStrErr, int bNoWarnings)
Reads a substance text block.
Definition mol_fmt1.c:92
static int MolfileReadHeaderLines(MOL_FMT_HEADER_BLOCK *hdr, INCHI_IOSTREAM *inp_file, char *pStrErr)
Reads header lines from input MOL file. A MOL file can have 3 header lines: (1) the name of the molec...
Definition mol_fmt1.c:450
int MolfileStrnread(char *dest, char *source, int len, char **first_space)
Read a string from a source buffer into a destination buffer.
Definition mol_fmt2.c:65
MOL_FMT_DATA * FreeMolfileData(MOL_FMT_DATA *mfdata)
Free MOL file data structure.
Definition mol_fmt2.c:664
int IntArray_ReAlloc(INT_ARRAY *items)
Reallocates memory for the INT_ARRAY structure.
Definition mol_fmt4.c:525
struct tagINT_ARRAY INT_ARRAY
INT_ARRAY - Dynamically growing array of int.
int MolfileV3000Init(MOL_FMT_CTAB *ctab, char *pStrErr)
Initialize V3000 connection table in MOL file data structure.
Definition mol_fmt3.c:68
struct A_MOL_FMT_BOND MOL_FMT_BOND
Data structure for bond representation in the MOL format.
int MolFmtSgroups_Append(MOL_FMT_SGROUPS *items, int id, int type)
Appends a new Sgroup to the array.
Definition mol_fmt4.c:715
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.
Definition mol_fmt3.c:1262
int DeleteMolfileV3000Info(MOL_FMT_v3000 *v3000)
Free memory allocated for V3000 specific data in the MOL file data structure.
Definition mol_fmt3.c:165
struct A_MOL_FMT_CTAB MOL_FMT_CTAB
Connection table data structure.
long MolfileExtractStrucNum(MOL_FMT_HEADER_BLOCK *pHdr)
Extract the MOL file number from the header name line like "Structure #22".
Definition mol_fmt2.c:333
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_...
Definition mol_fmt3.c:216
int MolFmtSgroups_Alloc(MOL_FMT_SGROUPS *items, int nitems)
Allocates memory for a specified number of Sgroup objects.
Definition mol_fmt4.c:675
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.
Definition mol_fmt3.c:444
struct A_NUM_LISTS NUM_LISTS
NUM_LISTS - Dynamically growing array of numeric lists.
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.
Definition mol_fmt3.c:1889
int MolFmtSgroups_ReAlloc(MOL_FMT_SGROUPS *items)
Expand array of Sgroups.
Definition mol_fmt4.c:693
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.
Definition mol_fmt3.c:561
void IntArray_Free(INT_ARRAY *items)
Frees the memory allocated for the INT_ARRAY structure.
Definition mol_fmt4.c:610
struct A_MOL_FMT_SGROUPS MOL_FMT_SGROUPS
MOL_FMT_SGROUPS is a dynamically growing array of pointers to MOL_FMT_SGROUP objects.
void NumLists_Free(NUM_LISTS *num_lists)
Frees the memory allocated for the numeric list.
Definition mol_fmt4.c:491
int MolfileReadField(void *data, int field_len, int data_type, char **line_ptr)
Extract the 'data' in the MOL file field at given text position 'line_ptr'.
Definition mol_fmt2.c:105
int MolfileV3000ReadHapticBond(MOL_FMT_CTAB *ctab, char **line_ptr, int **num_list, char *pStrErr)
Read V3000 haptic bond information from the input line.
Definition mol_fmt3.c:1732
struct A_MOL_FMT_HEADER_BLOCK MOL_FMT_HEADER_BLOCK
Data structure for MOL file header block (3 lines).
int IntArray_AppendIfAbsent(INT_ARRAY *items, int new_item)
Appends a new item to the INT_ARRAY structure if it is not already present.
Definition mol_fmt4.c:572
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.
Definition mol_fmt4.c:161
static int MolfileReadBondsBlock(MOL_FMT_CTAB *ctab, INCHI_IOSTREAM *inp_file, int err, char *pStrErr)
Reads a bond block from input MOL file (V2000)
Definition mol_fmt1.c:816
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,...
Definition mol_fmt3.c:1602
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.
Definition mol_fmt3.c:647
struct A_MOL_FMT_ATOM MOL_FMT_ATOM
Data structure for atom representation in the MOL format.
int IntArray_Alloc(INT_ARRAY *items, int nitems)
Initializes an INT_ARRAY structure.
Definition mol_fmt4.c:510
Data structure for atom representation in the MOL format.
Definition mol_fmt.h:442
double fy
Definition mol_fmt.h:444
char radical
Definition mol_fmt.h:454
char atom_aliased_flag
Definition mol_fmt.h:489
char valence
Definition mol_fmt.h:463
S_CHAR mass_difference
Definition mol_fmt.h:448
double fz
Definition mol_fmt.h:445
char stereo_parity
Definition mol_fmt.h:455
S_CHAR charge
Definition mol_fmt.h:451
double fx
Definition mol_fmt.h:443
char symbol[6]
Definition mol_fmt.h:446
char my_n_impH
Definition mol_fmt.h:485
char display_tom
Definition mol_fmt.h:487
Data structure for bond representation in the MOL format.
Definition mol_fmt.h:505
short atnum2
Definition mol_fmt.h:507
short atnum1
Definition mol_fmt.h:506
char bond_stereo
Definition mol_fmt.h:517
char bond_type
Definition mol_fmt.h:508
Connection table data structure.
Definition mol_fmt.h:618
int n_bonds
Definition mol_fmt.h:621
MOL_FMT_SGROUPS sgroups
Definition mol_fmt.h:640
short n_stext_entries
Definition mol_fmt.h:627
short follow_inchi_1_treating_iso_mass
Definition mol_fmt.h:635
short n_property_lines
Definition mol_fmt.h:634
int n_atoms
Definition mol_fmt.h:620
char chiral_flag
Definition mol_fmt.h:626
MOL_FMT_BOND * bonds
Definition mol_fmt.h:638
MOL_COORD * coords
Definition mol_fmt.h:639
MOL_FMT_v3000 * v3000
Definition mol_fmt.h:641
MOL_FMT_ATOM * atoms
Definition mol_fmt.h:637
char version_string[7]
Definition mol_fmt.h:636
Data structure for a MOL file.
Definition mol_fmt.h:651
MOL_FMT_CTAB ctab
Definition mol_fmt.h:653
MOL_FMT_HEADER_BLOCK hdr
Definition mol_fmt.h:652
MOL_FMT_SGROUPS is a dynamically growing array of pointers to MOL_FMT_SGROUP objects.
Definition mol_fmt.h:329
int used
Definition mol_fmt.h:332
int increment
Definition mol_fmt.h:333
MOL_FMT_SGROUP ** group
Definition mol_fmt.h:330
int allocated
Definition mol_fmt.h:331
Data structure for Sgroup data (substance group data).
Definition mol_fmt.h:288
int conn
Definition mol_fmt.h:292
char smt[80]
Definition mol_fmt.h:296
int type
Definition mol_fmt.h:290
double xbr2[4]
Definition mol_fmt.h:295
INT_ARRAY alist
Definition mol_fmt.h:297
int id
Definition mol_fmt.h:289
double xbr1[4]
Definition mol_fmt.h:294
int label
Definition mol_fmt.h:293
INT_ARRAY blist
Definition mol_fmt.h:298
int subtype
Definition mol_fmt.h:291
Data structure for V3000 representation in the MOL format.
Definition mol_fmt.h:568
int n_collections
Definition mol_fmt.h:575
int n_non_haptic_bonds
Definition mol_fmt.h:576
NUM_LISTS * sterac
Definition mol_fmt.h:591
int n_steabs
Definition mol_fmt.h:582
int n_sterac
Definition mol_fmt.h:590
int n_sterel
Definition mol_fmt.h:586
int n_star_atoms
Definition mol_fmt.h:570
int n_haptic_bonds
Definition mol_fmt.h:577
int n_sgroups
Definition mol_fmt.h:573
NUM_LISTS * sterel
Definition mol_fmt.h:587
NUM_LISTS * steabs
Definition mol_fmt.h:583
int * atom_index_fin
Definition mol_fmt.h:572
int n_3d_constraints
Definition mol_fmt.h:574
int n_non_star_atoms
Definition mol_fmt.h:569
NUM_LISTS * haptic_bonds
Definition mol_fmt.h:578
int * atom_index_orig
Definition mol_fmt.h:571
NUM_LISTS - Dynamically growing array of numeric lists.
Definition mol_fmt.h:159
int allocated
Definition mol_fmt.h:161
int ** lists
Definition mol_fmt.h:160
int used
Definition mol_fmt.h:162
int increment
Definition mol_fmt.h:163
INT_ARRAY - Dynamically growing array of int.
Definition mol_fmt.h:206
int * item
Definition mol_fmt.h:207
int increment
Definition mol_fmt.h:210
int used
Definition mol_fmt.h:209
int allocated
Definition mol_fmt.h:208