atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
w_library.c File Reference

Functions to create the molecular library
Functions to read the 'Simple chemical XML' files. More...

#include "global.h"
#include "bind.h"
#include "interface.h"
#include "project.h"
#include "glview.h"
#include "glwindow.h"
#include <libxml/xmlreader.h>
+ Include dependency graph for w_library.c:

Go to the source code of this file.

Macros

#define FAMILY   26
 

Functions

gboolean create_3d_model (int p, gboolean load)
 
G_MODULE_EXPORT void on_realize (GtkGLArea *area, gpointer data)
 
xmlNodePtr findnode (xmlNodePtr startnode, char *nname)
 find XML node
 
int action_atoms_from_project (project *this_proj, atom_search *asearch, gboolean visible)
 apply atom edition action to project (motion, remove, replace, insert, random move)
 
void to_insert_in_project (int stat, int orig, project *this_proj, atom_search *asearch, gboolean visible)
 to insert object in project
 
void create_object_from_library (int p)
 create object using the molecular library
 
double get_z_from_periodic_table (gchar *lab)
 get Z from atom label
 
int clean_xml_data (xmlDoc *doc, xmlTextReaderPtr reader)
 free XML data
 
gchar * replace_markup (char *init, char *key, char *rep)
 replace pattern in string
 
gchar * substitute_string (gchar *init, gchar *o_motif, gchar *n_motif)
 substitute all patterns in string
 
gchar * check_xml_string (gchar *init)
 check for, and correct tags in XML string
 
int sml_preview (const char *filetoread)
 retrieve preview information from 'Simple chemical library XML' file
 
gchar * open_sml_file (const char *filetoread, int fam)
 open 'Simple chemical library XML' file
 
int get_family (gchar *str)
 get molecular family id
 
void sort_files (int num_f)
 sort file(s) by molecular family and name
 
int get_sml_files ()
 get the library 'Simple chemical library XML' files
 
void fill_molecule_tree (GtkListStore *store)
 fill molecule list store
 
void fill_family_tree (GtkListStore *store)
 fill molecular family list store
 
void insert_preview ()
 insert preview in library window and visualize
 
void prepare_preview (int active, int id, gboolean visible)
 prepare library molecule preview
 
G_MODULE_EXPORT void select_library_data (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data)
 select library element callback
 
