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

General callbacks
Functions to open and close files. More...

#include "global.h"
#include "interface.h"
#include "callbacks.h"
#include "bind.h"
#include "project.h"
#include "workspace.h"
#include "glwindow.h"
#include "glview.h"
#include "atom_edit.h"
#include "cell_edit.h"
#include "readers.h"
Include dependency graph for callbacks.c:

Go to the source code of this file.

Functions

void simple_image_render ()
 simple direct rendering from command line
G_MODULE_EXPORT void on_edit_activate (GtkWidget *widg, gpointer data)
 create an edition dialog - prepare the dialog
gchar * substitute_string (gchar *init, gchar *o_motif, gchar *n_motif)
 substitute all patterns in string
int open_cif_file (gchar *filename)
int open_coord_file (gchar *filename, int fti)
 open atomic coordinates file
int open_history_file (gchar *filename)
int open_cell_file (int format, gchar *filename)
 open the file that contains the cell parameters
double get_z_from_periodic_table (gchar *lab)
 get Z from atom label
G_MODULE_EXPORT void on_close_workspace (GtkWidget *widg, gpointer data)
 close the active workspace
int signal_error (const char *file, const char *func, int error_line, int error_id)
void update_error_trace (const char *file, const char *func, int trace_line)
int open_save (FILE *fp, int act, int wid, int pid, int aid, gchar *pfile)
 open or save project file
void quit_gtk ()
 Leave the application.
int open_save_workspace (FILE *fp, int act)
 open or save the active workspace
void open_this_proj (gpointer data, gpointer user_data)
 Open many projects, one at a time.
G_MODULE_EXPORT void run_on_open_save_active (GtkDialog *info, gint response_id, gpointer data)
 open or save an atomes file - running the dialog
G_MODULE_EXPORT void on_open_save_activate (GtkWidget *widg, gpointer data)
 open or save an atomes file - prepare the dialog
G_MODULE_EXPORT void on_save_as_activate (GtkWidget *widg, gpointer data)
 open or save, choosing a file name
void run_project ()
 send project data to Fortran90
void apply_project (gboolean showtools)
 get project ready for calculation and initialize the OpenGL window
void open_this_isaacs_xml_file (gchar *profile, int ptoc, gboolean visible)
 open an ISAACS XML file
G_MODULE_EXPORT void run_on_isaacs_port (GtkDialog *info, gint response_id, gpointer data)
 open or write ISAACS XML file - running the dialog
G_MODULE_EXPORT void on_isaacs_port (GtkWidget *widg, gpointer data)
 open or write ISAACS XML file - prepare the dialog
void to_read_pos ()
 send atomic coordinates to Fortran90
void check_read_sa ()
 reading CPMD/VASP trajectory, testing parameters to active the read capabilty
void update_sa_info (int sid)
 reading CPMD/VASP trajectory, update chemical species info
G_MODULE_EXPORT void update_sa (GtkEntry *res, gpointer data)
 reading CPMD/VASP trajectory, set the number of chemical species
G_MODULE_EXPORT void changed_spec_combo (GtkComboBox *box, gpointer data)
 reading CPMD/VASP trajectory, change the active species
void prepare_sp_box ()
 eading CPMD/VASP trajectory, prepare the species combo box
G_MODULE_EXPORT void update_at_sp (GtkEntry *res, gpointer data)
 reading CPMD/VASP trajectory, changing number of atomes or species
int prep_chem_data ()
 prepare chemical data to read CPMD/VASP file
G_MODULE_EXPORT void run_to_read_trj_or_vas (GtkDialog *dialog, gint response_id, gpointer data)
 reading CPMD/VASP trajectory: run the dialog
int to_read_trj_or_vas (int ff)
 reading CPMD/VASP trajectory - prepare the dialog
void cell_data_from_pdb_ (float *a, float *b, float *c, float *alp, float *bet, float *gam)
 update cell parameters from the data in the PDB file
G_MODULE_EXPORT void run_read_npt_data (GtkDialog *info, gint response_id, gpointer data)
 read NPT data associated with atomic coordinates: run the dialog GTK3 callback
int read_npt_data ()
 read NPT data associated with atomic coordinates: setup the dialog
int open_coordinate_file (int id)
 try to open coordinate file, type is based of id
void open_this_coordinate_file (int format, gchar *proj_name)
 open coordinate file format, if successful add to workspace
G_MODULE_EXPORT void run_on_coord_port (GtkDialog *info, gint response_id, gpointer data)
 export or import atomic coordinates: run dialog
G_MODULE_EXPORT void on_coord_port (GtkWidget *widg, gpointer data)
 export or import atomic coordinates: prepare dialog

