InChI
 
Loading...
Searching...
No Matches
mol_fmt.h
Go to the documentation of this file.
1/*
2 * International Chemical Identifier (InChI)
3 * Version 1
4 * Software version 1.07
5 * April 30, 2024
6 *
7 * MIT License
8 *
9 * Copyright (c) 2024 IUPAC and InChI Trust
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 *
29 * The InChI library and programs are free software developed under the
30 * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
31 * Originally developed at NIST.
32 * Modifications and additions by IUPAC and the InChI Trust.
33 * Some portions of code were developed/changed by external contributors
34 * (either contractor or volunteer) which are listed in the file
35 * 'External-contributors' included in this distribution.
36 *
37 * info@inchi-trust.org
38 *
39 */
40
41#ifndef _MOL_FMT_H_
42#define _MOL_FMT_H_
43
44#include <stdio.h>
45
46#include "ichisize.h"
47#include "mode.h" /* djb-rwth: necessary header file */
48
49/*
50 Data structures and constants
51*/
52
53/*************************** read MOL file V2000.************************/
54/* ref: A.Dalby et al, "Description of Several Chemical Structure
55 * File Formats Used by Computer Programs Developed at Molecular
56 * Design Limited", J. Chem. Inf. Comput. Sci., 1992, 32, 244-255.
57 */
58
59/* ************************** read MOL file V3000.************************ */
60/* http://download.accelrys.com/freeware/ctfile-formats/CTFile-formats.zip
61 * Last accessed 2013-06-11
62 */
63
64/*-----------*/
65/* CONSTANTS */
66/*-----------*/
67
68#define SD_FMT_END_OF_DATA "$$$$"
69
70#define MOL_FMT_INPLINELEN 204 /* add cr, lf, double zero termination */
71#ifndef MOL_FMT_MAXLINELEN
72#define MOL_FMT_MAXLINELEN 200
73#endif
74
75#define MOL_FMT_PRESENT 1
76#define MOL_FMT_ABSENT 0
77
78/* configuration */
79#define MOL_FMT_QUERY MOL_FMT_ABSENT
80#define MOL_FMT_CPSS MOL_FMT_ABSENT
81#define MOL_FMT_REACT MOL_FMT_ABSENT
82
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'
91
92#define MOL_FMT_MAX_VALUE_LEN 32 /* max length of string containing a numerical value */
93
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
111
112/* V3000 specific constants */
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
117
118/* provisional limits for V3000 */
119#define MOL_FMT_V3000_INPLINELEN 32004 /* add cr, lf, double zero termination */
120#ifndef MOL_FMT_V3000_MAXLINELEN
121#define MOL_FMT_V3000_MAXLINELEN 32000
122#endif
123#define MOL_FMT_V3000_MAXFIELDLEN 4096
124
125/*#ifdef TARGET_EXE_USING_API*/
126#ifndef ISOTOPIC_SHIFT_FLAG
127#define ISOTOPIC_SHIFT_FLAG 10000 /* add to isotopic mass if isotopic_mass = */
128#endif
129/*#endif*/
130
131/*-------------------*/
132/* SIMPLE DATA TYPES */
133/*-------------------*/
134
135#ifndef INCHI_US_CHAR_DEF
136typedef signed char S_CHAR;
137typedef unsigned char U_CHAR;
138#define INCHI_US_CHAR_DEF
139#endif
140
141#ifndef LEN_COORD
142#define LEN_COORD 10
143#endif
144#ifndef NUM_COORD
145#define NUM_COORD 3
146#endif
147
148/*-----------------*/
149/* DATA STRUCTURES */
150/*-----------------*/
158typedef struct A_NUM_LISTS
159{
160 int **lists;
162 int used;
165
173int NumLists_Alloc(NUM_LISTS *num_lists, int nlists);
174
181int NumLists_ReAlloc(NUM_LISTS *num_lists);
182
190int NumLists_Append(NUM_LISTS *num_lists, int *list);
191
196void NumLists_Free(NUM_LISTS *num_lists);
197
205typedef struct tagINT_ARRAY
206{
207 int *item;
209 int used;
212
221int IntArray_Alloc(INT_ARRAY *items, int nitems);
222
230int IntArray_ReAlloc(INT_ARRAY *items);
231
240int IntArray_Append(INT_ARRAY *items, int new_item);
241
250int IntArray_AppendIfAbsent(INT_ARRAY *items, int new_item);
251
257void IntArray_Reset(INT_ARRAY *items);
258
264void IntArray_Free(INT_ARRAY *items);
265
271void IntArray_DebugPrint(INT_ARRAY *items);
272
287typedef struct A_MOL_FMT_SGROUP
288{
289 int id;
290 int type;
292 int conn;
293 int label;
294 double xbr1[4];
295 double xbr2[4];
296 char smt[80];
300
310 int id,
311 int type);
312
319
335
343int MolFmtSgroups_Alloc(MOL_FMT_SGROUPS *items, int nitems);
344
352
361int MolFmtSgroups_Append(MOL_FMT_SGROUPS *items, int id, int type);
362
369
378
416
441typedef struct A_MOL_FMT_ATOM
442{
443 double fx; /* F10.5; Generic */
444 double fy; /* F10.5; Generic */
445 double fz; /* F10.5; Generic */
446 char symbol[6]; /* aaa; Generic */
447
448 S_CHAR mass_difference; /* dd; (M_ISO) */
449 /* Generic: -3..+4 otherwise 0 or */
450 /* 127=most abund. isotope */
451 S_CHAR charge; /* ccc; (M CHG), */
452 /* Generic: 1=+3, 2=+2,3=+1, */
453 /* 4=doublet,5=-1,6=-2,7=-3 */
454 char radical; /* (M RAD) */
455 char stereo_parity; /* sss; Generic */
456#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
457 char H_count_plus_1; /* hhh; Query; */
458 /* Hn means >= n H; */
459 /* H0 means no H */
460 char stereo_care; /* bbb; Query: 0=ignore; */
461 /* 1=must match */
462#endif
463 char valence; /* vvv: */
464 /* 0=no marking; (1..14)=(1..14); */
465 /* 15=zero valence.Number of bonds*/
466 /* includes bonds to impl. H's */
467
468#if (MOL_FMT_CPSS == MOL_FMT_PRESENT)
469 char H0_designator; /* HHH: CPSS */
470 char reaction_component_type; /* rrr: */
471 /* CPSS: 1=reactant, */
472 /* 2=product, */
473 /* 3=intermediate */
474 char reaction_component_num; /* iii: CPSS: 0 to (n-1) */
475#endif
476#if (MOL_FMT_REACT == MOL_FMT_PRESENT)
477 short atom_atom_mapping_num; /* mmm: Reaction: 1..255 */
478 char cInversionRetentionFlag; /* nnn: */
479 /* 1=inverted, 2=retained config.;*/
480 /* 0=property not applied */
481#endif
482#if (MOL_FMT_REACT == MOL_FMT_PRESENT || MOL_FMT_QUERY == MOL_FMT_PRESENT)
483 char exact_change_flag; /* eee */
484#endif
485 char my_n_impH; /* number of implicit H calculated */
486 /* for adding H to strings in STDATA*/
487 char display_tom; /* Do not hide element's name */
488 /* (applies to C 7-25-98 DCh */
489 char atom_aliased_flag; /* Do not remove */
490 /* charge/radical/isotope if it */
491 /* is in the alias. 9-3-99 DCh */
493
504typedef struct A_MOL_FMT_BOND
505{
506 short atnum1; /* 111: First atom number: Generic */
507 short atnum2; /* 222: Second atom number:Generic */
508 char bond_type; /* ttt: */
509 /* 1,2,3=single, double, triple; */
510 /* 4=aromatic; */
511 /* 5=single or double; */
512 /* 6=single or aromatic; */
513 /* 7=double or aromatic; */
514 /* 8=any. */
515 /* Values 4-8 are for */
516 /* SSS queries only */
517 char bond_stereo; /* sss: */
518 /* Single bonds: */
519 /* 0=not stereo, 1=up, */
520 /* 4=either, 6=down */
521 /* Double bonds: */
522 /* 0=use x,y,z to */
523 /* determine cis/trans, */
524 /* 3=cis or trans (either) */
525 /* xxx: not used */
526
527#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
528 char bond_topology; /* rrr: */
529 /* 0=either, 1=ring, 2=chain: */
530 /* SSS queries only */
531#endif
532#if (MOL_FMT_REACT == MOL_FMT_PRESENT)
533 char react_center_status; /* ccc: */
534 /* 0 = unmarked, */
535 /* 1 = a center, */
536 /* -1 = not a center; */
537 /* Additional: */
538 /* 2 = no charge, */
539 /* 4 = bond made/broken, */
540 /* 8 = bond order changes */
541 /* 12=4+8; 5=4+1, 9=8+1, 13=12+1 */
542 /* 12=4+8; 5=4+1, 9=8+1, 13=12+1 */
543 /* are also possible */
544#endif
546
567typedef struct A_MOL_FMT_v3000
568{
571 int *atom_index_orig; /* index as supplied for atoms */
572 int *atom_index_fin; /* = index or -1 for star atom */
573 int n_sgroups; /* currently, we do not use this. */
574 int n_3d_constraints; /* currently, we do not use this. */
578 NUM_LISTS *haptic_bonds; /* haptic_bonds[i] is ptr to int* which contains */
579 /* bond_type, non-star atom number, */
580 /* nendpts, then endpts themselves */
581 /* Enhanced stereo */
583 NUM_LISTS *steabs; /* steabs[k][0] - not used */
584 /* steabs[k][1] - number of members in collection */
585 /* steabs[k][2..] - member atom numbers */
587 NUM_LISTS *sterel; /* sterel[k][0] - n from "STERELn" tag */
588 /* sterel[k][1] - number of members in collection */
589 /* sterel[k][2..] - member atom numbers */
591 NUM_LISTS *sterac; /* sterac[k][0] - n from "STERACn" tag */
592 /* sterac[k][1] - number of members in collection */
593 /* sterac[k][2..] - member atom numbers */
595
617typedef struct A_MOL_FMT_CTAB
618{
619 /* Line #1: Counts line */
620 int n_atoms; /* int accounts for possible V3000. Was: aaa; <= 255; Generic */
621 int n_bonds; /* int accounts for possible V3000. Was: bbb; <= 255; Generic */
622#if (MOL_FMT_QUERY == MOL_FMT_PRESENT)
623 short n_atom_lists; /* lll; <= 30; Query */
624#endif
625
626 char chiral_flag; /* ccc; 0 or 1; Generic */
627 short n_stext_entries; /* sss; CPSS */
628#if (MOL_FMT_CPSS == MOL_FMT_PRESENT)
629 short n_reaction_components_plus_1; /* xxx; CPSS */
630 short n_reactants; /* rrr; CPSS */
631 short n_products; /* ppp; CPSS */
632 short n_intermediates; /* iii; CPSS */
633#endif
634 short n_property_lines; /* mmm; Generic */
636 char version_string[7]; /* vvvvvv; Generic; 'V2000' */
637 MOL_FMT_ATOM *atoms; /* The Atom Block */
640 MOL_FMT_SGROUPS sgroups; /* growable array of pointers to Sgroup objects */
643
655
656/*
657 Functions
658*/
659
673 MOL_FMT_HEADER_BLOCK* OnlyHeaderBlock,
674 MOL_FMT_CTAB* OnlyCTab,
675 int bGetOrigCoord,
676 int treat_polymers,
677 int* err, char* pStrErr, int bNoWarnings);
678
687static int MolfileReadHeaderLines(MOL_FMT_HEADER_BLOCK* hdr, INCHI_IOSTREAM* inp_file, char* pStrErr);
688
697static int MolfileReadCountsLine(MOL_FMT_CTAB* ctab, INCHI_IOSTREAM* inp_file, char* pStrErr);
698
707static int MolfileReadAtomsBlock(MOL_FMT_CTAB* ctab, INCHI_IOSTREAM* inp_file,
708 int err, char* pStrErr);
709
719static int MolfileReadBondsBlock(MOL_FMT_CTAB* ctab, INCHI_IOSTREAM* inp_file,
720 int err, char* pStrErr);
721
752 MOL_FMT_HEADER_BLOCK *OnlyHeaderBlock,
753 MOL_FMT_CTAB *OnlyCTab,
754 int bGetOrigCoord,
755 int treat_polymers,
756 int pseudos_allowed,
757 char *pname,
758 int lname,
759 unsigned long *Id,
760 const char *pSdfLabel,
761 char *pSdfValue,
762 int *err,
763 char *pStrErr,
764 int bNoWarnings);
765
775int MolfileStrnread(char *dest,
776 char *source,
777 int len,
778 char **first_space);
779
796int MolfileReadField(void *data,
797 int field_len,
798 int data_type,
799 char **line_ptr);
800
808
816
827int MolfileSaveCopy(INCHI_IOSTREAM *inp_file,
828 long fPtrStart,
829 long fPtrEnd,
830 FILE *outfile,
831 long num);
832
850 int find_norm_factors,
851 double *x0,
852 double *y0,
853 double *z0,
854 double *xmin,
855 double *ymin,
856 double *zmin,
857 double *scaler,
858 int *err,
859 char *pStrErr);
860
868
869/*
870 V3000 Molfile
871*/
872
881 char *pStrErr);
882
892 INCHI_IOSTREAM *inp_file,
893 char *pStrErr);
894
905 INCHI_IOSTREAM *inp_file,
906 int err,
907 char *pStrErr);
908
924 INCHI_IOSTREAM *inp_file,
925 int err,
926 char *pStrErr);
927
943 INCHI_IOSTREAM *inp_file,
944 int err,
945 char *pStrErr);
946
959 char **line_ptr,
960 int **num_list,
961 char *pStrErr);
962
975 char **line_ptr,
976 int **num_list,
977 char *pStrErr);
978
990 INCHI_IOSTREAM *inp_file,
991 int err,
992 char *pStrErr);
993
1005 INCHI_IOSTREAM *inp_file,
1006 int err,
1007 char *pStrErr);
1008
1020 INCHI_IOSTREAM *inp_file,
1021 int err,
1022 char *pStrErr);
1023/* Clean V3000 stuff */
1024
1032
1041char *inchi_fgetsLf_V3000(char *line,
1042 INCHI_IOSTREAM *inp_stream);
1043
1052 INCHI_IOSTREAM *inp_stream);
1053
1063int MolfileV3000ReadField(void *data,
1064 int data_type,
1065 char **line_ptr);
1073int MolfileV3000ReadKeyword(char *key,
1074 char **line_ptr);
1075
1076/*
1077 SDF
1078*/
1079
1101 unsigned long *CAS_num,
1102 char *comment,
1103 int lcomment,
1104 char *name,
1105 int lname,
1106 int prev_err,
1107 const char *pSdfLabel,
1108 char *pSdfValue,
1109 char *pStrErr,
1110 int bNoWarnings);
1111
1123int SDFileIdentifyLabel(char *inp_line, const char *pSdfLabel);
1124
1131unsigned long SDFileExtractCASNo(char *line);
1132
1133#endif /* _MOL_FMT_H_ */
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
Data structure for MOL file header block (3 lines).
Definition mol_fmt.h:399
char dim_code[3]
Definition mol_fmt.h:409
char minute
Definition mol_fmt.h:408
char year
Definition mol_fmt.h:406
char comment[81]
Definition mol_fmt.h:414
short scaling_factor1
Definition mol_fmt.h:410
char user_initls[3]
Definition mol_fmt.h:402
double scaling_factor2
Definition mol_fmt.h:411
char hour
Definition mol_fmt.h:407
char molname[MOL_FMT_MAXLINELEN+1]
Definition mol_fmt.h:400
long internal_regno
Definition mol_fmt.h:413
char month
Definition mol_fmt.h:404
char line2[MOL_FMT_MAXLINELEN+1]
Definition mol_fmt.h:401
char prog_name[9]
Definition mol_fmt.h:403
char day
Definition mol_fmt.h:405
double energy
Definition mol_fmt.h:412
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
Definition mode.h:1030
Definition mode.h:1016