G_MODULE_EXPORT void set_library_markup (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
 set font markup in the molecular library tree store
 
GtkWidget * library_tree (GtkListStore *store, int id, gchar *name)
 create library tree store widget
 
G_MODULE_EXPORT void run_select_from_library (GtkDialog *lib, gint response_id, gpointer data)
 select from library - running the dialog
 
int select_from_library (gboolean visible, project *this_proj, atom_search *asearch)
 select object to insert from the library
 
int insert_this_project_from_lib (int id, gboolean visible, project *this_proj, atom_search *asearch)
 insert object from the library
 

Variables

element_data periodic_table_info []
 
insertion_menu mol []
 
gchar * family_list [FAMILY]
 
gchar * family_dir [FAMILY]
 
atom_searchremove_search
 
GtkListStore * family_store
 
GtkTreeIter first_family_iter
 
GtkListStore * molecule_store
 
GtkTreeIter first_mol_iter
 
GtkTreeSelection * libselect [2]
 
int the_family
 
gchar * the_molecule
 
gchar ** sml_file_name
 
gchar ** mol_name
 
GtkWidget * lib_preview_box = NULL
 
GtkWidget * lib_preview_plot = NULL
 
projectlib_proj = NULL
 
gchar * other_name [5]
 
int o_names
 
int inserted_from_lib
 
gboolean lib_res
 
gboolean lib_visible
 

Detailed Description

Functions to create the molecular library
Functions to read the 'Simple chemical XML' files.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file w_library.c.

Macro Definition Documentation

◆ FAMILY

#define FAMILY   26

Definition at line 214 of file w_library.c.

Function Documentation

◆ action_atoms_from_project()

int action_atoms_from_project ( project * this_proj,
atom_search * asearch,
gboolean visible )
extern

apply atom edition action to project (motion, remove, replace, insert, random move)

Parameters
this_projthe target project
asearchthe target atom search
visibleis the 'model edition' window visible (1/0)

Definition at line 206 of file atom_action.c.

◆ check_xml_string()

gchar * check_xml_string ( gchar * init)

check for, and correct tags in XML string

Parameters
initthe XML string to check / correct

Definition at line 393 of file w_library.c.

◆ clean_xml_data()

int clean_xml_data ( xmlDoc * doc,
xmlTextReaderPtr reader )

free XML data

Parameters
docthe XML doc pointer to free
readerthe XML reader to free

Definition at line 322 of file w_library.c.

◆ create_3d_model()

gboolean create_3d_model ( int p,
gboolean load )
extern

Definition at line 1384 of file glwindow.c.

◆ create_object_from_library()

void create_object_from_library ( int p)
extern

create object using the molecular library

Parameters
pthe project id of the library molecule in the workspace

Definition at line 421 of file atom_object.c.

◆ fill_family_tree()

void fill_family_tree ( GtkListStore * store)

fill molecular family list store

Parameters
storethe list store to fill

Definition at line 803 of file w_library.c.

◆ fill_molecule_tree()

void fill_molecule_tree ( GtkListStore * store)

fill molecule list store

Parameters
storethe list store to fill

Definition at line 777 of file w_library.c.

◆ findnode()

xmlNodePtr findnode ( xmlNodePtr startnode,
char * nname )
extern

find XML node

Parameters
startnodeStarting node
nnameNode name to find

Definition at line 548 of file read_isaacs.c.

◆ get_family()

int get_family ( gchar * str)

get molecular family id

Parameters
strthe moecular family

Definition at line 607 of file w_library.c.

◆ get_sml_files()

int get_sml_files ( )

get the library 'Simple chemical library XML' files

Definition at line 654 of file w_library.c.

◆ get_z_from_periodic_table()

double get_z_from_periodic_table ( gchar * lab)

get Z from atom label

Parameters
labthe atomic label

Definition at line 304 of file w_library.c.

◆ insert_preview()

void insert_preview ( )

insert preview in library window and visualize

Definition at line 827 of file w_library.c.

◆ insert_this_project_from_lib()

int insert_this_project_from_lib ( int id,
gboolean visible,
project * this_proj,
atom_search * asearch )

insert object from the library

Parameters
idobject id to insert
visibleis the 'model edition window' visible
this_projthe target project
asearchthe target atom search

Definition at line 1158 of file w_library.c.

◆ library_tree()

GtkWidget * library_tree ( GtkListStore * store,
int id,
gchar * name )

create library tree store widget

Parameters
storethe list store model to use
idselection id (0 = family, 1 = molecule)
namecolumn label

Definition at line 1013 of file w_library.c.

◆ on_realize()

G_MODULE_EXPORT void on_realize ( GtkGLArea * area,
gpointer data )
extern

◆ open_sml_file()

gchar * open_sml_file ( const char * filetoread,
int fam )

open 'Simple chemical library XML' file

Parameters
filetoreadthe name of the file to open
famthe molecular family

Definition at line 547 of file w_library.c.

◆ prepare_preview()

void prepare_preview ( int active,
int id,
gboolean visible )

prepare library molecule preview

Parameters
activeactive project id
idmolecule id number
visibleis the 'model edition' window visible

Definition at line 910 of file w_library.c.

◆ replace_markup()

gchar * replace_markup ( char * init,
char * key,
char * rep )

replace pattern in string

Parameters
initthe string
keythe pattern to replace
repthe new pattern

Definition at line 339 of file w_library.c.

◆ run_select_from_library()

G_MODULE_EXPORT void run_select_from_library ( GtkDialog * lib,
gint response_id,
gpointer data )

select from library - running the dialog

Parameters
libthe GtkDialog sending the signal
response_idthe response id
datathe associated data pointer

Definition at line 1045 of file w_library.c.

◆ select_from_library()

int select_from_library ( gboolean visible,
project * this_proj,
atom_search * asearch )

select object to insert from the library

Parameters
visibleis the 'model edition' window visible
this_projthe target project
asearchthe target atom search

Definition at line 1102 of file w_library.c.

◆ select_library_data()

G_MODULE_EXPORT void select_library_data ( GtkTreeView * tree_view,
GtkTreePath * path,
GtkTreeViewColumn * column,
gpointer data )

select library element callback

Parameters
tree_viewthe GtkTreeView sending the signal
paththe path in the tree view
columnthe column in the tree view
datathe associated data pointer

Definition at line 958 of file w_library.c.

◆ set_library_markup()

G_MODULE_EXPORT void set_library_markup ( GtkTreeViewColumn * col,
GtkCellRenderer * renderer,
GtkTreeModel * mod,
GtkTreeIter * iter,
gpointer data )

set font markup in the molecular library tree store

Parameters
colthe target GtkTreeViewColumn
rendererthe target cell renderer
modthe target tree model
iterthe target tree iter
datathe associated data pointer

Definition at line 996 of file w_library.c.

◆ sml_preview()

int sml_preview ( const char * filetoread)

retrieve preview information from 'Simple chemical library XML' file

Parameters
filetoreadthe name of the file to read

Definition at line 412 of file w_library.c.

◆ sort_files()

void sort_files ( int num_f)

sort file(s) by molecular family and name

Parameters
num_fnumber of file(s) to sort

Definition at line 624 of file w_library.c.

◆ substitute_string()

gchar * substitute_string ( gchar * init,
gchar * o_motif,
gchar * n_motif )

substitute all patterns in string

Parameters
initthe initial string
o_motifthe pattern to replace
n_motifthe new pattern

Definition at line 372 of file w_library.c.

◆ to_insert_in_project()

void to_insert_in_project ( int stat,
int orig,
project * this_proj,
atom_search * asearch,
gboolean visible )
extern

to insert object in project

Parameters
statin enum object_types
orig- (fragmol id/species id +1), -1, or, orgin atom id
this_projthe target project
asearchthe target atom search
visibleis the model edition window visible ?

Definition at line 1214 of file atom_object.c.

Variable Documentation

◆ family_dir

gchar* family_dir[FAMILY]
Initial value:
={"Misc",
"Alcohols",
"Aldehydes",
"Alkanes",
"Alkenes",
"Alkynes",
"Amides",
"Amines",
"Amino_acids",
"Aromatics",
"Carboxylic_acids",
"Cyclic_alkanes",
"Cyclic_alkenes",
"Ethers",
"Fatty_acids",
"Fullerenes",
"Heterocyclics",
"Macrocycles",
"Ketones",
"Nitriles",
"Nucleobases",
"Steroids",
"Linear_sugars",
"Cyclic_sugars",
"Sulfoxides",
"Thiols"}

Definition at line 242 of file w_library.c.

◆ family_list

gchar* family_list[FAMILY]
Initial value:
={"Misc",
"Alcohols",
"Aldehydes",
"Alkanes",
"Alkenes",
"Alkynes",
"Amides",
"Amines",
"Amino acids",
"Aromatics",
"Carboxylic acids",
"Cyclic alkanes",
"Cyclic alkenes",
"Ethers",
"Fatty acids",
"Fullerenes",
"Heterocyclics",
"Macrocycles",
"Ketones",
"Nitriles",
"Nucleobases",
"Steroids",
"Sugars (Linears)",
"Sugars (Cyclics)",
"Sulfoxides",
"Thiols"}

Definition at line 215 of file w_library.c.

◆ family_store

GtkListStore* family_store

Definition at line 281 of file w_library.c.

◆ first_family_iter

GtkTreeIter first_family_iter

Definition at line 282 of file w_library.c.

◆ first_mol_iter

GtkTreeIter first_mol_iter

Definition at line 284 of file w_library.c.

◆ inserted_from_lib

int inserted_from_lib

Definition at line 295 of file w_library.c.

◆ lib_preview_box

GtkWidget* lib_preview_box = NULL

Definition at line 290 of file w_library.c.

◆ lib_preview_plot

GtkWidget* lib_preview_plot = NULL

Definition at line 291 of file w_library.c.

◆ lib_proj

project* lib_proj = NULL

Definition at line 292 of file w_library.c.

◆ lib_res

gboolean lib_res

Definition at line 1033 of file w_library.c.

◆ lib_visible

gboolean lib_visible

Definition at line 1034 of file w_library.c.

◆ libselect

GtkTreeSelection* libselect[2]

Definition at line 285 of file w_library.c.

◆ mol

Initial value:
= {
{ "Atom", NULL, -1, 0 },
{ NULL, "H", 1, 1 },
{ NULL, "B", 5, 1 },
{ NULL, "C", 6, 1 },
{ NULL, "N", 7, 1 },
{ NULL, "O", 8, 1 },
{ NULL, "F", 9, 1 },
{ NULL, "S", 16, 1 },
{ NULL, "Cl", 17, 1 },
{ NULL, "Other ...", -1, 1 },
{ "Library", NULL, -1, 0 },
{ NULL, "H<sub>2</sub>O", -1, 3 },
{ NULL, "CH<sub>4</sub>", -1, 5 },
{ NULL, "Toluene", -1, 15 },
{ NULL, "Cp", -1, 10 },
{ NULL, "C<sub>60</sub>", -1, 60},
{ NULL, "Ni-Phthalocyanine", -1, 57 },
{ NULL, "More ...", -1, -1 },
{ NULL, NULL, -1, 0 }}

Definition at line 193 of file w_library.c.

◆ mol_name

gchar** mol_name

Definition at line 289 of file w_library.c.

◆ molecule_store

GtkListStore* molecule_store

Definition at line 283 of file w_library.c.

◆ o_names

int o_names

Definition at line 294 of file w_library.c.

◆ other_name

gchar* other_name[5]

Definition at line 293 of file w_library.c.

◆ periodic_table_info

element_data periodic_table_info[]

Definition at line 71 of file w_library.c.

◆ remove_search

atom_search* remove_search
extern

Definition at line 175 of file popup.c.

◆ sml_file_name

gchar** sml_file_name

Definition at line 288 of file w_library.c.

◆ the_family

int the_family

Definition at line 286 of file w_library.c.

◆ the_molecule

gchar* the_molecule

Definition at line 287 of file w_library.c.