Variables

char * coord_files [NCFORMATS+1]
char * coord_files_ext [NCFORMATS+1]
char ** las
const gchar * dfi [2]
gboolean save = TRUE
atomes_errorproject_error = NULL
atomes_error_signal errors_messages []
tint osp
gboolean run_os
GtkWidget * read_box
GtkWidget * all_sp_box = NULL
GtkWidget * sa_lab [2]
GtkWidget * sa_entry [2]
GtkWidget * read_this
int read_spec
int reading_vas_trj
int npt_selection
gchar * npt_file
GtkFileFilter * filter [NCFORMATS+1]
int pactive

Detailed Description

General callbacks
Functions to open and close 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 callbacks.c.

Function Documentation

◆ apply_project()

void apply_project ( gboolean showtools)

get project ready for calculation and initialize the OpenGL window

Parameters
showtools

Definition at line 794 of file callbacks.c.

◆ cell_data_from_pdb_()

void cell_data_from_pdb_ ( float * a,
float * b,
float * c,
float * alp,
float * bet,
float * gam )

update cell parameters from the data in the PDB file

Parameters
aa
bb
cc
alpalpha
betbeta
gamgamma

Definition at line 1305 of file callbacks.c.

◆ changed_spec_combo()

G_MODULE_EXPORT void changed_spec_combo ( GtkComboBox * box,
gpointer data )

reading CPMD/VASP trajectory, change the active species

Parameters
boxthe GtkComboBox sending the signal
datathe associated data pointer

Definition at line 1103 of file callbacks.c.

◆ check_read_sa()

void check_read_sa ( )

reading CPMD/VASP trajectory, testing parameters to active the read capabilty

Definition at line 1009 of file callbacks.c.

◆ get_z_from_periodic_table()

double get_z_from_periodic_table ( gchar * lab)
extern

get Z from atom label

Parameters
labthe atomic label

Definition at line 305 of file w_library.c.

◆ on_close_workspace()

G_MODULE_EXPORT void on_close_workspace ( GtkWidget * widg,
gpointer data )

close the active workspace

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 126 of file callbacks.c.

◆ on_coord_port()

G_MODULE_EXPORT void on_coord_port ( GtkWidget * widg,
gpointer data )

export or import atomic coordinates: prepare dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 1763 of file callbacks.c.

◆ on_edit_activate()

G_MODULE_EXPORT void on_edit_activate ( GtkWidget * widg,
gpointer data )
extern

create an edition dialog - prepare the dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 865 of file edit_menu.c.

◆ on_isaacs_port()

G_MODULE_EXPORT void on_isaacs_port ( GtkWidget * widg,
gpointer data )

open or write ISAACS XML file - prepare the dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer (int *) open = 0, save = 1

Definition at line 904 of file callbacks.c.

◆ on_open_save_activate()

G_MODULE_EXPORT void on_open_save_activate ( GtkWidget * widg,
gpointer data )

open or save an atomes file - prepare the dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 549 of file callbacks.c.

◆ on_save_as_activate()

G_MODULE_EXPORT void on_save_as_activate ( GtkWidget * widg,
gpointer data )

open or save, choosing a file name

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 747 of file callbacks.c.

◆ open_cell_file()

int open_cell_file ( int format,
gchar * filename )
extern

open the file that contains the cell parameters

Parameters
formatFile format
filenameFile name

Definition at line 231 of file read_npt.c.

◆ open_cif_file()

int open_cif_file ( gchar * filename)
extern

◆ open_coord_file()

int open_coord_file ( gchar * filename,
int fti )
extern

open atomic coordinates file

Parameters
filenamethe file name
ftithe type of coordinates

Definition at line 274 of file read_coord.c.

◆ open_coordinate_file()

int open_coordinate_file ( int id)

try to open coordinate file, type is based of id

Parameters
idfile type to open

Definition at line 1407 of file callbacks.c.

◆ open_history_file()

int open_history_file ( gchar * filename)
extern

◆ open_save()

int open_save ( FILE * fp,
int act,
int wid,
int pid,
int aid,
gchar * pfile )

open or save project file

Parameters
fpthe file pointer
act0 = read, 1 = write
widread or save workspace (1/0)
pidthe project id
aidthe active project id
pfilethe file name

Definition at line 246 of file callbacks.c.

◆ open_save_workspace()

int open_save_workspace ( FILE * fp,
int act )

open or save the active workspace

Parameters
fpthe file to read or write
actthe action (0 = read, 1 = write)

Definition at line 361 of file callbacks.c.

