atomes 1.2.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
dlp_field.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2025 by CNRS and University of Strasbourg */
15
23/*
24* This file: 'dlp_field.c'
25*
26* Contains:
27*
28
29 - The functions to prepare the DL-POLY / LAMMPS input preparation assistant
30 - The functions to design a classical force field
31
32*
33* List of functions:
34
35 int struct_id (int f);
36 int body_at (int b);
37 int get_field_tree_data (GtkWidget * tree, int treeid, GtkTreePath * path);
38 int get_field_data_id (int k, gchar * data);
39
40 G_MODULE_EXPORT gint on_assistant_go_forward (gint current_page, gpointer data);
41
42 gboolean set_nbd_but_sensitive (int nbid);
43 gboolean field_file_has_energy_parameters (gboolean scale, int sca, int scb);
44
45 G_MODULE_EXPORT gboolean on_pop_up_field (GtkWidget * widget, gpointer data);
46 G_MODULE_EXPORT gboolean on_field_button_event (GtkWidget * widget, GdkEvent * event, gpointer data);
47 G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWindow * assistant, gpointer data);
48 G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWidget * assistant, GdkEvent * event, gpointer data);
49
50 gchar * parameters_info (int obj, int key, gchar ** words, float * data);
51 gchar * set_field_label (int f, int m);
52 gchar * pop_info (int i, int id);
53 gchar * pop_edit (int i);
54 gchar * pop_add (int i);
55 gchar * pop_remove (int i);
56
57 void set_mol_num_label ();
58 void setup_cs_labels (int i);
59 void fill_field_struct (GtkTreeStore * store, int id, int mo);
60 void fill_field_body (GtkTreeStore * store, int id);
61 void fill_field_model (GtkTreeStore * store, int f, int m);
62 void update_field_trees ();
63 void get_is_energy (int i, int l);
64 void append_field_item (GMenu * menu, const gchar * name, const gchar * key, int item_id,
65 gchar * accel, int image_format, gpointer icon,
66 gboolean custom, GCallback handler, gpointer data,
67 gboolean check, gboolean status, gboolean radio, gboolean sensitive);
68 void pop_up_field_context_menu (int row_id, GtkWidget * widget, double event_x, double event_y, gpointer data);
69 void pop_up_field_context_menu (int row_id, GtkWidget * widget, GdkEvent * event, gpointer data);
70 void field_button_event (double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data);
71 void field_button_event (GdkEvent * event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data);
72 void field_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
73 void field_set_markup_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
74 void field_set_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
75 void field_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
76 void field_set_color_and_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
77 void field_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
78 void prop_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
79 void pmf_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
80 void rig_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
81 void field_set_color_markup_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
82 void field_set_color_markup_and_visible_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data);
83 void get_field_iter_and_edit (gchar * path_string, gpointer data);
84 void create_field_list (GtkWidget * vbx, int f);
85 void close_the_assistant (GtkAssistant * assistant);
86 void hide_show_this_pages (int start, int end, int status, int delta);
87 void remove_classical_assistant_pages ();
88 void add_classical_assistant_pages (int p);
89 void create_ff_structure (int ai, int type);
90 void on_assistant_apply (GtkAssistant * assistant, gpointer data);
91 void create_classical_force_field (int p, int f);
92
93 G_MODULE_EXPORT void toggle_field_params (GtkCheckButton * but, gpointer data);
94 G_MODULE_EXPORT void toggle_field_params (GtkToggleButton * but, gpointer data);
95 G_MODULE_EXPORT void changed_mol_box (GtkComboBox * box, gpointer data);
96 G_MODULE_EXPORT void run_changed_energy_unit (GtkDialog * dialog, gint response_id, gpointer data);
97 G_MODULE_EXPORT void changed_energy_unit (GtkComboBox * box, gpointer data);
98 G_MODULE_EXPORT void changed_field_key_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data);
99 G_MODULE_EXPORT void to_select_atom_id_from_fied_molecule (GSimpleAction * action, GVariant * parameter, gpointer data);
100 G_MODULE_EXPORT void on_field_button_pressed (GtkGesture * gesture, int n_press, double x, double y, gpointer data);
101 G_MODULE_EXPORT void on_field_button_released (GtkGesture * gesture, int n_press, double x, double y, gpointer data);
102 G_MODULE_EXPORT void edit_field_cell (GtkCellRendererText * cell, gchar * path_string, gchar * new_text, gpointer data);
103 G_MODULE_EXPORT void to_edit_field_prop (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data);
104 G_MODULE_EXPORT void on_field_row_activated (GtkTreeView * treeview, GtkTreePath * path, GtkTreeViewColumn * col, gpointer data);
105 G_MODULE_EXPORT void on_assistant_cancel (GtkAssistant * assistant, gpointer data);
106 G_MODULE_EXPORT void on_assistant_close (GtkAssistant * assistant, gpointer data);
107 G_MODULE_EXPORT void on_assistant_prepare (GtkAssistant * assistant, GtkWidget * page, gpointer data);
108 G_MODULE_EXPORT void run_clean_field (GtkDialog * dial, gint response_id, gpointer data);
109 G_MODULE_EXPORT void clean_field (GtkCheckButton * but, gpointer data);
110 G_MODULE_EXPORT void clean_field (GtkToggleButton * but, gpointer data);
111 G_MODULE_EXPORT void select_field_action (GtkCheckButton * but, gpointer data);
112 G_MODULE_EXPORT void select_field_action (GtkToggleButton * but, gpointer data);
113 G_MODULE_EXPORT void changed_init_box (GtkComboBox * box, gpointer data);
114 G_MODULE_EXPORT void show_force_field_preview (GtkButton * but, gpointer data);
115 G_MODULE_EXPORT void run_on_assistant_apply (GtkNativeDialog * info, gint response_id, gpointer data);
116 G_MODULE_EXPORT void run_on_assistant_apply (GtkDialog * info, gint response_id, gpointer data);
117
118 GtkWidget * vbox_init (int p);
119 GtkWidget * create_combo_mol (int f);
120 GtkWidget * create_field_tree (int f);
121 GtkWidget * create_mol_box (int f);
122 GtkWidget * vbox_field (int f);
123
124*/
125
126#include "dlp_field.h"
127#include "calc.h"
128#include "callbacks.h"
129#include "interface.h"
130#include "project.h"
131#include "glwindow.h"
132#include "glview.h"
133#include "bind.h"
134
136extern GtkWidget * extra_vbox[2];
137extern ColRGBA init_color (int id, int numid);
138extern void restore_ogl_selection (glwin * view);
139
140gchar * felemts[MAXDATA+1] = {"Energy unit",
141 "Molecule",
142 "Atom",
143 "Core-shell unit",
144 "Constraint bond",
145 "Mean force potential",
146 "Rigid unit",
147 "Tethering potential",
148 "Flexible chemical bond",
149 "Bond restraint",
150 "Bond angle",
151 "Angular restraint",
152 "Dihedral angle",
153 "Torsional restraint",
154 "Improper angle",
155 "Inversion angle",
156 "van der Waals potential",
157 "Metal potential",
158 "Tersoff Potential",
159 "Three-body potential",
160 "Four-body potential",
161 "External field"};
162
163gchar * elemts[MAXDATA] = {"molecule",
164 "atom",
165 "core-shell unit",
166 "constraint bond",
167 "mean force potential",
168 "rigid unit",
169 "tethering potential",
170 "flexible chemical bond",
171 "bond restraint",
172 "bond angle",
173 "angular restraint",
174 "dihedral angle",
175 "torsional restraint",
176 "improper angle",
177 "inversion angle",
178 "van der Waals potential",
179 "metal potential",
180 "Tersoff Potential",
181 "three-body potential",
182 "four-body potential",
183 "external field"};
184
185gchar * fkeysw[2][16][21] = {{{"eV", "kcal", "kJ", "K", "internal", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 0 - Energy unit(s)
186 {"harm", "rhrm", "quar", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 1 - Tethering pot.
187 {"harm", "mors", "12-6", "lj ", "rhrm", "quar", "buck", "coul", "fene", "mmst", "tab ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 2 - Bond pot.
188 {"-hrm", "-mrs", "-126", "-lj ", "-rhm", "-qur", "-bck", "-cul", "-fne", "-mst", "-tab", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 3 - Bond rest.
189 {"harm", "quar", "thrm", "shrm", "bvs1", "bvs2", "hcos", "cos ", "mmsb", "stst", "stbe", "cmps", "mmbd", "kky ", "tab ", " ", " ", " ", " ", " ", " "}, // 4 - Angles pot.
190 {"-hrm", "-qur", "-thm", "-shm", "-bv1", "-bv2", "-hcs", "-cos", "-msb", "-sts", "-stb", "-cmp", "-mbd", "-kky", "-tab", " ", " ", " ", " ", " ", " "}, // 5 - Angles rest.
191 {"cos ", "harm", "hcos", "cos3", "ryck", "rbf ", "opls", "tab ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 6 - Dihedral pot.
192 {"-cos", "-hrm", "-hcs", "-cs3", "-rck", "-rbf", "-opl", "-tab", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 8 - Torsion pot.
193 {"cos ", "harm", "hcos", "cos3", "ryck", "rbf ", "opls", "tab ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 7 - Improper pot.
194 {"harm", "hcos", "plan", "xpln", "calc", "tab ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 9 - Inversion pot.
195 {"12-6", "lj ", "ljc", "nm ", "buck", "bhm ", "hbnd", "snm ", "mors", "wca ", "dpd", "14-7", "mstw", "ryb", "zbl", "zbls", "zblb", "mlj", "mbuc", "m126", "tab "}, // 10 - Vdw pot.
196 {"eam ", "eeam", "2bea", "2bee", "fnsc", "exfs", "stch", "gupt", "mbpc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 11 - Metal pot.
197 {"ters", "kihs", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 12 - Tersoff pot.
198 {"harm", "thrm", "shrm", "bvs1", "bvs2", "hbnd", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 13 - Three-body pot.
199 {"harm", "hcos", "plan", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}, // 14 - Four-body pot.
200 {"elec", "oshr", "shrx", "grav", "magn", "sphr", "zbnd", "xpis", "zres", "zrs-", "zrs+", "osel", "ushr", " ", " ", " ", " ", " ", " ", " ", " "}}, // 15 - External fields.
201 {{"lj", "real", "metal", "si", "cgs", "electron", "micro", "nano", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
202 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
203 {"harmonic", "class2", "fene", "fene/expand", "gromos", "harmonic/shift", "harmonic/shift/cut", "mm3", "morse", "nonlinear", "oxdna/fene", "oxdna2/fene", "oxrna2/fene", "quartic", "special", "table", " ", " ", " ", " ", " "},
204 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
205 {"harmonic", "charmm", "class2", "class2/p6", "cosine", "cosine/buck6d", "cosine/delta", "cosine/periodic", "cosine/shift", "cosine/shift/exp", "cosine/squared", "cross", "dipole", "fourier", "fourier/simple", "mm3", "quartic", "sdk", "table", " ", " "},
206 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
207 {"cosine/shift/exp", "charmm", "charmmfsw", "class2", "fourier", "harmonic", "helix", "multi/harmonic", "nharmonic", "opls", "quadratic","spherical", "table", "table/cut", " ", " ", " ", " ", " ", " ", " "},
208 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
209 {"harmonic", "class2", "cossq", "cvff", "distance", "distharm", "fourier", "ring", "sqdistharm", "umbrella", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
210 {"inversion/harmonic", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
211 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
212 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
213 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
214 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
215 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
216 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}}};
217
218gchar * fnames[2][16][21] = {{{"Electron-Volts", "k-calories per mol", "k-Joules per mol", "Kelvin per Boltzmann", "DL_POLY internal units", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
219 {"Harmonic", "Restraint", "Quartic", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
220 {"Harmonic", "Morse", "12-6", "Lennard-Jones", "Restraint", "Quartic", "Buckingham", "Coulomb", "Shifted FENE", "MM3 bond stretch", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
221 {"Harmonic", "Morse", "12-6", "Lennard-Jones", "Restraint", "Quartic", "Buckingham", "Coulomb", "Shifted FENE", "MM3 bond stretch", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
222 {"Harmonic", "Quartic", "Truncated harmonic", "Screened harmonic", "Screened Vessal", "Truncated Vessal", "Harmonic cosine", "Cosine", "MM3 stretch-bend", "Compass stretch-stretch", "Compass stretch-bend", "Compass all terms", "MM3 angle bend", "KKY", "Tabulated", " ", " ", " ", " ", " ", " "},
223 {"Harmonic", "Quartic", "Truncated harmonic", "Screened harmonic", "Screened Vessal", "Truncated Vessal", "Harmonic cosine", "Cosine", "MM3 stretch-bend", "Compass stretch-stretch", "Compass stretch-bend", "Compass all terms", "MM3 angle bend", "KKY", "Tabulated", " ", " ", " ", " ", " ", " "},
224 {"Cosine", "Harmonic", "Harmonic cosine", "Triple cosine", "Ryckaert-Bellemans", "Fluorinated Ryckaert-Bellemans", "OPLS torsion", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
225 {"Cosine", "Harmonic", "Harmonic cosine", "Triple cosine", "Ryckaert-Bellemans", "Fluorinated Ryckaert-Bellemans", "OPLS torsion", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
226 {"Cosine", "Harmonic", "Harmonic cosine", "Triple cosine", "Ryckaert-Bellemans", "Fluorinated Ryckaert-Bellemans", "OPLS torsion", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
227 {"Harmonic", "Harmonic cosine", "Planar", "Extended Planar", "Calcite", "Tabulated", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
228 {"12-6", "Lennard-Jones", "LJ cohesive", "n-m", "Buckingham", "Born-Huggins-Meyer", "12-10 H-bond", "Shifted force n-m", "Morse", "Shifted Weeks-Chandler-Anderson", "Standard DPD", "14-7 buffered AMOEBA FF",
229 "Morse modified", "Rydberg", "ZBL", "ZBL mixed with Morse", "ZBL mixed with Buckingham", "Lennard-Jones tapered with MDF", "Buckingham tapered with MDF", "12-6 Lennard-Jones tapered with MDF", "Tabulated"},
230 {"EAM", "EEAM", "2BEAM", "2BEEAM", "Finis-Sinclair", "Extended Finis-Sinclair", "Sutton-Chen", "Gupta", "MBPC", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
231 {"Tersoff", "KIHS", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
232 {"Harmonic", "Truncated harmonic", "Screened harmonic", "Screened Vessal", "Truncated Vessal", "H-bond", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
233 {"Harmonic", "Harmonic cosine", "Planar", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
234 {"Electric field", "Oscillating Shear", "Continuous Shear", "Gravitational field", "Magnetic field", "Containing Sphere", "Repulsive Wall", "X-Piston", "Molecule in HR Zone", "HR Zone (pull out)", "HR Zone (pull in)", "Osc. Electric Field", "Umbrella sampling, harm. constant", " ", " ", " ", " ", " ", " ", " ", " "}},
235 {{"lj", "k-calories per mol", "Electron-Volts", "k-Joules per mol", "cgs", "electron", "micro", "nano", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
236 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
237 {"Harmonic","COMPASS class2 force field", "Finite extensible nonlinear elastic (FENE)", "FENE with variable size particles", "GROMOS force field", "Shifted harmonic", "Shifted truncated harmonic", "MM3 anharmonic", "Morse", "Nonlinear", "Finite extensible nonlinear elastic DNA",
238 "Finite extensible nonlinear elastic DNA (2)", "Finite extensible nonlinear elastic RNA", "Breakable quartic", "Special bond exclusions for 1-5 pairs and beyond", "Tabulated", " ", " ", " ", " ", " "},
239 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
240 {"Harmonic", "CHARMM force field", "COMPASS class2 force field", "COMPASS class2 force field - 6th order", "Cosine", "Cosine with Buckingham term between 1-3", "Difference of cosines", "DREIDING force field", "Cosine with a shift", "Cosine with a shift and exponential term in spring",
241 "Cosine with squared term", "Cross term coupling angle and bond length", "Dipole orientation", "Fourier (multiple cosines)", "Fourier (single cosine)", "MM3", "Quartic", "Combination of the harmonic (SDK)", "Tabulated", " ", " "},
242 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
243 {"Cosine with a shift and exponential term in spring", "CHARMM force field", "CHARMM force field with force switching", "COMPASS class2 force field", "Fourier (multiple cosines)", "Harmonic", "Helix", "Harmonic with 5 terms",
244 "Harmonic with N terms", "OPLS force field", "Quadratic", "Spherical", "Tabulated", "Tabulated with analytic cutoff", " ", " ", " ", " ", " ", " ", " "},
245 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
246 {"Harmonic", "COMPASS class2 force field", "Cosine squared", "CVFF force field", "Distance between atom planes", "Out-of-the plane distance", "Fourier (multiple cosines)", "Planar conformation", "Squared distance harmonic", "DREIDING force field", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
247 {"Harmonic with Wilson Decius out-of-plane", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
248 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
249 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
250 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
251 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
252 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
253 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}}};
254
255int fvalues[2][15][21] = {{{ 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 0 - Tethered
256 { 2, 3, 2, 2, 3, 4, 3, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 1 - Bond(s)
257 { 2, 3, 2, 2, 3, 4, 3, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 2 - Bond restraint(s)
258 { 2, 4, 3, 4, 4, 4, 2, 3, 4, 3, 3, 6, 2, 4, 0, 0, 0, 0, 0, 0, 0}, // 3 - Angle(s)
259 { 2, 4, 3, 4, 4, 4, 2, 3, 4, 3, 3, 6, 2, 4, 0, 0, 0, 0, 0, 0, 0}, // 4 - Angle restraint(s)
260 { 3, 2, 2, 3, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 5 - Dihedral(s)
261 { 3, 2, 2, 3, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 6 - Torsional restraint(s)
262 { 3, 2, 2, 3, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 7 - Improper(s)
263 { 2, 2, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 8 - Inversion(s)
264 { 2, 2, 3, 4, 3, 5, 2, 5, 3, 3, 2, 2, 4, 3, 2, 7, 7, 3, 4, 3, 0}, // 9 - vdW
265 { 0, 0, 0, 0, 7, 9, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 10 - Metal(s)
266 {11,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 11 - Tersoff(s)
267 { 2, 3, 4, 4, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 12 - 3-body
268 { 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 13 - 4-body
269 { 3, 2, 2, 3, 3, 4, 3, 3, 5, 5, 5, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0}}, // 14 - External(s)
270 {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 0 - Tethered
271 { 2, 4, 4, 5, 2, 3, 3, 2, 3, 3, 3, 3, 3, 5, 2, 2, 0, 0, 0, 0, 0}, // 1 - Bond(s)
272 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 2 - Bond restraint(s)
273 { 2, 4, 4, 4, 1, 3, 2, 3, 2, 3, 2, 6, 2, 4, 3, 2, 4, 2, 2, 0, 0}, // 3 - Angle(s)
274 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 4 - Angle restraint(s)
275 { 3, 4, 4, 6, 4, 3, 3, 5, 2, 4, 2,11, 2, 2, 0, 0, 0, 0, 0, 0, 0}, // 5 - Dihedral(s)
276 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 6 - Torsional restraint(s)
277 { 2, 2, 2, 3, 2, 2, 5, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 7 - Improper(s)
278 { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 8 - Inversion(s)
279 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 9 - vdW
280 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 10 - Metal(s)
281 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 11 - Tersoff(s)
282 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 12 - 3-body
283 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // 13 - 4-body
284 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};// 14 - External(s)
285
288
291
292char * fvars_teth[2][FTETH][FTETH_P] = {{{"k", " ", " "},
293 {"k", "r<sub>c</sub>", " "},
294 {"k", "k'", "k''"}},
295 {{" ", " ", " "},
296 {" ", " ", " "},
297 {" ", " ", " "}}};
298
299int feunit_teth[2][FTETH][FTETH_P] = {{{1, 0, 0},
300 {1, 0, 0},
301 {1, 0, 0}},
302 {{0, 0, 0},
303 {0, 0, 0},
304 {0, 0, 0}}};
305
306char * fvars_bond[2][FBONDS][FBONDS_P] = {{{"k", "r<sub>0</sub>", " ", " ", " "},
307 {"E<sub>0</sub>", "r<sub>0</sub>", "k", " ", " "},
308 {"A", "B", " ", " ", " "},
309 {"ϵ", "σ", " ", " ", " "},
310 {"k", "r<sub>0</sub>", "r<sub>c</sub>", " ", " "},
311 {"k", "r<sub>0</sub>", "k'", "k''", " "},
312 {"A", "ρ", "C", " ", " "},
313 {"k", " ", " ", " ", " "},
314 {"k", "R<sub>0</sub>", "Δ", " ", " "},
315 {"k", "r<sub>o</sub>", " ", " ", " "},
316 {" ", " ", " ", " ", " "},
317 {" ", " ", " ", " ", " "},
318 {" ", " ", " ", " ", " "},
319 {" ", " ", " ", " ", " "},
320 {" ", " ", " ", " ", " "},
321 {" ", " ", " ", " ", " "}},
322 {{"K", "r<sub>0</sub>", " ", " ", " "},
323 {"r<sub>0</sub>", "K<sub>2</sub>", "K<sub>3</sub>", "K<sub>4</sub>", " "},
324 {"K", "R<sub>0</sub>", "ϵ", "σ", " "},
325 {"K", "R<sub>0</sub>", "ϵ", "σ", "Δ"},
326 {"K", "r<sub>0</sub>", " ", " ", " "},
327 {"K", "r<sub>0</sub>", "r<sub>c</sub>", " ", " "},
328 {"U<sub>min</sub>", "r<sub>0</sub>", "r<sub>c</sub>", " ", " "},
329 {"K", "r<sub>0</sub>", " ", " ", " "},
330 {"D", "α", "r<sub>0</sub>", " ", " "},
331 {"ϵ", "r<sub>0</sub>", "λ", " ", " "},
332 {"ϵ", "Δ", "r<sub>0</sub>", " ", " "},
333 {"ϵ", "Δ", "r<sub>0</sub>", " ", " "},
334 {"ϵ", "Δ", "r<sub>0</sub>", " ", " "},
335 {"K", "B<sub>1</sub>", "B<sub>2</sub>", "R<sub>c</sub>", "U<sub>0</sub>"},
336 {"w<sub>LJ</sub>", "w<sub>Coul</sub>", " ", " ", " "},
337 {"Interpolation style", "Distances", " ", " ", " "}}};
338
339int feunit_bond[2][FBONDS][FBONDS_P] = {{{1, 0, 0, 0, 0},
340 {1, 0, 1, 0, 0},
341 {1, 1, 0, 0, 0},
342 {1, 0, 0, 0, 0},
343 {1, 0, 0, 0, 0},
344 {1, 0, 1, 1, 0},
345 {1, 0, 1, 0, 0},
346 {1, 0, 0, 0, 0},
347 {1, 0, 0, 0, 0},
348 {1, 0, 0, 0, 0},
349 {0, 0, 0, 0, 0},
350 {0, 0, 0, 0, 0},
351 {0, 0, 0, 0, 0},
352 {0, 0, 0, 0, 0},
353 {0, 0, 0, 0, 0},
354 {0, 0, 0, 0, 0}},
355 {{1, 0, 0, 0, 0},
356 {0, 1, 1, 1, 0},
357 {1, 0, 1, 0, 0},
358 {1, 0, 1, 0, 0},
359 {1, 0, 0, 0, 0},
360 {1, 0, 0, 0, 0},
361 {1, 0, 0, 0, 0},
362 {1, 0, 0, 0, 0},
363 {1, 0, 0, 0, 0},
364 {1, 0, 0, 0, 0},
365 {1, 0, 0, 0, 0},
366 {1, 0, 0, 0, 0},
367 {1, 0, 0, 0, 0},
368 {1, 0, 0, 0, 1},
369 {0, 0, 0, 0, 0},
370 {0, 0, 0, 0, 0}}};
371
372char * fvars_angle[2][FANGLES][FANGLES_P] = {{{"k", "θ<sub>0</sub>", " ", " ", " ", " "},
373 {"k", "θ<sub>0</sub>", "k'", "k''", " ", " "},
374 {"k", "θ<sub>0</sub>", "ρ", " ", " ", " "},
375 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " ", " "},
376 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " ", " "},
377 {"k", "θ<sub>0</sub>", "a", "ρ", " ", " "},
378 {"k", "θ<sub>0</sub>", " ", " ", " ", " "},
379 {"A", "δ", "m", " ", " ", " "},
380 {"A", "θ<sub>0</sub>", "r<sup>o</sup><sub>ij</sub>", "r<sup>o</sup><sub>jk</sub>", " ", " "},
381 {"A", "r<sup>o</sup><sub>ij</sub>", "r<sup>o</sup><sub>jk</sub>", " ", " ", " "},
382 {"A", "θ<sub>0</sub>", "r<sup>o</sup><sub>ij</sub>", " ", " ", " "},
383 {"A", "B", "C", "θ<sub>0</sub>", "r<sup>o</sup><sub>ij</sub>", "r<sup>o</sup><sub>jk</sub>"},
384 {"k", "θ<sub>0</sub>", " ", " ", " ", " "},
385 {"f<sub>k</sub>", "θ<sub>0</sub>", "g<sub>r</sub>", "r<sub>o</sub>", " ", " "},
386 {" ", " ", " ", " ", " ", " "},
387 {" ", " ", " ", " ", " ", " "},
388 {" ", " ", " ", " ", " ", " "},
389 {" ", " ", " ", " ", " ", " "},
390 {" ", " ", " ", " ", " ", " "}},
391 {{"K", "θ<sub>0</sub>", " ", " ", " ", " "},
392 {"K", "θ<sub>0</sub>", "K<sub>ub</sub>", "r<sub>ub</sub>", " ", " "},
393 {"θ<sub>0</sub>", "K<sub>2</sub>", "K<sub>3</sub>", "K<sub>4</sub>", " ", " "},
394 {"θ<sub>0</sub>", "K<sub>2</sub>", "K<sub>3</sub>", "K<sub>4</sub>", " ", " "},
395 {"K", " ", " ", " ", " ", " "},
396 {"K", "n", "θ<sub>0</sub>", " ", " ", " "},
397 {"K", "θ<sub>0</sub>", " ", " ", " ", " "},
398 {"C", "B", "n", " ", " ", " "},
399 {"U<sub>min</sub>", "θ<sub>0</sub>", " ", " ", " ", " "},
400 {"U<sub>min</sub>", "θ<sub>0</sub>", "A", " ", " ", " "},
401 {"K", "θ<sub>0</sub>", " ", " ", " ", " "},
402 {"K<sub>SS</sub>", "K<sub>BS0</sub>", "K<sub>BS1</sub>", "r<sub>12,0</sub>", "r<sub>32,0</sub>", "θ<sub>0</sub>"},
403 {"K", "λ<sub>0</sub>", " ", " ", " ", " "},
404 {"K", "C<sub>0</sub>", "C<sub>1</sub>", "C<sub>2</sub>", " ", " "},
405 {"K", "c", "n", "", " ", " "},
406 {"K", "θ<sub>0</sub>", " ", " ", " ", " "},
407 {"θ<sub>0</sub>", "K<sub>2</sub>", "K<sub>3</sub>", "K<sub>4</sub>", " ", " "},
408 {"K", "θ<sub>0</sub>", " ", " ", " ", " "},
409 {"Interpolation style", "Angles", " ", " ", " ", " "}}};
410
411int feunit_angle[2][FANGLES][FANGLES_P] = {{{1, 0, 0, 0, 0, 0},
412 {1, 0, 1, 1, 0, 0},
413 {1, 0, 0, 0, 0, 0},
414 {1, 0, 0, 0, 0, 0},
415 {1, 0, 0, 0, 0, 0},
416 {1, 0, 0, 0, 0, 0},
417 {1, 0, 0, 0, 0, 0},
418 {1, 0, 0, 0, 0, 0},
419 {1, 0, 0, 0, 0, 0},
420 {1, 0, 0, 0, 0, 0},
421 {1, 0, 0, 0, 0, 0},
422 {1, 1, 1, 0, 0, 0},
423 {1, 0, 0, 0, 0, 0},
424 {1, 0, 0, 0, 0, 0},
425 {0, 0, 0, 0, 0, 0},
426 {0, 0, 0, 0, 0, 0},
427 {0, 0, 0, 0, 0, 0},
428 {0, 0, 0, 0, 0, 0},
429 {0, 0, 0, 0, 0, 0}},
430 {{1, 0, 0, 0, 0, 0},
431 {1, 0, 1, 0, 0, 0},
432 {0, 1, 1, 1, 0, 0},
433 {0, 1, 1, 1, 0, 0},
434 {1, 0, 0, 0, 0, 0},
435 {1, 0, 0, 0, 0, 0},
436 {1, 0, 0, 0, 0, 0},
437 {1, 0, 0, 0, 0, 0},
438 {1, 0, 0, 0, 0, 0},
439 {1, 0, 0, 0, 0, 0},
440 {1, 0, 0, 0, 0, 0},
441 {1, 1, 1, 0, 0, 0},
442 {1, 0, 0, 0, 0, 0},
443 {1, 0, 0, 0, 0, 0},
444 {1, 0, 0, 0, 0, 0},
445 {1, 0, 0, 0, 0, 0},
446 {0, 1, 1, 1, 0, 0},
447 {1, 0, 0, 0, 0, 0},
448 {0, 0, 0, 0, 0, 0}}};
449
450char * fvars_dihedral[2][FDIHEDRAL][FDIHEDRAL_P] = {{{"A", "δ", "m", " ", " ", " ", " ", " ", " ", " ", " "},
451 {"k", "ϕ<sub>0</sub>", " ", " ", " ", " ", " ", " ", " ", " ", " "},
452 {"k", "ϕ<sub>0</sub>", " ", " ", " ", " ", " ", " ", " ", " ", " "},
453 {"A<sub>1</sub>", "A<sub>2</sub>", "A<sub>3</sub>", " ", " ", " ", " ", " ", " ", " ", " "},
454 {"A", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
455 {"A", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
456 {"A<sub>0</sub>", "A<sub>1</sub>", "A<sub>2</sub>", "A<sub>3</sub>", "ϕ<sub>0</sub>", " ", " ", " ", " ", " ", " "},
457 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
458 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
459 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
460 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
461 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
462 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "},
463 {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}},
464 {{"U<sub>min</sub>", "θ<sub>0</sub>", "a", " ", " ", " ", " ", " ", " ", " ", " "},
465 {"K", "n", "d", "weighting factor", " ", " ", " ", " ", " ", " ", " "},
466 {"K", "n", "d", "weighting factor", " ", " ", " ", " ", " ", " ", " "},
467 {"E<sub>d</sub>", "E<sub>mbt</sub>", "E<sub>ebt</sub>", "E<sub>at</sub>", "E<sub>aat</sub>", "E<sub>bb13</sub>", " ", " ", " ", " ", " "},
468 {"m", "K", "n", "d", " ", " ", " ", " ", " ", " ", " "},
469 {"K", "d", "n", " ", " ", " ", " ", " ", " ", " ", " "},
470 {"A", "B", "C", " ", " ", " ", " ", " ", " ", " ", " "},
471 {"A<sub>1</sub>", "A<sub>2</sub>", "A<sub>3</sub>", "A<sub>4</sub>", "A<sub>5</sub>", " ", " ", " ", " ", " ", " "},
472 {"n", "A", " ", " ", " ", " ", " ", " ", " ", " ", " "},
473 {"K<sub>1</sub>", "K<sub>2</sub>", "K<sub>3</sub>", "K<sub>4</sub>", " ", " ", " ", " ", " ", " ", " "},
474 {"K", "ϕ<sub>0</sub>", " ", " ", " ", " ", " ", " ", " ", " ", " "},
475 {"n", "C", "K", "a", "u", "L", "b", "v", "M", "c", "w"},
476 {"Interpolation style", "Dihedrals", " ", " ", " ", " ", " ", " ", " ", " ", " "},
477 {"Interpolation style", "Dihedrals", " ", " ", " ", " ", " ", " ", " ", " ", " "}}};
478
479int feunit_dihedral[2][FDIHEDRAL][FDIHEDRAL_P] = {{{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
480 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
481 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
482 {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
483 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
484 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
485 {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
486 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
487 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
488 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
489 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
490 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
491 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
492 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
493 {{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
494 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
495 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
496 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
497 {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
498 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
499 {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
500 {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
501 {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
502 {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
503 {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
504 {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
505 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
506 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};
507
508/*gchar la_dih_class2[6][9] = {{"K<sub>1</sub>", "ϕ<sub>1</sub>", "K<sub>2</sub>", "ϕ<sub>2</sub>", "K<sub>3</sub>", "ϕ<sub>3</sub>", " ", " ", " "},
509 {"mbt", "A<sub>1</sub>", "A<sub>2</sub>", "A<sub>3</sub>", "r<sub>2</sub>", " ", " ", " ", " "},
510 {"ebt", "B<sub>1</sub>", "B<sub>2</sub>", "B<sub>3</sub>", "C<sub>1</sub>", "C<sub>2</sub>", "C<sub>3</sub>", "r<sub>1</sub>", "r<sub>3</sub>"},
511 {"at", "D<sub>1</sub>", "D<sub>2</sub>", "D<sub>3</sub>", "E<sub>1</sub>", "E<sub>2</sub>", "E<sub>3</sub>", "θ<sub>1</sub>", "θ<sub>2</sub>"},
512 {"aat", "M", "θ<sub>1</sub>", "θ<sub>2</sub>", " ", " ", " ", " ", " "},
513 {"bb13", "N", "r<sub>1</sub>", "r<sub>3</sub>", " ", " ", " ", " ", " "}};
514
515int feu_la_dih_class2[6][9] = {{1, 0, 1, 0, 1, 0, 0, 0, 0},
516 {0, 1, 1, 1, 0, 0, 0, 0, 0},
517 {0, 1, 1, 1, 1, 1, 1, 0, 0},
518 {0, 1, 1, 1, 1, 1, 1, 0, 0},
519 {0, 1, 0, 0, 0, 0, 0, 0, 0},
520 {0, 1, 0, 0, 0, 0, 0, 0, 0}};*/
521
522char * fvars_inversion[2][FINVERS][FINVERS_P] = {{{"k", "ϕ<sub>0</sub>", " "},
523 {"k", "ϕ<sub>0</sub>", " "},
524 {"A", " ", " "},
525 {"k", "m", "ϕ<sub>0</sub>"},
526 {"A", "B", " "},
527 {" ", " ", " "}},
528 {{" ", " ", " "},
529 {" ", " ", " "},
530 {" ", " ", " "},
531 {" ", " ", " "},
532 {" ", " ", " "},
533 {" ", " ", " "}}};
534
535int feunit_inversion[2][FINVERS][FINVERS_P] = {{{1, 0, 0},
536 {1, 0, 0},
537 {1, 0, 0},
538 {1, 0, 0},
539 {1, 1, 0},
540 {0, 0, 0}},
541 {{1, 0, 0},
542 {1, 0, 0},
543 {1, 0, 0},
544 {1, 0, 0},
545 {1, 1, 0},
546 {0, 0, 0}}};
547
548// LAMMPS Impropers
549gchar * la_improper_style_keyw[11] = {"class2",
550 "cossq",
551 "cvff",
552 "distance",
553 "distharm",
554 "fourier",
555 "harmonic",
556 "inversion/harmonic",
557 "ring",
558 "sqdistharm",
559 "umbrella"};
560
561/*gchar * la_improper_style_info[11] = {"COMPASS class2 force field",
562 "Cosine squared",
563 "CVFF force field",
564 "Distance between atom planes",
565 "Out-of-the plane distance",
566 "Fourier (multiple cosines)",
567 "Harmonic",
568 "Harmonic with Wilson Decius out-of-plane",
569 "Planar conformation",
570 "Squared distance harmonic",
571 "DREIDING force field"};
572
573gchar la_improper_var[11][LIMPROPERS] = {{"E<sub>i</sub>", "E<sub>aa</sub>", " ", " ", " "},
574 {"K", "χ<sub>0</sub>", " ", " ", " "},
575 {"K", "d", "n", " ", " "},
576 {"K<sub>2</sub>", "K<sub>4</sub>", " ", " ", " "}
577 {"K", "d<sub>0</sub>", " ", " ", " "},
578 {"K", "C<sub>0</sub>", "C<sub>1</sub>", "C<sub>2</sub>", "all"},
579 {"K", "χ<sub>0</sub>", " ", " ", " "},
580 {"K", "ω<sub>0</sub>", " ", " ", " "},
581 {"K", "θ<sub>0</sub>", " ", " ", " "},
582 {"K", "d<sub>0</sub><sup>2</sup>", " ", " ", " "},
583 {"K", "ω<sub>0</sub>", " ", " ", " "}};
584
585gchar la_imp_class2[2][7] = {{"K", "χ<sub>0</sub>", " ", " ", " ", " ", " "},
586 {"aa", "M<sub>1</sub>", "M<sub>2</sub>", "M<sub>3</sub>", "θ<sub>1</sub>", "θ<sub>2</sub>", "θ<sub>3</sub>"}};
587
588int feu_la_imp_class2[2][7] = {{1, 0, 0, 0, 0, 0, 0},
589 {0, 1, 1, 1, 0, 0, 0}};
590
591int feu_la_improper[15][LIMPROPERS] = {{0, 0, 0, 0, 0},
592 {1, 0, 0, 0, 0},
593 {1, 0, 0, 0, 0},
594 {1, 1, 0, 0, 0},
595 {1, 0, 0, 0, 0},
596 {1, 0, 0, 0, 0},
597 {1, 0, 0, 0, 0},
598 {1, 0, 0, 0, 0},
599 {1, 0, 0, 0, 0},
600 {1, 0, 0, 0, 0}};*/
601
602char * fvars_vdw[2][FVDW][FVDW_P] = {{{"A", "B", " ", " ", " ", " ", " "},
603 {"ϵ", "ρ", " ", " ", " ", " ", " "},
604 {"ϵ", "ρ", "c", " ", " ", " ", " "},
605 {"E<sub>0</sub>", "n", "m", "r<sub>0</sub>", " ", " ", " "},
606 {"A", "ρ", "C", " ", " ", " ", " "},
607 {"A", "B", "σ", "C", "D", " ", " "},
608 {"A", "B", " ", " ", " ", " ", " "},
609 {"E<sub>0</sub>", "n", "m", "r<sub>0</sub>", "r<sub>c</sub>", " ", " "},
610 {"E<sub>0</sub>", "r<sub>0</sub>", "k", " ", " ", " ", " "},
611 {"ϵ", "σ", "Δ", " ", " ", " ", " "},
612 {"A", "r<sub>c</sub>", " ", " ", " ", " ", " "},
613 {"ϵ", "r<sub>o</sub>", " ", " ", " ", " ", " "},
614 {"E<sub>0</sub>", "r<sub>0</sub>", "k", "c", " ", " ", " "},
615 {"a", "b", "σ", " ", " ", " ", " "},
616 {"Z<sub>1</sub>", "Z<sub>2</sub>", " ", " ", " ", " ", " "},
617 {"Z<sub>1</sub>", "Z<sub>2</sub>", "r<sub>m</sub>", "ξ", "E<sub>0</sub>", "r<sub>0</sub>", "k"},
618 {"Z<sub>1</sub>", "Z<sub>2</sub>", "r<sub>m</sub>", "ξ", "A", "ρ", "C"},
619 {"ϵ", "ρ", "r<sub>i</sub>", " ", " ", " ", " "},
620 {"A", "ρ", "C", "r<sub>i</sub>", " ", " ", " "},
621 {"A", "B", "r<sub>i</sub>", " ", " ", " ", " "},
622 {" ", " ", " ", " ", " ", " ", " "}},
623 {{"A", "B", " ", " ", " ", " ", " "},
624 {"A", "B", " ", " ", " ", " ", " "},
625 {"ϵ", "ρ", " ", " ", " ", " ", " "},
626 {"ϵ", "ρ", "c", " ", " ", " ", " "},
627 {"E<sub>0</sub>", "n", "m", "r<sub>0</sub>", " ", " ", " "},
628 {"A", "ρ", "C", " ", " ", " ", " "},
629 {"A", "B", "σ", "C", "D", " ", " "},
630 {"E<sub>0</sub>", "n", "m", "r<sub>0</sub>", "r<sub>c</sub>", " ", " "},
631 {"E<sub>0</sub>", "r<sub>0</sub>", "k", " ", " ", " ", " "},
632 {"ϵ", "σ", "Δ", " ", " ", " ", " "},
633 {"A", "r<sub>c</sub>", " ", " ", " ", " ", " "},
634 {"ϵ", "r<sub>o</sub>", " ", " ", " ", " ", " "},
635 {"E<sub>0</sub>", "r<sub>0</sub>", "k", "c", " ", " ", " "},
636 {"a", "b", "σ", " ", " ", " ", " "},
637 {"Z<sub>1</sub>", "Z<sub>2</sub>", " ", " ", " ", " ", " "},
638 {"Z<sub>1</sub>", "Z<sub>2</sub>", "r<sub>m</sub>", "ξ", "E<sub>0</sub>", "r<sub>0</sub>", "k"},
639 {"Z<sub>1</sub>", "Z<sub>2</sub>", "r<sub>m</sub>", "ξ", "A", "ρ", "C"},
640 {"ϵ", "ρ", "r<sub>i</sub>", " ", " ", " ", " "},
641 {"A", "ρ", "C", "r<sub>i</sub>", " ", " ", " "},
642 {"A", "B", "r<sub>i</sub>", " ", " ", " ", " "},
643 {" ", " ", " ", " ", " ", " ", " "}}};
644
645int feunit_vdw[2][FVDW][FVDW_P] = {{{1, 1, 0, 0, 0, 0, 0},
646 {1, 0, 0, 0, 0, 0, 0},
647 {1, 0, 0, 0, 0, 0, 0},
648 {1, 0, 0, 0, 0, 0, 0},
649 {1, 0, 1, 0, 0, 0, 0},
650 {1, 0, 0, 1, 1, 0, 0},
651 {1, 1, 0, 0, 0, 0, 0},
652 {1, 0, 0, 0, 0, 0, 0},
653 {1, 0, 0, 0, 0, 0, 0},
654 {1, 0, 0, 0, 0, 0, 0},
655 {1, 0, 0, 0, 0, 0, 0},
656 {1, 0, 0, 0, 0, 0, 0},
657 {1, 0, 0, 0, 0, 0, 0},
658 {1, 1, 0, 0, 0, 0, 0},
659 {1, 1, 0, 0, 0, 0, 0},
660 {1, 1, 0, 0, 1, 0, 0},
661 {1, 1, 0, 0, 1, 0, 0},
662 {1, 0, 0, 0, 0, 0, 0},
663 {1, 0, 0, 0, 0, 0, 0},
664 {1, 1, 0, 0, 0, 0, 0},
665 {0, 0, 0, 0, 0, 0, 0}},
666 {{1, 1, 0, 0, 0, 0, 0},
667 {1, 0, 0, 0, 0, 0, 0},
668 {1, 0, 0, 0, 0, 0, 0},
669 {1, 0, 0, 0, 0, 0, 0},
670 {1, 0, 1, 0, 0, 0, 0},
671 {1, 0, 0, 1, 1, 0, 0},
672 {1, 1, 0, 0, 0, 0, 0},
673 {1, 0, 0, 0, 0, 0, 0},
674 {1, 0, 0, 0, 0, 0, 0},
675 {1, 0, 0, 0, 0, 0, 0},
676 {1, 0, 0, 0, 0, 0, 0},
677 {1, 0, 0, 0, 0, 0, 0},
678 {1, 0, 0, 0, 0, 0, 0},
679 {1, 1, 0, 0, 0, 0, 0},
680 {1, 1, 0, 0, 0, 0, 0},
681 {1, 1, 0, 0, 1, 0, 0},
682 {1, 1, 0, 0, 1, 0, 0},
683 {1, 0, 0, 0, 0, 0, 0},
684 {1, 0, 0, 0, 0, 0, 0},
685 {1, 1, 0, 0, 0, 0, 0},
686 {0, 0, 0, 0, 0, 0, 0}}};
687
688char * fvars_met[2][FMETALS][FMETALS_P] = {{{" ", " ", " ", " ", " ", " ", " ", " ", " "},
689 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
690 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
691 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
692 {"c<sub>0</sub>", "c<sub>1</sub>", "c<sub>2</sub>", "c", "A", "d", "β", " ", " "},
693 {"c<sub>0</sub>", "c<sub>1</sub>", "c<sub>2</sub>", "c<sub>3</sub>", "c<sub>4</sub>", "c", "A", "d", "B"},
694 {"ϵ", "a", "n", "m", "c", " ", " ", " ", " "},
695 {"A", "r<sub>0</sub>", "p", "B", "q<sub>ij</sub>", " ", " ", " ", " "},
696 {"ϵ", "a", "m", "α", "r<sub>o</sub>", " ", " ", " ", " "}},
697 {{" ", " ", " ", " ", " ", " ", " ", " ", " "},
698 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
699 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
700 {" ", " ", " ", " ", " ", " ", " ", " ", " "},
701 {"c<sub>0</sub>", "c<sub>1</sub>", "c<sub>2</sub>", "c", "A", "d", "β", " ", " "},
702 {"c<sub>0</sub>", "c<sub>1</sub>", "c<sub>2</sub>", "c<sub>3</sub>", "c<sub>4</sub>", "c", "A", "d", "B"},
703 {"ϵ", "a", "n", "m", "c", " ", " ", " ", " "},
704 {"A", "r<sub>0</sub>", "p", "B", "q<sub>ij</sub>", " ", " ", " ", " "},
705 {"ϵ", "a", "m", "α", "r<sub>o</sub>", " ", " ", " ", " "}}};
706
707int feunit_met[2][FMETALS][FMETALS_P] = {{{0, 0, 0, 0, 0, 0, 0, 0, 0},
708 {0, 0, 0, 0, 0, 0, 0, 0, 0},
709 {0, 0, 0, 0, 0, 0, 0, 0, 0},
710 {0, 0, 0, 0, 0, 0, 0, 0, 0},
711 {0, 0, 0, 0, 1, 0, 1, 0, 0},
712 {0, 0, 0, 0, 0, 0, 1, 0, 1},
713 {1, 0, 0, 0, 0, 0, 0, 0, 0},
714 {1, 0, 0, 1, 0, 0, 0, 0, 0},
715 {1, 0, 0, 0, 0, 0, 0, 0, 0}},
716 {{0, 0, 0, 0, 0, 0, 0, 0, 0},
717 {0, 0, 0, 0, 0, 0, 0, 0, 0},
718 {0, 0, 0, 0, 0, 0, 0, 0, 0},
719 {0, 0, 0, 0, 0, 0, 0, 0, 0},
720 {0, 0, 0, 0, 1, 0, 1, 0, 0},
721 {0, 0, 0, 0, 0, 0, 1, 0, 1},
722 {1, 0, 0, 0, 0, 0, 0, 0, 0},
723 {1, 0, 0, 1, 0, 0, 0, 0, 0},
724 {1, 0, 0, 0, 0, 0, 0, 0, 0}}};
725
726char * fvars_ters[2][FTERSOFFS][FTERSOFFS_P] = {{{"A", "a", "B", "b", "R", "S", "β", "η", "c", "d", "h", "χ", "ω", "δ", " ", " "},
727 {"A", "a", "B", "b", "R", "S", "η", "δ", "c<sub>1</sub>", "c<sub>2</sub>", "c<sub>3</sub>", "c<sub>4</sub>", "c<sub>5</sub>", "h", "α", "β"}},
728 {{"A", "a", "B", "b", "R", "S", "β", "η", "c", "d", "h", "χ", "ω", "δ", " ", " "},
729 {"A", "a", "B", "b", "R", "S", "η", "δ", "c<sub>1</sub>", "c<sub>2</sub>", "c<sub>3</sub>", "c<sub>4</sub>", "c<sub>5</sub>", "h", "α", "β"}}};
730
731int feunit_ters[2][FTERSOFFS][FTERSOFFS_P] = {{{1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
732 {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
733 {{1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
734 {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}};
735
736char * fvars_tbd[2][FTHREEBODY][FTHREEBODY_P] = {{{"k", "θ<sub>0</sub>", " ", " ", " "},
737 {"k", "θ<sub>0</sub>", "ρ", " ", " "},
738 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " "},
739 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " "},
740 {"k", "θ<sub>0</sub>", "a", "ρ", " "},
741 {"D<sub>hb</sub>", "R<sub>hb</sub>", " ", " ", " "}},
742 {{"k", "θ<sub>0</sub>", " ", " ", " "},
743 {"k", "θ<sub>0</sub>", "ρ", " ", " "},
744 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " "},
745 {"k", "θ<sub>0</sub>", "ρ<sub>1</sub>", "ρ<sub>2</sub>", " "},
746 {"k", "θ<sub>0</sub>", "a", "ρ", " "},
747 {"D<sub>hb</sub>", "R<sub>hb</sub>", " ", " ", " "}}};
748
749int feunit_tbd[2][FTHREEBODY][FTHREEBODY_P] = {{{1, 0, 0, 0, 0},
750 {1, 0, 0, 0, 0},
751 {1, 0, 0, 0, 0},
752 {1, 0, 0, 0, 0},
753 {1, 0, 0, 0, 0},
754 {1, 0, 0, 0, 0}},
755 {{1, 0, 0, 0, 0},
756 {1, 0, 0, 0, 0},
757 {1, 0, 0, 0, 0},
758 {1, 0, 0, 0, 0},
759 {1, 0, 0, 0, 0},
760 {1, 0, 0, 0, 0}}};
761
762char * fvars_fbd[2][FFOURBODY][FFOURBODY_P] = {{{"k", "ϕ<sub>0</sub>", " "},
763 {"k", "ϕ<sub>0</sub>", " "},
764 {"A", " ", " "}},
765 {{"k", "ϕ<sub>0</sub>", " "},
766 {"k", "ϕ<sub>0</sub>", " "},
767 {"A", " ", " "}}};
768
769int feunit_fbd[2][FFOURBODY][FFOURBODY_P] = {{{1, 0, 0},
770 {1, 0, 0},
771 {1, 0, 0}},
772 {{1, 0, 0},
773 {1, 0, 0},
774 {1, 0, 0}}};
775
776char * fvars_fext[2][FEXTERNAL][FEXTERNAL_P] = {{{"E<sub>x</sub>", "E<sub>y</sub>", "E<sub>z</sub>", " ", " ", " "},
777 {"A", "n", " ", " ", " ", " "},
778 {"A", "z<sub>0</sub>", " ", " ", " ", " "},
779 {"G<sub>x</sub>", "G<sub>y</sub>", "G<sub>z</sub>", " ", " ", " "},
780 {"H<sub>x</sub>", "H<sub>y</sub>", "H<sub>z</sub>", " ", " ", " "},
781 {"A", "R<sub>0</sub>", "n", "R<sub>cut</sub>", " ", " "},
782 {"A", "z<sub>0</sub>", "p", " ", " ", " "},
783 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "P<sup>in</sup><sub>k-atom</sub>", " ", " ", " "},
784 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
785 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
786 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
787 {"E<sub>x</sub>", "E<sub>y</sub>", "E<sub>z</sub>", "ω<sup>in</sup><sub>ps<sup>-1</sup></sub>", " ", " "},
788 {"i<sub>gid</sub><sup>A</sup>", "j<sub>gid</sub><sup>A</sup>", "k", "i<sub>gid</sub><sup>B</sup>", "j<sub>gid</sub><sup>B</sup>", "R<sub>0</sub>"}},
789 {{"E<sub>x</sub>", "E<sub>y</sub>", "E<sub>z</sub>", " ", " ", " "},
790 {"A", "n", " ", " ", " ", " "},
791 {"A", "z<sub>0</sub>", " ", " ", " ", " "},
792 {"G<sub>x</sub>", "G<sub>y</sub>", "G<sub>z</sub>", " ", " ", " "},
793 {"H<sub>x</sub>", "H<sub>y</sub>", "H<sub>z</sub>", " ", " ", " "},
794 {"A", "R<sub>0</sub>", "n", "R<sub>cut</sub>", " ", " "},
795 {"A", "z<sub>0</sub>", "p", " ", " ", " "},
796 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "P<sup>in</sup><sub>k-atom</sub>", " ", " ", " "},
797 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
798 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
799 {"i<sub>ind</sub><sup>glob</sup>", "j<sub>ind</sub><sup>glob</sup>", "k", "z<sub>mn</sub>", "z<sub>mx</sub>", " "},
800 {"E<sub>x</sub>", "E<sub>y</sub>", "E<sub>z</sub>", "ω<sup>in</sup><sub>ps<sup>-1</sup></sub>", " ", " "},
801 {"i<sub>gid</sub><sup>A</sup>", "j<sub>gid</sub><sup>A</sup>", "k", "i<sub>gid</sub><sup>B</sup>", "j<sub>gid</sub><sup>B</sup>", "R<sub>0</sub>"}}};
802
803int feunit_fext[2][FEXTERNAL][FEXTERNAL_P] = {{{1, 1, 1, 0, 0, 0},
804 {1, 0, 0, 0, 0, 0},
805 {1, 0, 0, 0, 0, 0},
806 {1, 1, 1, 0, 0, 0},
807 {1, 1, 1, 0, 0, 0},
808 {1, 0, 0, 0, 0, 0},
809 {1, 0, 0, 0, 0, 0},
810 {0, 0, 1, 0, 0, 0},
811 {0, 0, 1, 0, 0, 0},
812 {0, 0, 1, 0, 0, 0},
813 {0, 0, 1, 0, 0, 0},
814 {1, 1, 1, 0, 0, 0},
815 {0, 0, 0, 0, 1, 0}},
816 {{1, 1, 1, 0, 0, 0},
817 {1, 0, 0, 0, 0, 0},
818 {1, 0, 0, 0, 0, 0},
819 {1, 1, 1, 0, 0, 0},
820 {1, 1, 1, 0, 0, 0},
821 {1, 0, 0, 0, 0, 0},
822 {1, 0, 0, 0, 0, 0},
823 {0, 0, 1, 0, 0, 0},
824 {0, 0, 1, 0, 0, 0},
825 {0, 0, 1, 0, 0, 0},
826 {0, 0, 1, 0, 0, 0},
827 {1, 1, 1, 0, 0, 0},
828 {0, 0, 0, 0, 1, 0}}};
829
830int field_v[MAXDATA] = { 8, 8, 9, 7, 8, 5, 5, 8, 8, 9, 9, 10, 10, 10, 10, 6, 6, 5, 7, 8, 3};
831int field_s[MAXDATA] = {650, 520, 520, 500, 600, 450, 600, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720, 720};
832int field_a[MAXDATA] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0};
833
834gchar * ctitle[MAXDATA][12] ={{"Id", "Name", "Multiplicity", "Chemistry", "Atom(s)", "Species", "Viz. 3D", "Viz. Atom num."}, // Molecule(s)
835 {"Id", "Name", "Element", "Mass", "Charge", "Frozen", "Atom(s)", "Viz. 3D"}, // Atom(s)
836 {"Id", "Core Id", "Shell", "Masse", "Charge", "k2 (1)", "k4 (2)", "Viz. 3D", "Use (3)"}, // Core-shell unit(s)
837 {"Id", "At.1 Id", "At.2 Id", "Length [Å]", "av. d [Å] (1)", "Viz. 3D", "Use (2)"}, // Constraint(s)
838 {"Id", "Length [Å]", "av. d12 [Å] (1)", "Unit Id", "At. Id", "Weight (2)", "Viz. 3D", "Use (3)"}, // Mean force potential(s)
839 {"Id", "Atom(s) in unit", "List of atom(s)", "Viz. 3D", "Use(1)"}, // Rigid unit(s)
840 {"Id", "Atom Id", "Viz. 3D", "Use (1)", "Potential"}, // Tethering potential(s)
841 {"Id", "At.1", "At.2", "Bond(s)", "av. d [Å] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Bond(s)
842 {"Id", "At.1", "At.2", "Bond restraint(s)", "av. d [Å] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Bond restraint(s)
843 {"Id", "At.1", "At.2", "At.3", "Angle(s)", "av. θ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Angle(s)
844 {"Id", "At.1", "At.2", "At.3", "Angle restraint(s)", "av. θ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Angle restraint(s)
845 {"Id", "At.1", "At.2", "At.3", "At.4", "Dihedral(s)", "av. ϕ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Dihedrals
846 {"Id", "At.1", "At.2", "At.3", "At.4", "Torsional restraint(s)", "av. ϕ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Torsions
847 {"Id", "At.1", "At.2", "At.3", "At.4", "Improper(s)", "av. ϕ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Impropers
848 {"Id", "At.1", "At.2", "At.3", "At.4", "Inversion(s)", "av. ϕ [°] (1)", "Viz. 3D", "Use (2)", "Potential (3)"}, // Inversion(s)
849 {"Id", "Spec.1", "Spec.2", "Viz. 3D", "Use (1)", "VdW potential"}, // VdW(s)
850 {"Id", "At.1", "At.2", "Viz. 3D", "Use (1)", "Metal potential"}, // Metal(s)
851 {"Id", "At.", "Viz. 3D", "Use (1)", "Tersoff Pot."}, // Tersoff potential(s)
852 {"Id", "At.1", "At.2*", "At.3", "Viz. 3D", "Use (1)", "Three-body Pot."}, // Three-body potential(s)
853 {"Id", "At.1*", "At.2", "At.3", "At.4", "Viz. 3D", "Use (1)", "Four-body Pot."}, // Four-body potential(s)
854 {"Id", "Use (1)", "Field type"}}; // External field(s)
855
856GType col_type[MAXDATA][12] = {{G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 0 - Molecule(s)
857 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 1 - Atom(s)
858 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_FLOAT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 2 - Core-shell unit(s)
859 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_FLOAT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 3 - Constraint(s)
860 {G_TYPE_INT, G_TYPE_FLOAT, G_TYPE_FLOAT, G_TYPE_INT, G_TYPE_INT, G_TYPE_FLOAT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 4 - Mean force potential(s)
861 {G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 5 - Rigid unit(s)
862 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 6 - Tethering potential(s)
863 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 7 - Bond(s)
864 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 8 - Bond restraint(s)
865 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT}, // 9 - Angle(s)
866 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT}, // 10 - Angle restraint(s)
867 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT}, // 11 - Dihedral(s)
868 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT}, // 12 - Improper(s)
869 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT}, // 13 - Torsion(s)
870 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT}, // 14 - Inversion(s)
871 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 15 - vdW(s)
872 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 16 - Metal(s)
873 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 17 - Tersoff potential(s)
874 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 18 - Three-body potential(s)
875 {G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}, // 19 - Four-body potential(s)
876 {G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT}}; // 20 - External field(s)
877
878// 0 - nothing
879// 1 - combo box
880// 2 - viz3D bool
881// 3 - pick bool
882// 4 - editable
883int is_special[MAXDATA][11] ={{0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0}, // Molecule(s)
884 {0, 0, 0, 4, 4, 0, 0, 2, 0, 0, 0}, // Atom(s)
885 {0, 0, 0, 4, 4, 4, 4, 2, 3, 0, 0}, // Core-shell unit(s)
886 {0, 0, 0, 4, 0, 2, 3, 0, 0, 0, 0}, // Constraint(s)
887 {0, 4, 0, 0, 0, 4, 2, 3, 0, 0, 0}, // Mean force potential(s)
888 {0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0}, // Rigid unit(s)
889 {0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0}, // Tethering potential(s)
890 {0, 0, 0, 0, 0, 2, 3, 1, 0, 0, 0}, // Bond(s)
891 {0, 0, 0, 0, 0, 2, 3, 1, 0, 0, 0}, // Bond restrain(s)
892 {0, 0, 0, 0, 0, 0, 2, 3, 1, 0, 0}, // Angle(s)
893 {0, 0, 0, 0, 0, 0, 2, 3, 1, 0, 0}, // Angle restraint(s)
894 {0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 0}, // Dihedral(s)
895 {0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 0}, // Torsional restraint(s)
896 {0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 0}, // Improper(s)
897 {0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 0}, // Inversion(s)
898 {0, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0}, // vdW(s)
899 {0, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0}, // Metal(s)
900 {0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0}, // Tersoff potential(s)
901 {0, 0, 0, 0, 2, 3, 1, 0, 0, 0, 0}, // Three-body potential(s)
902 {0, 0, 0, 0, 0, 2, 3, 1, 0, 0, 0}, // Four-body potential(s)
903 {0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0}}; // External field(s)
904
905gboolean afp_init[MAXDATC+MAXDATA] = {TRUE, // 0 - System
906 TRUE, // 1 - Analysis
907 TRUE, // 2 - Electrostatics
908 TRUE, // 3 - Equilibration
909 TRUE, // 4 - Thermodynamics
910 TRUE, // 5 - Molecular dynamics
911 TRUE, // 6 - Output
912 TRUE, // 7 - Computational
913 TRUE, // 8 - Molecule(s)
914 TRUE, // 9 - Atom(s)
915 FALSE, // 10 - Shell(s)
916 FALSE, // 11 - Constraint(s)
917 FALSE, // 12 - Mean force potential(s)
918 FALSE, // 13 - Rigid unit(s)
919 FALSE, // 14 - Tethering potential(s)
920 TRUE, // 15 - Bond(s)
921 FALSE, // 16 - Bond restraint(s)
922 TRUE, // 17 - Angle(s)
923 FALSE, // 18 _ Angle restraint(s)
924 TRUE, // 19 - Dihedral(s)
925 FALSE, // 20 - Torsional restraint(s)
926 FALSE, // 21 - Improper(s)
927 FALSE, // 22 - Inversion(s)
928 TRUE, // 23 - Vdw(s)
929 FALSE, // 24 - Metal(s)
930 FALSE, // 25 - Tersoff potential(s)
931 FALSE, // 26 - Three-body potential(s)
932 FALSE, // 27 - Four-body potential(s)
933 FALSE};// 28 - External field(s)
934
935gchar * mo_title[8]={"Bond", "Bond restraint", "Angle", "Angle restraint", "Dihedral", "Torsional restraint", "Improper", "Inversion"};
936
937// Energy converter, values taken from DL_POLY 'read_file.f90' and 'setup_module.f90'
938float internal_to_other[5] = {9648.530821, 418.4, 100.0, 0.831451115, 1.0};
939
940GtkWidget * field_assistant;
941GtkTreeViewColumn * field_col[MAXDATA][11];
942GtkCellRenderer * field_renderer[MAXDATA][11];
943GtkWidget * mol_box[MOLIMIT-1];
944GtkWidget * combo_mol[MOLIMIT-1];
945GtkWidget * field_tree[MAXDATA];
946GtkWidget * field_label[MAXDATA];
947GtkTreeStore * field_model[MAXDATA];
948GtkTreeIter field_iter;
949
968
969//GtkWidget * view[13];
970GtkWidget * aview;
971GtkWidget * cs_label[2];
972GtkWidget * fwin = NULL;
973GtkWidget * cwin = NULL;
974GtkWidget * mol_num_label = NULL;
975GtkWidget * fibox[MAXDATC+MAXDATA+2];
976GtkWidget * enbox;
977GtkWidget * ff_but[19];
978
979int field_object = FALSE;
980gboolean field_color = FALSE;
983
984extern void field_unselect_all ();
985extern gboolean tersoff_question ();
986extern void check_tersoffs (int id, int key);
987extern void check_to_visualize_properties (int id);
988extern int get_num_vdw_max ();
989extern gchar * get_body_element_name (field_nth_body * body, int aid, int nbd);
990extern void print_lammps_atom_file (GtkTextBuffer * buf);
991
999int struct_id (int f)
1000{
1001 if (f < 9)
1002 {
1003 return 2;
1004 }
1005 else if (f < 11)
1006 {
1007 return 3;
1008 }
1009 else
1010 {
1011 return 4;
1012 }
1013}
1014
1022int body_at (int b)
1023{
1024 if (b < 2)
1025 {
1026 return 2;
1027 }
1028 else if (b == 2)
1029 {
1030 return 1;
1031 }
1032 else
1033 {
1034 return b;
1035 }
1036}
1037
1039
1046{
1047 gchar * str;
1048 str = g_strdup_printf ("<b>%d</b>", tmp_field -> molecules);
1049 if (mol_num_label == NULL)
1050 {
1051 mol_num_label = markup_label(str, -1, -1, 0.0, 0.5);
1052 }
1053 else
1054 {
1055 gtk_label_set_text (GTK_LABEL(mol_num_label), str);
1056 gtk_label_set_use_markup (GTK_LABEL(mol_num_label), TRUE);
1057 }
1058}
1059
1068{
1069 gchar * str;
1070 str = g_strdup_printf ("\t <b>(1)</b> Force constant of the core-shell spring in [<b>%s &#xC5;<sup>-2</sup></b>]", exact_name(fkeysw[activef][0][i]));
1071 gtk_label_set_text (GTK_LABEL(cs_label[0]), str);
1072 gtk_label_set_use_markup (GTK_LABEL(cs_label[0]), TRUE);
1073 g_free (str);
1074
1075 str = g_strdup_printf ("\t <b>(2)</b> Quartic (anharmonic) force constant of the core-shell spring in [<b>%s &#xC5;<sup>-4</sup></b>]"
1076 " usually <i>k<sub>2</sub></i> >> <i>k<sub>4</sub></i>", exact_name(fkeysw[activef][0][i]));
1077 gtk_label_set_text (GTK_LABEL(cs_label[1]), str);
1078 gtk_label_set_use_markup (GTK_LABEL(cs_label[1]), TRUE);
1079 g_free (str);
1080}
1081
1085gchar *** is_var;
1086
1097gchar * parameters_info (int obj, int key, gchar ** words, float * data)
1098{
1099 int i;
1100 gchar * str = NULL;
1101 if (fvalues[activef][obj][key] > 0)
1102 {
1103 // float v = internal_to_other[tmp_field -> energy_unit] / internal_to_other[ff_unit];
1104 str = g_strdup_printf (" <b><i>%s</i>=</b> %.3f", words[0], data[0]);
1105 for (i=1; i< fvalues[activef][obj][key]; i++) str = g_strdup_printf ("%s, <b><i>%s</i>=</b> %.3f", str, words[i], data[i]);
1106 }
1107 else
1108 {
1109 str = g_strdup_printf ("<i>Tabulated</i>");
1110 }
1111 return str;
1112}
1113
1114extern void print_all_field_struct (field_molecule * mol, int str);
1115
1125void fill_field_struct (GtkTreeStore * store, int id, int mo)
1126{
1127 int j, k, l;
1128 char ** vars;
1129 gchar * stra, * strb, * strc;
1130 GtkTreeIter field_level;
1131 if (tmp_field -> afp[MAXDATC])
1132 {
1133 for (j=0; j<mo; j++) tmp_fmol = tmp_fmol -> next;
1134 }
1135#ifdef DEBUG
1136 //g_debug ("id= %d, mo= %d", id, mo);
1137 //if (id > 5) print_all_field_struct (tmp_fmol, id);
1138#endif
1139 tmp_fstr = tmp_fmol -> first_struct[id];
1140 l = id + 2;
1141 while (tmp_fstr)
1142 {
1143 gtk_tree_store_append (store, & field_level, NULL);
1144 tmp_fprop = tmp_fstr -> def;
1145 stra = g_strdup_printf ("%.3f", tmp_fstr -> av);
1146 strb = g_strdup_printf ("<b>Default</b>: %s (%s)", fnames[activef][l][tmp_fprop -> key], exact_name(fkeysw[activef][l][tmp_fprop -> key]));
1147 if (id < 2)
1148 {
1149 vars = (char **)fvars_bond[activef][tmp_fprop -> key];
1150 }
1151 else if (id < 4)
1152 {
1153 vars = (char **)fvars_angle[activef][tmp_fprop -> key];
1154 }
1155 else if (id < 7)
1156 {
1157 vars = (char **)fvars_dihedral[activef][tmp_fprop -> key];
1158 }
1159 else
1160 {
1161 vars = (char **)fvars_inversion[activef][tmp_fprop -> key];
1162 }
1163
1164 strc = parameters_info (l-1, tmp_fprop -> key, vars, tmp_fprop -> val);
1165 for (k=0; k<struct_id(id+7); k++) gtk_tree_store_set (store, & field_level, k+1, get_active_atom (mo, tmp_fstr -> aid[k]) -> name, -1);
1166 gtk_tree_store_set (store, & field_level, 0, tmp_fstr -> id+1,
1167 k+1, tmp_fstr -> num,
1168 k+2, stra,
1169 k+3, tmp_fstr -> def -> show,
1170 k+4, tmp_fstr -> def -> use,
1171 k+5, strb,
1172 k+6, strc,
1173 k+7, tmp_fstr -> id, -1);
1174 g_free (stra);
1175 g_free (strb);
1176 g_free (strc);
1177 tmp_fat = get_active_atom (mo, tmp_fstr -> aid[0]);
1178 tmp_fbt = get_active_atom (mo, tmp_fstr -> aid[1]);
1179 if (id > 1) tmp_fct = get_active_atom (mo, tmp_fstr -> aid[2]);
1180 if (id > 3) tmp_fdt = get_active_atom (mo, tmp_fstr -> aid[3]);
1181 if (id < 2)
1182 {
1183 print_dlp_bond (id, NULL, tmp_fstr, tmp_fmol -> fragments[0], store, & field_level);
1184 }
1185 else if (id < 4)
1186 {
1187 print_dlp_angle (id, NULL, tmp_fstr, tmp_fmol -> fragments[0], store, & field_level);
1188 }
1189 else if (id < 6)
1190 {
1191 print_dlp_dihedral (id, NULL, tmp_fstr, tmp_fmol -> fragments[0], store, & field_level);
1192 }
1193 else if (id < 8)
1194 {
1195 print_dlp_improper_inversion (id, NULL, tmp_fstr, tmp_fmol -> fragments[0], store, & field_level);
1196 }
1197 tmp_fstr = tmp_fstr -> next;
1198 }
1199}
1200
1209void fill_field_body (GtkTreeStore * store, int id)
1210{
1211 int i, j, k, l;
1212 gchar * stra, * strb;
1213 GtkTreeIter field_level;
1214 if (! id)
1215 {
1216 i = get_num_vdw_max ();
1217 }
1218 tmp_fbody = tmp_field -> first_body[id];
1219 k = body_at(id);
1220 for (i=0; i < tmp_field -> nbody[id]; i++)
1221 {
1222 gtk_tree_store_append (store, & field_level, NULL);
1223 for (j=0; j<k ; j++)
1224 {
1225 if (tmp_fbody -> na[j] > 0)
1226 {
1227 if (! id)
1228 {
1229 gtk_tree_store_set (store, & field_level, j+1, get_body_element_name (tmp_fbody, j, 0), -1);
1230 }
1231 else
1232 {
1233 l = tmp_fbody -> ma[j][0];
1234 gtk_tree_store_set (store, & field_level, j+1, get_active_atom (l, tmp_fbody -> a[j][0]) -> name, -1);
1235 }
1236 }
1237 }
1238 stra = g_strdup_printf ("%s (%s)", fnames[activef][10+id][tmp_fbody -> key], exact_name(fkeysw[activef][10+id][tmp_fbody -> key]));
1239 if (id == 0) strb = parameters_info (9+id, tmp_fbody -> key, fvars_vdw[activef][tmp_fbody -> key], tmp_fbody -> val);
1240 if (id == 1) strb = parameters_info (9+id, tmp_fbody -> key, fvars_met[activef][tmp_fbody -> key], tmp_fbody -> val);
1241 if (id == 2) strb = parameters_info (9+id, tmp_fbody -> key, fvars_ters[activef][tmp_fbody -> key], tmp_fbody -> val);
1242 if (id == 3) strb = parameters_info (9+id, tmp_fbody -> key, fvars_tbd[activef][tmp_fbody -> key], tmp_fbody -> val);
1243 if (id == 4) strb = parameters_info (9+id, tmp_fbody -> key, fvars_fbd[activef][tmp_fbody -> key], tmp_fbody -> val);
1244 gtk_tree_store_set (store, & field_level, 0, tmp_fbody -> id+1,
1245 k+1, tmp_fbody -> show,
1246 k+2, tmp_fbody -> use,
1247 k+3, stra,
1248 k+4, strb, -1);
1249 g_free (stra);
1250 g_free (strb);
1251 if (tmp_fbody -> next != NULL) tmp_fbody = tmp_fbody -> next;
1252 }
1253}
1254
1264void fill_field_model (GtkTreeStore * store, int f, int m)
1265{
1266 GtkTreeIter field_level, unit_level, site_level;
1267 int i, j, k, l;
1268 gchar * stra, * strb, * strc, * strd;
1269
1270 tmp_fmol = tmp_field -> first_molecule;
1271
1272 //if (get_active_field_elements(f) > 10000 && ! tmp_field -> show_all[f])
1273 {
1274
1275 }
1276 //else
1277 {
1278 switch (f)
1279 {
1280 case 0:
1281 stra = NULL;
1282 for (i=0; i< tmp_field -> molecules; i++)
1283 {
1284 tmp_mol = tmp_fmol -> mol;
1285 for (j=0; j < tmp_proj -> nspec; j++)
1286 {
1287 if (tmp_mol -> species[j] > 0)
1288 {
1289 if (tmp_mol -> species[j] == 1)
1290 {
1291 if (stra == NULL)
1292 {
1293 stra = g_strdup_printf ("%s ", exact_name(tmp_proj -> chemistry -> label[j]));
1294 }
1295 else
1296 {
1297 stra = g_strdup_printf ("%s%s ", stra, exact_name(tmp_proj -> chemistry -> label[j]));
1298 }
1299 }
1300 else
1301 {
1302 if (stra == NULL)
1303 {
1304 stra = g_strdup_printf ("%s<sub>%d</sub> ", exact_name(tmp_proj -> chemistry -> label[j]), tmp_mol -> species[j]);
1305 }
1306 else
1307 {
1308 stra = g_strdup_printf ("%s%s<sub>%d</sub> ", stra, exact_name(tmp_proj -> chemistry -> label[j]), tmp_mol -> species[j]);
1309 }
1310 }
1311 }
1312 }
1313 gtk_tree_store_append (store, & field_level, NULL);
1314 gtk_tree_store_set (store, & field_level, 0, i+1,
1315 1, tmp_fmol -> name,
1316 2, tmp_fmol -> multi,
1317 3, stra,
1318 4, tmp_mol -> natoms,
1319 5, tmp_mol -> nspec,
1320 6, tmp_fmol -> show,
1321 7, tmp_fmol -> show_id, -1);
1322 g_free (stra);
1323 stra = NULL;
1324 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
1325 }
1326 break;
1327 case 1:
1328 if (tmp_field -> afp[MAXDATC])
1329 {
1330 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1331 }
1332 tmp_fat = tmp_fmol -> first_atom;
1333 for (i=0; i < tmp_fmol -> atoms; i++)
1334 {
1335 gtk_tree_store_append (store, & field_level, NULL);
1336 stra = g_strdup_printf ("%.3f", tmp_fat -> mass);
1337 strb = g_strdup_printf ("%.2f", tmp_fat -> charge);
1338 gtk_tree_store_set (store, & field_level, 0, i+1,
1339 1, tmp_fat -> name,
1340 2, tmp_proj -> chemistry -> label[tmp_fat -> sp],
1341 3, stra,
1342 4, strb,
1343 5, tmp_fat -> frozen,
1344 6, tmp_fat -> num / tmp_fmol -> multi,
1345 7, tmp_fat -> show, -1);
1346 g_free (stra);
1347 g_free (strb);
1348 if (tmp_fat -> next != NULL) tmp_fat = tmp_fat -> next;
1349 }
1350 break;
1351 case 2:
1352 if (tmp_field -> afp[MAXDATC])
1353 {
1354 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1355 }
1356 tmp_fshell = tmp_fmol -> first_shell;
1357 for (i=0; i < tmp_fmol -> shells; i++)
1358 {
1359 gtk_tree_store_append (store, & field_level, NULL);
1360 if (tmp_fshell -> ia[0])
1361 {
1362 l = tmp_fmol -> atoms_id[tmp_fshell -> ia[0]-1][0].a;
1363 tmp_fat = get_active_atom (tmp_fmol -> id, l);
1364 stra = g_strdup_printf ("%d (%s)", tmp_fshell -> ia[0], exact_name(tmp_proj -> chemistry -> label[tmp_fat -> sp]));
1365 }
1366 else
1367 {
1368 stra = g_strdup_printf ("<i>None</i>");
1369 }
1370 if (tmp_fshell -> ia[1])
1371 {
1372 l = tmp_fmol -> atoms_id[tmp_fshell -> ia[1]-1][0].a;
1373 tmp_fat = get_active_atom (tmp_fmol -> id, l);
1374 strb = g_strdup_printf ("%d (%s)", tmp_fshell -> ia[1], exact_name(tmp_proj -> chemistry -> label[tmp_fat -> sp]));
1375 }
1376 else
1377 {
1378 strb = g_strdup_printf ("<i>None</i>");
1379 }
1380 strc = g_strdup_printf ("%.3f", tmp_fshell -> m);
1381 strd = g_strdup_printf ("%.2f", tmp_fshell -> z);
1382 gtk_tree_store_set (store, & field_level, 0, i+1,
1383 1, stra,
1384 2, strb,
1385 3, strc,
1386 4, strd,
1387 5, tmp_fshell -> k2,
1388 6, tmp_fshell -> k4,
1389 7, tmp_fshell -> show,
1390 8, tmp_fshell -> use, -1);
1391 g_free (stra);
1392 g_free (strb);
1393 g_free (strc);
1394 g_free (strd);
1395 if (tmp_fshell -> next != NULL) tmp_fshell = tmp_fshell -> next;
1396 }
1397 break;
1398 case 3:
1399 if (tmp_field -> afp[MAXDATC])
1400 {
1401 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1402 }
1403 tmp_fcons = tmp_fmol -> first_constraint;
1404 for (i=0; i < tmp_fmol -> constraints; i++)
1405 {
1406 gtk_tree_store_append (store, & field_level, NULL);
1407 if (tmp_fcons -> ia[0])
1408 {
1409 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[0]-1][0].a;
1410 l = get_active_atom (m, k) -> sp;
1411 stra = g_strdup_printf ("%d (%s)", tmp_fcons -> ia[0], exact_name(tmp_proj -> chemistry -> label[l]));
1412 }
1413 else
1414 {
1415 stra = g_strdup_printf ("<i>None</i>");
1416 }
1417 if (tmp_fcons -> ia[1])
1418 {
1419 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[1]-1][0].a;
1420 l = get_active_atom (m, k) -> sp;
1421 strb = g_strdup_printf ("%d (%s)", tmp_fcons -> ia[1], exact_name(tmp_proj -> chemistry -> label[l]));
1422 }
1423 else
1424 {
1425 strb = g_strdup_printf ("<i>None</i>");
1426 }
1427 gtk_tree_store_set (store, & field_level, 0, i+1,
1428 1, stra,
1429 2, strb,
1430 3, tmp_fcons -> length,
1431 4, tmp_fcons -> av,
1432 5, tmp_fcons -> show,
1433 6, tmp_fcons -> use, -1);
1434 g_free (stra);
1435 g_free (strb);
1436 if (tmp_fcons -> next != NULL) tmp_fcons = tmp_fcons -> next;
1437 }
1438 break;
1439 case 4:
1440 if (tmp_field -> afp[MAXDATC])
1441 {
1442 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1443 }
1444 tmp_fpmf = tmp_fmol -> first_pmf;
1445 for (i=0; i < tmp_fmol -> pmfs; i++)
1446 {
1447 gtk_tree_store_append (store, & field_level, NULL);
1448 gtk_tree_store_set (store, & field_level, 0, i+1,
1449 1, tmp_fpmf -> length,
1450 2, tmp_fpmf -> av,
1451 3, 0, 4, 0, 5, 0.0,
1452 6, tmp_fpmf -> show,
1453 7, tmp_fpmf -> use, -1);
1454 for (j=0; j<2; j++)
1455 {
1456 gtk_tree_store_append (store, & unit_level, & field_level);
1457 gtk_tree_store_set (store, & unit_level, 0, -(i+1), 1, 0.0, 2, 0.0, 3, j+1, 4, 0, 5, 0.0, 6, tmp_fpmf -> show, 7, FALSE, -1);
1458 if (tmp_fpmf -> num[j] > 0)
1459 {
1460 for (k=0; k<tmp_fpmf -> num[j]; k++)
1461 {
1462 gtk_tree_store_append (store, & site_level, & unit_level);
1463 gtk_tree_store_set (store, & site_level, 0, -(i+1), 1, 0.0, 2, 0.0, 3, -(j+1),
1464 4, tmp_fpmf -> list[j][k]+1,
1465 5, tmp_fpmf -> weight[j][k], 6, tmp_fpmf -> show, 7, FALSE, -1);
1466 }
1467 }
1468 }
1469 if (tmp_fpmf -> next != NULL) tmp_fpmf = tmp_fpmf -> next;
1470 }
1471 break;
1472 case 5:
1473 if (tmp_field -> afp[MAXDATC])
1474 {
1475 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1476 }
1477 tmp_frig = tmp_fmol -> first_rigid;
1478 for (i=0; i < tmp_fmol -> rigids; i++)
1479 {
1480 gtk_tree_store_append (store, & field_level, NULL);
1481 gtk_tree_store_set (store, & field_level, 0, i+1,
1482 1, tmp_frig -> num,
1483 2, NULL,
1484 3, tmp_frig -> show,
1485 4, tmp_frig -> use, -1);
1486 if (tmp_frig -> num > 0)
1487 {
1488 for (j=0; j<tmp_frig -> num; j++)
1489 {
1490 l = tmp_fmol -> atoms_id[tmp_frig -> list[j]][0].a;
1491 k = get_active_atom (m, l) -> sp;
1492 stra = g_strdup_printf ("%d (%s)", tmp_frig -> list[j]+1, exact_name(tmp_proj -> chemistry -> label[k]));
1493 gtk_tree_store_append (store, & unit_level, & field_level);
1494 gtk_tree_store_set (store, & unit_level, 0, -(i+1), 1, 0, 2, stra, 3, FALSE, 4, FALSE, -1);
1495 g_free (stra);
1496 }
1497 }
1498 if (tmp_frig -> next != NULL) tmp_frig = tmp_frig -> next;
1499 }
1500 break;
1501 case 6:
1502 if (tmp_field -> afp[MAXDATC])
1503 {
1504 for (j=0; j<m; j++) tmp_fmol = tmp_fmol -> next;
1505 }
1506 tmp_ftet = tmp_fmol -> first_tethered;
1507 for (i=0; i < tmp_fmol -> tethered; i++)
1508 {
1509 j = tmp_fmol -> atoms_id[tmp_ftet -> num-1][0].a;
1510 k = get_active_atom (m, j) -> sp;
1511 stra = g_strdup_printf ("%d (%s)", tmp_ftet -> num, exact_name(tmp_proj -> chemistry -> label[k]));
1512 strb = g_strdup_printf ("%s (%s)", fnames[activef][1][tmp_ftet -> key], exact_name(fkeysw[activef][1][tmp_ftet -> key]));
1513 strc = parameters_info (0, tmp_ftet -> key, fvars_teth[activef][tmp_ftet -> key], tmp_ftet -> val);
1514 gtk_tree_store_append (store, & field_level, NULL);
1515 gtk_tree_store_set (store, & field_level, 0, i+1,
1516 1, stra,
1517 2, tmp_ftet -> show,
1518 3, tmp_ftet -> use,
1519 4, strb,
1520 5, strc, -1);
1521 g_free (stra);
1522 g_free (strb);
1523 g_free (strc);
1524 if (tmp_ftet -> next != NULL) tmp_ftet = tmp_ftet -> next;
1525 }
1526 break;
1527 case SEXTERN:
1528 // External field
1529 tmp_fext = tmp_field -> first_external;
1530 for (i=0; i < tmp_field -> extern_fields; i++)
1531 {
1532 gtk_tree_store_append (store, & field_level, NULL);
1533 stra = g_strdup_printf ("%s (%s)", fnames[activef][15][tmp_fext -> key], exact_name(fkeysw[activef][15][tmp_fext -> key]));
1534 gtk_tree_store_set (store, & field_level, 0, tmp_fext -> id+1,
1535 1, tmp_fext -> use,
1536 2, stra,
1537 3, parameters_info (14, tmp_fext -> key, fvars_fext[activef][tmp_fext -> key], tmp_fext -> val), -1);
1538 g_free (stra);
1539 if (tmp_fext -> next != NULL) tmp_fext = tmp_fext -> next;
1540 }
1541 break;
1542 default:
1543 if (f < MOLIMIT)
1544 {
1545 fill_field_struct (store, f-7, m);
1546 }
1547 else
1548 {
1549 fill_field_body (store, f - MOLIMIT);
1550 }
1551 break;
1552 }
1553 }
1554}
1555
1556#ifdef GTK4
1565G_MODULE_EXPORT void toggle_field_params (GtkCheckButton * but, gpointer data)
1566#else
1575G_MODULE_EXPORT void toggle_field_params (GtkToggleButton * but, gpointer data)
1576#endif
1577{
1578 int i, j;
1579 i = GPOINTER_TO_INT (data);
1580 tmp_field -> afp[i] = button_get_status ((GtkWidget *)but);
1581 if (i == MAXDATC)
1582 {
1583 for (j=0; j<MOLIMIT-1; j++)
1584 {
1587 }
1588 }
1589 else if (i > MAXDATC)
1590 {
1591 gtk_widget_set_visible (fibox[i+1], tmp_field -> afp[i]);
1592 }
1593}
1594
1602gboolean set_nbd_but_sensitive (int nbid)
1603{
1604 if (nbid == 0 || nbid == 2 || nbid == 5)
1605 {
1606 return TRUE;
1607 }
1608 else
1609 {
1610 int i, j;
1611 i = (nbid == 1) ? 2 : nbid;
1612 j = 0;
1613 field_molecule * ftmp = tmp_field -> first_molecule;
1614 while (ftmp)
1615 {
1616 j += ftmp -> atoms;
1617 ftmp = ftmp -> next;
1618 }
1619 gboolean res = (j >= i) ? TRUE : FALSE;
1620 return res;
1621 }
1622}
1623
1632gchar * set_field_label (int f, int m)
1633{
1634 gchar * lab;
1635 int k;
1636 if (f < MOLIMIT)
1637 {
1638 if (tmp_field -> afp[MAXDATC])
1639 {
1641 lab = g_strdup_printf ("the <b>%d</b> different fragment(s) in molecule <b>%s</b>\n",
1642 tmp_fmol -> multi, tmp_fmol -> name);
1643 }
1644 else
1645 {
1646 lab = g_strdup_printf ("the system\n");
1647 }
1648 }
1649 switch (f)
1650 {
1651 case 1:
1652 lab = g_strdup_printf ("%seach contains the following <b>%d</b> type(s) of atom", lab, tmp_fmol -> atoms);
1653 break;
1654 case 2:
1655 if (tmp_fmol -> shells == 0)
1656 {
1657 lab = g_strdup_printf ("%sdo not contains any core-shell unit", lab);
1658 }
1659 else
1660 {
1661 lab = g_strdup_printf ("%seach contains the following <b>%d</b> core-shell unit", lab, tmp_fmol -> shells);
1662 }
1663 break;
1664 case 3:
1665 if (tmp_fmol -> constraints == 0)
1666 {
1667 lab = g_strdup_printf ("%sdo not contains any constraint", lab);
1668 }
1669 else
1670 {
1671 lab = g_strdup_printf ("%seach contains the following <b>%d</b> constraint(s)", lab, tmp_fmol -> constraints);
1672 }
1673 break;
1674 case 4:
1675 if (tmp_fmol -> pmfs == 0)
1676 {
1677 lab = g_strdup_printf ("%sdo not contains any mean force potential", lab);
1678 }
1679 else
1680 {
1681 lab = g_strdup_printf ("%seach contains the following <b>%d</b> type(s) of mean force potential(s)", lab, tmp_fmol -> pmfs);
1682 }
1683 break;
1684 case 5:
1685 if (tmp_fmol -> rigids == 0)
1686 {
1687 lab = g_strdup_printf ("%sdo not contains any rigid unit", lab);
1688 }
1689 else
1690 {
1691 lab = g_strdup_printf ("%seach contains the following <b>%d</b> rigid unit(s)", lab, tmp_fmol -> rigids);
1692 }
1693 break;
1694 case 6:
1695 if (tmp_fmol -> tethered == 0)
1696 {
1697 lab = g_strdup_printf ("%sdo not contains any tethering potential(s)", lab);
1698 }
1699 else
1700 {
1701 lab = g_strdup_printf ("%seach contains the following <b>%d</b> tethering potential(s)", lab, tmp_fmol -> tethered);
1702 }
1703 break;
1704 case SEXTERN:
1705 if (tmp_field -> extern_fields == 0)
1706 {
1707 lab = g_strdup_printf ("the force field do not contains any external field(s)");
1708 }
1709 else
1710 {
1711 lab = g_strdup_printf ("the force field contains the following <b>%d</b> external field(s)", tmp_field -> extern_fields);
1712 }
1713 break;
1714 default:
1715 if (f < MOLIMIT)
1716 {
1717 if (f == 14)
1718 {
1719 if (tmp_fmol -> nstruct[f-7] == 0)
1720 {
1721 lab = g_strdup_printf ("%sdo not contains any %s <sup>*</sup>", lab, mo_title[f-7]);
1722 }
1723 else
1724 {
1725 lab = g_strdup_printf ("%s contains the following <b>%d</b> type(s) of %s <sup>*</sup>", lab, tmp_fmol -> nstruct[f-7], elemts[f]);
1726 }
1727 }
1728 else
1729 {
1730 if (tmp_fmol -> nstruct[f-7] == 0)
1731 {
1732 lab = g_strdup_printf ("%sdo not contains any %s", lab, mo_title[f-7]);
1733 }
1734 else
1735 {
1736 lab = g_strdup_printf ("%s contains the following <b>%d</b> type(s) of %s", lab, tmp_fmol -> nstruct[f-7], elemts[f]);
1737 }
1738 }
1739 break;
1740 }
1741 else
1742 {
1743 k = f - MOLIMIT;
1744 if (tmp_field -> nbody[k] == 0)
1745 {
1746 lab = g_strdup_printf ("the force field do not contains any %s(s)", elemts[f]);
1747 }
1748 else
1749 {
1750 lab = g_strdup_printf ("the force field contains the following <b>%d</b> %s(s)", tmp_field -> nbody[k], elemts[f]);
1751 }
1752 break;
1753 }
1754 }
1755 return lab;
1756}
1757
1766G_MODULE_EXPORT void changed_mol_box (GtkComboBox * box, gpointer data)
1767{
1768 int i, j;
1769 i = GPOINTER_TO_INT(data);
1770 j = combo_get_active ((GtkWidget *)box);
1771 gtk_label_set_text (GTK_LABEL(field_label[i]), set_field_label(i, j));
1772 gtk_label_set_use_markup (GTK_LABEL(field_label[i]), TRUE);
1773 gtk_tree_store_clear (field_model[i]);
1774 fill_field_model (field_model[i], i, j);
1775}
1776
1783{
1784 int i;
1785 for (i=0; i<MAXDATA; i++)
1786 {
1787 if (i > 0 && i < MOLIMIT)
1788 {
1789 changed_mol_box (GTK_COMBO_BOX (combo_mol[i-1]), GINT_TO_POINTER(i));
1790 }
1791 else
1792 {
1793 if (i > 0)
1794 {
1795 gtk_label_set_text (GTK_LABEL(field_label[i]), set_field_label(i, 0));
1796 gtk_label_set_use_markup(GTK_LABEL(field_label[i]), TRUE);
1797 }
1798 gtk_tree_store_clear (field_model[i]);
1799 fill_field_model (field_model[i], i, -1);
1800 }
1801 }
1802}
1803
1812void get_is_energy (int i, int l)
1813{
1814 int j, k;
1815 j = (i > 1 && i < 8) ? (i-1)/2 + 1 - i/7 : i;
1816 is_energy = g_malloc (fetypes[activef][i+1]*sizeof*is_energy);
1817 if (l)
1818 {
1819 is_var = g_malloc (fetypes[activef][i+1]*sizeof*is_var);
1820 }
1821 switch (j)
1822 {
1823 case 0:
1824 for (k=0; k<fetypes[activef][i+1]; k++)
1825 {
1828 }
1829 break;
1830 case 1:
1831 // Bonds
1832 for (k=0; k<fetypes[activef][i+1]; k++)
1833 {
1836 }
1837 break;
1838 case 2:
1839 // Angles
1840 for (k=0; k<fetypes[activef][i+1]; k++)
1841 {
1844 }
1845 break;
1846 case 3:
1847 // Dihedrals / Impropers
1848 for (k=0; k<fetypes[activef][i+1]; k++)
1849 {
1852 }
1853 break;
1854 case 8:
1855 // Inversions
1856 for (k=0; k<fetypes[activef][i+1]; k++)
1857 {
1860 }
1861 break;
1862 case 9:
1863 for (k=0; k<fetypes[activef][i+1]; k++)
1864 {
1866 if (l) is_var[k] = duplicate_strings (FVDW_P, fvars_vdw[activef][k]);
1867 }
1868 break;
1869 case 10:
1870 for (k=0; k<fetypes[activef][i+1]; k++)
1871 {
1874 }
1875 break;
1876 case 11:
1877 for (k=0; k<fetypes[activef][i+1]; k++)
1878 {
1881 }
1882 break;
1883 case 12:
1884 for (k=0; k<fetypes[activef][i+1]; k++)
1885 {
1888 }
1889 break;
1890 case 13:
1891 for (k=0; k<fetypes[activef][i+1]; k++)
1892 {
1895 }
1896 break;
1897 case 14:
1898 for (k=0; k<fetypes[activef][i+1]; k++)
1899 {
1902 }
1903 break;
1904 }
1905}
1906
1916gboolean field_file_has_energy_parameters (gboolean scale, int sca, int scb)
1917{
1918 int i, j, k, l;
1919 is_param = allocdint(15, 21);
1920 has_energy = allocint (15);
1921 i = 0;
1922 tmp_fmol = tmp_field -> first_molecule;
1923 while (tmp_fmol)
1924 {
1926 while (tmp_fshell)
1927 {
1928 if (! scale)
1929 {
1930 i =1;
1931 break;
1932 }
1933 else
1934 {
1937 tmp_fshell = tmp_fshell -> next;
1938 }
1939 }
1940 tmp_fmol = tmp_fmol -> next;
1941 }
1942 for (j=0; j<15; j++)
1943 {
1944 get_is_energy (j, 0);
1945 l = 0;
1946 if (j == 0)
1947 {
1948 tmp_fmol = tmp_field -> first_molecule;
1949 while (tmp_fmol)
1950 {
1952 while (tmp_ftet)
1953 {
1954 for (k=0; k<fvalues[activef][j][tmp_ftet -> key]; k++)
1955 {
1956 if (is_energy[tmp_ftet -> key][k])
1957 {
1958 is_param[j][tmp_ftet -> key] ++;
1959 if (scale) tmp_ftet -> val[k]= (tmp_ftet -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1960 l ++;
1961 }
1962 }
1963 tmp_ftet = tmp_ftet -> next;
1964 }
1965 tmp_fmol = tmp_fmol -> next;
1966 }
1967 }
1968 else if (j>0 && j<9)
1969 {
1970 tmp_fmol = tmp_field -> first_molecule;
1971 while (tmp_fmol)
1972 {
1973 tmp_fstr = tmp_fmol -> first_struct[j-1];
1974 //get_active_struct (j-1, tmp_fmol -> id, 0);
1975 while (tmp_fstr)
1976 {
1977 for (k=0; k<fvalues[activef][j][tmp_fstr -> def -> key]; k++)
1978 {
1979 if (is_energy[tmp_fstr -> def -> key][k])
1980 {
1981 is_param[j][tmp_fstr -> def -> key] ++;
1982 if (scale) tmp_fstr -> def -> val[k] = (tmp_fstr -> def -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1983 l ++;
1984 }
1985 }
1986 tmp_fprop = tmp_fstr -> other;
1987 while (tmp_fprop)
1988 {
1989 for (k=0; k<fvalues[activef][j][tmp_fprop -> key]; k++)
1990 {
1991 if (is_energy[tmp_fprop -> key][k])
1992 {
1993 is_param[j][tmp_fprop -> key] ++;
1994 if (scale) tmp_fprop -> val[k] = (tmp_fprop -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1995 l ++;
1996 }
1997 }
1998 tmp_fprop = tmp_fprop -> next;
1999 }
2000 tmp_fstr = tmp_fstr -> next;
2001 }
2002 tmp_fmol = tmp_fmol -> next;
2003 }
2004 }
2005 else
2006 {
2007 tmp_fbody = get_active_body (0, j-9);
2008 while (tmp_fbody)
2009 {
2010 for (k=0; k<fvalues[activef][j][tmp_fbody -> key]; k++)
2011 {
2012 if (is_energy[tmp_fbody -> key][k])
2013 {
2014 is_param[j][tmp_fbody -> key] ++;
2015 if (scale) tmp_fbody -> val[k] = (tmp_fbody -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
2016 l ++;
2017 }
2018 }
2019 tmp_fbody = tmp_fbody -> next;
2020 }
2021 }
2022 has_energy[j] = l;
2023 i += l;
2024 for (k=0; k<fetypes[activef][j+1]; k++) g_free (is_energy[k]);
2025 g_free (is_energy);
2026 }
2027 if (i)
2028 {
2029 return TRUE;
2030 }
2031 else
2032 {
2033 g_free (is_param);
2034 return FALSE;
2035 }
2036}
2037
2047G_MODULE_EXPORT void run_changed_energy_unit (GtkDialog * dialog, gint response_id, gpointer data)
2048{
2049 if (response_id == GTK_RESPONSE_YES)
2050 {
2051 int i = GPOINTER_TO_INT(data);
2052 setup_cs_labels (i);
2053 // Correct all parameters
2054 field_file_has_energy_parameters (TRUE, tmp_field -> energy_unit, i);
2055 tmp_field -> energy_unit = i;
2056 }
2057 g_free (is_param);
2058 destroy_this_dialog (dialog);
2059}
2060
2069G_MODULE_EXPORT void changed_energy_unit (GtkComboBox * box, gpointer data)
2070{
2071 int i, j, k, l;
2072 i = combo_get_active ((GtkWidget *)box);
2073 if (i != tmp_field -> energy_unit)
2074 {
2075 if (field_file_has_energy_parameters(FALSE, 0, 0))
2076 {
2077 GtkWidget * dialog = gtk_dialog_new_with_buttons ("Change energy unit ?", GTK_WINDOW(field_assistant),
2078 GTK_DIALOG_MODAL, "Yes", GTK_RESPONSE_YES, "No", GTK_RESPONSE_NO, NULL);
2079 gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
2080 GtkWidget * vbox = dialog_get_content_area (dialog);
2081 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label("Change the energy unit ?\nThe value of all field parameters that are energy related (listed below) will be scaled accordingly.", -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
2082 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label("List of energy related parameters in your FIELD file:\n", -1, -1, 0.5, 0.5), FALSE, FALSE, 0);
2083 GtkWidget * hbox;
2084 GtkWidget * vbax, * vbbx;
2085 GtkWidget * hax, * hbx;
2086 gchar * str;
2087 // Core-Shell
2088 tmp_fmol = tmp_field -> first_molecule;
2089 while (tmp_fmol)
2090 {
2092 if (tmp_fshell)
2093 {
2094 hbox = create_hbox (0);
2095 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2096 vbax = create_vbox (BSEP);
2097 vbbx = create_vbox (BSEP);
2098 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbax, FALSE, FALSE, 0);
2099 hax = create_hbox (0);
2100 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbax, hax, FALSE, FALSE, 0);
2101 str = g_strdup_printf ("\t<b>%s(s):</b>", felemts[3]);
2102 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hax, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2103 g_free (str);
2104 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbbx, FALSE, FALSE, 0);
2105 hbx = create_hbox (0);
2106 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbbx, hbx, FALSE, FALSE, 0);
2107 str = g_strdup_printf ("k<sub>2</sub> and k<sub>4</sub>");
2108 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2109 g_free (str);
2110 break;
2111 }
2112 tmp_fmol = tmp_fmol -> next;
2113 }
2114 for (j=0; j<15; j++)
2115 {
2116 if (has_energy[j])
2117 {
2118 hbox = create_hbox (0);
2119 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2120 vbax = create_vbox (BSEP);
2121 vbbx = create_vbox (BSEP);
2122 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbax, FALSE, FALSE, 0);
2123 hax = create_hbox (0);
2124 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbax, hax, FALSE, FALSE, 0);
2125 str = g_strdup_printf ("\t<b>%s:</b>", felemts[j+7]);
2126 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hax, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2127 g_free (str);
2128 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbbx, FALSE, FALSE, 0);
2129 get_is_energy (j, 1);
2130 for (k=0; k<fetypes[activef][j+1]; k++)
2131 {
2132 if (is_param[j][k])
2133 {
2134 hbx = create_hbox (0);
2135 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbbx, hbx, FALSE, FALSE, 0);
2136 str = g_strdup_printf ("%s %s:", fnames[activef][j+1][k], elemts[j+6]);
2137 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2138 g_free (str);
2139 str = NULL;
2140 for (l=0; l<fntypes[activef][j]; l++)
2141 {
2142 if (is_energy[k][l])
2143 {
2144 if (str)
2145 {
2146 str = g_strdup_printf ("%s, %s", str, is_var[k][l]);
2147 }
2148 else
2149 {
2150 str = g_strdup_printf ("%s", is_var[k][l]);
2151 }
2152 }
2153 }
2154 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2155 g_free (str);
2156 }
2157 }
2158 for (k=0; k<fetypes[activef][j+1]; k++)
2159 {
2160 g_free (is_energy[k]);
2161 g_free (is_var[k]);
2162 }
2163 g_free (is_energy);
2164 g_free (is_var);
2165 }
2166 }
2167 run_this_gtk_dialog (dialog, G_CALLBACK(run_changed_energy_unit), GINT_TO_POINTER(i));
2168 }
2169 else
2170 {
2171 setup_cs_labels (i);
2172 tmp_field -> energy_unit = i;
2173 }
2174 }
2175 combo_set_active ((GtkWidget *)box, tmp_field -> energy_unit);
2177}
2178
2186GtkWidget * vbox_init (int p)
2187{
2188 int i, j, k, l;
2189 int col[3]={5, 4, 4};
2190 gchar * str;
2191 GtkWidget * vbox;
2192 GtkWidget * hbox;
2193 GtkWidget * ebox;
2194
2195 vbox = create_vbox (BSEP);
2196 hbox = create_hbox (0);
2197 str = g_strdup_printf ("<b>Please select the %s:</b>", felemts[0]);
2198 ebox = fbox (hbox, str);
2199 g_free (str);
2200 enbox = create_combo ();
2201 for (j=0; j<fetypes[activef][0]; j++)
2202 {
2203 str = g_strdup_printf ("%s (%s)", fnames[activef][0][j], fkeysw[activef][0][j]);
2204 combo_text_append (enbox, str);
2205 g_free (str);
2206 }
2207 combo_set_active (enbox, tmp_field -> energy_unit);
2208 g_signal_connect (G_OBJECT (enbox), "changed", G_CALLBACK(changed_energy_unit), GINT_TO_POINTER(0));
2209 gtk_widget_set_size_request (enbox, 250, 30);
2211 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ebox, enbox, FALSE, FALSE, 60);
2212 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2213
2214 hbox = create_hbox (0);
2215 ebox = fbox (hbox, "<b>Please select the component(s) of the force field:</b>");
2216 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
2217 hbox = create_hbox (0);
2218 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label("<u> Intra-molecular interaction(s):</u>", 200, 20, 0.0, 0.5), FALSE, FALSE, 10);
2219
2220 //str = g_strdup_printf ("Use multiple molecule(s)");
2221 //but = check_button (str, 225, 40, tmp_field -> afp[MAXDATC], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(MAXDATC));
2222 //g_free (str);
2223 //add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, but, FALSE, FALSE, 30);
2224
2225 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2226 hbox = create_hbox (0);
2227 k = 2+MAXDATC;
2228 l = 0;
2229 for (i=0; i<3; i++)
2230 {
2231 ebox = create_vbox (BSEP);
2232 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, ebox, FALSE, FALSE, 20);
2233 for (j=0; j<col[i]; j++)
2234 {
2235 str = g_strdup_printf ("Use %s(s)", elemts[k-MAXDATC]);
2236 ff_but[l] = check_button (str, 225, 40, tmp_field -> afp[k], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(k));
2237 g_free (str);
2239 add_box_child_start (GTK_ORIENTATION_VERTICAL, ebox, ff_but[l], FALSE, FALSE, 0);
2240 k ++;
2241 l ++;
2242 }
2243 }
2244 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2245 hbox = create_hbox (0);
2246 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label("<u>Non-bonded interaction(s)</u>", 200, 20, 0.0, 0.5), FALSE, FALSE, 10);
2247 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2248 hbox = create_hbox (0);
2249 for (i=0; i<3; i++)
2250 {
2251 ebox = create_vbox (BSEP);
2252 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, ebox, FALSE, FALSE, 20);
2253 for (j=0; j<2; j++)
2254 {
2255 str = g_strdup_printf ("Use %s(s)", elemts[k-MAXDATC]);
2256 if (activef) tmp_field -> afp[k] = FALSE;
2257 ff_but[l] = check_button (str, 225, 40, tmp_field -> afp[k], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(k));
2258 k ++;
2259 g_free (str);
2262 add_box_child_start (GTK_ORIENTATION_VERTICAL, ebox, ff_but[l], FALSE, FALSE, 0);
2263 l ++;
2264 }
2265 }
2266 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2267 return vbox;
2268}
2269
2279int get_field_tree_data (GtkWidget * tree, int treeid, GtkTreePath * path)
2280{
2281 int res = -1;
2282 GtkTreeModel * tmodel = gtk_tree_view_get_model (GTK_TREE_VIEW(tree));
2283 if (gtk_tree_model_get_iter (tmodel, & field_iter, path))
2284 {
2285 gtk_tree_model_get (tmodel, & field_iter, 0, & res, -1);
2286 if (res == 0)
2287 {
2288 gtk_tree_model_get (tmodel, & field_iter, field_v[treeid]+1, & res, -1);
2289 }
2290 else
2291 {
2292 res --;
2293 }
2294 }
2295 return res;
2296}
2297
2306int get_field_data_id (int k, gchar * data)
2307{
2308 int i, j;
2309 gchar * str;
2310 i = -1;
2311 for (j=0; j<fetypes[activef][k]; j++)
2312 {
2313 str = g_strdup_printf ("%s (%s)", fnames[activef][k][j], exact_name(fkeysw[activef][k][j]));
2314 if (g_strcmp0 (data, str) == 0)
2315 {
2316 i = j;
2317 g_free (str);
2318 break;
2319 }
2320 g_free (str);
2321 }
2322 return i;
2323}
2324
2335G_MODULE_EXPORT void changed_field_key_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data)
2336{
2337 GValue val = {0, };
2338 int i, j, k, l, m, n, o;
2339 gboolean changeit = TRUE;
2340 char ** vars;
2341 int * ids;
2342 i = GPOINTER_TO_INT(data);
2343 GObject * cmodel;
2344 g_object_get (combo, "model", & cmodel, NULL);
2345 gtk_tree_model_get_value ((GtkTreeModel *)cmodel, iter, 0, & val);
2346 if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(field_model[i]), iter, path_string))
2347 {
2348 GValue vbl = {0, };
2349 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), iter, field_v[i]+1, & vbl);
2350 j = (int) g_value_get_int (& vbl);
2351 gchar * str = g_strdup_printf ("%s", (char *)g_value_get_string (& val));
2352 l = get_field_data_id (i-5, str);
2353 if (l > -1)
2354 {
2355 if (i < MOLIMIT) k = combo_get_active (combo_mol[i-1]);
2356 if (i > 6 && i < MOLIMIT)
2357 {
2358 tmp_fstr = get_active_struct (i-7, k, j);
2359 o = struct_id (i);
2360 ids = allocint (o);
2361 if (i < 9)
2362 {
2363 vars = (char **)fvars_bond[activef][l];
2364 }
2365 else if (i < 11)
2366 {
2367 vars = (char **)fvars_angle[activef][l];
2368 }
2369 else if (i < 14)
2370 {
2371 vars = (char **)fvars_dihedral[activef][l];
2372 }
2373 else
2374 {
2375 vars = (char **)fvars_inversion[activef][l];
2376 }
2377 gtk_tree_model_get (GTK_TREE_MODEL(field_model[i]), iter, 0, & m, -1);
2378 if (m)
2379 {
2380 // Default prop
2381 for (n=0; n<o; n++) ids[n] = -1;
2382 if (l != tmp_fstr -> def -> key)
2383 {
2384 adjust_field_prop (i-7, o, NULL, ids, l);
2385 // print status of field prop
2386 str = g_strdup_printf ("<b>Default</b>: %s", str);
2387 gtk_tree_store_set (field_model[i], iter, field_v[i]-1, str, -1);
2388 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, vars, tmp_fstr -> def -> val), -1);
2390 }
2391 }
2392 else
2393 {
2394 // Other prop
2395 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2396 for (n=1; n<o+1; n++)
2397 {
2398 gtk_tree_model_get (GTK_TREE_MODEL(field_model[i]), iter, n, & str, -1);
2399 ids[n-1] = (int) string_to_double ((gpointer)str) - 1;
2400 }
2401 adjust_field_prop (i-7, o, NULL, ids, l);
2402 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, vars, get_active_prop_using_atoms(tmp_fstr -> other, o, ids) -> val), -1);
2403 }
2404 g_free (ids);
2405 }
2406 else
2407 {
2408 switch (i)
2409 {
2410 case 6:
2411 tmp_ftet = get_active_tethered (k, j-1);
2412 tmp_ftet -> key = l;
2413 tmp_ftet -> val = NULL;
2414 tmp_ftet -> val = allocfloat (fvalues[activef][i-6][l]);
2415 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2416 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (0, l, fvars_teth[activef][l], tmp_ftet-> val), -1);
2417 break;
2418 case SEXTERN:
2420 tmp_fext -> key = l;
2421 tmp_fext -> val = NULL;
2422 tmp_fext -> val = allocfloat (fvalues[activef][i-6][l]);
2423 gtk_tree_store_set_value (field_model[i], iter, 2, & val);
2424 gtk_tree_store_set (field_model[i], iter, 3, parameters_info (i-6, l, fvars_fext[activef][l], tmp_fext -> val), -1);
2425 break;
2426 default:
2427 k = i - MOLIMIT;
2428 tmp_fbody = get_active_body (j-1, k);
2429 if (k == 2)
2430 {
2431 changeit = tersoff_question ();
2432 }
2433 if (changeit)
2434 {
2435 if (k == 2)
2436 {
2437 check_tersoffs (-1, l);
2438 gtk_tree_store_clear (field_model[i]);
2439 fill_field_model (field_model[i], i, -1);
2440 }
2441 else
2442 {
2443 tmp_fbody -> key = l;
2444 tmp_fbody -> val = NULL;
2445 tmp_fbody -> val = allocfloat (fvalues[activef][i-6][l]);
2446 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2447 }
2448 }
2449 else if (i == 17)
2450 {
2451 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_ters[activef][l], tmp_fbody -> val), -1);
2452 }
2453
2454 if (i == 15) gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_vdw[activef][l], tmp_fbody -> val), -1);
2455 if (i == 16) gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_met[activef][l], tmp_fbody -> val), -1);
2456 if (i == 18) gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_tbd[activef][l], tmp_fbody -> val), -1);
2457 if (i == 19) gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_fbd[activef][l], tmp_fbody -> val), -1);
2458 break;
2459 }
2460 }
2461 }
2462 g_free (str);
2463 g_value_unset(& vbl);
2464 }
2465 g_value_unset(& val);
2466}
2467
2475GtkWidget * create_combo_mol (int f)
2476{
2477 int i;
2478 gchar * str;
2479
2480 GtkWidget * combo = create_combo ();
2481 tmp_fmol = tmp_field -> first_molecule;
2482 for (i=0; i<tmp_field -> molecules; i++)
2483 {
2484 str = g_strdup_printf ("%d: %s", i+1, tmp_fmol -> name);
2485 combo_text_append (combo, str);
2486 g_free (str);
2487 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
2488 }
2489 widget_set_sensitive (combo, (tmp_field -> molecules > 1) ? TRUE : FALSE);
2490 combo_set_active (combo, 0);
2491 g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK(changed_mol_box), GINT_TO_POINTER(f+1));
2492 return combo;
2493}
2494
2496
2505gchar * pop_info (int i, int id)
2506{
2507 int j, k, l;
2508 gchar * str = NULL;
2509
2510 actel = 0;
2511 switch (i)
2512 {
2513 case 0:
2515 str = g_strdup_printf ("Molecule N°%d", id+1);
2516 actel = 1;
2517 break;
2518 default:
2519 if (i < MOLIMIT)
2520 {
2521 j = combo_get_active (combo_mol[i-1]);
2523 }
2524 switch (i)
2525 {
2526 case 1:
2527 tmp_fat = get_active_atom (j, id);
2528 str = g_strdup_printf ("Atom N°%d: \"%s\"", tmp_fat -> id+1, tmp_fat -> name);
2529 actel = tmp_fat -> num;
2530 break;
2531 case 2:
2532 if (tmp_fmol -> shells > 0)
2533 {
2534 tmp_fshell = get_active_shell (j, id);
2535 actel = 1;
2536 if (tmp_fshell -> ia[0])
2537 {
2538 k = tmp_fmol -> atoms_id[tmp_fshell -> ia[0]-1][0].a;
2539 str = g_strdup_printf ("Core-Shell N°%d: Atom %d (%s) - ", tmp_fshell -> id+1, tmp_fshell -> ia[0],
2540 exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2541 }
2542 else
2543 {
2544 str = g_strdup_printf ("Core-Shell N°%d: <i>None</i> - ", tmp_fshell -> id+1);
2545 }
2546 if (tmp_fshell -> ia[1])
2547 {
2548 k = tmp_fmol -> atoms_id[tmp_fshell -> ia[1]-1][1].a;
2549 str = g_strdup_printf ("%s%d (%s)", str, tmp_fshell -> ia[1], exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2550 }
2551 else
2552 {
2553 str = g_strdup_printf ("%s<i>None</i>", str);
2554 }
2555 }
2556 break;
2557 case 3:
2558 if (tmp_fmol -> constraints > 0)
2559 {
2561 actel = 1;
2562 if (tmp_fcons -> ia[0])
2563 {
2564 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[0]-1][0].a;
2565 str = g_strdup_printf ("Constrained Bond N°%d: Atom %d (%s) - ", tmp_fcons -> id+1, tmp_fcons -> ia[0],
2566 exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2567 }
2568 else
2569 {
2570 str = g_strdup_printf ("Constrained Bond N°%d: <i>None</i> - ", tmp_fcons -> id+1);
2571 }
2572 if (tmp_fcons -> ia[1])
2573 {
2574 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[1]-1][1].a;
2575 str = g_strdup_printf ("%s%d (%s)", str, tmp_fcons -> ia[1], exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2576 }
2577 else
2578 {
2579 str = g_strdup_printf ("%s<i>None</i>", str);
2580 }
2581 }
2582 break;
2583 case 4:
2584 if (tmp_fmol -> pmfs > 0)
2585 {
2586 tmp_fpmf = get_active_pmf (j, id);
2587 actel = 1;
2588 str = g_strdup_printf ("Mean Force Potential N°%d", tmp_fpmf -> id+1);
2589 }
2590 break;
2591 case 5:
2592 if (tmp_fmol -> rigids > 0)
2593 {
2594 tmp_frig = get_active_rigid (j, id);
2595 actel = 1;
2596 str = g_strdup_printf ("Rigid Unit N°%d: %d Atom(s)", tmp_frig -> id+1, tmp_frig -> num);
2597 }
2598 break;
2599 case 6:
2600 if (tmp_fmol -> tethered > 0)
2601 {
2602 tmp_ftet = get_active_tethered (j, id);
2603 actel = 1;
2604 str = g_strdup_printf ("Tethering Potential N°%d", tmp_ftet -> id+1);
2605 }
2606 break;
2607 case SEXTERN:
2608 if (tmp_field -> extern_fields > 0)
2609 {
2611 str = g_strdup_printf ("%s N°: %d", felemts[i+1], tmp_fext -> id+1);
2612 actel = 1;
2613 }
2614 break;
2615 default:
2616 if (i < MOLIMIT)
2617 {
2618 if (tmp_fmol -> nstruct[i-7] > 0)
2619 {
2620 actel = 1;
2621 tmp_fstr = get_active_struct (i-7, j, row_id);
2622 str = g_strdup_printf ("%s N°%d: \"", mo_title[i-7], tmp_fstr -> id+1);
2623 for (k=0; k<struct_id(i); k++)
2624 {
2625 str = g_strdup_printf ("%s%s", str, get_active_atom (j, tmp_fstr -> aid[k]) -> name);
2626 if (k<struct_id(i)-1) str = g_strdup_printf ("%s-", str);
2627 }
2628 str = g_strdup_printf ("%s\"", str);
2629 }
2630 }
2631 else
2632 {
2633 k = i - MOLIMIT;
2634 if (tmp_field -> nbody[k] > 0)
2635 {
2637 str = g_strdup_printf ("%s N°: %d \"%s", felemts[i+1], tmp_fbody -> id+1, get_active_atom (tmp_fbody -> ma[0][0], tmp_fbody -> a[0][0]) -> name);
2638 for (l=1; l<body_at(k); l++)
2639 {
2640 if (tmp_fbody -> na[l] < 0)
2641 {
2642 str = g_strdup_printf ("%s - NONE", str);
2643 }
2644 else
2645 {
2646 str = g_strdup_printf ("%s - %s", str, get_active_atom (tmp_fbody -> ma[l][0], tmp_fbody -> a[l][0]) -> name);
2647 }
2648 }
2649 str = g_strdup_printf ("%s\"", str);
2650 actel = 1;
2651 }
2652 }
2653 break;
2654 }
2655 break;
2656 }
2657 return str;
2658}
2659
2667gchar * pop_edit (int i)
2668{
2669 gchar * str = NULL;
2670 switch (i)
2671 {
2672 case 0:
2673 str = g_strdup_printf ("Edit Name: \"%s\"", tmp_fmol -> name);
2674 break;
2675 default:
2676 str = g_strdup_printf ("Edit %s Properties", elemts[i]);
2677 break;
2678 }
2679 return str;
2680}
2681
2689gchar * pop_add (int i)
2690{
2691 gchar * str = NULL;
2692 if ((i>1 && i<7) || (i>MOLIMIT && i<MAXDATA)) str = g_strdup_printf ("Add a New %s", elemts[i]);
2693 return str;
2694}
2695
2703gchar * pop_remove (int i)
2704{
2705 gchar * str = NULL;
2706 if ((i>1 && i<7) || (i>MOLIMIT && i<MAXDATA)) str = g_strdup_printf ("Remove %s", elemts[i]);
2707 return str;
2708}
2709
2719G_MODULE_EXPORT void to_select_atom_id_from_fied_molecule (GSimpleAction * action, GVariant * parameter, gpointer data)
2720{
2722}
2723
2724GSimpleActionGroup * field_pop_actions = NULL;
2725
2749void append_field_item (GMenu * menu, const gchar * name, const gchar * key, int item_id,
2750 gchar * accel, int image_format, gpointer icon,
2751 gboolean custom, GCallback handler, gpointer data,
2752 gboolean check, gboolean status, gboolean radio, gboolean sensitive)
2753{
2754 gchar * str_a, * str_b, * str_c;
2755 str_a = g_strdup_printf ("set-%s", key);
2756 str_b = g_strdup_printf ("%s.%d", str_a, item_id);
2757 str_c = (sensitive) ? g_strdup_printf ("ff-%d.%s", item_id, (radio) ? str_a : str_b) : g_strdup_printf ("None");
2758 append_menu_item (menu, name, (const gchar *) str_c, accel, (custom) ? str_b : NULL, image_format, icon, check, status, radio, (radio) ? (const gchar *)str_b : NULL);
2759 if (handler)
2760 {
2761 if (! radio || (radio && status))
2762 {
2763 widget_add_action (field_pop_actions, (radio) ? (const gchar *)str_a : (const gchar *)str_b, handler, data,
2764 check, status, radio, (const gchar *)str_b);
2765 }
2766 }
2767 g_free (str_a);
2768 g_free (str_b);
2769 g_free (str_c);
2770}
2771
2772#ifdef GTK4
2784void pop_up_field_context_menu (int id, GtkWidget * widget, double event_x, double event_y, gpointer data)
2785#else
2796void pop_up_field_context_menu (int row_id, GtkWidget * widget, GdkEvent * event, gpointer data)
2797#endif
2798{
2799 GtkWidget * menu;
2800 gchar * str;
2801 int i, j, k, l;
2802 i = GPOINTER_TO_INT (data);
2803 str = pop_info (i, row_id);
2804 if (field_pop_actions) g_object_unref (field_pop_actions);
2805 field_pop_actions = g_simple_action_group_new ();
2806 GMenu * fmenu = g_menu_new ();
2807 GMenu * fmenus;
2808 if (str)
2809 {
2810 fmenus = g_menu_new ();
2811 append_field_item (fmenus, str, "pop", i, NULL, IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
2812 g_free (str);
2813 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2814 g_object_unref (fmenus);
2815 }
2816 if (actel > 0)
2817 {
2818 str = pop_edit (i);
2819 if (str)
2820 {
2821 fmenus = g_menu_new ();
2822 append_field_item (fmenus, str, "edit-fp", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(edit_field_prop), data, FALSE, FALSE, FALSE, TRUE);
2823 g_free (str);
2824 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2825 g_object_unref (fmenus);
2826 }
2827 switch (i)
2828 {
2829 case 0:
2830 if (tmp_field -> molecules < tmp_coord -> totcoord[2] && tmp_fmol -> multi > 1)
2831 {
2832 fmenus = g_menu_new ();
2833 append_field_item (fmenus, "Add New Molecule", "add-mol", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(add_molecule_to_field), data, FALSE, FALSE, FALSE, TRUE);
2834 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2835 g_object_unref (fmenus);
2836 }
2837 if (tmp_field -> molecules > tmp_coord -> totcoord[3]
2838 && tmp_fmol -> mol -> multiplicity > 1
2839 && tmp_fmol -> multi < tmp_fmol -> mol -> multiplicity)
2840 {
2841 fmenus = g_menu_new ();
2842 str = g_strdup_printf ("Remove Molecule %s From Field", tmp_fmol -> name);
2843 append_field_item (fmenus, str, "rem-mol", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(remove_molecule_from_field), data, FALSE, FALSE, FALSE, TRUE);
2844 g_free (str);
2845 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2846 g_object_unref (fmenus);
2847 }
2848 break;
2849 default:
2850 if (i == 1)
2851 {
2852 j = combo_get_active (combo_mol[i-1]);
2854 if (actel > 1)
2855 {
2856
2857 fmenus = g_menu_new ();
2858 str = g_strdup_printf ("Created New Field Atom From %s Atom(s)", tmp_fat -> name);
2859 append_field_item (fmenus, str, "add-fat", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(to_select_atom_id_from_fied_molecule), GINT_TO_POINTER(0), FALSE, FALSE, FALSE, TRUE);
2860 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2861 g_object_unref (fmenus);
2862 }
2863 l = 0;
2864 tmp_fbt = tmp_fmol -> first_atom;
2865 for (k=0; k<tmp_fmol -> atoms; k++)
2866 {
2867 if (tmp_fbt -> sp == tmp_fat -> sp) l ++;
2868 if (tmp_fbt -> next != NULL) tmp_fbt = tmp_fbt -> next;
2869 }
2870 if (l > 1)
2871 {
2872 fmenus = g_menu_new ();
2873 str = g_strdup_printf ("Remove Atom %s From Field Molecule", tmp_fat -> name);
2874 append_field_item (fmenus, str, "rem-fat", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(remove_atom_from_field_molecule), (gpointer *)tmp_fat, FALSE, FALSE, FALSE, TRUE);
2875 g_free (str);
2876 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2877 g_object_unref (fmenus);
2878 }
2879 }
2880 str = pop_remove (i);
2881 if (str) append_field_item (fmenu, str, "rem-fp", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(remove_field_prop), data, FALSE, FALSE, FALSE, TRUE);
2882 g_free (str);
2883 break;
2884 }
2885 }
2886 str = pop_add (i);
2887 if (str != NULL)
2888 {
2889 fmenus = g_menu_new ();
2890 append_field_item (fmenus, str, "add-prop", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(add_field_prop), data, FALSE, FALSE, FALSE, TRUE);
2891 g_free (str);
2892 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2893 g_object_unref (fmenus);
2894 }
2895#ifdef GTK4
2896 menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)fmenu, GTK_POPOVER_MENU_NESTED);
2897 gtk_widget_set_parent (menu, widget);
2898 // gtk_widget_set_size_request (menu, -1, i);
2899#else
2900 menu = gtk_menu_new_from_model ((GMenuModel *)fmenu);
2901#endif
2902 str = g_strdup_printf ("ff-%d", i);
2903 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(field_pop_actions));
2904 g_free (str);
2905#ifdef GTK4
2906 pop_menu_at_pointer (menu, event_x, event_y);
2907#else
2908 pop_menu_at_pointer (menu, event);
2909#endif
2910 /* GtkWidget * prop;
2911 menu = gtk_menu_new ();
2912 if (str != NULL)
2913 {
2914 prop = create_menu_item (FALSE, str);
2915 g_free (str);
2916 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2917 if (actel > 0) add_menu_separator (menu);
2918 }
2919 if (actel > 0)
2920 {
2921 str = pop_edit (i);
2922 if (str != NULL)
2923 {
2924 prop = create_menu_item (FALSE, str);
2925 g_free (str);
2926 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2927 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(edit_field_prop), data);
2928 }
2929 switch (i)
2930 {
2931 case 0:
2932 if (tmp_field -> molecules < tmp_coord -> totcoord[2] && tmp_fmol -> multi > 1)
2933 {
2934 add_menu_separator (menu);
2935 prop = create_menu_item (FALSE, "Add New Molecule");
2936 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2937 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(add_molecule_to_field), data);
2938 }
2939 if (tmp_field -> molecules > tmp_coord -> totcoord[3]
2940 && tmp_fmol -> mol -> multiplicity > 1
2941 && tmp_fmol -> multi < tmp_fmol -> mol -> multiplicity)
2942 {
2943 add_menu_separator (menu);
2944 str = g_strdup_printf ("Remove Molecule %s From Field", tmp_fmol -> name);
2945 prop = create_menu_item (FALSE, str);
2946 g_free (str);
2947 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2948 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_molecule_from_field), (gpointer *)tmp_fmol);
2949 }
2950 break;
2951 default:
2952 if (i == 1)
2953 {
2954 j = combo_get_active (combo_mol[i-1]);
2955 tmp_fmol = get_active_field_molecule (j);
2956 if (actel > 1)
2957 {
2958 add_menu_separator (menu);
2959 str = g_strdup_printf ("Created New Field Atom From %s Atom(s)", tmp_fat -> name);
2960 prop = create_menu_item (FALSE, str);
2961 g_free (str);
2962 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2963 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(select_atom_id_from_fied_molecule), GINT_TO_POINTER(0));
2964 }
2965 l = 0;
2966 tmp_fbt = tmp_fmol -> first_atom;
2967 for (k=0; k<tmp_fmol -> atoms; k++)
2968 {
2969 if (tmp_fbt -> sp == tmp_fat -> sp) l ++;
2970 if (tmp_fbt -> next != NULL) tmp_fbt = tmp_fbt -> next;
2971 }
2972 if (l > 1)
2973 {
2974 add_menu_separator (menu);
2975 str = g_strdup_printf ("Remove Atom %s From Field Molecule", tmp_fat -> name);
2976 prop = create_menu_item (FALSE, str);
2977 g_free (str);
2978 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2979 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_atom_from_field_molecule), (gpointer *)tmp_fat);
2980 }
2981 }
2982 str = pop_remove (i);
2983 if (str != NULL)
2984 {
2985 prop = create_menu_item (FALSE, str);
2986 g_free (str);
2987 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2988 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_field_prop), data);
2989 }
2990 break;
2991 }
2992 }
2993 str = pop_add (i);
2994 if (str != NULL)
2995 {
2996 if (actel > 0) add_menu_separator (menu);
2997 prop = create_menu_item (FALSE, str);
2998 g_free (str);
2999 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
3000 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(add_field_prop), data);
3001 }
3002 pop_menu_at_pointer (menu, (GdkEvent *)event);
3003#endif*/
3004}
3005
3006#ifdef GTK3
3015G_MODULE_EXPORT gboolean on_pop_up_field (GtkWidget * widget, gpointer data)
3016{
3017 pop_up_field_context_menu (row_id, widget, NULL, data);
3018 return TRUE;
3019}
3020#endif
3021
3022#ifdef GTK4
3035void field_button_event (double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
3036#else
3050void field_button_event (GdkEvent * event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
3051#endif
3052{
3053 if (event_type == GDK_BUTTON_PRESS)
3054 {
3055 GtkTreePath * path;
3056 GtkTreeViewColumn * column;
3057 int i, j, k;
3058 i = GPOINTER_TO_INT(data);
3059#ifdef GTK4
3060 int e_x, e_y;
3061 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW(field_tree[i]), event_x, event_y, & e_x, & e_y);
3062 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(field_tree[i]), e_x, e_y, & path, & column, & j, & k);
3063#else
3064 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(field_tree[i]), event_x, event_y, & path, & column, & j, & k);
3065#endif
3066 if (path != NULL)
3067 {
3069 }
3070 else
3071 {
3072 row_id = 0;
3073 }
3074 if (event_button == 3)
3075 {
3076#ifdef GTK4
3077 pop_up_field_context_menu (row_id, field_tree[i], event_x, event_y, data);
3078#else
3079 pop_up_field_context_menu (row_id, field_tree[i], event, data);
3080#endif
3081 }
3082 }
3083}
3084
3085#ifdef GTK4
3097G_MODULE_EXPORT void on_field_button_pressed (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
3098{
3099 field_button_event (x, y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_PRESS, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
3100}
3101
3113G_MODULE_EXPORT void on_field_button_released (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
3114{
3115 field_button_event (x, y, gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture), GDK_BUTTON_RELEASE, gtk_event_controller_get_current_event_time((GtkEventController *)gesture), data);
3116}
3117#else
3127G_MODULE_EXPORT gboolean on_field_button_event (GtkWidget * widget, GdkEvent * event, gpointer data)
3128{
3129 GdkEventButton * bevent = (GdkEventButton *)event;
3130 field_button_event (event, bevent -> x, bevent -> y, bevent -> button, bevent -> type, bevent -> time, data);
3131 return FALSE;
3132}
3133#endif
3134
3146void field_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3147{
3148 int i, j, k, l;
3149 int tree = GPOINTER_TO_INT(data);
3150 gtk_tree_model_get (mod, iter, 0, & i, -1);
3151 if (tree < SEXTERN)
3152 {
3153 if (i == 0)
3154 {
3155 gtk_tree_model_get (mod, iter, field_v[tree]+1, & i, -1);
3156 i ++;
3157 }
3158 else if (i < 0)
3159 {
3160 i = - i;
3161 }
3162 for (k=0; k<field_v[tree]; k++)
3163 {
3164 if (is_special[tree][k] == 2) break;
3165 }
3166 gtk_tree_model_get (mod, iter, k, & j, -1);
3167 l = (tree && tree < MOLIMIT) ? combo_get_active (combo_mol[tree-1]) : 0;
3168 k = get_field_objects (tree, l);
3169 set_renderer_color (j, renderer, init_color (i-1, k));
3170 }
3171}
3172
3184void field_set_markup_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3185{
3186 int tree = GPOINTER_TO_INT(data);
3187 gchar * str = NULL;
3188 gtk_tree_model_get (mod, iter, field_v[tree]-1, & str, -1);
3189 g_object_set (renderer, "markup", str, NULL, NULL);
3190 g_free (str);
3191}
3192
3204void field_set_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3205{
3206 int i;
3207 int tree = GPOINTER_TO_INT(data);
3208 i = (tree > 5) ? 1 : 0;
3209 if (i)
3210 {
3211 gchar * str = NULL;
3212 gtk_tree_model_get (mod, iter, field_v[tree], & str, -1);
3213 g_object_set (renderer, "markup", str, NULL, NULL);
3214 g_free (str);
3215 }
3216 else
3217 {
3218 gchar * str = NULL;
3219 GtkTreeViewColumn * cal;
3220 switch (tree)
3221 {
3222 case 0:
3223 gtk_tree_model_get (mod, iter, 3, & str, -1);
3224 break;
3225 default:
3226 // CHECK THIS
3227 cal = gtk_tree_view_get_column (GTK_TREE_VIEW(field_tree[tree]), 1);
3228 if (cal == col)
3229 {
3230 gtk_tree_model_get (mod, iter, 1, & str, -1);
3231 }
3232 else
3233 {
3234 gtk_tree_model_get (mod, iter, 2, & str, -1);
3235 }
3236 break;
3237 }
3238 g_object_set (renderer, "markup", str, NULL, NULL);
3239 g_free (str);
3240 }
3241}
3242
3254void field_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3255{
3256 int i, j;
3257 int tree = GPOINTER_TO_INT(data);
3258 if (tree != SEXTERN)
3259 {
3260 if (tree == 4 || tree == 5)
3261 {
3262 gtk_tree_model_get (mod, iter, 0, & j, -1);
3263 if (j < 0) j = 0;
3264 }
3265 else
3266 {
3267 for (i=0; i<field_v[tree]; i++)
3268 {
3269 if (is_special[tree][i] == 3) break;
3270 }
3271 gtk_tree_model_get (mod, iter, i, & j, -1);
3272 }
3273 gtk_cell_renderer_set_visible (renderer, j);
3274 }
3275}
3276
3288void field_set_color_and_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3289{
3290 field_set_color (col, renderer, mod, iter, data);
3291 field_set_markup (col, renderer, mod, iter, data);
3292}
3293
3305void field_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3306{
3307 field_set_color (col, renderer, mod, iter, data);
3308 field_set_visible (col, renderer, mod, iter, data);
3309}
3310
3322void prop_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3323{
3324 int i;
3325 gtk_tree_model_get (mod, iter, 0, & i, -1);
3326 gtk_cell_renderer_set_visible (renderer, i);
3327 field_set_color (col, renderer, mod, iter, data);
3328}
3329
3341void pmf_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3342{
3343 field_set_color (col, renderer, mod, iter, GINT_TO_POINTER(4));
3344 int i, j, k;
3345 i = GPOINTER_TO_INT(data);
3346 if (i == 3)
3347 {
3348 gtk_tree_model_get (mod, iter, i, & j, -1);
3349 k = (! j || j < 0) ? 0 : 1;
3350 }
3351 else
3352 {
3353 gtk_tree_model_get (mod, iter, 4, & k, -1);
3354 }
3355 gtk_cell_renderer_set_visible (renderer, k);
3356}
3357
3369void rig_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3370{
3371 field_set_color (col, renderer, mod, iter, data);
3372 int i;
3373 gtk_tree_model_get (mod, iter, 0, & i, -1);
3374 if (i < 0) i = 0;
3375 gtk_cell_renderer_set_visible (renderer, ! i);
3376}
3377
3389void field_set_color_markup_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3390{
3391 field_set_color (col, renderer, mod, iter, data);
3392 field_set_markup (col, renderer, mod, iter, data);
3393 field_set_visible (col, renderer, mod, iter, data);
3394}
3395
3407void field_set_color_markup_and_visible_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3408{
3409 field_set_color (col, renderer, mod, iter, data);
3410 field_set_markup_box (col, renderer, mod, iter, data);
3411 field_set_visible (col, renderer, mod, iter, data);
3412}
3413
3424G_MODULE_EXPORT void edit_field_cell (GtkCellRendererText * cell, gchar * path_string, gchar * new_text, gpointer data)
3425{
3426 int i, j, k, l;
3427 i = GPOINTER_TO_INT(data);
3428 if (i < 2)
3429 {
3430 j = 1;
3431 }
3432 else if (i < 6)
3433 {
3434 j = 2;
3435 }
3436 else if (i == 6)
3437 {
3438 j = 3;
3439 }
3440 else if (i < 9)
3441 {
3442 j = 4;
3443 }
3444 GtkTreeIter iter;
3445 GtkTreePath * path = gtk_tree_path_new_from_string (path_string);
3446 gtk_tree_model_get_iter (GTK_TREE_MODEL(field_model[j]), & iter, path);
3447 gtk_tree_model_get (GTK_TREE_MODEL(field_model[j]), & iter, 0, & k, -1);
3448 l = combo_get_active (combo_mol[j-1]);
3449 float val = string_to_double ((gpointer)new_text);
3450 k --;
3451 if (i == 0) get_active_atom (l, k) -> mass = val;
3452 if (i == 1) get_active_atom (l, k) -> charge = val;
3453 if (i == 2) get_active_shell (l, k) -> m = val;
3454 if (i == 3) get_active_shell (l, k) -> z = val;
3455 if (i == 4) get_active_shell (l, k) -> k2 = val;
3456 if (i == 5) get_active_shell (l, k) -> k4 = val;
3457 if (i == 6) get_active_constraint (l, k) -> length = val;
3458 if (i == 7) get_active_pmf (l, k) -> length = val;
3459 if (i == 8)
3460 {
3461 int n, m;
3462 gtk_tree_model_get (GTK_TREE_MODEL(field_model[j]), & iter, 3, & n, 4, & m, -1);
3463 if (n < 0 && m > 0)
3464 {
3465 get_active_pmf (l, k) -> weight[-n-1][m-1] = val;
3466 }
3467 }
3468 if (j < MOLIMIT) changed_mol_box (GTK_COMBO_BOX(combo_mol[j-1]), GINT_TO_POINTER(j));
3469}
3470
3479void get_field_iter_and_edit (gchar * path_string, gpointer data)
3480{
3481 int i = GPOINTER_TO_INT(data);
3482 gtk_tree_model_get_iter (GTK_TREE_MODEL(field_model[i]),
3483 & field_iter,
3484 gtk_tree_path_new_from_string (path_string));
3485 if (i == 4 || i == 5 || (i > 6 && i < MOLIMIT))
3486 {
3487 GValue vbl = {0, };
3488 if (i < 6)
3489 {
3490 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), & field_iter, 0, & vbl);
3491 }
3492 else
3493 {
3494 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), & field_iter, field_v[i]+1, & vbl);
3495 }
3496 row_id = (int) g_value_get_int (& vbl);
3497 if (i < 6) row_id = abs(row_id) - 1;
3498 }
3499 edit_field_prop (g_simple_action_new ("Dummy", NULL), NULL, data);
3500}
3501
3512G_MODULE_EXPORT void to_edit_field_prop (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3513{
3514 destroy_this_widget (GTK_WIDGET(editable));
3515 get_field_iter_and_edit (path_string, data);
3516}
3517
3528G_MODULE_EXPORT void on_field_row_activated (GtkTreeView * treeview, GtkTreePath * path, GtkTreeViewColumn * col, gpointer data)
3529{
3530 get_field_iter_and_edit (gtk_tree_path_to_string (path), data);
3531}
3532
3540GtkWidget * create_field_tree (int f)
3541{
3542 int i, j, k, l, m;
3543 gchar * str;
3544 GtkListStore * list_store_combo;
3545 GtkTreeIter iter;
3546 gboolean combox = FALSE;
3547
3548 l = (f > 5) ? 1 : 0;
3549 m = 0;
3550 field_model[f] = gtk_tree_store_newv (field_v[f]+l+field_a[f], col_type[f]);
3551 field_tree[f] = gtk_tree_view_new_with_model(GTK_TREE_MODEL(field_model[f]));
3552 for (i=0; i<field_v[f]+l; i++)
3553 {
3554 if (is_special[f][i] == 1)
3555 {
3556 k = f-5;
3557 field_renderer[f][i] = gtk_cell_renderer_combo_new ();
3558 list_store_combo = gtk_list_store_new (1, G_TYPE_STRING);
3559 for (j=0; j<fetypes[activef][k]; j++)
3560 {
3561 str = g_strdup_printf ("%s (%s)", fnames[activef][k][j], exact_name(fkeysw[activef][k][j]));
3562 gtk_list_store_append (list_store_combo, & iter);
3563 gtk_list_store_set (list_store_combo, & iter, 0, str, -1);
3564 g_free (str);
3565 }
3566 g_object_set (field_renderer[f][i], "model", list_store_combo,
3567 "text-column", 0,
3568 "has-entry", FALSE,
3569 "editable", TRUE, NULL);
3570 g_signal_connect (G_OBJECT(field_renderer[f][i]), "changed", G_CALLBACK(changed_field_key_renderer), GINT_TO_POINTER(f));
3571 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i], field_renderer[f][i], "text", i, NULL);
3572 g_object_unref (list_store_combo);
3573 combox = TRUE;
3574 }
3575 else if (combox)
3576 {
3577 field_renderer[f][i] = gtk_cell_renderer_text_new ();
3578 field_col[f][i] = gtk_tree_view_column_new_with_attributes ("Parameter(s)", field_renderer[f][i], "text", i, NULL);
3579 m = 1;
3580 combox = FALSE;
3581 }
3582 else if (is_special[f][i] > 1 && is_special[f][i] < 4)
3583 {
3584 field_renderer[f][i] = gtk_cell_renderer_toggle_new ();
3585 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i-m], field_renderer[f][i], "active", i, NULL);
3586 g_signal_connect (G_OBJECT(field_renderer[f][i]), "toggled",
3588 & tmp_view -> colorp[f][is_special[f][i]-2]);
3589 if ((f == 4 && i == field_v[f]+l-1) || f == SEXTERN) gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE(field_renderer[f][i]), TRUE);
3590 gtk_tree_view_column_set_clickable (field_col[f][i], TRUE);
3591 if (f != SEXTERN)
3592 {
3593 g_signal_connect (G_OBJECT(field_col[f][i]), "clicked", G_CALLBACK(visualize_or_select_all_elements), & tmp_view -> colorp[f][is_special[f][i]-2]);
3594 }
3595 }
3596 else
3597 {
3598 field_renderer[f][i] = gtk_cell_renderer_text_new();
3599 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i-m], field_renderer[f][i], "text", i, NULL);
3600 }
3601
3602 if (is_special[f][i] == 4)
3603 {
3604 g_object_set (field_renderer[f][i], "editable", TRUE, NULL);
3605 if (f < 3)
3606 {
3607 j = 2*(f-1) + i - 3;
3608 }
3609 else if (f == 3)
3610 {
3611 j = 6;
3612 }
3613 else if (f == 4)
3614 {
3615 j = (i == 1) ? 7 : 8;
3616 }
3617 g_signal_connect (G_OBJECT(field_renderer[f][i]), "edited", G_CALLBACK(edit_field_cell), GINT_TO_POINTER(j));
3618 }
3619 if ((f == 0 && i == 3) || (f == 2 && (i == 1 || i == 2)) || (f == 3 && (i == 1 || i == 2)))
3620 {
3621 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color_and_markup, GINT_TO_POINTER(f), NULL);
3622 }
3623 else if (f == 4 || f == 5)
3624 {
3625 if ((f == 4 && i < 3) || (f == 5 && i < 2))
3626 {
3627 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color_and_visible, GINT_TO_POINTER(f), NULL);
3628 }
3629 else if (f == 4 && (i == 3 || i == 4 || i == 5))
3630 {
3631 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], pmf_set_color_and_visible, GINT_TO_POINTER(i), NULL);
3632 }
3633 else if (f == 5 && i == 2)
3634 {
3635 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], rig_set_color_and_visible, GINT_TO_POINTER(f), NULL);
3636 }
3637 else
3638 {
3639 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_visible, GINT_TO_POINTER(f), NULL);
3640 }
3641 }
3642 else if (f > 6 && f < MOLIMIT && (i == 0 || i == struct_id(f)+1))
3643 {
3644 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], prop_set_color_and_visible, GINT_TO_POINTER(f), NULL);
3645 }
3646 else if (l == 1 && i > field_v[f]-2)
3647 {
3648 if (i == field_v[f]-1)
3649 {
3650 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color_markup_and_visible_box, GINT_TO_POINTER(f), NULL);
3651 }
3652 else if (i == field_v[f])
3653 {
3654 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color_markup_and_visible, GINT_TO_POINTER(f), NULL);
3655 g_object_set (field_renderer[f][i], "editable", TRUE, NULL);
3656 g_signal_connect (G_OBJECT(field_renderer[f][i]), "editing-started", G_CALLBACK(to_edit_field_prop), GINT_TO_POINTER(f));
3657 }
3658 }
3659 else if (is_special[f][i] < 2 || is_special[f][i] > 3)
3660 {
3661 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color, GINT_TO_POINTER(f), NULL);
3662 }
3663 gtk_tree_view_column_set_alignment (field_col[f][i], 0.5);
3664 gtk_tree_view_append_column(GTK_TREE_VIEW(field_tree[f]), field_col[f][i]);
3665 }
3666
3667 fill_field_model (field_model[f], f, 0);
3668 g_object_unref (field_model[f]);
3669 GtkTreeSelection * fieldselect = gtk_tree_view_get_selection (GTK_TREE_VIEW(field_tree[f]));
3670 gtk_tree_selection_set_mode (fieldselect, GTK_SELECTION_SINGLE);
3671#ifdef GTK4
3672 add_widget_gesture_and_key_action (field_tree[f], "field-button-pressed", G_CALLBACK(on_field_button_pressed), GINT_TO_POINTER(f),
3673 "field-button-released", G_CALLBACK(on_field_button_released), GINT_TO_POINTER(f),
3674 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
3675#else
3676 g_signal_connect (G_OBJECT(field_tree[f]), "button_press_event", G_CALLBACK(on_field_button_event), GINT_TO_POINTER(f));
3677 g_signal_connect (G_OBJECT(field_tree[f]), "popup-menu", G_CALLBACK(on_pop_up_field), GINT_TO_POINTER(f));
3678 g_signal_connect (G_OBJECT(field_tree[f]), "row-activated", G_CALLBACK(on_field_row_activated), GINT_TO_POINTER(f));
3679#endif
3680 return field_tree[f];
3681}
3682
3691void create_field_list (GtkWidget * vbx, int f)
3692{
3693 int i;
3694 field_tree[f] = NULL;
3695 field_model[f] = NULL;
3696 for (i=0; i<11; i++)
3697 {
3698 field_renderer[f][i] = NULL;
3699 field_col[f][i] = NULL;
3700 }
3701 GtkWidget * scrollsets = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
3702 if (f == 0)
3703 {
3704 gtk_widget_set_size_request (scrollsets, field_s[f], 175);
3705 }
3706 else if (f < MOLIMIT)
3707 {
3708 if (f == 1)
3709 {
3710 gtk_widget_set_size_request (scrollsets, field_s[f], 320);
3711 }
3712 else if (f == 8 || f == 10 || f == 12 || f == 13)
3713 {
3714 gtk_widget_set_size_request (scrollsets, field_s[f], 180);
3715 }
3716 else
3717 {
3718 gtk_widget_set_size_request (scrollsets, field_s[f], 220);
3719 }
3720 }
3721 else
3722 {
3723 gtk_widget_set_size_request (scrollsets, field_s[f], 300);
3724 }
3726 GtkWidget * hbox = create_hbox (0);
3727 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, scrollsets, FALSE, FALSE, (800-field_s[f])/2);
3728 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, hbox, FALSE, FALSE, 20);
3729}
3730
3738GtkWidget * create_mol_box (int f)
3739{
3740 GtkWidget * hbox;
3741 hbox = create_hbox (0);
3742 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label("Please select molecule: ", -1, -1, 0.0, 0.5), FALSE, FALSE, 100);
3743 combo_mol[f] = create_combo_mol (f);
3744 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, combo_mol[f], FALSE, FALSE, 10);
3745 return hbox;
3746}
3747
3755GtkWidget * vbox_field (int f)
3756{
3757 gchar * str;
3758 GtkWidget * vbx;
3759 GtkWidget * hbx;
3760 GtkWidget * vbox;
3761 GtkWidget * hbox;
3762 vbox = create_vbox (5);
3763 if (f > 6 && f < MOLIMIT)
3764 {
3765 hbx = create_hbox (0);
3766 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbx, FALSE, FALSE, 0);
3767 vbx = create_vbox (BSEP);
3768 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, vbx, FALSE, FALSE, 0);
3769 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, gtk_image_new_from_file(ifield[f-7]), FALSE, FALSE, 50);
3770 }
3771 if (f == 0)
3772 {
3773 hbox = fbox (vbox, "Number of isolated molecular fragments: ");
3774 str = g_strdup_printf ("<b>%d</b>", tmp_coord -> totcoord[2]);
3775 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 75);
3776 g_free (str);
3777 str = g_strdup_printf ("\tEach of these fragments can be described separately in the force field.");
3778 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 5);
3779 g_free (str);
3780 hbox = fbox (vbox, "Number of distinct molecules: ");
3781 str = g_strdup_printf ("<b>%d</b>", tmp_coord -> totcoord[3]);
3782 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 75);
3783 g_free (str);
3784 hbox = fbox (vbox, "Number of molecules in the force field: ");
3786 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, mol_num_label, FALSE, FALSE, 75);
3787 }
3788 else if (f < MOLIMIT)
3789 {
3790 // if f > 0, ie. atoms tab at least
3791 // need a combobox to pick the 'active' molecule and its corresponding force field
3792 // If using molecules the combo box is active, and visible
3793 // Otherwise deactivate and hide the combo box
3794 // Anyway fill the treestore according to the selection
3795
3796 mol_box[f-1] = create_mol_box (f-1);
3797 if (f > 6 && f < MOLIMIT)
3798 {
3799 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, mol_box[f-1], FALSE, FALSE, 0);
3800 }
3801 else
3802 {
3803 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, mol_box[f-1], FALSE, FALSE, 0);
3804 }
3806 }
3807
3808 if (f > 6 && f < MOLIMIT)
3809 {
3810 hbox = fbox (vbx, g_strdup_printf ("%s(s) properties: ", felemts[f+1]));
3811 }
3812 else
3813 {
3814 hbox = fbox (vbox, g_strdup_printf ("%s(s) properties: ", felemts[f+1]));
3815 }
3816 if (f > 0)
3817 {
3818 field_label[f] = markup_label(set_field_label(f, 0), 120, 40, 0.35, 0.5);
3819 hbox = create_hbox (0);
3820 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, field_label[f], TRUE, TRUE, 0);
3821 if (f > 6 && f < MOLIMIT)
3822 {
3823 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, hbox, FALSE, FALSE, 10);
3824 }
3825 else
3826 {
3827 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
3828 }
3829 }
3831 if (f > 6 && f < MOLIMIT)
3832 {
3833 if (f == 8 || f == 10 || f == 12 || f == 13)
3834 {
3835 int g = (f < 12) ? f - 1 : 11;
3836 str = g_strdup_printf ("\t <b>*</b> in the FIELD file %s(s) appear in the %s section.\n"
3837 "\t They are presented separately in this assistant for clarity purposes only.",
3838 elemts[f], elemts[g]);
3839 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3840 g_free (str);
3841 }
3842 else if (f == 14)
3843 {
3844 str = g_strdup_printf ("\t <b>*</b> the potential will be calculated by the sum of the 3 possible inversion terms between atoms 1 (center), 2, 3 and 4.");
3845 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3846 g_free (str);
3847 }
3848 str = g_strdup_printf ("\t <b>(1)</b> average value for the force field element as measured in the model.");
3849 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3850 g_free (str);
3851 str = g_strdup_printf ("\t <b>(2)</b> only the selected element(s) will be used to create the force field.");
3852 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3853 g_free (str);
3854 str = g_strdup_printf ("\t <b>(3)</b> each force field element can be tuned separately, if not the <b>Default</b> parameters will be used.");
3855 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3856 g_free (str);
3857
3858 }
3859 else if (f == 2)
3860 {
3861 cs_label[0] = markup_label(" ", -1, -1, 0.0, 0.5);
3862 cs_label[1] = markup_label(" ", -1, -1, 0.0, 0.5);
3863 setup_cs_labels (tmp_field -> energy_unit);
3864 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, cs_label[0], FALSE, FALSE, 0);
3865 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, cs_label[1], FALSE, FALSE, 0);
3866 str = g_strdup_printf ("\t <b>(3)</b> only the selected element(s) will be used to create the force field.");
3867 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3868 g_free (str);
3869 }
3870 else if (f == 3)
3871 {
3872 str = g_strdup_printf ("\t <b>(1)</b> average value for the force field element as measured in the model.");
3873 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3874 g_free (str);
3875 str = g_strdup_printf ("\t <b>(2)</b> only the selected element(s) will be used to create the force field.");
3876 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3877 g_free (str);
3878 }
3879 else if (f == 4)
3880 {
3881 str = g_strdup_printf ("\t <b>(1)</b> average distance between the barycenters of units 1 and 2 as measured in the model.");
3882 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3883 g_free (str);
3884 str = g_strdup_printf ("\t <b>(2)</b> if all 0.0 then atomic weight(s) will be used by DL-POLY.");
3885 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3886 g_free (str);
3887 str = g_strdup_printf ("\t <b>(3)</b> only the selected element(s) will be used to create the force field.");
3888 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3889 g_free (str);
3890 }
3891 else if ((f > 2 && f < 7) || f > 11)
3892 {
3893 str = g_strdup_printf ("\t <b>(1)</b> only the selected element(s) will be used to create the force field.");
3894 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3895 g_free (str);
3896 }
3897 return vbox;
3898}
3899
3900GtkWidget * field_i_prep[2];
3901GtkWidget * field_i_box[2];
3902GtkWidget * field_i_lab[2];
3903GtkWidget * field_i_fixed[2];
3904GtkWidget * field_i_combo[2];
3905GtkWidget * field_i_obj[2];
3906GtkWidget * preview_but;
3910
3918void close_the_assistant (GtkAssistant * assistant)
3919{
3921 int j;
3922#ifdef GTK3
3923 // GTK3 Menu Action To Check
3924 gboolean i = (tmp_proj -> force_field[activef]) ? TRUE : FALSE;
3925 widget_set_sensitive (tmp_view -> color_styles[5], i);
3926 widget_set_sensitive (tmp_view -> color_styles[5+ATOM_MAPS], i);
3927#endif
3928 field_color = FALSE;
3929 for (j=0; j<2; j++)
3930 {
3931 tmp_view -> anim -> last -> img -> acl_format[j] = saved_label_format[j];
3932 tmp_view -> anim -> last -> img -> labels[j].position = saved_label_position[j];
3933 }
3935/*
3936 tmp_fmol = tmp_field -> first_molecule;
3937 for (j=0; j<tmp_field -> molecules; j++)
3938 {
3939 g_debug ("FIELD_CANCEL:: Mol= %d, show= %d, show_id= %d", j, tmp_fmol -> show, tmp_fmol -> show_id);
3940 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
3941 }
3942*/
3943 // restore selection if any from calc.c
3945 mol_num_label = NULL;
3946 tmp_field = NULL;
3947 tmp_view = NULL;
3948 if (! assist_init)
3949 {
3950 if (tmp_proj -> force_field[activef])
3951 {
3952 g_free (tmp_proj -> force_field[activef]);
3953 tmp_proj -> force_field[activef] = NULL;
3954 }
3955 }
3956}
3957
3966G_MODULE_EXPORT void on_assistant_cancel (GtkAssistant * assistant, gpointer data)
3967{
3968 close_the_assistant (assistant);
3969}
3970
3971#ifdef GTK4
3980G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWindow * assistant, gpointer data)
3981#else
3991G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWidget * assistant, GdkEvent * event, gpointer data)
3992#endif
3993{
3994 on_assistant_cancel (((GtkAssistant *)assistant), data);
3995 return TRUE;
3996}
3997
4006G_MODULE_EXPORT void on_assistant_close (GtkAssistant * assistant, gpointer data)
4007{
4008 close_the_assistant (assistant);
4009}
4010
4019G_MODULE_EXPORT gint on_assistant_go_forward (gint current_page, gpointer data)
4020{
4021 int i, j;
4022 j = -1;
4023 switch (current_page)
4024 {
4025 case 0:
4026 j = 1;
4027 if (! tmp_field -> prepare_file[0])
4028 {
4029 j = MAXDATC+1;
4030 if (! tmp_field -> prepare_file[1]) j += MAXDATA+2;
4031 }
4032 return j;
4033 break;
4034 case MAXDATC+MAXDATA+2:
4035 return -1;
4036 break;
4037 default:
4038 if (current_page > MAXDATC-1 && tmp_field -> prepare_file[1])
4039 {
4040 for (i=current_page-1; i<MAXDATC+MAXDATA; i++)
4041 {
4042 if (tmp_field -> afp[i])
4043 {
4044 j = i+2;
4045 break;
4046 }
4047 }
4048 }
4049 else if (tmp_field -> prepare_file[0])
4050 {
4051 for (i=current_page; i<MAXDATC; i++)
4052 {
4053 if (tmp_field -> afp[i])
4054 {
4055 j = i+1;
4056 break;
4057 }
4058 }
4059 }
4060 if (j == -1) j = MAXDATC+MAXDATA+2;
4061 return j;
4062 break;
4063 }
4064}
4065
4075G_MODULE_EXPORT void on_assistant_prepare (GtkAssistant * assistant, GtkWidget * page, gpointer data)
4076{
4077 int i, j, k;
4078 i = gtk_assistant_get_current_page (assistant);
4080 switch (i)
4081 {
4082 case 0:
4083 // if (is_the_widget_visible(preview_but)) hide_the_widgets (preview_but);
4084 break;
4085 case 1:
4086 // if (! is_the_widget_visible(preview_but)) show_the_widgets (preview_but);
4087 break;
4088 case MAXDATC+MAXDATA+2:
4089 break;
4090 default:
4091 j = field_object = i-2-MAXDATC;
4092 toviz.c = 1;
4093 switch (j)
4094 {
4095 case 0:
4096 tmp_fmol = tmp_field -> first_molecule;
4097 for (k=0; k<tmp_field -> molecules; k++)
4098 {
4099 if (tmp_fmol -> show) visualize_object (j, k, -1);
4100 if (tmp_fmol -> show_id) visualize_object (-1, k, -1);
4101 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
4102 }
4103 break;
4104 default:
4105 if (j > -1 && j < SEXTERN) check_to_visualize_properties (j);
4106 break;
4107 }
4108 break;
4109 }
4111}
4112
4123void hide_show_this_pages (int start, int end, int status, int delta)
4124{
4125 int i;
4126 for (i=start; i<end; i++)
4127 {
4128 if (fibox[i+delta] != NULL)
4129 {
4130 if (GTK_IS_WIDGET(fibox[i+delta]))
4131 {
4132 gtk_widget_set_visible (fibox[i+delta], (status) ? tmp_field -> afp[i] : status);
4133 }
4134 }
4135 }
4136}
4137
4144{
4145 int i;
4146 GtkAssistant * assist = GTK_ASSISTANT(field_assistant);
4148 for (i=MAXDATC+MAXDATA+1; i>-1; i--)
4149 {
4150 gtk_assistant_remove_page (assist, i+1);
4152 }
4153}
4154
4164G_MODULE_EXPORT void run_clean_field (GtkDialog * dial, gint response_id, gpointer data)
4165{
4166 if (response_id == GTK_RESPONSE_APPLY)
4167 {
4168 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant),
4169 gtk_assistant_get_nth_page(GTK_ASSISTANT (field_assistant), 0), FALSE);
4170 gtk_label_set_text (GTK_LABEL(field_i_lab[1]), "Initialize force field using: ");
4171 int i;
4172 for (i=0; i<2; i++)
4173 {
4175 //tmp_field -> prepare_file[i] = TRUE;
4182 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_obj[i], TRUE, TRUE, 25);
4183 }
4184 for (i=0; i<MAXDATC+MAXDATA+2; i++)
4185 {
4186 if (fibox[i] != NULL)
4187 {
4188 if (GTK_IS_WIDGET(fibox[i]))
4189 {
4190 gtk_widget_set_visible (fibox[i], FALSE);
4191 }
4192 }
4193 }
4195 for (i=0; i<19; i++)
4196 {
4198 }
4200 button_set_status (data, FALSE);
4201 assist_init = FALSE;
4202 }
4203 destroy_this_dialog (dial);
4204}
4205
4206#ifdef GTK4
4215G_MODULE_EXPORT void clean_field (GtkCheckButton * but, gpointer data)
4216#else
4225G_MODULE_EXPORT void clean_field (GtkToggleButton * but, gpointer data)
4226#endif
4227{
4228 if (button_get_status ((GtkWidget *)but))
4229 {
4230 GtkWidget * dial = dialog_cancel_apply ("Clean all force field parameter(s) ?", field_assistant, FALSE);
4231 GtkWidget * box = dialog_get_content_area (dial);
4232 gtk_box_set_homogeneous (GTK_BOX(box), FALSE);
4233 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, gtk_label_new ("Providing that the force field information was already saved once\n"
4234 "the previous data could still be retrieved by canceling the assistant."), FALSE, FALSE, 0);
4235 run_this_gtk_dialog (dial, G_CALLBACK(run_clean_field), but);
4236 }
4237}
4238
4239#ifdef GTK4
4248G_MODULE_EXPORT void select_field_action (GtkCheckButton * but, gpointer data)
4249#else
4258G_MODULE_EXPORT void select_field_action (GtkToggleButton * but, gpointer data)
4259#endif
4260{
4261 int i, j;
4262 i = GPOINTER_TO_INT(data);
4263 tmp_field -> prepare_file[i] = button_get_status ((GtkWidget *)but);
4264 if (i == 1)
4265 {
4266 for (j=0; j<2; j++)
4267 {
4268 widget_set_sensitive (field_i_lab[j], (tmp_field -> prepare_file[i] && ! assist_init) ? TRUE : FALSE);
4269 widget_set_sensitive (field_i_combo[j], (tmp_field -> prepare_file[i] && ! assist_init) ? TRUE : FALSE);
4270 }
4271 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4272 }
4273 else
4274 {
4275 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4276 }
4277}
4278
4287{
4288 int i;
4289 gchar * info;
4290 GtkAssistant * assist = GTK_ASSISTANT(field_assistant);
4291 // Control file
4292 for (i=0; i<MAXDATC; i++)
4293 {
4294 fibox[i] = vbox_control (i);
4295 gtk_assistant_append_page (assist, fibox[i]);
4296 gtk_assistant_set_page_title (assist, fibox[i], g_strdup_printf ("%s", celemts[i]));
4297 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4298 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4299 }
4300
4301 // Field file
4302 i = MAXDATC;
4303 fibox[i] = vbox_init (p);
4304 gtk_assistant_append_page (assist, fibox[i]);
4305 gtk_assistant_set_page_title (assist, fibox[i], "Select the component(s) of the force field");
4306 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4307 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4308 for (i=MAXDATC+1; i<MAXDATC+MAXDATA+1; i++)
4309 {
4310 fibox[i] = vbox_field (i-MAXDATC-1);
4311 gtk_assistant_append_page (assist, fibox[i]);
4312 gtk_assistant_set_page_title (assist, fibox[i], g_strdup_printf ("%s(s)", felemts[i-MAXDATC]));
4313 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4314 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4315 }
4316 i = MAXDATC+MAXDATA+1;
4317 fibox[i] = create_vbox (BSEP);
4318
4319 info = g_strdup_printf ("<b> Finalize the creation of the %s input file(s) now !</b>", (activef) ? "LAMMPS" : "DL-POLY");
4320 add_box_child_start (GTK_ORIENTATION_VERTICAL, fibox[i], markup_label(info, -1, -1, 0.5, 0.5), TRUE, TRUE, 100);
4321 g_free (info);
4322 add_box_child_start (GTK_ORIENTATION_VERTICAL, fibox[i], markup_label("\n \t<b>Note: </b>You can re-open this assistant later if required to adjust your choices\n", -1, -1, 0.0, 0.5),
4323 FALSE, FALSE, 0);
4324 gtk_assistant_append_page (assist, fibox[i]);
4325 gtk_assistant_set_page_title (assist, fibox[i], (activef) ? "Create the LAMMPS input file(s) now !" : "Create the DL-POLY input file(s) now !");
4326 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONFIRM);
4327 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4328 gtk_assistant_update_buttons_state (assist);
4329 append_pages = TRUE;
4330}
4331
4332gchar * field_init[3]={"Atomic species as field atom(s)",
4333 "Atomic species and total coordination(s) as field atom(s)",
4334 "Atomic species and partial coordination(s) as field atom(s)"};
4335
4336// gboolean create_ff_structure (gpointer data)
4345void create_ff_structure (int ai, int type)
4346{
4347 int i;
4348 //if (append_pages) remove_classical_assistant_pages ();
4349 tmp_proj -> force_field[activef] = create_force_field_data_structure (ai);
4350 tmp_proj -> force_field[activef] -> type = type;
4351 tmp_field = tmp_proj -> force_field[activef];
4352 for (i=0; i<MAXDATC+MAXDATA; i++) tmp_field -> afp[i] = afp_init[i];
4353 for (i=0; i<2; i++)
4354 {
4356 if (activef && ! i)
4357 {
4359 tmp_field -> prepare_file[i] = FALSE;
4360 }
4361 else
4362 {
4363 tmp_field -> prepare_file[i] = button_get_status (field_i_prep[i]);
4364 }
4366 }
4367 // for (i=13; i<19; i++) widget_set_sensitive (ff_but[i], set_nbd_but_sensitive (i));
4373 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[1], field_i_obj[1], TRUE, TRUE, 25);
4374 gtk_label_set_text (GTK_LABEL(field_i_lab[1]), "Force field was initialized using: ");
4375 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant),
4376 gtk_assistant_get_nth_page(GTK_ASSISTANT (field_assistant), 0), TRUE);
4378 if (tmp_field -> md_opts[1] == 0.0) hide_the_widgets (extra_vbox[1]);
4379 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4380 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4381 // return FALSE;
4382}
4383
4392G_MODULE_EXPORT void changed_init_box (GtkComboBox * box, gpointer data)
4393{
4394 int i, j;
4395 i = GPOINTER_TO_INT(data);
4396 j = combo_get_active ((GtkWidget *)box);
4397 if (j > -1)
4398 {
4399 switch (i)
4400 {
4401 case 0:
4402 tmp_field -> type = j;
4404 if (tmp_field -> type == j)
4405 {
4408 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[0], field_i_obj[0], TRUE, TRUE, 25);
4410 }
4411 else
4412 {
4413 combo_set_active ((GtkWidget *)box, -1);
4414 }
4415 break;
4416 case 1:
4417 if (tmp_field -> type > -1)
4418 {
4422 field_i_obj[1] = gtk_spinner_new ();
4424 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[1], field_i_obj[1], TRUE, TRUE, 25);
4426 gtk_spinner_start (GTK_SPINNER(field_i_obj[1]));
4427 // gdk_threads_add_idle (create_ff_structure, GINT_TO_POINTER(j));
4428 create_ff_structure (j, tmp_field -> type);
4429 assist_init = TRUE;
4430 }
4431 else
4432 {
4433 show_warning ("Please select the force field first !", field_assistant);
4434 }
4435 break;
4436 }
4437 }
4438}
4439
4448G_MODULE_EXPORT void show_force_field_preview (GtkButton * but, gpointer data)
4449{
4450 GtkWidget * preview = (activef) ? dialogmodal ("LAMMPS files preview", GTK_WINDOW(field_assistant)) : dialogmodal ("DL-POLY files preview", GTK_WINDOW(field_assistant));
4451 GtkWidget * notebook = gtk_notebook_new ();
4452 GtkWidget * scrollsets;
4453 GtkWidget * aview;
4454 gchar * ff_files[2][3] = {{"CONTROL", "FIELD" , "CONFIG"}, {"LAMMPS.IN", "LAMMPS.DATA", ""}};
4455 int num_files[2] = {3, 2};
4456 int i;
4457 for (i=0; i<num_files[activef]; i++)
4458 {
4459 if ((i==0 && tmp_field -> prepare_file[0]) || (i > 0 && tmp_field -> prepare_file[1]))
4460 {
4461 scrollsets = create_scroll (NULL, 700, 350, GTK_SHADOW_ETCHED_IN);
4462 aview = create_text_view (-1, -1, 0, 1, NULL, NULL, NULL);
4464 if (! activef)
4465 {
4466 switch (i)
4467 {
4468 case 0:
4469 print_dlp_control (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4470 break;
4471 case 1:
4472 print_dlp_field (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4473 break;
4474 case 2:
4475 print_dlp_config (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4476 break;
4477 }
4478 }
4479 else
4480 {
4481 switch (i)
4482 {
4483 case 0:
4484
4485 break;
4486 case 1:
4487 print_lammps_atom_file (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4488 break;
4489 }
4490 }
4491 gtk_notebook_append_page (GTK_NOTEBOOK(notebook), scrollsets, gtk_label_new (ff_files[activef][i]));
4492 }
4493 }
4494 add_box_child_start (GTK_ORIENTATION_VERTICAL, dialog_get_content_area (preview), notebook, FALSE, FALSE, 0);
4495 if (gtk_assistant_get_current_page (GTK_ASSISTANT (field_assistant)) > MAXDATC && tmp_field -> prepare_file[0]) gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
4496 run_this_gtk_dialog (preview, G_CALLBACK(run_destroy_dialog), NULL);
4497}
4498
4499#ifdef GTK4
4509G_MODULE_EXPORT void run_on_assistant_apply (GtkNativeDialog * info, gint response_id, gpointer data)
4510{
4511 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
4512#else
4522G_MODULE_EXPORT void run_on_assistant_apply (GtkDialog * info, gint response_id, gpointer data)
4523{
4524 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
4525#endif
4526 int i;
4527 GtkTextBuffer * buffer;
4528 GtkTextIter bStart;
4529 GtkTextIter bEnd;
4530 GError * err = NULL;
4531 gboolean result = FALSE;
4532 gchar * ff_files[2][3] = {{"CONTROL", "FIELD" , "CONFIG"}, {"LAMMPS.IN", "LAMMPS.DATA", ""}};
4533 int num_files[2] = {3, 2};
4534 if (response_id == GTK_RESPONSE_ACCEPT)
4535 {
4536 gchar * direname = file_chooser_get_current_folder (chooser);
4537 if (direname != NULL)
4538 {
4539 gchar * filename;
4540 gchar * str;
4541 gboolean doit[3];
4542 for (i=0; i<num_files[activef]; i++)
4543 {
4544 if ((i==0 && tmp_field -> prepare_file[0]) || (i > 0 && tmp_field -> prepare_file[1]))
4545 {
4546 filename = g_strdup_printf ("%s/%s", direname, ff_files[activef][i]);
4547 if (g_file_test(filename, G_FILE_TEST_EXISTS))
4548 {
4549 str = g_strdup_printf ("%s file found in '%s'\nreplace existing %s file ?", ff_files[activef][i], direname, ff_files[activef][i]);
4550 doit[i] = ask_yes_no ("Replace file ?", str, GTK_MESSAGE_QUESTION, field_assistant);
4551 g_free (str);
4552 }
4553 else
4554 {
4555 doit[i] = TRUE;
4556 }
4557 }
4558 else
4559 {
4560 doit[i] = FALSE;
4561 }
4562 }
4563 for (i=0; i<num_files[activef]; i++)
4564 {
4565 buffer = add_buffer (NULL, NULL, NULL);
4566 if (doit[i])
4567 {
4568 filename = g_strdup_printf ("%s/%s", direname, ff_files[activef][i]);
4569 switch (i)
4570 {
4571 case 0:
4572 print_dlp_control (buffer);
4573 break;
4574 case 1:
4575 print_dlp_field (buffer);
4576 break;
4577 case 2:
4578 print_dlp_config (buffer);
4579 break;
4580 }
4581 gtk_text_buffer_get_start_iter (buffer, & bStart);
4582 gtk_text_buffer_get_end_iter (buffer, & bEnd);
4583 gchar * text = gtk_text_buffer_get_text (buffer, & bStart, & bEnd, FALSE);
4584 gtk_text_buffer_set_modified (buffer, FALSE);
4585 result = g_file_set_contents (filename, text, -1, & err);
4586 g_free (text);
4587 g_object_unref (buffer);
4588 if (! result && err)
4589 {
4590 show_error (g_strdup_printf ("Error while saving input file: %s\n Error: %s", filename, err -> message), 0, field_assistant);
4591 g_error_free (err);
4592 }
4593 g_free (filename);
4594 }
4595 }
4596 g_free (direname);
4597 }
4598 }
4599#ifdef GTK4
4601#else
4602 destroy_this_dialog (info);
4603#endif
4604}
4605
4614void on_assistant_apply (GtkAssistant * assistant, gpointer data)
4615{
4616 gchar * text;
4617#ifdef GTK4
4618 GtkFileChooserNative * info;
4619#else
4620 GtkWidget * info;
4621#endif
4622 gchar * ff_type[2] = {"DL-POLY", "LAMMPS"};
4623
4624 text = g_strdup_printf ("Saving %s input file(s)", ff_type[activef]);
4625 info = create_file_chooser (text,
4626 GTK_WINDOW(assistant),
4627 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
4628 "Save");
4629 g_free (text);
4630#ifdef GTK4
4631 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_on_assistant_apply), NULL);
4632#else
4633 run_this_gtk_dialog (info, G_CALLBACK(run_on_assistant_apply), NULL);
4634 // GTK3 Menu Action To Check
4635 gboolean i = (tmp_proj -> force_field[activef]) ? TRUE : FALSE;
4636 widget_set_sensitive (tmp_view -> color_styles[5], i);
4637 widget_set_sensitive (tmp_view -> color_styles[5+ATOM_MAPS], i);
4638#endif
4639}
4640
4650{
4651 field_assistant = gtk_assistant_new ();
4652 gtk_widget_set_size_request (field_assistant, 800, 600);
4653 int i, j, k;
4654 activef = f;
4655 field_color = TRUE;
4656 field_object = -1;
4657 selected_aspec = -1;
4660 tmp_coord = tmp_proj -> coord;
4661 tmp_view = tmp_proj -> modelgl;
4662 tmp_fmol = NULL;
4663 tmp_fmol = g_malloc0 (sizeof*tmp_fmol);
4664 gchar * field_type[2] = {"DL-POLY 4", "LAMMPS"};
4665
4666 // Preparing data structure and pointers
4667 append_pages = FALSE;
4668 if (tmp_proj -> force_field[activef] == NULL)
4669 {
4670 assist_init = FALSE;
4671 tmp_proj -> force_field[activef] = g_malloc0 (sizeof*tmp_proj -> force_field[activef]);
4672 tmp_proj -> force_field[activef] -> type = -1;
4673 tmp_proj -> force_field[activef] -> atom_init = -1;
4674 for (i=0; i<2; i++) tmp_proj -> force_field[activef] -> prepare_file[i] = TRUE;
4675 if (activef) tmp_proj -> force_field[activef] -> prepare_file[0] = FALSE;
4676 }
4677 else
4678 {
4679 assist_init = TRUE;
4680 if (tmp_proj -> force_field[activef] -> type > -1) setup_this_force_field (tmp_proj -> force_field[activef] -> type);
4681 //tmp_field = duplicate_dlpoly_field (tmp_proj -> force_field[activef]);
4682 }
4683 tmp_field = tmp_proj -> force_field[activef];
4684
4685 gtk_window_set_resizable (GTK_WINDOW (field_assistant), FALSE);
4686 gtk_window_set_modal (GTK_WINDOW (field_assistant), TRUE);
4687 gchar * info = g_strdup_printf ("%s calculation assistant", field_type[f]);
4688 gtk_window_set_title (GTK_WINDOW(field_assistant), info);
4689 g_free (info);
4690
4691 GtkWidget * intro = create_vbox (BSEP);
4692 info = g_strdup_printf ("<b> This assistant will help you to setup a %s \n"
4693 "calculation using <i>%s</i> 3D model as starting point</b>", field_type[f], tmp_proj -> name);
4694 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, markup_label(info, -1, -1, 0.5, 0.5), FALSE, FALSE, 50);
4695 g_free (info);
4696
4697 gchar * i_titles[2][2] = {{"Force field: ", "Force field: "}, {"Initialize force field using: ","Force field was initialized using: "}};
4698 for (i=0; i<2; i++)
4699 {
4700 field_i_box[i] = create_hbox (0);
4701 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, field_i_box[i], FALSE, FALSE, 0);
4702 j = (i == 0) ? tmp_field -> type + 1 : tmp_field -> atom_init + 1;
4703 k = (j) ? 1 : 0;
4704 field_i_lab[i] = markup_label(i_titles[i][k], 210, -1, 0.0, 0.5);
4705 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_lab[i], FALSE, FALSE, 20);
4708 switch (i)
4709 {
4710 case 0:
4711 for (j=0; j<N_FIELDS; j++) combo_text_append (field_i_combo[i], field_acro[j]);
4713 break;
4714 case 1:
4715 for (j=0; j<3; j++) combo_text_append (field_i_combo[i], field_init[j]);
4717 break;
4718 }
4720 g_signal_connect (G_OBJECT (field_i_combo[i]), "changed", G_CALLBACK(changed_init_box), GINT_TO_POINTER(i));
4721 field_i_fixed[i] = gtk_fixed_new ();
4722 gtk_widget_set_size_request (field_i_fixed[i], 410, -1);
4723 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_fixed[i], FALSE, FALSE, 0);
4724 gtk_fixed_put (GTK_FIXED(field_i_fixed[i]), field_i_combo[i], 0, 0);
4726 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_obj[i], FALSE, FALSE, 25);
4727 }
4728
4729 GtkWidget * hbox = create_hbox (0);
4730 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, hbox, FALSE, FALSE, 10);
4731 GtkWidget * but = check_button ("\tDelete the existing force field data and reset the parameters to the default values",
4732 -1, 40, FALSE, G_CALLBACK(clean_field), GINT_TO_POINTER(p));
4733 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, but, FALSE, FALSE, 85);
4734
4735 if (! f)
4736 {
4737 field_i_prep[0] = check_button ("\tPrepare the CONTROL file to describe the calculation",
4738 -1, 40, tmp_field -> prepare_file[0], G_CALLBACK(select_field_action), GINT_TO_POINTER(0));
4739 field_i_prep[1] = check_button ("\tPrepare the FIELD and CONFIG files to describe the force field and the atomistic model",
4740 -1, 40, tmp_field -> prepare_file[1], G_CALLBACK(select_field_action), GINT_TO_POINTER(1));
4741 }
4742 else
4743 {
4744 field_i_prep[0] = check_button ("\tPrepare the LAMMPS Input to describe the calculation",
4745 -1, 40, tmp_field -> prepare_file[0], G_CALLBACK(select_field_action), GINT_TO_POINTER(0));
4746 field_i_prep[1] = check_button ("\tPrepare the LAMMPS Atom file to describe the force field and the atomistic model",
4747 -1, 40, tmp_field -> prepare_file[1], G_CALLBACK(select_field_action), GINT_TO_POINTER(1));
4748 }
4749 for (i=0; i<2; i++)
4750 {
4751 hbox = create_hbox (0);
4752 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, hbox, FALSE, FALSE, 0);
4755 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, field_i_prep[i], FALSE, FALSE, 50);
4756 }
4757 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro,
4758 markup_label("\n \t<b>Note: </b>You can re-open this assistant later if required to adjust your choices\n",
4759 -1, -1, 0.0, 0.5), FALSE, FALSE, 50);
4760
4761 gtk_assistant_append_page (GTK_ASSISTANT (field_assistant), intro);
4762 info = g_strdup_printf ("%s calculation set-up", field_type[f]);
4763 gtk_assistant_set_page_title (GTK_ASSISTANT (field_assistant), intro, info);
4764 g_free (info);
4765 gtk_assistant_set_page_type (GTK_ASSISTANT (field_assistant), intro, GTK_ASSISTANT_PAGE_INTRO);
4766 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant), intro, assist_init);
4767 preview_but = create_button ("Preview", IMG_STOCK, EDITF, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(show_force_field_preview), NULL);
4768 gtk_assistant_add_action_widget (GTK_ASSISTANT (field_assistant), preview_but);
4769
4770 if (assist_init)
4771 {
4774 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4775 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4776 }
4777 else
4778 {
4781 }
4782
4783 gtk_assistant_set_forward_page_func (GTK_ASSISTANT (field_assistant), on_assistant_go_forward, NULL, NULL);
4784 g_signal_connect (G_OBJECT (field_assistant), "prepare", G_CALLBACK(on_assistant_prepare), NULL);
4785 g_signal_connect (G_OBJECT (field_assistant), "cancel", G_CALLBACK(on_assistant_cancel), NULL);
4786 g_signal_connect (G_OBJECT (field_assistant), "close", G_CALLBACK(on_assistant_close), NULL);
4787 g_signal_connect (G_OBJECT (field_assistant), "apply", G_CALLBACK(on_assistant_apply), NULL);
4789
4790 for (i=0; i<2; i++)
4791 {
4792 saved_label_format[i] = tmp_view -> anim -> last -> img -> acl_format[i];
4793 saved_label_position[i] = tmp_view -> anim -> last -> img -> labels[i].position;
4794 tmp_view -> anim -> last -> img -> labels[i].position = 0;
4795 tmp_view -> anim -> last -> img -> acl_format[i] = ID_IN_MOLECULE;
4796 }
4797
4798 //g_debug ("Number of pages in the assitant: %d", gtk_assistant_get_n_pages (GTK_ASSISTANT (field_assistant)));
4799 //g_debug ("Active page is: %d", gtk_assistant_get_current_page (GTK_ASSISTANT (fwin)));
4800}
insertion_menu mol[]
Definition w_library.c:193
Binding to the Fortran90 subroutines.
int selected_aspec
Definition popup.c:179
Variable declarations for the MD input preparation assistants.
Callback declarations for main window.
integer(kind=c_int) function chemistry()
Definition chemistry.F90:22
color colorp[64]
double scale(double axe)
find appropriate major tick spacing based on axis length
Definition curve.c:204
char * sca
Definition curve.c:76
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
Definition labels.c:56
ColRGBA col
Definition d_measures.c:77
int atoms[NUM_STYLES][2]
GtkTreePath * path
Definition datab.c:103
gchar * text
Definition datab.c:105
field_constraint * get_active_constraint(int a, int b)
retrieve constraint property
Definition dlp_active.c:185
field_molecule * get_active_field_molecule(int a)
retrieve field molecule
Definition dlp_active.c:87
field_rigid * get_active_rigid(int a, int b)
retrieve rigid property
Definition dlp_active.c:225
field_prop * get_active_prop_using_atoms(struct field_prop *pr, int ti, int *ids)
retrieve field molecule structural property using atoms
Definition dlp_active.c:286
field_struct * get_active_struct(int s, int a, int b)
retrieve field structural property
Definition dlp_active.c:318
field_shell * get_active_shell(int a, int b)
retrieve shell property
Definition dlp_active.c:165
field_atom * get_active_atom(int a, int b)
retrieve field atom
Definition dlp_active.c:145
field_external * get_active_external(int a)
retrieve external field property
Definition dlp_active.c:125
field_nth_body * get_active_body(int a, int b)
retrieve field nth body interaction
Definition dlp_active.c:106
field_pmf * get_active_pmf(int a, int b)
retrieve PMF property
Definition dlp_active.c:205
field_tethered * get_active_tethered(int a, int b)
retrieve tethered property
Definition dlp_active.c:245
G_MODULE_EXPORT void remove_atom_from_field_molecule(GSimpleAction *action, GVariant *parameter, gpointer data)
remove atom from field molecule - creating the dialog
Definition dlp_atom.c:731
float val
Definition dlp_init.c:117
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
gchar * celemts[MAXDATC]
GtkWidget * vbox_control(int f)
crerate DL-POLY option widgets
G_MODULE_EXPORT void add_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
add field property callback
Definition dlp_edit.c:3046
void adjust_field_prop(int fil, int sti, field_prop *tmp, int *ids, int key)
adjust field property
Definition dlp_edit.c:163
G_MODULE_EXPORT void select_atom_id_from_fied_molecule(GtkButton *but, gpointer data)
select atom id from field molecule - creating the dialog
Definition dlp_edit.c:1163
G_MODULE_EXPORT void edit_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
edit field property callback
Definition dlp_edit.c:2981
G_MODULE_EXPORT void remove_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
remove field property callback
Definition dlp_edit.c:3286
int * atoms_id
model example
Definition dlp_field.c:1038
GtkTreeIter field_iter
Definition dlp_field.c:948
gchar * field_init[3]
Definition dlp_field.c:4332
int feunit_fbd[2][FFOURBODY][FFOURBODY_P]
Definition dlp_field.c:769
GtkWidget * field_i_lab[2]
Definition dlp_field.c:3902
char * fvars_fbd[2][FFOURBODY][FFOURBODY_P]
Definition dlp_field.c:762
glwin * tmp_view
Definition dlp_field.c:952
field_constraint * tmp_fcons
Definition dlp_field.c:959
int fvalues[2][15][21]
Definition dlp_field.c:255
gchar * mo_title[8]
Definition dlp_field.c:935
char * fvars_bond[2][FBONDS][FBONDS_P]
Definition dlp_field.c:306
gchar * pop_add(int i)
get add string label
Definition dlp_field.c:2689
void close_the_assistant(GtkAssistant *assistant)
classical force field creation close the assistant
Definition dlp_field.c:3918
gboolean field_file_has_energy_parameters(gboolean scale, int sca, int scb)
scale all field parameter(s) related to the energy unit
Definition dlp_field.c:1916
void on_assistant_apply(GtkAssistant *assistant, gpointer data)
on classical force field assistant apply - creating the dialog
Definition dlp_field.c:4614
GtkWidget * field_i_combo[2]
Definition dlp_field.c:3904
int field_object
Definition dlp_field.c:979
void field_unselect_all()
unselect all atoms
Definition dlp_viz.c:130
GtkWidget * field_i_fixed[2]
Definition dlp_field.c:3903
field_nth_body * tmp_fbody
Definition dlp_field.c:965
float internal_to_other[5]
Definition dlp_field.c:938
GtkCellRenderer * field_renderer[MAXDATA][11]
Definition dlp_field.c:942
project * tmp_proj
Definition dlp_field.c:953
int feunit_tbd[2][FTHREEBODY][FTHREEBODY_P]
Definition dlp_field.c:749
G_MODULE_EXPORT void on_assistant_cancel(GtkAssistant *assistant, gpointer data)
classical force field creation cancel assistant
Definition dlp_field.c:3966
field_shell * tmp_fshell
Definition dlp_field.c:958
int feunit_dihedral[2][FDIHEDRAL][FDIHEDRAL_P]
Definition dlp_field.c:479
GtkWidget * mol_box[MOLIMIT-1]
Definition dlp_field.c:943
G_MODULE_EXPORT gboolean on_field_button_event(GtkWidget *widget, GdkEvent *event, gpointer data)
classical force field tree model button event callback GTK3
Definition dlp_field.c:3127
field_rigid * tmp_frig
Definition dlp_field.c:961
void create_ff_structure(int ai, int type)
create the classical force field data structure and update widgets
Definition dlp_field.c:4345
G_MODULE_EXPORT void select_field_action(GtkToggleButton *but, gpointer data)
select force field creation option toggle callback GTK3
Definition dlp_field.c:4258
void pop_up_field_context_menu(int row_id, GtkWidget *widget, GdkEvent *event, gpointer data)
classical force field tree model popup menu GTK3
Definition dlp_field.c:2796
int saved_label_position[2]
Definition dlp_field.c:3909
int feunit_angle[2][FANGLES][FANGLES_P]
Definition dlp_field.c:411
G_MODULE_EXPORT void toggle_field_params(GtkToggleButton *but, gpointer data)
change classical force field parameter toggle callback GTK3
Definition dlp_field.c:1575
int body_at(int b)
find the number of atom(s) in a non bonded interaction
Definition dlp_field.c:1022
void field_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer visibility in the classical force field tree store
Definition dlp_field.c:3254
GtkWidget * enbox
Definition dlp_field.c:976
int num_field_objects
Definition dlp_field.c:981
void create_field_list(GtkWidget *vbx, int f)
classical force field creation prepare list store selection widgets
Definition dlp_field.c:3691
GtkWidget * vbox_init(int p)
classical force field assistant prepare the field object configuration widgets
Definition dlp_field.c:2186
field_pmf * tmp_fpmf
Definition dlp_field.c:960
void print_all_field_struct(field_molecule *mol, int str)
print all field structural element(s)
Definition dlp_print.c:195
gchar * fnames[2][16][21]
Definition dlp_field.c:218
void field_set_markup_box(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer pango markup in the classical force field tree store
Definition dlp_field.c:3184
void set_mol_num_label()
classical force field prepare the molecule information widget
Definition dlp_field.c:1045
gchar * la_improper_style_keyw[11]
Definition dlp_field.c:549
field_external * tmp_fext
Definition dlp_field.c:967
field_atom * tmp_fat
Definition dlp_field.c:957
GtkTreeViewColumn * field_col[MAXDATA][11]
Definition dlp_field.c:941
int row_id
Definition dlp_field.c:982
G_MODULE_EXPORT void clean_field(GtkToggleButton *but, gpointer data)
clean force field data toggle callback GTK3
Definition dlp_field.c:4225
int * has_energy
Definition dlp_field.c:1083
void field_set_color_and_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color and markup in the classical force field tree store
Definition dlp_field.c:3288
void field_set_color_markup_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color, markup and visibility in the classical force field tree store
Definition dlp_field.c:3389
void field_button_event(GdkEvent *event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
classical force field tree model button event GTK3
Definition dlp_field.c:3050
GtkTreeStore * field_model[MAXDATA]
Definition dlp_field.c:947
int fetypes[2][16]
Definition dlp_field.c:286
int get_field_tree_data(GtkWidget *tree, int treeid, GtkTreePath *path)
retrieve classical force field data from tree model
Definition dlp_field.c:2279
gchar * felemts[MAXDATA+1]
Definition dlp_field.c:140
G_MODULE_EXPORT void changed_mol_box(GtkComboBox *box, gpointer data)
classical force field assistant change the target molecule for the page
Definition dlp_field.c:1766
GtkWidget * aview
Definition dlp_field.c:970
void field_set_color_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color and visibility in the classical force field tree store
Definition dlp_field.c:3305
gboolean afp_init[MAXDATC+MAXDATA]
Definition dlp_field.c:905
GtkWidget * mol_num_label
Definition dlp_field.c:974
char * fvars_ters[2][FTERSOFFS][FTERSOFFS_P]
Definition dlp_field.c:726
G_MODULE_EXPORT void to_edit_field_prop(GtkCellRenderer *cell, GtkCellEditable *editable, gchar *path_string, gpointer data)
to edit data in the classical force field tree model
Definition dlp_field.c:3512
GtkWidget * cwin
Definition dlp_field.c:973
gchar * pop_remove(int i)
get remove string label
Definition dlp_field.c:2703
void check_tersoffs(int id, int key)
check non bonded potential
Definition dlp_edit.c:2945
char * fvars_inversion[2][FINVERS][FINVERS_P]
Definition dlp_field.c:522
GtkWidget * cs_label[2]
Definition dlp_field.c:971
int struct_id(int f)
number of atoms in a structural element
Definition dlp_field.c:999
G_MODULE_EXPORT void on_assistant_close(GtkAssistant *assistant, gpointer data)
classical force field creation close assistant
Definition dlp_field.c:4006
gboolean field_color
Definition dlp_field.c:980
int get_field_data_id(int k, gchar *data)
get classical force field parameter from description string
Definition dlp_field.c:2306
G_MODULE_EXPORT void to_select_atom_id_from_fied_molecule(GSimpleAction *action, GVariant *parameter, gpointer data)
create new field atom from field atom popup menu callback
Definition dlp_field.c:2719
G_MODULE_EXPORT void edit_field_cell(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer data)
edit cell in the classical force field tree model
Definition dlp_field.c:3424
int actel
Definition dlp_field.c:2495
G_MODULE_EXPORT void on_field_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
activating row in the classical force field tree model
Definition dlp_field.c:3528
void fill_field_model(GtkTreeStore *store, int f, int m)
classical force field fill the tree store
Definition dlp_field.c:1264
void update_field_trees()
classical force field assistant update all tree models
Definition dlp_field.c:1782
int feunit_teth[2][FTETH][FTETH_P]
Definition dlp_field.c:299
gchar * elemts[MAXDATA]
Definition dlp_field.c:163
int feunit_vdw[2][FVDW][FVDW_P]
Definition dlp_field.c:645
G_MODULE_EXPORT void changed_field_key_renderer(GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *iter, gpointer data)
change combo box in classical force field tree model
Definition dlp_field.c:2335
char * fvars_dihedral[2][FDIHEDRAL][FDIHEDRAL_P]
Definition dlp_field.c:450
G_MODULE_EXPORT void show_force_field_preview(GtkButton *but, gpointer data)
show classical force field input files preview
Definition dlp_field.c:4448
ColRGBA init_color(int id, int numid)
initialize color based id number over total number of elements
Definition initcoord.c:81
void get_field_iter_and_edit(gchar *path_string, gpointer data)
edit field property in the classical force field tree model
Definition dlp_field.c:3479
char * fvars_angle[2][FANGLES][FANGLES_P]
Definition dlp_field.c:372
field_struct * tmp_fstr
Definition dlp_field.c:964
gboolean tersoff_question()
change Tersoff potential ?
Definition dlp_edit.c:663
int feunit_bond[2][FBONDS][FBONDS_P]
Definition dlp_field.c:339
gchar * parameters_info(int obj, int key, gchar **words, float *data)
prepare classical force field parameter description string
Definition dlp_field.c:1097
G_MODULE_EXPORT void changed_energy_unit(GtkComboBox *box, gpointer data)
change the classical force field energy unit - creating the dialog
Definition dlp_field.c:2069
GtkWidget * field_i_box[2]
Definition dlp_field.c:3901
GtkWidget * ff_but[19]
Definition dlp_field.c:977
int get_num_vdw_max()
Get the number of field shell interactions.
Definition dlp_edit.c:1994
void field_set_color_markup_and_visible_box(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color, markup and visibility in the classical force field tree store
Definition dlp_field.c:3407
G_MODULE_EXPORT void run_clean_field(GtkDialog *dial, gint response_id, gpointer data)
clean force field data - running the dialog
Definition dlp_field.c:4164
field_molecule * tmp_fmol
Definition dlp_field.c:955
gboolean set_nbd_but_sensitive(int nbid)
adjust non bonded interaction button sensitivity
Definition dlp_field.c:1602
int atom_init
Definition dlp_field.c:950
gchar * pop_info(int i, int id)
get popup information message
Definition dlp_field.c:2505
void remove_classical_assistant_pages()
classical force field creation remove assistant pages
Definition dlp_field.c:4143
void get_is_energy(int i, int l)
get the energy unit linked parameter list
Definition dlp_field.c:1812
field_atom * tmp_fdt
Definition dlp_field.c:957
void check_to_visualize_properties(int id)
check if it is requried to update rendering
Definition dlp_viz.c:766
gboolean append_pages
Definition dlp_field.c:135
GtkWidget * field_i_prep[2]
Definition dlp_field.c:3900
G_MODULE_EXPORT gboolean on_assistant_cancel_event(GtkWidget *assistant, GdkEvent *event, gpointer data)
classical force field creation cancel event callback GTK3
Definition dlp_field.c:3991
gboolean assist_init
Definition dlp_field.c:3907
field_prop * tmp_fprop
Definition dlp_field.c:963
GtkWidget * extra_vbox[2]
gchar * ctitle[MAXDATA][12]
Definition dlp_field.c:834
GtkWidget * create_mol_box(int f)
classical force field create molecule selection widgets
Definition dlp_field.c:3738
char * fvars_tbd[2][FTHREEBODY][FTHREEBODY_P]
Definition dlp_field.c:736
void restore_ogl_selection(glwin *view)
restore a saved atom selection
Definition calc.c:218
int field_s[MAXDATA]
Definition dlp_field.c:831
GSimpleActionGroup * field_pop_actions
Definition dlp_field.c:2724
GtkWidget * preview_but
Definition dlp_field.c:3906
field_tethered * tmp_ftet
Definition dlp_field.c:962
field_atom * tmp_fct
Definition dlp_field.c:957
int fntypes[2][15]
Definition dlp_field.c:289
GType col_type[MAXDATA][12]
Definition dlp_field.c:856
void print_lammps_atom_file(GtkTextBuffer *buf)
print LAMMPS atom file
Definition la_print.c:619
void add_classical_assistant_pages(int p)
classical force field assistant add pages
Definition dlp_field.c:4286
void prop_set_color_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color and visibility in the classical force field structural property tree store
Definition dlp_field.c:3322
GtkWidget * create_combo_mol(int f)
classical force field create molecule selection combo box
Definition dlp_field.c:2475
GtkWidget * field_assistant
Definition dlp_field.c:940
G_MODULE_EXPORT void on_assistant_prepare(GtkAssistant *assistant, GtkWidget *page, gpointer data)
prepare classical force field assistant pages before display
Definition dlp_field.c:4075
GtkWidget * create_field_tree(int f)
classical force field create the list store selection widgets
Definition dlp_field.c:3540
GtkWidget * field_tree[MAXDATA]
Definition dlp_field.c:945
GtkWidget * fibox[MAXDATC+MAXDATA+2]
Definition dlp_field.c:975
int ** is_param
Definition dlp_field.c:1082
int feunit_inversion[2][FINVERS][FINVERS_P]
Definition dlp_field.c:535
G_MODULE_EXPORT gint on_assistant_go_forward(gint current_page, gpointer data)
classical force field assistant find the next page to go to
Definition dlp_field.c:4019
G_MODULE_EXPORT void run_on_assistant_apply(GtkDialog *info, gint response_id, gpointer data)
on classical force field assistant apply - running the dialog GTK3
Definition dlp_field.c:4522
G_MODULE_EXPORT void run_changed_energy_unit(GtkDialog *dialog, gint response_id, gpointer data)
change the classical force field energy unit - running the dialog
Definition dlp_field.c:2047
char * fvars_vdw[2][FVDW][FVDW_P]
Definition dlp_field.c:602
int feunit_fext[2][FEXTERNAL][FEXTERNAL_P]
Definition dlp_field.c:803
void create_classical_force_field(int p, int f)
create classical force field prepare the assistant
Definition dlp_field.c:4649
gchar * fkeysw[2][16][21]
Definition dlp_field.c:185
int field_v[MAXDATA]
Definition dlp_field.c:830
void field_set_markup(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer pango markup in the classical force field tree store
Definition dlp_field.c:3204
GtkWidget * fwin
Definition dlp_field.c:972
field_atom * tmp_fbt
Definition dlp_field.c:957
int ** is_energy
Definition dlp_field.c:1084
coord_info * tmp_coord
Definition dlp_field.c:954
GtkWidget * field_label[MAXDATA]
Definition dlp_field.c:946
gchar * pop_edit(int i)
get edit string label
Definition dlp_field.c:2667
void hide_show_this_pages(int start, int end, int status, int delta)
classical force field assistant show / hide pages
Definition dlp_field.c:4123
int field_a[MAXDATA]
Definition dlp_field.c:832
molecule * tmp_mol
Definition dlp_field.c:956
classical_field * tmp_field
Definition dlp_field.c:951
void setup_cs_labels(int i)
classical force field prepare the core-shell description strings
Definition dlp_field.c:1067
void field_set_color(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color in the classical force field tree store
Definition dlp_field.c:3146
void pmf_set_color_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color and visibility in the classical force field mean force potential tree store
Definition dlp_field.c:3341
char * fvars_fext[2][FEXTERNAL][FEXTERNAL_P]
Definition dlp_field.c:776
int feunit_ters[2][FTERSOFFS][FTERSOFFS_P]
Definition dlp_field.c:731
GtkWidget * vbox_field(int f)
classical force field create page option widgets
Definition dlp_field.c:3755
gchar * set_field_label(int f, int m)
prepare classical force field description string
Definition dlp_field.c:1632
void append_field_item(GMenu *menu, const gchar *name, const gchar *key, int item_id, gchar *accel, int image_format, gpointer icon, gboolean custom, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, gboolean sensitive)
append menu items to the popup menu
Definition dlp_field.c:2749
void fill_field_struct(GtkTreeStore *store, int id, int mo)
classical force field fill the tree store with structural element parameter(s)
Definition dlp_field.c:1125
int feunit_met[2][FMETALS][FMETALS_P]
Definition dlp_field.c:707
GtkWidget * combo_mol[MOLIMIT-1]
Definition dlp_field.c:944
char * fvars_met[2][FMETALS][FMETALS_P]
Definition dlp_field.c:688
char * fvars_teth[2][FTETH][FTETH_P]
Definition dlp_field.c:292
int is_special[MAXDATA][11]
Definition dlp_field.c:883
GtkWidget * field_i_obj[2]
Definition dlp_field.c:3905
G_MODULE_EXPORT void changed_init_box(GtkComboBox *box, gpointer data)
classical force field change initialization parameter
Definition dlp_field.c:4392
gchar *** is_var
Definition dlp_field.c:1085
void fill_field_body(GtkTreeStore *store, int id)
classical force field fill the tree store with non bonded parameter(s)
Definition dlp_field.c:1209
gchar * get_body_element_name(field_nth_body *body, int aid, int nbd)
get field body potential element name
Definition dlp_edit.c:1926
void rig_set_color_and_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
set renderer color and visibility in the classical force field rigid constraint(s) tree store
Definition dlp_field.c:3369
int saved_label_format[2]
Definition dlp_field.c:3908
field_nth_body * new_body
Definition dlp_field.c:966
Variable declarations for the creation of the DL_POLY input file(s)
#define LA_BONDS_P
Definition dlp_field.h:93
#define FANGLES_P
Definition dlp_field.h:107
#define FBONDS_P
Definition dlp_field.h:106
#define FFOURBODY
Definition dlp_field.h:78
#define DL_METALS
Definition dlp_field.h:50
#define FEXTERNAL
Definition dlp_field.h:79
int * duplicate_int(int num, int *old_val)
copy a list of int
Definition global.c:560
void print_dlp_bond(int bi, GtkTextBuffer *buf, field_struct *bd, int fi, GtkTreeStore *store, GtkTreeIter *iter)
print / fill tree store with force field bond(s) information
Definition dlp_print.c:774
G_MODULE_EXPORT void add_molecule_to_field(GSimpleAction *action, GVariant *parameter, gpointer data)
add molecule to force field - creating the dialog
Definition dlp_mol.c:470
#define FTETH_P
Definition dlp_field.h:105
#define FVDW
Definition dlp_field.h:74
#define DL_METALS_P
Definition dlp_field.h:87
#define DL_TETH_P
Definition dlp_field.h:85
#define FINVERS
Definition dlp_field.h:73
#define LA_INVERS
Definition dlp_field.h:60
#define LA_TERSOFFS_P
Definition dlp_field.h:100
#define DL_ENERGY
Definition dlp_field.h:43
#define DL_BONDS_P
Definition dlp_field.h:81
#define DL_DIHEDRAL
Definition dlp_field.h:46
#define MOLIMIT
Definition dlp_field.h:117
#define DL_INVERS_P
Definition dlp_field.h:84
#define LA_VDW
Definition dlp_field.h:62
G_MODULE_EXPORT void setup_this_force_field(int id)
setup force field parameters
#define DL_TERSOFFS
Definition dlp_field.h:51
#define LA_ENERGY
Definition dlp_field.h:56
#define LA_EXTERNAL
Definition dlp_field.h:67
#define LA_FOURBODY
Definition dlp_field.h:66
void print_dlp_improper_inversion(int di, GtkTextBuffer *buf, field_struct *dh, int fi, GtkTreeStore *store, GtkTreeIter *iter)
print / fill tree store with force field improper(s)/inversion(s) information
Definition dlp_print.c:299
void print_dlp_angle(int ai, GtkTextBuffer *buf, field_struct *an, int fi, GtkTreeStore *store, GtkTreeIter *iter)
print / fill tree store with force field angle(s) information
Definition dlp_print.c:649
#define FVDW_P
Definition dlp_field.h:110
tint toviz
Definition dlp_viz.c:75
#define FDIHEDRAL_P
Definition dlp_field.h:108
#define DL_BONDS
Definition dlp_field.h:44
#define DL_VDW_P
Definition dlp_field.h:86
#define FFOURBODY_P
Definition dlp_field.h:114
void print_dlp_control(GtkTextBuffer *buf)
print DL-POLY CONTROL file
Definition dlp_print.c:1897
#define DL_DIHEDRAL_P
Definition dlp_field.h:83
#define LA_FOURBODY_P
Definition dlp_field.h:102
#define DL_EXTERNAL_P
Definition dlp_field.h:91
#define FTETH
Definition dlp_field.h:69
#define FMETALS_P
Definition dlp_field.h:111
#define FTERSOFFS_P
Definition dlp_field.h:112
#define DL_ANGLES
Definition dlp_field.h:45
char * field_acro[N_FIELDS]
#define DL_FOURBODY_P
Definition dlp_field.h:90
#define LA_ANGLES_P
Definition dlp_field.h:94
#define FBONDS
Definition dlp_field.h:70
#define DL_THREEBODY_P
Definition dlp_field.h:89
#define LA_DIHEDRAL_P
Definition dlp_field.h:95
#define LA_THREEBODY
Definition dlp_field.h:65
#define LA_METALS
Definition dlp_field.h:63
G_MODULE_EXPORT void remove_molecule_from_field(GSimpleAction *action, GVariant *parameter, gpointer data)
remove molecule from force field - creating the dialog
Definition dlp_mol.c:752
#define FEXTERNAL_P
Definition dlp_field.h:115
#define FDIHEDRAL
Definition dlp_field.h:72
#define DL_FOURBODY
Definition dlp_field.h:53
#define SEXTERN
Definition dlp_field.h:118
classical_field * create_force_field_data_structure(int ai)
initialize classical force field
Definition dlp_init.c:2974
#define FTERSOFFS
Definition dlp_field.h:76
#define LA_INVERS_P
Definition dlp_field.h:96
#define FTHREEBODY
Definition dlp_field.h:77
#define DL_TERSOFFS_P
Definition dlp_field.h:88
void print_dlp_field(GtkTextBuffer *buf)
print DL-POLY classical force field
Definition dlp_print.c:1401
void print_dlp_config(GtkTextBuffer *buf)
print DL-POLY CONFIG file
Definition dlp_print.c:1575
#define LA_BONDS
Definition dlp_field.h:57
void visualize_object(int id, int jd, int kd)
visualize object and update OpenGL rendering
Definition dlp_viz.c:550
#define DL_TETH
Definition dlp_field.h:48
#define DL_EXTERNAL
Definition dlp_field.h:54
void print_dlp_dihedral(int di, GtkTextBuffer *buf, field_struct *dh, int fi, GtkTreeStore *store, GtkTreeIter *iter)
print / fill tree store with force field dihedral(s) information
Definition dlp_print.c:499
#define DL_VDW
Definition dlp_field.h:49
#define LA_EXTERNAL_P
Definition dlp_field.h:103
#define DL_INVERS
Definition dlp_field.h:47
#define LA_METALS_P
Definition dlp_field.h:99
#define LA_TETH_P
Definition dlp_field.h:97
#define LA_DIHEDRAL
Definition dlp_field.h:59
G_MODULE_EXPORT void visualize_or_select_all_elements(GtkTreeViewColumn *col, gpointer data)
select all element(s) in the column for visualization
Definition dlp_viz.c:1022
G_MODULE_EXPORT void on_toggle_visualize_or_select_object(GtkCellRendererToggle *cell_renderer, gchar *string_path, gpointer data)
on visualize force field object toggle callback
Definition dlp_viz.c:828
#define FINVERS_P
Definition dlp_field.h:109
#define DL_THREEBODY
Definition dlp_field.h:52
gboolean afp[MAXDATA]
#define N_FIELDS
Definition dlp_field.h:39
#define LA_THREEBODY_P
Definition dlp_field.h:101
#define DL_ANGLES_P
Definition dlp_field.h:82
#define LA_ANGLES
Definition dlp_field.h:58
#define LA_TETH
Definition dlp_field.h:61
#define FANGLES
Definition dlp_field.h:71
int get_field_objects(int id, int jd)
get the number of this type of field object
Definition dlp_viz.c:365
@ PARTIAL_COORD_AND_SPEC
Definition dlp_field.h:148
#define LA_TERSOFFS
Definition dlp_field.h:64
#define LA_VDW_P
Definition dlp_field.h:98
#define FMETALS
Definition dlp_field.h:75
#define FTHREEBODY_P
Definition dlp_field.h:113
int multi
Definition dlp_init.c:121
int ** allocdint(int xal, int yal)
allocate an int ** pointer
Definition global.c:330
int activef
Definition global.c:161
gchar ** duplicate_strings(int num, gchar **old_val)
copy a list of strings
Definition global.c:544
int * allocint(int val)
allocate an int * pointer
Definition global.c:314
float * allocfloat(int val)
allocate a float * pointer
Definition global.c:398
double string_to_double(gpointer string)
convert string to double
Definition global.c:624
gchar * ifield[8]
Definition global.c:140
GtkWidget * dialog_cancel_apply(gchar *title, GtkWidget *parent, gboolean resiz)
create a dialog modal offering a choice to apply something or not
Definition gtk-misc.c:571
#define EDITF
Definition global.h:206
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:501
@ IMG_NONE
Definition global.h:262
@ IMG_STOCK
Definition global.h:266
int combo_get_active(GtkWidget *combo)
retrieve the active item's position
Definition gtk-misc.c:909
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
Definition gtk-misc.c:1714
GtkWidget * create_text_view(int dimx, int dimy, int edit, int mono, GCallback handler, gpointer data, gchar *text)
create a GtkTextView and display some text
Definition gtk-misc.c:1260
GtkTextBuffer * add_buffer(GCallback handler, gpointer data, gchar *text)
create a GtkTextBuffer
Definition gtk-misc.c:1232
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:2095
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:520
project * proj
void combo_set_active(GtkWidget *combo, int pos)
set the active item's position
Definition gtk-misc.c:932
#define BSEP
Definition global.h:247
void opengl_project_changed(int id)
change the OpenGL project
Definition update_p.c:245
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
Definition gtk-misc.c:2436
void widget_add_action(GSimpleActionGroup *action_group, const gchar *act, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, const gchar *stat)
add an action to an action group
Definition gui.c:645
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
Definition gtk-misc.c:1425
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
Definition gtk-misc.c:2522
void button_set_status(GtkWidget *button, int status)
set status of check / toggle button
Definition gtk-misc.c:1872
GtkWidget * fbox(GtkWidget *box, char *lab)
box creating routine, to help design faster elements for the GUI
Definition gtk-misc.c:2076
gchar * file_chooser_get_current_folder(GtkFileChooser *chooser)
get the current folder for a GtkFileChooser
Definition gtk-misc.c:2287
#define APPLY
Definition global.h:222
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1893
@ CONTAINER_SCR
Definition global.h:253
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
Definition gtk-misc.c:1955
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:984
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:835
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
create a GtkLabel with pango markup
Definition gtk-misc.c:1646
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
Definition gtk-misc.c:308
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:215
#define CANCEL
Definition global.h:217
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2200
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:823
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:961
G_MODULE_EXPORT void run_destroy_dialog(GtkDialog *dialog, gint response_id, gpointer data)
to destroy a GtkDialog when the dialog emit the closing signal
Definition gtk-misc.c:2237
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2169
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:235
#define MAXDATC
Number of tabs for the description of the classical calculation.
Definition global.h:698
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
Definition gtk-misc.c:198
void append_menu_item(GMenu *menu, const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
create a menu item, then append it to a menu
Definition gui.c:762
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:811
int button_get_status(GtkWidget *button)
get status of check / toggle button
Definition gtk-misc.c:1855
GtkWidget * create_file_chooser(const gchar *title, GtkWindow *parent, GtkFileChooserAction act, const gchar *act_name)
create a GtkFileChooser, utility to select file(s)
Definition gtk-misc.c:2358
#define MAXDATA
Number of tabs for the description of the classical force field.
Definition global.h:703
void destroy_this_native_dialog(GtkNativeDialog *dialog)
destroy a GtkNativeDialog
Definition gtk-misc.c:2219
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:182
project * get_project_by_id(int p)
get project pointer using id number
Definition project.c:120
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
action
Definition glview.h:198
labels
Definition glview.h:223
@ ID_IN_MOLECULE
Definition glview.h:228
#define ATOM_MAPS
Definition glwin.h:61
Function declarations for the creation of the OpenGL window.
void show_warning(char *warning, GtkWidget *win)
show warning
Definition interface.c:260
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:293
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
Definition interface.c:356
gchar * exact_name(gchar *name)
short cut to print string without spaces
Definition interface.c:370
Messaging function declarations.
struct file_list * ftmp
Definition main.c:84
integer(kind=c_int) function molecules(frag_and_mol, allbonds)
double z
Definition ogl_draw.c:61
double y
Definition ogl_draw.c:61
double x
Definition ogl_draw.c:61
Function declarations for reading atomes project file Function declarations for saving atomes proje...
Definition glwin.h:351
Definition glwin.h:965
int c
Definition global.h:109
int b
Definition tab-1.c:95
int a
Definition tab-1.c:95
int status
Definition w_advance.c:178
GtkWidget * res[2]
Definition w_encode.c:212
GtkWidget * hbox
Definition workspace.c:71
GtkWidget * img
Definition workspace.c:70
GtkWidget * vbox
Definition workspace.c:72
GtkWidget * lab
Definition workspace.c:73