◆ open_this_coordinate_file()

void open_this_coordinate_file ( int format,
gchar * proj_name )

open coordinate file format, if successful add to workspace

Parameters
formatthe format of the file that contains the atomic coordinates
proj_namethe project name to use, if any

Definition at line 1568 of file callbacks.c.

◆ open_this_isaacs_xml_file()

void open_this_isaacs_xml_file ( gchar * profile,
int ptoc,
gboolean visible )

open an ISAACS XML file

Parameters
profilethe XML file name
ptocthe previous active project
visibleread from the command line (FALSE), from the gui (TRUE)

Definition at line 814 of file callbacks.c.

◆ open_this_proj()

void open_this_proj ( gpointer data,
gpointer user_data )

Open many projects, one at a time.

Parameters
data
user_data

Definition at line 426 of file callbacks.c.

◆ prep_chem_data()

int prep_chem_data ( )

prepare chemical data to read CPMD/VASP file

Definition at line 1207 of file callbacks.c.

◆ prepare_sp_box()

void prepare_sp_box ( )

eading CPMD/VASP trajectory, prepare the species combo box

Definition at line 1113 of file callbacks.c.

◆ quit_gtk()

void quit_gtk ( )

Leave the application.

Definition at line 330 of file callbacks.c.

◆ read_npt_data()

int read_npt_data ( )

read NPT data associated with atomic coordinates: setup the dialog

Definition at line 1370 of file callbacks.c.

◆ run_on_coord_port()

G_MODULE_EXPORT void run_on_coord_port ( GtkDialog * info,
gint response_id,
gpointer data )

export or import atomic coordinates: run dialog

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

Definition at line 1657 of file callbacks.c.

◆ run_on_isaacs_port()

G_MODULE_EXPORT void run_on_isaacs_port ( GtkDialog * info,
gint response_id,
gpointer data )

open or write ISAACS XML file - running the dialog

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

Definition at line 858 of file callbacks.c.

◆ run_on_open_save_active()

G_MODULE_EXPORT void run_on_open_save_active ( GtkDialog * info,
gint response_id,
gpointer data )

open or save an atomes file - running the dialog

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

Definition at line 465 of file callbacks.c.

◆ run_project()

void run_project ( )

send project data to Fortran90

Definition at line 759 of file callbacks.c.

◆ run_read_npt_data()

G_MODULE_EXPORT void run_read_npt_data ( GtkDialog * info,
gint response_id,
gpointer data )

read NPT data associated with atomic coordinates: run the dialog GTK3 callback

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

Definition at line 1345 of file callbacks.c.

◆ run_to_read_trj_or_vas()

G_MODULE_EXPORT void run_to_read_trj_or_vas ( GtkDialog * dialog,
gint response_id,
gpointer data )

reading CPMD/VASP trajectory: run the dialog

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

Definition at line 1229 of file callbacks.c.

◆ signal_error()

int signal_error ( const char * file,
const char * func,
int error_line,
int error_id )

Definition at line 182 of file callbacks.c.

◆ simple_image_render()

void simple_image_render ( )
extern

simple direct rendering from command line

Definition at line 241 of file image.c.

◆ substitute_string()

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

substitute all patterns in string

Parameters
initthe initial string
o_motifthe pattern to replace
n_motifthe new pattern

Definition at line 375 of file w_library.c.

◆ to_read_pos()

void to_read_pos ( )

send atomic coordinates to Fortran90

Definition at line 960 of file callbacks.c.

◆ to_read_trj_or_vas()

int to_read_trj_or_vas ( int ff)

reading CPMD/VASP trajectory - prepare the dialog

Parameters
fffile type

Definition at line 1268 of file callbacks.c.

◆ update_at_sp()

G_MODULE_EXPORT void update_at_sp ( GtkEntry * res,
gpointer data )

reading CPMD/VASP trajectory, changing number of atomes or species

Parameters
resthe GtkEntry sending the signal
datathe associated data pointer (int *) 0 = atomes, 1 = species

Definition at line 1167 of file callbacks.c.

◆ update_error_trace()

void update_error_trace ( const char * file,
const char * func,
int trace_line )

Definition at line 200 of file callbacks.c.

◆ update_sa()

G_MODULE_EXPORT void update_sa ( GtkEntry * res,
gpointer data )

reading CPMD/VASP trajectory, set the number of chemical species

Parameters
resthe GtkEntry sending the signal
datathe associated data pointer

Definition at line 1071 of file callbacks.c.

◆ update_sa_info()

void update_sa_info ( int sid)

reading CPMD/VASP trajectory, update chemical species info

Parameters
sidthe species id

Definition at line 1035 of file callbacks.c.

Variable Documentation

◆ all_sp_box

GtkWidget* all_sp_box = NULL

Definition at line 998 of file callbacks.c.

◆ coord_files

char* coord_files[NCFORMATS+1]
Initial value:
= {i18n("XYZ file"),
i18n("XYZ file - NPT"),
i18n("Chem3D file"),
i18n("CPMD trajectory"),
i18n("CPMD trajectory - NPT"),
i18n("VASP trajectory"),
i18n("VASP trajectory - NPT"),
i18n("PDB file"),
i18n("PDB file"),
i18n("Cryst. information (crystal build) - single configuration"),
i18n("Cryst. information (crystal build) - multiple configurations"),
i18n("Cryst. information (symmetry positions) - single configuration"),
i18n("DL-POLY HISTORY file"),
i18n("ISAACS Project File")}
#define i18n(String)
Definition global.c:80

Definition at line 88 of file callbacks.c.

◆ coord_files_ext

char* coord_files_ext[NCFORMATS+1]
Initial value:
={"xyz", "xyz", "c3d", "trj", "trj", "xdatcar", "xdatcar",
"pdb", "ent", "cif", "cif", "cif", "hist", "ipf"}

Definition at line 103 of file callbacks.c.

◆ dfi

const gchar* dfi[2]
extern

Definition at line 93 of file main.c.

◆ errors_messages

atomes_error_signal errors_messages[]
Initial value:
= {{ ERROR_RW, i18n("I/O error")},
{ ERROR_PROJECT, i18n("project information")},
{ ERROR_CURVE, i18n("curve(s) information")},
{ ERROR_IMAGE, i18n("OpenGL information")},
{ ERROR_ATOM_A, i18n("atom's data - A")},
{ ERROR_ATOM_B, i18n("atom's data - B")},
{ ERROR_UPDATE, i18n("updating project")},
{ ERROR_NO_WAY, i18n("this should not happen")},
{ ERROR_COORD, i18n("coordination data")},
{ ERROR_RINGS, i18n("ring(s) data")},
{ ERROR_CHAINS, i18n("chain(s) data")},
{ ERROR_MOL, i18n("molecule(s) data")},
{ ERROR_ANA, i18n("analysis data")},
{ ERROR_QM, i18n("ab-initio data")},
{ ERROR_FIELD, i18n("classical data")}}
#define ERROR_CHAINS
Definition global.h:306
#define ERROR_ATOM_B
Definition global.h:301
#define ERROR_RW
Definition global.h:296
#define ERROR_UPDATE
Definition global.h:302
#define ERROR_CURVE
Definition global.h:298
#define ERROR_PROJECT
Definition global.h:297
#define ERROR_FIELD
#define ERROR_IMAGE
Definition global.h:299
#define ERROR_RINGS
Definition global.h:305
#define ERROR_ATOM_A
Definition global.h:300
#define ERROR_COORD
Definition global.h:304
#define ERROR_MOL
Definition global.h:307
#define ERROR_ANA
Definition global.h:308
#define ERROR_QM
Definition global.h:309
#define ERROR_NO_WAY
Definition global.h:303

Definition at line 156 of file callbacks.c.

◆ filter

GtkFileFilter* filter[NCFORMATS+1]

Definition at line 1557 of file callbacks.c.

◆ las

char** las

Definition at line 106 of file callbacks.c.

◆ npt_file

gchar* npt_file

Definition at line 1320 of file callbacks.c.

◆ npt_selection

int npt_selection

Definition at line 1319 of file callbacks.c.

◆ osp

tint osp

Definition at line 438 of file callbacks.c.

◆ pactive

int pactive

Definition at line 1558 of file callbacks.c.

◆ project_error

atomes_error* project_error = NULL

Definition at line 155 of file callbacks.c.

◆ read_box

GtkWidget* read_box

Definition at line 997 of file callbacks.c.

◆ read_spec

int read_spec

Definition at line 1002 of file callbacks.c.

◆ read_this

GtkWidget* read_this

Definition at line 1001 of file callbacks.c.

◆ reading_vas_trj

int reading_vas_trj

Definition at line 1200 of file callbacks.c.

◆ run_os

gboolean run_os

Definition at line 439 of file callbacks.c.

◆ sa_entry

GtkWidget* sa_entry[2]

Definition at line 1000 of file callbacks.c.

◆ sa_lab

GtkWidget* sa_lab[2]

Definition at line 999 of file callbacks.c.

◆ save

gboolean save = TRUE

Definition at line 153 of file callbacks.c.