atomes 1.1.15
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-2024 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#ifdef GTK4
1581 tmp_field -> afp[i] = gtk_check_button_get_active (but);
1582#else
1583 tmp_field -> afp[i] = gtk_toggle_button_get_active (but);
1584#endif
1585 if (i == MAXDATC)
1586 {
1587 for (j=0; j<MOLIMIT-1; j++)
1588 {
1590 gtk_combo_box_set_active (GTK_COMBO_BOX(combo_mol[j]), 0);
1591 }
1592 }
1593 else if (i > MAXDATC)
1594 {
1595 gtk_widget_set_visible (fibox[i+1], tmp_field -> afp[i]);
1596 }
1597}
1598
1606gboolean set_nbd_but_sensitive (int nbid)
1607{
1608 if (nbid == 0 || nbid == 2 || nbid == 5)
1609 {
1610 return TRUE;
1611 }
1612 else
1613 {
1614 int i, j;
1615 i = (nbid == 1) ? 2 : nbid;
1616 j = 0;
1617 field_molecule * ftmp = tmp_field -> first_molecule;
1618 while (ftmp)
1619 {
1620 j += ftmp -> atoms;
1621 ftmp = ftmp -> next;
1622 }
1623 gboolean res = (j >= i) ? TRUE : FALSE;
1624 return res;
1625 }
1626}
1627
1636gchar * set_field_label (int f, int m)
1637{
1638 gchar * lab;
1639 int k;
1640 if (f < MOLIMIT)
1641 {
1642 if (tmp_field -> afp[MAXDATC])
1643 {
1645 lab = g_strdup_printf ("the <b>%d</b> different fragment(s) in molecule <b>%s</b>\n",
1646 tmp_fmol -> multi, tmp_fmol -> name);
1647 }
1648 else
1649 {
1650 lab = g_strdup_printf ("the system\n");
1651 }
1652 }
1653 switch (f)
1654 {
1655 case 1:
1656 lab = g_strdup_printf ("%seach contains the following <b>%d</b> type(s) of atom", lab, tmp_fmol -> atoms);
1657 break;
1658 case 2:
1659 if (tmp_fmol -> shells == 0)
1660 {
1661 lab = g_strdup_printf ("%sdo not contains any core-shell unit", lab);
1662 }
1663 else
1664 {
1665 lab = g_strdup_printf ("%seach contains the following <b>%d</b> core-shell unit", lab, tmp_fmol -> shells);
1666 }
1667 break;
1668 case 3:
1669 if (tmp_fmol -> constraints == 0)
1670 {
1671 lab = g_strdup_printf ("%sdo not contains any constraint", lab);
1672 }
1673 else
1674 {
1675 lab = g_strdup_printf ("%seach contains the following <b>%d</b> constraint(s)", lab, tmp_fmol -> constraints);
1676 }
1677 break;
1678 case 4:
1679 if (tmp_fmol -> pmfs == 0)
1680 {
1681 lab = g_strdup_printf ("%sdo not contains any mean force potential", lab);
1682 }
1683 else
1684 {
1685 lab = g_strdup_printf ("%seach contains the following <b>%d</b> type(s) of mean force potential(s)", lab, tmp_fmol -> pmfs);
1686 }
1687 break;
1688 case 5:
1689 if (tmp_fmol -> rigids == 0)
1690 {
1691 lab = g_strdup_printf ("%sdo not contains any rigid unit", lab);
1692 }
1693 else
1694 {
1695 lab = g_strdup_printf ("%seach contains the following <b>%d</b> rigid unit(s)", lab, tmp_fmol -> rigids);
1696 }
1697 break;
1698 case 6:
1699 if (tmp_fmol -> tethered == 0)
1700 {
1701 lab = g_strdup_printf ("%sdo not contains any tethering potential(s)", lab);
1702 }
1703 else
1704 {
1705 lab = g_strdup_printf ("%seach contains the following <b>%d</b> tethering potential(s)", lab, tmp_fmol -> tethered);
1706 }
1707 break;
1708 case SEXTERN:
1709 if (tmp_field -> extern_fields == 0)
1710 {
1711 lab = g_strdup_printf ("the force field do not contains any external field(s)");
1712 }
1713 else
1714 {
1715 lab = g_strdup_printf ("the force field contains the following <b>%d</b> external field(s)", tmp_field -> extern_fields);
1716 }
1717 break;
1718 default:
1719 if (f < MOLIMIT)
1720 {
1721 if (f == 14)
1722 {
1723 if (tmp_fmol -> nstruct[f-7] == 0)
1724 {
1725 lab = g_strdup_printf ("%sdo not contains any %s <sup>*</sup>", lab, mo_title[f-7]);
1726 }
1727 else
1728 {
1729 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]);
1730 }
1731 }
1732 else
1733 {
1734 if (tmp_fmol -> nstruct[f-7] == 0)
1735 {
1736 lab = g_strdup_printf ("%sdo not contains any %s", lab, mo_title[f-7]);
1737 }
1738 else
1739 {
1740 lab = g_strdup_printf ("%s contains the following <b>%d</b> type(s) of %s", lab, tmp_fmol -> nstruct[f-7], elemts[f]);
1741 }
1742 }
1743 break;
1744 }
1745 else
1746 {
1747 k = f - MOLIMIT;
1748 if (tmp_field -> nbody[k] == 0)
1749 {
1750 lab = g_strdup_printf ("the force field do not contains any %s(s)", elemts[f]);
1751 }
1752 else
1753 {
1754 lab = g_strdup_printf ("the force field contains the following <b>%d</b> %s(s)", tmp_field -> nbody[k], elemts[f]);
1755 }
1756 break;
1757 }
1758 }
1759 return lab;
1760}
1761
1770G_MODULE_EXPORT void changed_mol_box (GtkComboBox * box, gpointer data)
1771{
1772 int i, j;
1773 i = GPOINTER_TO_INT(data);
1774 j = gtk_combo_box_get_active (box);
1775 gtk_label_set_text (GTK_LABEL(field_label[i]), set_field_label(i, j));
1776 gtk_label_set_use_markup (GTK_LABEL(field_label[i]), TRUE);
1777 gtk_tree_store_clear (field_model[i]);
1778 fill_field_model (field_model[i], i, j);
1779}
1780
1787{
1788 int i;
1789 for (i=0; i<MAXDATA; i++)
1790 {
1791 if (i > 0 && i < MOLIMIT)
1792 {
1793 changed_mol_box (GTK_COMBO_BOX (combo_mol[i-1]), GINT_TO_POINTER(i));
1794 }
1795 else
1796 {
1797 if (i > 0)
1798 {
1799 gtk_label_set_text (GTK_LABEL(field_label[i]), set_field_label(i, 0));
1800 gtk_label_set_use_markup(GTK_LABEL(field_label[i]), TRUE);
1801 }
1802 gtk_tree_store_clear (field_model[i]);
1803 fill_field_model (field_model[i], i, -1);
1804 }
1805 }
1806}
1807
1816void get_is_energy (int i, int l)
1817{
1818 int j, k;
1819 j = (i > 1 && i < 8) ? (i-1)/2 + 1 - i/7 : i;
1820 is_energy = g_malloc (fetypes[activef][i+1]*sizeof*is_energy);
1821 if (l)
1822 {
1823 is_var = g_malloc (fetypes[activef][i+1]*sizeof*is_var);
1824 }
1825 switch (j)
1826 {
1827 case 0:
1828 for (k=0; k<fetypes[activef][i+1]; k++)
1829 {
1832 }
1833 break;
1834 case 1:
1835 // Bonds
1836 for (k=0; k<fetypes[activef][i+1]; k++)
1837 {
1840 }
1841 break;
1842 case 2:
1843 // Angles
1844 for (k=0; k<fetypes[activef][i+1]; k++)
1845 {
1848 }
1849 break;
1850 case 3:
1851 // Dihedrals / Impropers
1852 for (k=0; k<fetypes[activef][i+1]; k++)
1853 {
1856 }
1857 break;
1858 case 8:
1859 // Inversions
1860 for (k=0; k<fetypes[activef][i+1]; k++)
1861 {
1864 }
1865 break;
1866 case 9:
1867 for (k=0; k<fetypes[activef][i+1]; k++)
1868 {
1870 if (l) is_var[k] = duplicate_strings (FVDW_P, fvars_vdw[activef][k]);
1871 }
1872 break;
1873 case 10:
1874 for (k=0; k<fetypes[activef][i+1]; k++)
1875 {
1878 }
1879 break;
1880 case 11:
1881 for (k=0; k<fetypes[activef][i+1]; k++)
1882 {
1885 }
1886 break;
1887 case 12:
1888 for (k=0; k<fetypes[activef][i+1]; k++)
1889 {
1892 }
1893 break;
1894 case 13:
1895 for (k=0; k<fetypes[activef][i+1]; k++)
1896 {
1899 }
1900 break;
1901 case 14:
1902 for (k=0; k<fetypes[activef][i+1]; k++)
1903 {
1906 }
1907 break;
1908 }
1909}
1910
1920gboolean field_file_has_energy_parameters (gboolean scale, int sca, int scb)
1921{
1922 int i, j, k, l;
1923 is_param = allocdint(15, 21);
1924 has_energy = allocint (15);
1925 i = 0;
1926 tmp_fmol = tmp_field -> first_molecule;
1927 while (tmp_fmol)
1928 {
1930 while (tmp_fshell)
1931 {
1932 if (! scale)
1933 {
1934 i =1;
1935 break;
1936 }
1937 else
1938 {
1941 tmp_fshell = tmp_fshell -> next;
1942 }
1943 }
1944 tmp_fmol = tmp_fmol -> next;
1945 }
1946 for (j=0; j<15; j++)
1947 {
1948 get_is_energy (j, 0);
1949 l = 0;
1950 if (j == 0)
1951 {
1952 tmp_fmol = tmp_field -> first_molecule;
1953 while (tmp_fmol)
1954 {
1956 while (tmp_ftet)
1957 {
1958 for (k=0; k<fvalues[activef][j][tmp_ftet -> key]; k++)
1959 {
1960 if (is_energy[tmp_ftet -> key][k])
1961 {
1962 is_param[j][tmp_ftet -> key] ++;
1963 if (scale) tmp_ftet -> val[k]= (tmp_ftet -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1964 l ++;
1965 }
1966 }
1967 tmp_ftet = tmp_ftet -> next;
1968 }
1969 tmp_fmol = tmp_fmol -> next;
1970 }
1971 }
1972 else if (j>0 && j<9)
1973 {
1974 tmp_fmol = tmp_field -> first_molecule;
1975 while (tmp_fmol)
1976 {
1977 tmp_fstr = tmp_fmol -> first_struct[j-1];
1978 //get_active_struct (j-1, tmp_fmol -> id, 0);
1979 while (tmp_fstr)
1980 {
1981 for (k=0; k<fvalues[activef][j][tmp_fstr -> def -> key]; k++)
1982 {
1983 if (is_energy[tmp_fstr -> def -> key][k])
1984 {
1985 is_param[j][tmp_fstr -> def -> key] ++;
1986 if (scale) tmp_fstr -> def -> val[k] = (tmp_fstr -> def -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1987 l ++;
1988 }
1989 }
1990 tmp_fprop = tmp_fstr -> other;
1991 while (tmp_fprop)
1992 {
1993 for (k=0; k<fvalues[activef][j][tmp_fprop -> key]; k++)
1994 {
1995 if (is_energy[tmp_fprop -> key][k])
1996 {
1997 is_param[j][tmp_fprop -> key] ++;
1998 if (scale) tmp_fprop -> val[k] = (tmp_fprop -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
1999 l ++;
2000 }
2001 }
2002 tmp_fprop = tmp_fprop -> next;
2003 }
2004 tmp_fstr = tmp_fstr -> next;
2005 }
2006 tmp_fmol = tmp_fmol -> next;
2007 }
2008 }
2009 else
2010 {
2011 tmp_fbody = get_active_body (0, j-9);
2012 while (tmp_fbody)
2013 {
2014 for (k=0; k<fvalues[activef][j][tmp_fbody -> key]; k++)
2015 {
2016 if (is_energy[tmp_fbody -> key][k])
2017 {
2018 is_param[j][tmp_fbody -> key] ++;
2019 if (scale) tmp_fbody -> val[k] = (tmp_fbody -> val[k] * internal_to_other[sca]) / internal_to_other[scb];
2020 l ++;
2021 }
2022 }
2023 tmp_fbody = tmp_fbody -> next;
2024 }
2025 }
2026 has_energy[j] = l;
2027 i += l;
2028 for (k=0; k<fetypes[activef][j+1]; k++) g_free (is_energy[k]);
2029 g_free (is_energy);
2030 }
2031 if (i)
2032 {
2033 return TRUE;
2034 }
2035 else
2036 {
2037 g_free (is_param);
2038 return FALSE;
2039 }
2040}
2041
2051G_MODULE_EXPORT void run_changed_energy_unit (GtkDialog * dialog, gint response_id, gpointer data)
2052{
2053 if (response_id == GTK_RESPONSE_YES)
2054 {
2055 int i = GPOINTER_TO_INT(data);
2056 setup_cs_labels (i);
2057 // Correct all parameters
2058 field_file_has_energy_parameters (TRUE, tmp_field -> energy_unit, i);
2059 tmp_field -> energy_unit = i;
2060 }
2061 g_free (is_param);
2062 destroy_this_dialog (dialog);
2063}
2064
2073G_MODULE_EXPORT void changed_energy_unit (GtkComboBox * box, gpointer data)
2074{
2075 int i, j, k, l;
2076 i = gtk_combo_box_get_active (box);
2077 if (i != tmp_field -> energy_unit)
2078 {
2079 if (field_file_has_energy_parameters(FALSE, 0, 0))
2080 {
2081 GtkWidget * dialog = gtk_dialog_new_with_buttons ("Change energy unit ?", GTK_WINDOW(field_assistant),
2082 GTK_DIALOG_MODAL, "Yes", GTK_RESPONSE_YES, "No", GTK_RESPONSE_NO, NULL);
2083 gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
2084 GtkWidget * vbox = dialog_get_content_area (dialog);
2085 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);
2086 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);
2087 GtkWidget * hbox;
2088 GtkWidget * vbax, * vbbx;
2089 GtkWidget * hax, * hbx;
2090 gchar * str;
2091 // Core-Shell
2092 tmp_fmol = tmp_field -> first_molecule;
2093 while (tmp_fmol)
2094 {
2096 if (tmp_fshell)
2097 {
2098 hbox = create_hbox (0);
2099 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2100 vbax = create_vbox (BSEP);
2101 vbbx = create_vbox (BSEP);
2102 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbax, FALSE, FALSE, 0);
2103 hax = create_hbox (0);
2104 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbax, hax, FALSE, FALSE, 0);
2105 str = g_strdup_printf ("\t<b>%s(s):</b>", felemts[3]);
2106 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hax, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2107 g_free (str);
2108 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbbx, FALSE, FALSE, 0);
2109 hbx = create_hbox (0);
2110 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbbx, hbx, FALSE, FALSE, 0);
2111 str = g_strdup_printf ("k<sub>2</sub> and k<sub>4</sub>");
2112 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2113 g_free (str);
2114 break;
2115 }
2116 tmp_fmol = tmp_fmol -> next;
2117 }
2118 for (j=0; j<15; j++)
2119 {
2120 if (has_energy[j])
2121 {
2122 hbox = create_hbox (0);
2123 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2124 vbax = create_vbox (BSEP);
2125 vbbx = create_vbox (BSEP);
2126 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbax, FALSE, FALSE, 0);
2127 hax = create_hbox (0);
2128 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbax, hax, FALSE, FALSE, 0);
2129 str = g_strdup_printf ("\t<b>%s:</b>", felemts[j+7]);
2130 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hax, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2131 g_free (str);
2132 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, vbbx, FALSE, FALSE, 0);
2133 get_is_energy (j, 1);
2134 for (k=0; k<fetypes[activef][j+1]; k++)
2135 {
2136 if (is_param[j][k])
2137 {
2138 hbx = create_hbox (0);
2139 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbbx, hbx, FALSE, FALSE, 0);
2140 str = g_strdup_printf ("%s %s:", fnames[activef][j+1][k], elemts[j+6]);
2141 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2142 g_free (str);
2143 str = NULL;
2144 for (l=0; l<fntypes[activef][j]; l++)
2145 {
2146 if (is_energy[k][l])
2147 {
2148 if (str)
2149 {
2150 str = g_strdup_printf ("%s, %s", str, is_var[k][l]);
2151 }
2152 else
2153 {
2154 str = g_strdup_printf ("%s", is_var[k][l]);
2155 }
2156 }
2157 }
2158 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, markup_label(str, 250, -1, 0.0, 0.5), FALSE, FALSE, 0);
2159 g_free (str);
2160 }
2161 }
2162 for (k=0; k<fetypes[activef][j+1]; k++)
2163 {
2164 g_free (is_energy[k]);
2165 g_free (is_var[k]);
2166 }
2167 g_free (is_energy);
2168 g_free (is_var);
2169 }
2170 }
2171 run_this_gtk_dialog (dialog, G_CALLBACK(run_changed_energy_unit), GINT_TO_POINTER(i));
2172 }
2173 else
2174 {
2175 setup_cs_labels (i);
2176 tmp_field -> energy_unit = i;
2177 }
2178 }
2179 gtk_combo_box_set_active (box, tmp_field -> energy_unit);
2181}
2182
2190GtkWidget * vbox_init (int p)
2191{
2192 int i, j, k, l;
2193 int col[3]={5, 4, 4};
2194 gchar * str;
2195 GtkWidget * vbox;
2196 GtkWidget * hbox;
2197 GtkWidget * ebox;
2198
2199 vbox = create_vbox (BSEP);
2200 hbox = create_hbox (0);
2201 str = g_strdup_printf ("<b>Please select the %s:</b>", felemts[0]);
2202 ebox = fbox (hbox, str);
2203 g_free (str);
2204 enbox = create_combo ();
2205 for (j=0; j<fetypes[activef][0]; j++)
2206 {
2207 str = g_strdup_printf ("%s (%s)", fnames[activef][0][j], fkeysw[activef][0][j]);
2208 combo_text_append (enbox, str);
2209 g_free (str);
2210 }
2211 gtk_combo_box_set_active (GTK_COMBO_BOX(enbox), tmp_field -> energy_unit);
2212 g_signal_connect (G_OBJECT (enbox), "changed", G_CALLBACK(changed_energy_unit), GINT_TO_POINTER(0));
2213 gtk_widget_set_size_request (enbox, 250, 30);
2215 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, ebox, enbox, FALSE, FALSE, 60);
2216 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2217
2218 hbox = create_hbox (0);
2219 ebox = fbox (hbox, "<b>Please select the component(s) of the force field:</b>");
2220 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 5);
2221 hbox = create_hbox (0);
2222 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);
2223
2224 //str = g_strdup_printf ("Use multiple molecule(s)");
2225 //but = check_button (str, 225, 40, tmp_field -> afp[MAXDATC], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(MAXDATC));
2226 //g_free (str);
2227 //add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, but, FALSE, FALSE, 30);
2228
2229 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2230 hbox = create_hbox (0);
2231 k = 2+MAXDATC;
2232 l = 0;
2233 for (i=0; i<3; i++)
2234 {
2235 ebox = create_vbox (BSEP);
2236 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, ebox, FALSE, FALSE, 20);
2237 for (j=0; j<col[i]; j++)
2238 {
2239 str = g_strdup_printf ("Use %s(s)", elemts[k-MAXDATC]);
2240 ff_but[l] = check_button (str, 225, 40, tmp_field -> afp[k], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(k));
2241 g_free (str);
2243 add_box_child_start (GTK_ORIENTATION_VERTICAL, ebox, ff_but[l], FALSE, FALSE, 0);
2244 k ++;
2245 l ++;
2246 }
2247 }
2248 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2249 hbox = create_hbox (0);
2250 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);
2251 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
2252 hbox = create_hbox (0);
2253 for (i=0; i<3; i++)
2254 {
2255 ebox = create_vbox (BSEP);
2256 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, ebox, FALSE, FALSE, 20);
2257 for (j=0; j<2; j++)
2258 {
2259 str = g_strdup_printf ("Use %s(s)", elemts[k-MAXDATC]);
2260 if (activef) tmp_field -> afp[k] = FALSE;
2261 ff_but[l] = check_button (str, 225, 40, tmp_field -> afp[k], G_CALLBACK(toggle_field_params), GINT_TO_POINTER(k));
2262 k ++;
2263 g_free (str);
2266 add_box_child_start (GTK_ORIENTATION_VERTICAL, ebox, ff_but[l], FALSE, FALSE, 0);
2267 l ++;
2268 }
2269 }
2270 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 0);
2271 return vbox;
2272}
2273
2283int get_field_tree_data (GtkWidget * tree, int treeid, GtkTreePath * path)
2284{
2285 int res = -1;
2286 GtkTreeModel * tmodel = gtk_tree_view_get_model (GTK_TREE_VIEW(tree));
2287 if (gtk_tree_model_get_iter (tmodel, & field_iter, path))
2288 {
2289 gtk_tree_model_get (tmodel, & field_iter, 0, & res, -1);
2290 if (res == 0)
2291 {
2292 gtk_tree_model_get (tmodel, & field_iter, field_v[treeid]+1, & res, -1);
2293 }
2294 else
2295 {
2296 res --;
2297 }
2298 }
2299 return res;
2300}
2301
2310int get_field_data_id (int k, gchar * data)
2311{
2312 int i, j;
2313 gchar * str;
2314 i = -1;
2315 for (j=0; j<fetypes[activef][k]; j++)
2316 {
2317 str = g_strdup_printf ("%s (%s)", fnames[activef][k][j], exact_name(fkeysw[activef][k][j]));
2318 if (g_strcmp0 (data, str) == 0)
2319 {
2320 i = j;
2321 g_free (str);
2322 break;
2323 }
2324 g_free (str);
2325 }
2326 return i;
2327}
2328
2339G_MODULE_EXPORT void changed_field_key_renderer (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * iter, gpointer data)
2340{
2341 GValue val = {0, };
2342 int i, j, k, l, m, n, o;
2343 gboolean changeit = TRUE;
2344 char ** vars;
2345 int * ids;
2346 i = GPOINTER_TO_INT(data);
2347 GObject * cmodel;
2348 g_object_get (combo, "model", & cmodel, NULL);
2349 gtk_tree_model_get_value ((GtkTreeModel *)cmodel, iter, 0, & val);
2350 if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(field_model[i]), iter, path_string))
2351 {
2352 GValue vbl = {0, };
2353 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), iter, field_v[i]+1, & vbl);
2354 j = (int) g_value_get_int (& vbl);
2355 gchar * str = g_strdup_printf ("%s", (char *)g_value_get_string (& val));
2356 l = get_field_data_id (i-5, str);
2357 if (l > -1)
2358 {
2359 if (i < MOLIMIT) k = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[i-1]));
2360 if (i > 6 && i < MOLIMIT)
2361 {
2362 tmp_fstr = get_active_struct (i-7, k, j);
2363 o = struct_id (i);
2364 ids = allocint (o);
2365 if (i < 9)
2366 {
2367 vars = (char **)fvars_bond[activef][l];
2368 }
2369 else if (i < 11)
2370 {
2371 vars = (char **)fvars_angle[activef][l];
2372 }
2373 else if (i < 14)
2374 {
2375 vars = (char **)fvars_dihedral[activef][l];
2376 }
2377 else
2378 {
2379 vars = (char **)fvars_inversion[activef][l];
2380 }
2381 gtk_tree_model_get (GTK_TREE_MODEL(field_model[i]), iter, 0, & m, -1);
2382 if (m)
2383 {
2384 // Default prop
2385 for (n=0; n<o; n++) ids[n] = -1;
2386 if (l != tmp_fstr -> def -> key)
2387 {
2388 adjust_field_prop (i-7, o, NULL, ids, l);
2389 // print status of field prop
2390 str = g_strdup_printf ("<b>Default</b>: %s", str);
2391 gtk_tree_store_set (field_model[i], iter, field_v[i]-1, str, -1);
2392 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, vars, tmp_fstr -> def -> val), -1);
2394 }
2395 }
2396 else
2397 {
2398 // Other prop
2399 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2400 for (n=1; n<o+1; n++)
2401 {
2402 gtk_tree_model_get (GTK_TREE_MODEL(field_model[i]), iter, n, & str, -1);
2403 ids[n-1] = (int) string_to_double ((gpointer)str) - 1;
2404 }
2405 adjust_field_prop (i-7, o, NULL, ids, l);
2406 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);
2407 }
2408 g_free (ids);
2409 }
2410 else
2411 {
2412 switch (i)
2413 {
2414 case 6:
2415 tmp_ftet = get_active_tethered (k, j-1);
2416 tmp_ftet -> key = l;
2417 tmp_ftet -> val = NULL;
2418 tmp_ftet -> val = allocfloat (fvalues[activef][i-6][l]);
2419 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2420 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (0, l, fvars_teth[activef][l], tmp_ftet-> val), -1);
2421 break;
2422 case SEXTERN:
2424 tmp_fext -> key = l;
2425 tmp_fext -> val = NULL;
2426 tmp_fext -> val = allocfloat (fvalues[activef][i-6][l]);
2427 gtk_tree_store_set_value (field_model[i], iter, 2, & val);
2428 gtk_tree_store_set (field_model[i], iter, 3, parameters_info (i-6, l, fvars_fext[activef][l], tmp_fext -> val), -1);
2429 break;
2430 default:
2431 k = i - MOLIMIT;
2432 tmp_fbody = get_active_body (j-1, k);
2433 if (k == 2)
2434 {
2435 changeit = tersoff_question ();
2436 }
2437 if (changeit)
2438 {
2439 if (k == 2)
2440 {
2441 check_tersoffs (-1, l);
2442 gtk_tree_store_clear (field_model[i]);
2443 fill_field_model (field_model[i], i, -1);
2444 }
2445 else
2446 {
2447 tmp_fbody -> key = l;
2448 tmp_fbody -> val = NULL;
2449 tmp_fbody -> val = allocfloat (fvalues[activef][i-6][l]);
2450 gtk_tree_store_set_value (field_model[i], iter, field_v[i]-1, & val);
2451 }
2452 }
2453 else if (i == 17)
2454 {
2455 gtk_tree_store_set (field_model[i], iter, field_v[i], parameters_info (i-6, l, fvars_ters[activef][l], tmp_fbody -> val), -1);
2456 }
2457
2458 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);
2459 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);
2460 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);
2461 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);
2462 break;
2463 }
2464 }
2465 }
2466 g_free (str);
2467 g_value_unset(& vbl);
2468 }
2469 g_value_unset(& val);
2470}
2471
2479GtkWidget * create_combo_mol (int f)
2480{
2481 int i;
2482 gchar * str;
2483
2484 GtkWidget * combo = create_combo ();
2485 tmp_fmol = tmp_field -> first_molecule;
2486 for (i=0; i<tmp_field -> molecules; i++)
2487 {
2488 str = g_strdup_printf ("%d: %s", i+1, tmp_fmol -> name);
2489 combo_text_append (combo, str);
2490 g_free (str);
2491 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
2492 }
2493 widget_set_sensitive (combo, (tmp_field -> molecules > 1) ? TRUE : FALSE);
2494 gtk_combo_box_set_active (GTK_COMBO_BOX(combo), 0);
2495 g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK(changed_mol_box), GINT_TO_POINTER(f+1));
2496 return combo;
2497}
2498
2500
2509gchar * pop_info (int i, int id)
2510{
2511 int j, k, l;
2512 gchar * str = NULL;
2513
2514 actel = 0;
2515 switch (i)
2516 {
2517 case 0:
2519 str = g_strdup_printf ("Molecule N°%d", id+1);
2520 actel = 1;
2521 break;
2522 default:
2523 if (i < MOLIMIT)
2524 {
2525 j = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[i-1]));
2527 }
2528 switch (i)
2529 {
2530 case 1:
2531 tmp_fat = get_active_atom (j, id);
2532 str = g_strdup_printf ("Atom N°%d: \"%s\"", tmp_fat -> id+1, tmp_fat -> name);
2533 actel = tmp_fat -> num;
2534 break;
2535 case 2:
2536 if (tmp_fmol -> shells > 0)
2537 {
2538 tmp_fshell = get_active_shell (j, id);
2539 actel = 1;
2540 if (tmp_fshell -> ia[0])
2541 {
2542 k = tmp_fmol -> atoms_id[tmp_fshell -> ia[0]-1][0].a;
2543 str = g_strdup_printf ("Core-Shell N°%d: Atom %d (%s) - ", tmp_fshell -> id+1, tmp_fshell -> ia[0],
2544 exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2545 }
2546 else
2547 {
2548 str = g_strdup_printf ("Core-Shell N°%d: <i>None</i> - ", tmp_fshell -> id+1);
2549 }
2550 if (tmp_fshell -> ia[1])
2551 {
2552 k = tmp_fmol -> atoms_id[tmp_fshell -> ia[1]-1][1].a;
2553 str = g_strdup_printf ("%s%d (%s)", str, tmp_fshell -> ia[1], exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2554 }
2555 else
2556 {
2557 str = g_strdup_printf ("%s<i>None</i>", str);
2558 }
2559 }
2560 break;
2561 case 3:
2562 if (tmp_fmol -> constraints > 0)
2563 {
2565 actel = 1;
2566 if (tmp_fcons -> ia[0])
2567 {
2568 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[0]-1][0].a;
2569 str = g_strdup_printf ("Constrained Bond N°%d: Atom %d (%s) - ", tmp_fcons -> id+1, tmp_fcons -> ia[0],
2570 exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2571 }
2572 else
2573 {
2574 str = g_strdup_printf ("Constrained Bond N°%d: <i>None</i> - ", tmp_fcons -> id+1);
2575 }
2576 if (tmp_fcons -> ia[1])
2577 {
2578 k = tmp_fmol -> atoms_id[tmp_fcons -> ia[1]-1][1].a;
2579 str = g_strdup_printf ("%s%d (%s)", str, tmp_fcons -> ia[1], exact_name(tmp_proj -> chemistry -> label[get_active_atom (j, k) -> sp]));
2580 }
2581 else
2582 {
2583 str = g_strdup_printf ("%s<i>None</i>", str);
2584 }
2585 }
2586 break;
2587 case 4:
2588 if (tmp_fmol -> pmfs > 0)
2589 {
2590 tmp_fpmf = get_active_pmf (j, id);
2591 actel = 1;
2592 str = g_strdup_printf ("Mean Force Potential N°%d", tmp_fpmf -> id+1);
2593 }
2594 break;
2595 case 5:
2596 if (tmp_fmol -> rigids > 0)
2597 {
2598 tmp_frig = get_active_rigid (j, id);
2599 actel = 1;
2600 str = g_strdup_printf ("Rigid Unit N°%d: %d Atom(s)", tmp_frig -> id+1, tmp_frig -> num);
2601 }
2602 break;
2603 case 6:
2604 if (tmp_fmol -> tethered > 0)
2605 {
2606 tmp_ftet = get_active_tethered (j, id);
2607 actel = 1;
2608 str = g_strdup_printf ("Tethering Potential N°%d", tmp_ftet -> id+1);
2609 }
2610 break;
2611 case SEXTERN:
2612 if (tmp_field -> extern_fields > 0)
2613 {
2615 str = g_strdup_printf ("%s N°: %d", felemts[i+1], tmp_fext -> id+1);
2616 actel = 1;
2617 }
2618 break;
2619 default:
2620 if (i < MOLIMIT)
2621 {
2622 if (tmp_fmol -> nstruct[i-7] > 0)
2623 {
2624 actel = 1;
2625 tmp_fstr = get_active_struct (i-7, j, row_id);
2626 str = g_strdup_printf ("%s N°%d: \"", mo_title[i-7], tmp_fstr -> id+1);
2627 for (k=0; k<struct_id(i); k++)
2628 {
2629 str = g_strdup_printf ("%s%s", str, get_active_atom (j, tmp_fstr -> aid[k]) -> name);
2630 if (k<struct_id(i)-1) str = g_strdup_printf ("%s-", str);
2631 }
2632 str = g_strdup_printf ("%s\"", str);
2633 }
2634 }
2635 else
2636 {
2637 k = i - MOLIMIT;
2638 if (tmp_field -> nbody[k] > 0)
2639 {
2641 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);
2642 for (l=1; l<body_at(k); l++)
2643 {
2644 if (tmp_fbody -> na[l] < 0)
2645 {
2646 str = g_strdup_printf ("%s - NONE", str);
2647 }
2648 else
2649 {
2650 str = g_strdup_printf ("%s - %s", str, get_active_atom (tmp_fbody -> ma[l][0], tmp_fbody -> a[l][0]) -> name);
2651 }
2652 }
2653 str = g_strdup_printf ("%s\"", str);
2654 actel = 1;
2655 }
2656 }
2657 break;
2658 }
2659 break;
2660 }
2661 return str;
2662}
2663
2671gchar * pop_edit (int i)
2672{
2673 gchar * str = NULL;
2674 switch (i)
2675 {
2676 case 0:
2677 str = g_strdup_printf ("Edit Name: \"%s\"", tmp_fmol -> name);
2678 break;
2679 default:
2680 str = g_strdup_printf ("Edit %s Properties", elemts[i]);
2681 break;
2682 }
2683 return str;
2684}
2685
2693gchar * pop_add (int i)
2694{
2695 gchar * str = NULL;
2696 if ((i>1 && i<7) || (i>MOLIMIT && i<MAXDATA)) str = g_strdup_printf ("Add a New %s", elemts[i]);
2697 return str;
2698}
2699
2707gchar * pop_remove (int i)
2708{
2709 gchar * str = NULL;
2710 if ((i>1 && i<7) || (i>MOLIMIT && i<MAXDATA)) str = g_strdup_printf ("Remove %s", elemts[i]);
2711 return str;
2712}
2713
2723G_MODULE_EXPORT void to_select_atom_id_from_fied_molecule (GSimpleAction * action, GVariant * parameter, gpointer data)
2724{
2726}
2727
2728GSimpleActionGroup * field_pop_actions = NULL;
2729
2753void append_field_item (GMenu * menu, const gchar * name, const gchar * key, int item_id,
2754 gchar * accel, int image_format, gpointer icon,
2755 gboolean custom, GCallback handler, gpointer data,
2756 gboolean check, gboolean status, gboolean radio, gboolean sensitive)
2757{
2758 gchar * str_a, * str_b, * str_c;
2759 str_a = g_strdup_printf ("set-%s", key);
2760 str_b = g_strdup_printf ("%s.%d", str_a, item_id);
2761 str_c = (sensitive) ? g_strdup_printf ("ff-%d.%s", item_id, (radio) ? str_a : str_b) : g_strdup_printf ("None");
2762 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);
2763 if (handler)
2764 {
2765 if (! radio || (radio && status))
2766 {
2767 widget_add_action (field_pop_actions, (radio) ? (const gchar *)str_a : (const gchar *)str_b, handler, data,
2768 check, status, radio, (const gchar *)str_b);
2769 }
2770 }
2771 g_free (str_a);
2772 g_free (str_b);
2773 g_free (str_c);
2774}
2775
2776#ifdef GTK4
2788void pop_up_field_context_menu (int id, GtkWidget * widget, double event_x, double event_y, gpointer data)
2789#else
2800void pop_up_field_context_menu (int row_id, GtkWidget * widget, GdkEvent * event, gpointer data)
2801#endif
2802{
2803 GtkWidget * menu;
2804 gchar * str;
2805 int i, j, k, l;
2806 i = GPOINTER_TO_INT (data);
2807 str = pop_info (i, row_id);
2808 if (field_pop_actions) g_object_unref (field_pop_actions);
2809 field_pop_actions = g_simple_action_group_new ();
2810 GMenu * fmenu = g_menu_new ();
2811 GMenu * fmenus;
2812 if (str)
2813 {
2814 fmenus = g_menu_new ();
2815 append_field_item (fmenus, str, "pop", i, NULL, IMG_NONE, NULL, FALSE, NULL, NULL, FALSE, FALSE, FALSE, TRUE);
2816 g_free (str);
2817 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2818 g_object_unref (fmenus);
2819 }
2820 if (actel > 0)
2821 {
2822 str = pop_edit (i);
2823 if (str)
2824 {
2825 fmenus = g_menu_new ();
2826 append_field_item (fmenus, str, "edit-fp", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(edit_field_prop), data, FALSE, FALSE, FALSE, TRUE);
2827 g_free (str);
2828 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2829 g_object_unref (fmenus);
2830 }
2831 switch (i)
2832 {
2833 case 0:
2834 if (tmp_field -> molecules < tmp_coord -> totcoord[2] && tmp_fmol -> multi > 1)
2835 {
2836 fmenus = g_menu_new ();
2837 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);
2838 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2839 g_object_unref (fmenus);
2840 }
2841 if (tmp_field -> molecules > tmp_coord -> totcoord[3]
2842 && tmp_fmol -> mol -> multiplicity > 1
2843 && tmp_fmol -> multi < tmp_fmol -> mol -> multiplicity)
2844 {
2845 fmenus = g_menu_new ();
2846 str = g_strdup_printf ("Remove Molecule %s From Field", tmp_fmol -> name);
2847 append_field_item (fmenus, str, "rem-mol", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(remove_molecule_from_field), data, FALSE, FALSE, FALSE, TRUE);
2848 g_free (str);
2849 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2850 g_object_unref (fmenus);
2851 }
2852 break;
2853 default:
2854 if (i == 1)
2855 {
2856 j = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[i-1]));
2858 if (actel > 1)
2859 {
2860
2861 fmenus = g_menu_new ();
2862 str = g_strdup_printf ("Created New Field Atom From %s Atom(s)", tmp_fat -> name);
2863 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);
2864 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2865 g_object_unref (fmenus);
2866 }
2867 l = 0;
2868 tmp_fbt = tmp_fmol -> first_atom;
2869 for (k=0; k<tmp_fmol -> atoms; k++)
2870 {
2871 if (tmp_fbt -> sp == tmp_fat -> sp) l ++;
2872 if (tmp_fbt -> next != NULL) tmp_fbt = tmp_fbt -> next;
2873 }
2874 if (l > 1)
2875 {
2876 fmenus = g_menu_new ();
2877 str = g_strdup_printf ("Remove Atom %s From Field Molecule", tmp_fat -> name);
2878 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);
2879 g_free (str);
2880 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2881 g_object_unref (fmenus);
2882 }
2883 }
2884 str = pop_remove (i);
2885 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);
2886 g_free (str);
2887 break;
2888 }
2889 }
2890 str = pop_add (i);
2891 if (str != NULL)
2892 {
2893 fmenus = g_menu_new ();
2894 append_field_item (fmenus, str, "add-prop", i, NULL, IMG_NONE, NULL, FALSE, G_CALLBACK(add_field_prop), data, FALSE, FALSE, FALSE, TRUE);
2895 g_free (str);
2896 g_menu_append_section (fmenu, NULL, (GMenuModel *)fmenus);
2897 g_object_unref (fmenus);
2898 }
2899#ifdef GTK4
2900 menu = gtk_popover_menu_new_from_model_full ((GMenuModel *)fmenu, GTK_POPOVER_MENU_NESTED);
2901 gtk_widget_set_parent (menu, widget);
2902 // gtk_widget_set_size_request (menu, -1, i);
2903#else
2904 menu = gtk_menu_new_from_model ((GMenuModel *)fmenu);
2905#endif
2906 str = g_strdup_printf ("ff-%d", i);
2907 gtk_widget_insert_action_group (menu, str, G_ACTION_GROUP(field_pop_actions));
2908 g_free (str);
2909#ifdef GTK4
2910 pop_menu_at_pointer (menu, event_x, event_y);
2911#else
2912 pop_menu_at_pointer (menu, event);
2913#endif
2914 /* GtkWidget * prop;
2915 menu = gtk_menu_new ();
2916 if (str != NULL)
2917 {
2918 prop = create_menu_item (FALSE, str);
2919 g_free (str);
2920 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2921 if (actel > 0) add_menu_separator (menu);
2922 }
2923 if (actel > 0)
2924 {
2925 str = pop_edit (i);
2926 if (str != NULL)
2927 {
2928 prop = create_menu_item (FALSE, str);
2929 g_free (str);
2930 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2931 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(edit_field_prop), data);
2932 }
2933 switch (i)
2934 {
2935 case 0:
2936 if (tmp_field -> molecules < tmp_coord -> totcoord[2] && tmp_fmol -> multi > 1)
2937 {
2938 add_menu_separator (menu);
2939 prop = create_menu_item (FALSE, "Add New Molecule");
2940 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2941 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(add_molecule_to_field), data);
2942 }
2943 if (tmp_field -> molecules > tmp_coord -> totcoord[3]
2944 && tmp_fmol -> mol -> multiplicity > 1
2945 && tmp_fmol -> multi < tmp_fmol -> mol -> multiplicity)
2946 {
2947 add_menu_separator (menu);
2948 str = g_strdup_printf ("Remove Molecule %s From Field", tmp_fmol -> name);
2949 prop = create_menu_item (FALSE, str);
2950 g_free (str);
2951 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2952 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_molecule_from_field), (gpointer *)tmp_fmol);
2953 }
2954 break;
2955 default:
2956 if (i == 1)
2957 {
2958 j = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[i-1]));
2959 tmp_fmol = get_active_field_molecule (j);
2960 if (actel > 1)
2961 {
2962 add_menu_separator (menu);
2963 str = g_strdup_printf ("Created New Field Atom From %s Atom(s)", tmp_fat -> name);
2964 prop = create_menu_item (FALSE, str);
2965 g_free (str);
2966 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2967 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(select_atom_id_from_fied_molecule), GINT_TO_POINTER(0));
2968 }
2969 l = 0;
2970 tmp_fbt = tmp_fmol -> first_atom;
2971 for (k=0; k<tmp_fmol -> atoms; k++)
2972 {
2973 if (tmp_fbt -> sp == tmp_fat -> sp) l ++;
2974 if (tmp_fbt -> next != NULL) tmp_fbt = tmp_fbt -> next;
2975 }
2976 if (l > 1)
2977 {
2978 add_menu_separator (menu);
2979 str = g_strdup_printf ("Remove Atom %s From Field Molecule", tmp_fat -> name);
2980 prop = create_menu_item (FALSE, str);
2981 g_free (str);
2982 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2983 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_atom_from_field_molecule), (gpointer *)tmp_fat);
2984 }
2985 }
2986 str = pop_remove (i);
2987 if (str != NULL)
2988 {
2989 prop = create_menu_item (FALSE, str);
2990 g_free (str);
2991 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
2992 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(remove_field_prop), data);
2993 }
2994 break;
2995 }
2996 }
2997 str = pop_add (i);
2998 if (str != NULL)
2999 {
3000 if (actel > 0) add_menu_separator (menu);
3001 prop = create_menu_item (FALSE, str);
3002 g_free (str);
3003 gtk_menu_shell_append ((GtkMenuShell *)menu, prop);
3004 g_signal_connect (G_OBJECT(prop), "activate", G_CALLBACK(add_field_prop), data);
3005 }
3006 pop_menu_at_pointer (menu, (GdkEvent *)event);
3007#endif*/
3008}
3009
3010#ifdef GTK3
3019G_MODULE_EXPORT gboolean on_pop_up_field (GtkWidget * widget, gpointer data)
3020{
3021 pop_up_field_context_menu (row_id, widget, NULL, data);
3022 return TRUE;
3023}
3024#endif
3025
3026#ifdef GTK4
3039void field_button_event (double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
3040#else
3054void field_button_event (GdkEvent * event, double event_x, double event_y, guint event_button, guint event_type, guint32 event_time, gpointer data)
3055#endif
3056{
3057 if (event_type == GDK_BUTTON_PRESS)
3058 {
3059 GtkTreePath * path;
3060 GtkTreeViewColumn * column;
3061 int i, j, k;
3062 i = GPOINTER_TO_INT(data);
3063#ifdef GTK4
3064 int e_x, e_y;
3065 gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW(field_tree[i]), event_x, event_y, & e_x, & e_y);
3066 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(field_tree[i]), e_x, e_y, & path, & column, & j, & k);
3067#else
3068 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(field_tree[i]), event_x, event_y, & path, & column, & j, & k);
3069#endif
3070 if (path != NULL)
3071 {
3073 }
3074 else
3075 {
3076 row_id = 0;
3077 }
3078 if (event_button == 3)
3079 {
3080#ifdef GTK4
3081 pop_up_field_context_menu (row_id, field_tree[i], event_x, event_y, data);
3082#else
3083 pop_up_field_context_menu (row_id, field_tree[i], event, data);
3084#endif
3085 }
3086 }
3087}
3088
3089#ifdef GTK4
3101G_MODULE_EXPORT void on_field_button_pressed (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
3102{
3103 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);
3104}
3105
3117G_MODULE_EXPORT void on_field_button_released (GtkGesture * gesture, int n_press, double x, double y, gpointer data)
3118{
3119 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);
3120}
3121#else
3131G_MODULE_EXPORT gboolean on_field_button_event (GtkWidget * widget, GdkEvent * event, gpointer data)
3132{
3133 GdkEventButton * bevent = (GdkEventButton *)event;
3134 field_button_event (event, bevent -> x, bevent -> y, bevent -> button, bevent -> type, bevent -> time, data);
3135 return FALSE;
3136}
3137#endif
3138
3150void field_set_color (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3151{
3152 int i, j, k, l;
3153 int tree = GPOINTER_TO_INT(data);
3154 gtk_tree_model_get (mod, iter, 0, & i, -1);
3155 if (tree < SEXTERN)
3156 {
3157 if (i == 0)
3158 {
3159 gtk_tree_model_get (mod, iter, field_v[tree]+1, & i, -1);
3160 i ++;
3161 }
3162 else if (i < 0)
3163 {
3164 i = - i;
3165 }
3166 for (k=0; k<field_v[tree]; k++)
3167 {
3168 if (is_special[tree][k] == 2) break;
3169 }
3170 gtk_tree_model_get (mod, iter, k, & j, -1);
3171 l = (tree && tree < MOLIMIT) ? gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[tree-1])) : 0;
3172 k = get_field_objects (tree, l);
3173 set_renderer_color (j, renderer, init_color (i-1, k));
3174 }
3175}
3176
3188void field_set_markup_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3189{
3190 int tree = GPOINTER_TO_INT(data);
3191 gchar * str = NULL;
3192 gtk_tree_model_get (mod, iter, field_v[tree]-1, & str, -1);
3193 g_object_set (renderer, "markup", str, NULL, NULL);
3194 g_free (str);
3195}
3196
3208void field_set_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3209{
3210 int i;
3211 int tree = GPOINTER_TO_INT(data);
3212 i = (tree > 5) ? 1 : 0;
3213 if (i)
3214 {
3215 gchar * str = NULL;
3216 gtk_tree_model_get (mod, iter, field_v[tree], & str, -1);
3217 g_object_set (renderer, "markup", str, NULL, NULL);
3218 g_free (str);
3219 }
3220 else
3221 {
3222 gchar * str = NULL;
3223 GtkTreeViewColumn * cal;
3224 switch (tree)
3225 {
3226 case 0:
3227 gtk_tree_model_get (mod, iter, 3, & str, -1);
3228 break;
3229 default:
3230 // CHECK THIS
3231 cal = gtk_tree_view_get_column (GTK_TREE_VIEW(field_tree[tree]), 1);
3232 if (cal == col)
3233 {
3234 gtk_tree_model_get (mod, iter, 1, & str, -1);
3235 }
3236 else
3237 {
3238 gtk_tree_model_get (mod, iter, 2, & str, -1);
3239 }
3240 break;
3241 }
3242 g_object_set (renderer, "markup", str, NULL, NULL);
3243 g_free (str);
3244 }
3245}
3246
3258void field_set_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3259{
3260 int i, j;
3261 int tree = GPOINTER_TO_INT(data);
3262 if (tree != SEXTERN)
3263 {
3264 if (tree == 4 || tree == 5)
3265 {
3266 gtk_tree_model_get (mod, iter, 0, & j, -1);
3267 if (j < 0) j = 0;
3268 }
3269 else
3270 {
3271 for (i=0; i<field_v[tree]; i++)
3272 {
3273 if (is_special[tree][i] == 3) break;
3274 }
3275 gtk_tree_model_get (mod, iter, i, & j, -1);
3276 }
3277 gtk_cell_renderer_set_visible (renderer, j);
3278 }
3279}
3280
3292void field_set_color_and_markup (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3293{
3294 field_set_color (col, renderer, mod, iter, data);
3295 field_set_markup (col, renderer, mod, iter, data);
3296}
3297
3309void field_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3310{
3311 field_set_color (col, renderer, mod, iter, data);
3312 field_set_visible (col, renderer, mod, iter, data);
3313}
3314
3326void prop_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3327{
3328 int i;
3329 gtk_tree_model_get (mod, iter, 0, & i, -1);
3330 gtk_cell_renderer_set_visible (renderer, i);
3331 field_set_color (col, renderer, mod, iter, data);
3332}
3333
3345void pmf_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3346{
3347 field_set_color (col, renderer, mod, iter, GINT_TO_POINTER(4));
3348 int i, j, k;
3349 i = GPOINTER_TO_INT(data);
3350 if (i == 3)
3351 {
3352 gtk_tree_model_get (mod, iter, i, & j, -1);
3353 k = (! j || j < 0) ? 0 : 1;
3354 }
3355 else
3356 {
3357 gtk_tree_model_get (mod, iter, 4, & k, -1);
3358 }
3359 gtk_cell_renderer_set_visible (renderer, k);
3360}
3361
3373void rig_set_color_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3374{
3375 field_set_color (col, renderer, mod, iter, data);
3376 int i;
3377 gtk_tree_model_get (mod, iter, 0, & i, -1);
3378 if (i < 0) i = 0;
3379 gtk_cell_renderer_set_visible (renderer, ! i);
3380}
3381
3393void field_set_color_markup_and_visible (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3394{
3395 field_set_color (col, renderer, mod, iter, data);
3396 field_set_markup (col, renderer, mod, iter, data);
3397 field_set_visible (col, renderer, mod, iter, data);
3398}
3399
3411void field_set_color_markup_and_visible_box (GtkTreeViewColumn * col, GtkCellRenderer * renderer, GtkTreeModel * mod, GtkTreeIter * iter, gpointer data)
3412{
3413 field_set_color (col, renderer, mod, iter, data);
3414 field_set_markup_box (col, renderer, mod, iter, data);
3415 field_set_visible (col, renderer, mod, iter, data);
3416}
3417
3428G_MODULE_EXPORT void edit_field_cell (GtkCellRendererText * cell, gchar * path_string, gchar * new_text, gpointer data)
3429{
3430 int i, j, k, l;
3431 i = GPOINTER_TO_INT(data);
3432 if (i < 2)
3433 {
3434 j = 1;
3435 }
3436 else if (i < 6)
3437 {
3438 j = 2;
3439 }
3440 else if (i == 6)
3441 {
3442 j = 3;
3443 }
3444 else if (i < 9)
3445 {
3446 j = 4;
3447 }
3448 GtkTreeIter iter;
3449 GtkTreePath * path = gtk_tree_path_new_from_string (path_string);
3450 gtk_tree_model_get_iter (GTK_TREE_MODEL(field_model[j]), & iter, path);
3451 gtk_tree_model_get (GTK_TREE_MODEL(field_model[j]), & iter, 0, & k, -1);
3452 l = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_mol[j-1]));
3453 float val = string_to_double ((gpointer)new_text);
3454 k --;
3455 if (i == 0) get_active_atom (l, k) -> mass = val;
3456 if (i == 1) get_active_atom (l, k) -> charge = val;
3457 if (i == 2) get_active_shell (l, k) -> m = val;
3458 if (i == 3) get_active_shell (l, k) -> z = val;
3459 if (i == 4) get_active_shell (l, k) -> k2 = val;
3460 if (i == 5) get_active_shell (l, k) -> k4 = val;
3461 if (i == 6) get_active_constraint (l, k) -> length = val;
3462 if (i == 7) get_active_pmf (l, k) -> length = val;
3463 if (i == 8)
3464 {
3465 int n, m;
3466 gtk_tree_model_get (GTK_TREE_MODEL(field_model[j]), & iter, 3, & n, 4, & m, -1);
3467 if (n < 0 && m > 0)
3468 {
3469 get_active_pmf (l, k) -> weight[-n-1][m-1] = val;
3470 }
3471 }
3472 if (j < MOLIMIT) changed_mol_box (GTK_COMBO_BOX(combo_mol[j-1]), GINT_TO_POINTER(j));
3473}
3474
3483void get_field_iter_and_edit (gchar * path_string, gpointer data)
3484{
3485 int i = GPOINTER_TO_INT(data);
3486 gtk_tree_model_get_iter (GTK_TREE_MODEL(field_model[i]),
3487 & field_iter,
3488 gtk_tree_path_new_from_string (path_string));
3489 if (i == 4 || i == 5 || (i > 6 && i < MOLIMIT))
3490 {
3491 GValue vbl = {0, };
3492 if (i < 6)
3493 {
3494 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), & field_iter, 0, & vbl);
3495 }
3496 else
3497 {
3498 gtk_tree_model_get_value (GTK_TREE_MODEL(field_model[i]), & field_iter, field_v[i]+1, & vbl);
3499 }
3500 row_id = (int) g_value_get_int (& vbl);
3501 if (i < 6) row_id = abs(row_id) - 1;
3502 }
3503 edit_field_prop (g_simple_action_new ("Dummy", NULL), NULL, data);
3504}
3505
3516G_MODULE_EXPORT void to_edit_field_prop (GtkCellRenderer * cell, GtkCellEditable * editable, gchar * path_string, gpointer data)
3517{
3518 destroy_this_widget (GTK_WIDGET(editable));
3519 get_field_iter_and_edit (path_string, data);
3520}
3521
3532G_MODULE_EXPORT void on_field_row_activated (GtkTreeView * treeview, GtkTreePath * path, GtkTreeViewColumn * col, gpointer data)
3533{
3534 get_field_iter_and_edit (gtk_tree_path_to_string (path), data);
3535}
3536
3544GtkWidget * create_field_tree (int f)
3545{
3546 int i, j, k, l, m;
3547 gchar * str;
3548 GtkListStore * list_store_combo;
3549 GtkTreeIter iter;
3550 gboolean combox = FALSE;
3551
3552 l = (f > 5) ? 1 : 0;
3553 m = 0;
3554 field_model[f] = gtk_tree_store_newv (field_v[f]+l+field_a[f], col_type[f]);
3555 field_tree[f] = gtk_tree_view_new_with_model(GTK_TREE_MODEL(field_model[f]));
3556 for (i=0; i<field_v[f]+l; i++)
3557 {
3558 if (is_special[f][i] == 1)
3559 {
3560 k = f-5;
3561 field_renderer[f][i] = gtk_cell_renderer_combo_new();
3562 list_store_combo = gtk_list_store_new (1, G_TYPE_STRING);
3563 for (j=0; j<fetypes[activef][k]; j++)
3564 {
3565 str = g_strdup_printf ("%s (%s)", fnames[activef][k][j], exact_name(fkeysw[activef][k][j]));
3566 gtk_list_store_append (list_store_combo, & iter);
3567 gtk_list_store_set (list_store_combo, & iter, 0, str, -1);
3568 g_free (str);
3569 }
3570 g_object_set (field_renderer[f][i], "model", list_store_combo,
3571 "text-column", 0,
3572 "has-entry", FALSE,
3573 "editable", TRUE, NULL);
3574 g_signal_connect (G_OBJECT(field_renderer[f][i]), "changed", G_CALLBACK(changed_field_key_renderer), GINT_TO_POINTER(f));
3575 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i], field_renderer[f][i], "text", i, NULL);
3576 g_object_unref (list_store_combo);
3577 combox = TRUE;
3578 }
3579 else if (combox)
3580 {
3581 field_renderer[f][i] = gtk_cell_renderer_text_new();
3582 field_col[f][i] = gtk_tree_view_column_new_with_attributes ("Parameter(s)", field_renderer[f][i], "text", i, NULL);
3583 m = 1;
3584 combox = FALSE;
3585 }
3586 else if (is_special[f][i] > 1 && is_special[f][i] < 4)
3587 {
3588 field_renderer[f][i] = gtk_cell_renderer_toggle_new ();
3589 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i-m], field_renderer[f][i], "active", i, NULL);
3590 g_signal_connect (G_OBJECT(field_renderer[f][i]), "toggled",
3592 & tmp_view -> colorp[f][is_special[f][i]-2]);
3593 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);
3594 gtk_tree_view_column_set_clickable (field_col[f][i], TRUE);
3595 if (f != SEXTERN)
3596 {
3597 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]);
3598 }
3599 }
3600 else
3601 {
3602 field_renderer[f][i] = gtk_cell_renderer_text_new();
3603 field_col[f][i] = gtk_tree_view_column_new_with_attributes (ctitle[f][i-m], field_renderer[f][i], "text", i, NULL);
3604 }
3605
3606 if (is_special[f][i] == 4)
3607 {
3608 g_object_set (field_renderer[f][i], "editable", TRUE, NULL);
3609 if (f < 3)
3610 {
3611 j = 2*(f-1) + i - 3;
3612 }
3613 else if (f == 3)
3614 {
3615 j = 6;
3616 }
3617 else if (f == 4)
3618 {
3619 j = (i == 1) ? 7 : 8;
3620 }
3621 g_signal_connect (G_OBJECT(field_renderer[f][i]), "edited", G_CALLBACK(edit_field_cell), GINT_TO_POINTER(j));
3622 }
3623 if ((f == 0 && i == 3) || (f == 2 && (i == 1 || i == 2)) || (f == 3 && (i == 1 || i == 2)))
3624 {
3625 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);
3626 }
3627 else if (f == 4 || f == 5)
3628 {
3629 if ((f == 4 && i < 3) || (f == 5 && i < 2))
3630 {
3631 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);
3632 }
3633 else if (f == 4 && (i == 3 || i == 4 || i == 5))
3634 {
3635 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);
3636 }
3637 else if (f == 5 && i == 2)
3638 {
3639 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);
3640 }
3641 else
3642 {
3643 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_visible, GINT_TO_POINTER(f), NULL);
3644 }
3645 }
3646 else if (f > 6 && f < MOLIMIT && (i == 0 || i == struct_id(f)+1))
3647 {
3648 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);
3649 }
3650 else if (l == 1 && i > field_v[f]-2)
3651 {
3652 if (i == field_v[f]-1)
3653 {
3654 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);
3655 }
3656 else if (i == field_v[f])
3657 {
3658 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);
3659 g_object_set (field_renderer[f][i], "editable", TRUE, NULL);
3660 g_signal_connect (G_OBJECT(field_renderer[f][i]), "editing-started", G_CALLBACK(to_edit_field_prop), GINT_TO_POINTER(f));
3661 }
3662 }
3663 else if (is_special[f][i] < 2 || is_special[f][i] > 3)
3664 {
3665 gtk_tree_view_column_set_cell_data_func (field_col[f][i], field_renderer[f][i], field_set_color, GINT_TO_POINTER(f), NULL);
3666 }
3667 gtk_tree_view_column_set_alignment (field_col[f][i], 0.5);
3668 gtk_tree_view_append_column(GTK_TREE_VIEW(field_tree[f]), field_col[f][i]);
3669 }
3670
3671 fill_field_model (field_model[f], f, 0);
3672 g_object_unref (field_model[f]);
3673 GtkTreeSelection * fieldselect = gtk_tree_view_get_selection (GTK_TREE_VIEW(field_tree[f]));
3674 gtk_tree_selection_set_mode (fieldselect, GTK_SELECTION_SINGLE);
3675#ifdef GTK4
3676 add_widget_gesture_and_key_action (field_tree[f], "field-button-pressed", G_CALLBACK(on_field_button_pressed), GINT_TO_POINTER(f),
3677 "field-button-released", G_CALLBACK(on_field_button_released), GINT_TO_POINTER(f),
3678 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
3679#else
3680 g_signal_connect (G_OBJECT(field_tree[f]), "button_press_event", G_CALLBACK(on_field_button_event), GINT_TO_POINTER(f));
3681 g_signal_connect (G_OBJECT(field_tree[f]), "popup-menu", G_CALLBACK(on_pop_up_field), GINT_TO_POINTER(f));
3682 g_signal_connect (G_OBJECT(field_tree[f]), "row-activated", G_CALLBACK(on_field_row_activated), GINT_TO_POINTER(f));
3683#endif
3684 return field_tree[f];
3685}
3686
3695void create_field_list (GtkWidget * vbx, int f)
3696{
3697 int i;
3698 field_tree[f] = NULL;
3699 field_model[f] = NULL;
3700 for (i=0; i<11; i++)
3701 {
3702 field_renderer[f][i] = NULL;
3703 field_col[f][i] = NULL;
3704 }
3705 GtkWidget * scrollsets = create_scroll (NULL, -1, -1, GTK_SHADOW_ETCHED_IN);
3706 if (f == 0)
3707 {
3708 gtk_widget_set_size_request (scrollsets, field_s[f], 175);
3709 }
3710 else if (f < MOLIMIT)
3711 {
3712 if (f == 1)
3713 {
3714 gtk_widget_set_size_request (scrollsets, field_s[f], 320);
3715 }
3716 else if (f == 8 || f == 10 || f == 12 || f == 13)
3717 {
3718 gtk_widget_set_size_request (scrollsets, field_s[f], 180);
3719 }
3720 else
3721 {
3722 gtk_widget_set_size_request (scrollsets, field_s[f], 220);
3723 }
3724 }
3725 else
3726 {
3727 gtk_widget_set_size_request (scrollsets, field_s[f], 300);
3728 }
3730 GtkWidget * hbox = create_hbox (0);
3731 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, scrollsets, FALSE, FALSE, (800-field_s[f])/2);
3732 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, hbox, FALSE, FALSE, 20);
3733}
3734
3742GtkWidget * create_mol_box (int f)
3743{
3744 GtkWidget * hbox;
3745 hbox = create_hbox (0);
3746 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label("Please select molecule: ", -1, -1, 0.0, 0.5), FALSE, FALSE, 100);
3747 combo_mol[f] = create_combo_mol (f);
3748 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, combo_mol[f], FALSE, FALSE, 10);
3749 return hbox;
3750}
3751
3759GtkWidget * vbox_field (int f)
3760{
3761 gchar * str;
3762 GtkWidget * vbx;
3763 GtkWidget * hbx;
3764 GtkWidget * vbox;
3765 GtkWidget * hbox;
3766 vbox = create_vbox (5);
3767 if (f > 6 && f < MOLIMIT)
3768 {
3769 hbx = create_hbox (0);
3770 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbx, FALSE, FALSE, 0);
3771 vbx = create_vbox (BSEP);
3772 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, vbx, FALSE, FALSE, 0);
3773 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbx, gtk_image_new_from_file(ifield[f-7]), FALSE, FALSE, 50);
3774 }
3775 if (f == 0)
3776 {
3777 hbox = fbox (vbox, "Number of isolated molecular fragments: ");
3778 str = g_strdup_printf ("<b>%d</b>", tmp_coord -> totcoord[2]);
3779 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 75);
3780 g_free (str);
3781 str = g_strdup_printf ("\tEach of these fragments can be described separately in the force field.");
3782 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 5);
3783 g_free (str);
3784 hbox = fbox (vbox, "Number of distinct molecules: ");
3785 str = g_strdup_printf ("<b>%d</b>", tmp_coord -> totcoord[3]);
3786 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 75);
3787 g_free (str);
3788 hbox = fbox (vbox, "Number of molecules in the force field: ");
3790 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, mol_num_label, FALSE, FALSE, 75);
3791 }
3792 else if (f < MOLIMIT)
3793 {
3794 // if f > 0, ie. atoms tab at least
3795 // need a combobox to pick the 'active' molecule and its corresponding force field
3796 // If using molecules the combo box is active, and visible
3797 // Otherwise deactivate and hide the combo box
3798 // Anyway fill the treestore according to the selection
3799
3800 mol_box[f-1] = create_mol_box (f-1);
3801 if (f > 6 && f < MOLIMIT)
3802 {
3803 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, mol_box[f-1], FALSE, FALSE, 0);
3804 }
3805 else
3806 {
3807 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, mol_box[f-1], FALSE, FALSE, 0);
3808 }
3810 }
3811
3812 if (f > 6 && f < MOLIMIT)
3813 {
3814 hbox = fbox (vbx, g_strdup_printf ("%s(s) properties: ", felemts[f+1]));
3815 }
3816 else
3817 {
3818 hbox = fbox (vbox, g_strdup_printf ("%s(s) properties: ", felemts[f+1]));
3819 }
3820 if (f > 0)
3821 {
3822 field_label[f] = markup_label(set_field_label(f, 0), 120, 40, 0.35, 0.5);
3823 hbox = create_hbox (0);
3824 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, field_label[f], TRUE, TRUE, 0);
3825 if (f > 6 && f < MOLIMIT)
3826 {
3827 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbx, hbox, FALSE, FALSE, 10);
3828 }
3829 else
3830 {
3831 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, hbox, FALSE, FALSE, 10);
3832 }
3833 }
3835 if (f > 6 && f < MOLIMIT)
3836 {
3837 if (f == 8 || f == 10 || f == 12 || f == 13)
3838 {
3839 int g = (f < 12) ? f - 1 : 11;
3840 str = g_strdup_printf ("\t <b>*</b> in the FIELD file %s(s) appear in the %s section.\n"
3841 "\t They are presented separately in this assistant for clarity purposes only.",
3842 elemts[f], elemts[g]);
3843 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3844 g_free (str);
3845 }
3846 else if (f == 14)
3847 {
3848 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.");
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 }
3852 str = g_strdup_printf ("\t <b>(1)</b> average value for the force field element as measured in the model.");
3853 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3854 g_free (str);
3855 str = g_strdup_printf ("\t <b>(2)</b> only the selected element(s) will be used to create the force field.");
3856 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3857 g_free (str);
3858 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.");
3859 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3860 g_free (str);
3861
3862 }
3863 else if (f == 2)
3864 {
3865 cs_label[0] = markup_label(" ", -1, -1, 0.0, 0.5);
3866 cs_label[1] = markup_label(" ", -1, -1, 0.0, 0.5);
3867 setup_cs_labels (tmp_field -> energy_unit);
3868 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, cs_label[0], FALSE, FALSE, 0);
3869 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, cs_label[1], FALSE, FALSE, 0);
3870 str = g_strdup_printf ("\t <b>(3)</b> only the selected element(s) will be used to create the force field.");
3871 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3872 g_free (str);
3873 }
3874 else if (f == 3)
3875 {
3876 str = g_strdup_printf ("\t <b>(1)</b> average value for the force field element as measured in the model.");
3877 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3878 g_free (str);
3879 str = g_strdup_printf ("\t <b>(2)</b> only the selected element(s) will be used to create the force field.");
3880 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3881 g_free (str);
3882 }
3883 else if (f == 4)
3884 {
3885 str = g_strdup_printf ("\t <b>(1)</b> average distance between the barycenters of units 1 and 2 as measured in the model.");
3886 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3887 g_free (str);
3888 str = g_strdup_printf ("\t <b>(2)</b> if all 0.0 then atomic weight(s) will be used by DL-POLY.");
3889 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3890 g_free (str);
3891 str = g_strdup_printf ("\t <b>(3)</b> only the selected element(s) will be used to create the force field.");
3892 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3893 g_free (str);
3894 }
3895 else if ((f > 2 && f < 7) || f > 11)
3896 {
3897 str = g_strdup_printf ("\t <b>(1)</b> only the selected element(s) will be used to create the force field.");
3898 add_box_child_start (GTK_ORIENTATION_VERTICAL, vbox, markup_label(str, -1, -1, 0.0, 0.5), FALSE, FALSE, 0);
3899 g_free (str);
3900 }
3901 return vbox;
3902}
3903
3904GtkWidget * field_i_prep[2];
3905GtkWidget * field_i_box[2];
3906GtkWidget * field_i_lab[2];
3907GtkWidget * field_i_fixed[2];
3908GtkWidget * field_i_combo[2];
3909GtkWidget * field_i_obj[2];
3910GtkWidget * preview_but;
3914
3922void close_the_assistant (GtkAssistant * assistant)
3923{
3925 int j;
3926#ifdef GTK3
3927 // GTK3 Menu Action To Check
3928 gboolean i = (tmp_proj -> force_field[activef]) ? TRUE : FALSE;
3929 widget_set_sensitive (tmp_view -> color_styles[5], i);
3930 widget_set_sensitive (tmp_view -> color_styles[5+ATOM_MAPS], i);
3931#endif
3932 field_color = FALSE;
3933 for (j=0; j<2; j++)
3934 {
3935 tmp_view -> anim -> last -> img -> labels_format[j] = saved_label_format[j];
3936 tmp_view -> anim -> last -> img -> labels_position[j] = saved_label_position[j];
3937 }
3939/*
3940 tmp_fmol = tmp_field -> first_molecule;
3941 for (j=0; j<tmp_field -> molecules; j++)
3942 {
3943 g_debug ("FIELD_CANCEL:: Mol= %d, show= %d, show_id= %d", j, tmp_fmol -> show, tmp_fmol -> show_id);
3944 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
3945 }
3946*/
3947 // restore selection if any from calc.c
3949 mol_num_label = NULL;
3950 tmp_field = NULL;
3951 tmp_view = NULL;
3952 if (! assist_init)
3953 {
3954 if (tmp_proj -> force_field[activef])
3955 {
3956 g_free (tmp_proj -> force_field[activef]);
3957 tmp_proj -> force_field[activef] = NULL;
3958 }
3959 }
3960}
3961
3970G_MODULE_EXPORT void on_assistant_cancel (GtkAssistant * assistant, gpointer data)
3971{
3972 close_the_assistant (assistant);
3973}
3974
3975#ifdef GTK4
3984G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWindow * assistant, gpointer data)
3985#else
3995G_MODULE_EXPORT gboolean on_assistant_cancel_event (GtkWidget * assistant, GdkEvent * event, gpointer data)
3996#endif
3997{
3998 on_assistant_cancel (((GtkAssistant *)assistant), data);
3999 return TRUE;
4000}
4001
4010G_MODULE_EXPORT void on_assistant_close (GtkAssistant * assistant, gpointer data)
4011{
4012 close_the_assistant (assistant);
4013}
4014
4023G_MODULE_EXPORT gint on_assistant_go_forward (gint current_page, gpointer data)
4024{
4025 int i, j;
4026 j = -1;
4027 switch (current_page)
4028 {
4029 case 0:
4030 j = 1;
4031 if (! tmp_field -> prepare_file[0])
4032 {
4033 j = MAXDATC+1;
4034 if (! tmp_field -> prepare_file[1]) j += MAXDATA+2;
4035 }
4036 return j;
4037 break;
4038 case MAXDATC+MAXDATA+2:
4039 return -1;
4040 break;
4041 default:
4042 if (current_page > MAXDATC-1 && tmp_field -> prepare_file[1])
4043 {
4044 for (i=current_page-1; i<MAXDATC+MAXDATA; i++)
4045 {
4046 if (tmp_field -> afp[i])
4047 {
4048 j = i+2;
4049 break;
4050 }
4051 }
4052 }
4053 else if (tmp_field -> prepare_file[0])
4054 {
4055 for (i=current_page; i<MAXDATC; i++)
4056 {
4057 if (tmp_field -> afp[i])
4058 {
4059 j = i+1;
4060 break;
4061 }
4062 }
4063 }
4064 if (j == -1) j = MAXDATC+MAXDATA+2;
4065 return j;
4066 break;
4067 }
4068}
4069
4079G_MODULE_EXPORT void on_assistant_prepare (GtkAssistant * assistant, GtkWidget * page, gpointer data)
4080{
4081 int i, j, k;
4082 i = gtk_assistant_get_current_page (assistant);
4084 switch (i)
4085 {
4086 case 0:
4087 // if (is_the_widget_visible(preview_but)) hide_the_widgets (preview_but);
4088 break;
4089 case 1:
4090 // if (! is_the_widget_visible(preview_but)) show_the_widgets (preview_but);
4091 break;
4092 case MAXDATC+MAXDATA+2:
4093 break;
4094 default:
4095 j = field_object = i-2-MAXDATC;
4096 toviz.c = 1;
4097 switch (j)
4098 {
4099 case 0:
4100 tmp_fmol = tmp_field -> first_molecule;
4101 for (k=0; k<tmp_field -> molecules; k++)
4102 {
4103 if (tmp_fmol -> show) visualize_object (j, k, -1);
4104 if (tmp_fmol -> show_id) visualize_object (-1, k, -1);
4105 if (tmp_fmol -> next != NULL) tmp_fmol = tmp_fmol -> next;
4106 }
4107 break;
4108 default:
4109 if (j > -1 && j < SEXTERN) check_to_visualize_properties (j);
4110 break;
4111 }
4112 break;
4113 }
4115}
4116
4127void hide_show_this_pages (int start, int end, int status, int delta)
4128{
4129 int i;
4130 for (i=start; i<end; i++)
4131 {
4132 if (fibox[i+delta] != NULL)
4133 {
4134 if (GTK_IS_WIDGET(fibox[i+delta]))
4135 {
4136 gtk_widget_set_visible (fibox[i+delta], (status) ? tmp_field -> afp[i] : status);
4137 }
4138 }
4139 }
4140}
4141
4148{
4149 int i;
4150 GtkAssistant * assist = GTK_ASSISTANT(field_assistant);
4152 for (i=MAXDATC+MAXDATA+1; i>-1; i--)
4153 {
4154 gtk_assistant_remove_page (assist, i+1);
4156 }
4157}
4158
4168G_MODULE_EXPORT void run_clean_field (GtkDialog * dial, gint response_id, gpointer data)
4169{
4170 if (response_id == GTK_RESPONSE_APPLY)
4171 {
4172 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant),
4173 gtk_assistant_get_nth_page(GTK_ASSISTANT (field_assistant), 0), FALSE);
4174 gtk_label_set_text (GTK_LABEL(field_i_lab[1]), "Initialize force field using: ");
4175 int i;
4176 for (i=0; i<2; i++)
4177 {
4178 gtk_combo_box_set_active (GTK_COMBO_BOX(field_i_combo[i]), -1);
4179 //tmp_field -> prepare_file[i] = TRUE;
4186 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_obj[i], TRUE, TRUE, 25);
4187 }
4188 for (i=0; i<MAXDATC+MAXDATA+2; i++)
4189 {
4190 if (fibox[i] != NULL)
4191 {
4192 if (GTK_IS_WIDGET(fibox[i]))
4193 {
4194 gtk_widget_set_visible (fibox[i], FALSE);
4195 }
4196 }
4197 }
4199 for (i=0; i<19; i++)
4200 {
4201#ifdef GTK4
4202 gtk_check_button_set_active (GTK_CHECK_BUTTON(ff_but[i]), afp_init[i+MAXDATC+2]);
4203#else
4204 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ff_but[i]), afp_init[i+MAXDATC+2]);
4205#endif
4206 }
4208#ifdef GTK4
4209 gtk_check_button_set_active (GTK_CHECK_BUTTON(data), FALSE);
4210#else
4211 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(data), FALSE);
4212#endif
4213 assist_init = FALSE;
4214 }
4215 destroy_this_dialog (dial);
4216}
4217
4218#ifdef GTK4
4227G_MODULE_EXPORT void clean_field (GtkCheckButton * but, gpointer data)
4228#else
4237G_MODULE_EXPORT void clean_field (GtkToggleButton * but, gpointer data)
4238#endif
4239{
4240#ifdef GTK4
4241 if (gtk_check_button_get_active (but))
4242#else
4243 if (gtk_toggle_button_get_active (but))
4244#endif
4245 {
4246 GtkWidget * dial = dialog_cancel_apply ("Clean all force field parameter(s) ?", field_assistant, FALSE);
4247 GtkWidget * box = dialog_get_content_area (dial);
4248 gtk_box_set_homogeneous (GTK_BOX(box), FALSE);
4249 add_box_child_start (GTK_ORIENTATION_VERTICAL, box, gtk_label_new ("Providing that the force field information was already saved once\n"
4250 "the previous data could still be retrieved by canceling the assistant."), FALSE, FALSE, 0);
4251 run_this_gtk_dialog (dial, G_CALLBACK(run_clean_field), but);
4252 }
4253}
4254
4255#ifdef GTK4
4264G_MODULE_EXPORT void select_field_action (GtkCheckButton * but, gpointer data)
4265#else
4274G_MODULE_EXPORT void select_field_action (GtkToggleButton * but, gpointer data)
4275#endif
4276{
4277 int i, j;
4278 i = GPOINTER_TO_INT(data);
4279#ifdef GTK4
4280 tmp_field -> prepare_file[i] = gtk_check_button_get_active (but);
4281#else
4282 tmp_field -> prepare_file[i] = gtk_toggle_button_get_active (but);
4283#endif
4284 if (i == 1)
4285 {
4286 for (j=0; j<2; j++)
4287 {
4288 widget_set_sensitive (field_i_lab[j], (tmp_field -> prepare_file[i] && ! assist_init) ? TRUE : FALSE);
4289 widget_set_sensitive (field_i_combo[j], (tmp_field -> prepare_file[i] && ! assist_init) ? TRUE : FALSE);
4290 }
4291 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4292 }
4293 else
4294 {
4295 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4296 }
4297}
4298
4307{
4308 int i;
4309 gchar * info;
4310 GtkAssistant * assist = GTK_ASSISTANT(field_assistant);
4311 // Control file
4312 for (i=0; i<MAXDATC; i++)
4313 {
4314 fibox[i] = vbox_control (i);
4315 gtk_assistant_append_page (assist, fibox[i]);
4316 gtk_assistant_set_page_title (assist, fibox[i], g_strdup_printf ("%s", celemts[i]));
4317 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4318 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4319 }
4320
4321 // Field file
4322 i = MAXDATC;
4323 fibox[i] = vbox_init (p);
4324 gtk_assistant_append_page (assist, fibox[i]);
4325 gtk_assistant_set_page_title (assist, fibox[i], "Select the component(s) of the force field");
4326 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4327 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4328 for (i=MAXDATC+1; i<MAXDATC+MAXDATA+1; i++)
4329 {
4330 fibox[i] = vbox_field (i-MAXDATC-1);
4331 gtk_assistant_append_page (assist, fibox[i]);
4332 gtk_assistant_set_page_title (assist, fibox[i], g_strdup_printf ("%s(s)", felemts[i-MAXDATC]));
4333 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONTENT);
4334 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4335 }
4336 i = MAXDATC+MAXDATA+1;
4337 fibox[i] = create_vbox (BSEP);
4338
4339 info = g_strdup_printf ("<b> Finalize the creation of the %s input file(s) now !</b>", (activef) ? "LAMMPS" : "DL-POLY");
4340 add_box_child_start (GTK_ORIENTATION_VERTICAL, fibox[i], markup_label(info, -1, -1, 0.5, 0.5), TRUE, TRUE, 100);
4341 g_free (info);
4342 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),
4343 FALSE, FALSE, 0);
4344 gtk_assistant_append_page (assist, fibox[i]);
4345 gtk_assistant_set_page_title (assist, fibox[i], (activef) ? "Create the LAMMPS input file(s) now !" : "Create the DL-POLY input file(s) now !");
4346 gtk_assistant_set_page_type (assist, fibox[i], GTK_ASSISTANT_PAGE_CONFIRM);
4347 gtk_assistant_set_page_complete (assist, fibox[i], TRUE);
4348 gtk_assistant_update_buttons_state (assist);
4349 append_pages = TRUE;
4350}
4351
4352gchar * field_init[3]={"Atomic species as field atom(s)",
4353 "Atomic species and total coordination(s) as field atom(s)",
4354 "Atomic species and partial coordination(s) as field atom(s)"};
4355
4356// gboolean create_ff_structure (gpointer data)
4365void create_ff_structure (int ai, int type)
4366{
4367 int i;
4368 //if (append_pages) remove_classical_assistant_pages ();
4369 tmp_proj -> force_field[activef] = create_force_field_data_structure (ai);
4370 tmp_proj -> force_field[activef] -> type = type;
4371 tmp_field = tmp_proj -> force_field[activef];
4372 for (i=0; i<MAXDATC+MAXDATA; i++) tmp_field -> afp[i] = afp_init[i];
4373 for (i=0; i<2; i++)
4374 {
4376 if (activef && ! i)
4377 {
4379 tmp_field -> prepare_file[i] = FALSE;
4380 }
4381 else
4382 {
4383#ifdef GTK4
4384 tmp_field -> prepare_file[i] = gtk_check_button_get_active (GTK_CHECK_BUTTON(field_i_prep[i]));
4385#else
4386 tmp_field -> prepare_file[i] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(field_i_prep[i]));
4387#endif
4388 }
4390 }
4391 // for (i=13; i<19; i++) widget_set_sensitive (ff_but[i], set_nbd_but_sensitive (i));
4397 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[1], field_i_obj[1], TRUE, TRUE, 25);
4398 gtk_label_set_text (GTK_LABEL(field_i_lab[1]), "Force field was initialized using: ");
4399 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant),
4400 gtk_assistant_get_nth_page(GTK_ASSISTANT (field_assistant), 0), TRUE);
4402 if (tmp_field -> md_opts[1] == 0.0) hide_the_widgets (extra_vbox[1]);
4403 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4404 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4405 // return FALSE;
4406}
4407
4416G_MODULE_EXPORT void changed_init_box (GtkComboBox * box, gpointer data)
4417{
4418 int i, j;
4419 i = GPOINTER_TO_INT(data);
4420 j = gtk_combo_box_get_active (box);
4421 if (j > -1)
4422 {
4423 switch (i)
4424 {
4425 case 0:
4426 tmp_field -> type = j;
4428 if (tmp_field -> type == j)
4429 {
4432 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[0], field_i_obj[0], TRUE, TRUE, 25);
4434 }
4435 else
4436 {
4437 gtk_combo_box_set_active (box, -1);
4438 }
4439 break;
4440 case 1:
4441 if (tmp_field -> type > -1)
4442 {
4446 field_i_obj[1] = gtk_spinner_new ();
4448 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[1], field_i_obj[1], TRUE, TRUE, 25);
4450 gtk_spinner_start (GTK_SPINNER(field_i_obj[1]));
4451 // gdk_threads_add_idle (create_ff_structure, GINT_TO_POINTER(j));
4452 create_ff_structure (j, tmp_field -> type);
4453 assist_init = TRUE;
4454 }
4455 else
4456 {
4457 show_warning ("Please select the force field first !", field_assistant);
4458 }
4459 break;
4460 }
4461 }
4462}
4463
4472G_MODULE_EXPORT void show_force_field_preview (GtkButton * but, gpointer data)
4473{
4474 GtkWidget * preview = (activef) ? dialogmodal ("LAMMPS files preview", GTK_WINDOW(field_assistant)) : dialogmodal ("DL-POLY files preview", GTK_WINDOW(field_assistant));
4475 GtkWidget * notebook = gtk_notebook_new ();
4476 GtkWidget * scrollsets;
4477 GtkWidget * aview;
4478 gchar * ff_files[2][3] = {{"CONTROL", "FIELD" , "CONFIG"}, {"LAMMPS.IN", "LAMMPS.DATA", ""}};
4479 int num_files[2] = {3, 2};
4480 int i;
4481 for (i=0; i<num_files[activef]; i++)
4482 {
4483 if ((i==0 && tmp_field -> prepare_file[0]) || (i > 0 && tmp_field -> prepare_file[1]))
4484 {
4485 scrollsets = create_scroll (NULL, 700, 350, GTK_SHADOW_ETCHED_IN);
4486 aview = create_text_view (-1, -1, 0, 1, NULL, NULL, NULL);
4488 if (! activef)
4489 {
4490 switch (i)
4491 {
4492 case 0:
4493 print_dlp_control (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4494 break;
4495 case 1:
4496 print_dlp_field (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4497 break;
4498 case 2:
4499 print_dlp_config (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4500 break;
4501 }
4502 }
4503 else
4504 {
4505 switch (i)
4506 {
4507 case 0:
4508
4509 break;
4510 case 1:
4511 print_lammps_atom_file (gtk_text_view_get_buffer(GTK_TEXT_VIEW(aview)));
4512 break;
4513 }
4514 }
4515 gtk_notebook_append_page (GTK_NOTEBOOK(notebook), scrollsets, gtk_label_new (ff_files[activef][i]));
4516 }
4517 }
4518 add_box_child_start (GTK_ORIENTATION_VERTICAL, dialog_get_content_area (preview), notebook, FALSE, FALSE, 0);
4519 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);
4520 run_this_gtk_dialog (preview, G_CALLBACK(run_destroy_dialog), NULL);
4521}
4522
4523#ifdef GTK4
4533G_MODULE_EXPORT void run_on_assistant_apply (GtkNativeDialog * info, gint response_id, gpointer data)
4534{
4535 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkFileChooserNative *)info);
4536#else
4546G_MODULE_EXPORT void run_on_assistant_apply (GtkDialog * info, gint response_id, gpointer data)
4547{
4548 GtkFileChooser * chooser = GTK_FILE_CHOOSER((GtkWidget *)info);
4549#endif
4550 int i;
4551 GtkTextBuffer * buffer;
4552 GtkTextIter bStart;
4553 GtkTextIter bEnd;
4554 GError * err = NULL;
4555 gboolean result = FALSE;
4556 gchar * ff_files[2][3] = {{"CONTROL", "FIELD" , "CONFIG"}, {"LAMMPS.IN", "LAMMPS.DATA", ""}};
4557 int num_files[2] = {3, 2};
4558 if (response_id == GTK_RESPONSE_ACCEPT)
4559 {
4560 gchar * direname = file_chooser_get_current_folder (chooser);
4561 if (direname != NULL)
4562 {
4563 gchar * filename;
4564 gchar * str;
4565 gboolean doit[3];
4566 for (i=0; i<num_files[activef]; i++)
4567 {
4568 if ((i==0 && tmp_field -> prepare_file[0]) || (i > 0 && tmp_field -> prepare_file[1]))
4569 {
4570 filename = g_strdup_printf ("%s/%s", direname, ff_files[activef][i]);
4571 if (g_file_test(filename, G_FILE_TEST_EXISTS))
4572 {
4573 str = g_strdup_printf ("%s file found in '%s'\nreplace existing %s file ?", ff_files[activef][i], direname, ff_files[activef][i]);
4574 doit[i] = ask_yes_no ("Replace file ?", str, GTK_MESSAGE_QUESTION, field_assistant);
4575 g_free (str);
4576 }
4577 else
4578 {
4579 doit[i] = TRUE;
4580 }
4581 }
4582 else
4583 {
4584 doit[i] = FALSE;
4585 }
4586 }
4587 for (i=0; i<num_files[activef]; i++)
4588 {
4589 buffer = add_buffer (NULL, NULL, NULL);
4590 if (doit[i])
4591 {
4592 filename = g_strdup_printf ("%s/%s", direname, ff_files[activef][i]);
4593 switch (i)
4594 {
4595 case 0:
4596 print_dlp_control (buffer);
4597 break;
4598 case 1:
4599 print_dlp_field (buffer);
4600 break;
4601 case 2:
4602 print_dlp_config (buffer);
4603 break;
4604 }
4605 gtk_text_buffer_get_start_iter (buffer, & bStart);
4606 gtk_text_buffer_get_end_iter (buffer, & bEnd);
4607 gchar * text = gtk_text_buffer_get_text (buffer, & bStart, & bEnd, FALSE);
4608 gtk_text_buffer_set_modified (buffer, FALSE);
4609 result = g_file_set_contents (filename, text, -1, & err);
4610 g_free (text);
4611 g_object_unref (buffer);
4612 if (! result && err)
4613 {
4614 show_error (g_strdup_printf ("Error while saving input file: %s\n Error: %s", filename, err -> message), 0, field_assistant);
4615 g_error_free (err);
4616 }
4617 g_free (filename);
4618 }
4619 }
4620 g_free (direname);
4621 }
4622 }
4623#ifdef GTK4
4625#else
4626 destroy_this_dialog (info);
4627#endif
4628}
4629
4638void on_assistant_apply (GtkAssistant * assistant, gpointer data)
4639{
4640 gchar * text;
4641#ifdef GTK4
4642 GtkFileChooserNative * info;
4643#else
4644 GtkWidget * info;
4645#endif
4646 gchar * ff_type[2] = {"DL-POLY", "LAMMPS"};
4647
4648 text = g_strdup_printf ("Saving %s input file(s)", ff_type[activef]);
4649 info = create_file_chooser (text,
4650 GTK_WINDOW(assistant),
4651 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
4652 "Save");
4653 g_free (text);
4654#ifdef GTK4
4655 run_this_gtk_native_dialog ((GtkNativeDialog *)info, G_CALLBACK(run_on_assistant_apply), NULL);
4656#else
4657 run_this_gtk_dialog (info, G_CALLBACK(run_on_assistant_apply), NULL);
4658 // GTK3 Menu Action To Check
4659 gboolean i = (tmp_proj -> force_field[activef]) ? TRUE : FALSE;
4660 widget_set_sensitive (tmp_view -> color_styles[5], i);
4661 widget_set_sensitive (tmp_view -> color_styles[5+ATOM_MAPS], i);
4662#endif
4663}
4664
4674{
4675 field_assistant = gtk_assistant_new ();
4676 gtk_widget_set_size_request (field_assistant, 800, 600);
4677 int i, j, k;
4678 activef = f;
4679 field_color = TRUE;
4680 field_object = -1;
4681 selected_aspec = -1;
4684 tmp_coord = tmp_proj -> coord;
4685 tmp_view = tmp_proj -> modelgl;
4686 tmp_fmol = NULL;
4687 tmp_fmol = g_malloc0 (sizeof*tmp_fmol);
4688 gchar * field_type[2] = {"DL-POLY 4", "LAMMPS"};
4689
4690 // Preparing data structure and pointers
4691 append_pages = FALSE;
4692 if (tmp_proj -> force_field[activef] == NULL)
4693 {
4694 assist_init = FALSE;
4695 tmp_proj -> force_field[activef] = g_malloc0 (sizeof*tmp_proj -> force_field[activef]);
4696 tmp_proj -> force_field[activef] -> type = -1;
4697 tmp_proj -> force_field[activef] -> atom_init = -1;
4698 for (i=0; i<2; i++) tmp_proj -> force_field[activef] -> prepare_file[i] = TRUE;
4699 if (activef) tmp_proj -> force_field[activef] -> prepare_file[0] = FALSE;
4700 }
4701 else
4702 {
4703 assist_init = TRUE;
4704 if (tmp_proj -> force_field[activef] -> type > -1) setup_this_force_field (tmp_proj -> force_field[activef] -> type);
4705 //tmp_field = duplicate_dlpoly_field (tmp_proj -> force_field[activef]);
4706 }
4707 tmp_field = tmp_proj -> force_field[activef];
4708
4709 gtk_window_set_resizable (GTK_WINDOW (field_assistant), FALSE);
4710 gtk_window_set_modal (GTK_WINDOW (field_assistant), TRUE);
4711 gchar * info = g_strdup_printf ("%s calculation assistant", field_type[f]);
4712 gtk_window_set_title (GTK_WINDOW(field_assistant), info);
4713 g_free (info);
4714
4715 GtkWidget * intro = create_vbox (BSEP);
4716 info = g_strdup_printf ("<b> This assistant will help you to setup a %s \n"
4717 "calculation using <i>%s</i> 3D model as starting point</b>", field_type[f], tmp_proj -> name);
4718 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, markup_label(info, -1, -1, 0.5, 0.5), FALSE, FALSE, 50);
4719 g_free (info);
4720
4721 gchar * i_titles[2][2] = {{"Force field: ", "Force field: "}, {"Initialize force field using: ","Force field was initialized using: "}};
4722 for (i=0; i<2; i++)
4723 {
4724 field_i_box[i] = create_hbox (0);
4725 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, field_i_box[i], FALSE, FALSE, 0);
4726 j = (i == 0) ? tmp_field -> type + 1 : tmp_field -> atom_init + 1;
4727 k = (j) ? 1 : 0;
4728 field_i_lab[i] = markup_label(i_titles[i][k], 210, -1, 0.0, 0.5);
4729 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_lab[i], FALSE, FALSE, 20);
4731 gtk_combo_box_set_active (GTK_COMBO_BOX(field_i_combo[i]), -1);
4732 switch (i)
4733 {
4734 case 0:
4735 for (j=0; j<N_FIELDS; j++) combo_text_append (field_i_combo[i], field_acro[j]);
4736 gtk_combo_box_set_active (GTK_COMBO_BOX(field_i_combo[i]), tmp_field -> type);
4737 break;
4738 case 1:
4739 for (j=0; j<3; j++) combo_text_append (field_i_combo[i], field_init[j]);
4740 gtk_combo_box_set_active (GTK_COMBO_BOX(field_i_combo[i]), tmp_field -> atom_init);
4741 break;
4742 }
4744 g_signal_connect (G_OBJECT (field_i_combo[i]), "changed", G_CALLBACK(changed_init_box), GINT_TO_POINTER(i));
4745 field_i_fixed[i] = gtk_fixed_new ();
4746 gtk_widget_set_size_request (field_i_fixed[i], 410, -1);
4747 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_fixed[i], FALSE, FALSE, 0);
4748 gtk_fixed_put (GTK_FIXED(field_i_fixed[i]), field_i_combo[i], 0, 0);
4750 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, field_i_box[i], field_i_obj[i], FALSE, FALSE, 25);
4751 }
4752
4753 GtkWidget * hbox = create_hbox (0);
4754 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, hbox, FALSE, FALSE, 10);
4755 GtkWidget * but = check_button ("\tDelete the existing force field data and reset the parameters to the default values",
4756 -1, 40, FALSE, G_CALLBACK(clean_field), GINT_TO_POINTER(p));
4757 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, but, FALSE, FALSE, 85);
4758
4759 if (! f)
4760 {
4761 field_i_prep[0] = check_button ("\tPrepare the CONTROL file to describe the calculation",
4762 -1, 40, tmp_field -> prepare_file[0], G_CALLBACK(select_field_action), GINT_TO_POINTER(0));
4763 field_i_prep[1] = check_button ("\tPrepare the FIELD and CONFIG files to describe the force field and the atomistic model",
4764 -1, 40, tmp_field -> prepare_file[1], G_CALLBACK(select_field_action), GINT_TO_POINTER(1));
4765 }
4766 else
4767 {
4768 field_i_prep[0] = check_button ("\tPrepare the LAMMPS Input to describe the calculation",
4769 -1, 40, tmp_field -> prepare_file[0], G_CALLBACK(select_field_action), GINT_TO_POINTER(0));
4770 field_i_prep[1] = check_button ("\tPrepare the LAMMPS Atom file to describe the force field and the atomistic model",
4771 -1, 40, tmp_field -> prepare_file[1], G_CALLBACK(select_field_action), GINT_TO_POINTER(1));
4772 }
4773 for (i=0; i<2; i++)
4774 {
4775 hbox = create_hbox (0);
4776 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro, hbox, FALSE, FALSE, 0);
4779 add_box_child_start (GTK_ORIENTATION_HORIZONTAL, hbox, field_i_prep[i], FALSE, FALSE, 50);
4780 }
4781 add_box_child_start (GTK_ORIENTATION_VERTICAL, intro,
4782 markup_label("\n \t<b>Note: </b>You can re-open this assistant later if required to adjust your choices\n",
4783 -1, -1, 0.0, 0.5), FALSE, FALSE, 50);
4784
4785 gtk_assistant_append_page (GTK_ASSISTANT (field_assistant), intro);
4786 info = g_strdup_printf ("%s calculation set-up", field_type[f]);
4787 gtk_assistant_set_page_title (GTK_ASSISTANT (field_assistant), intro, info);
4788 g_free (info);
4789 gtk_assistant_set_page_type (GTK_ASSISTANT (field_assistant), intro, GTK_ASSISTANT_PAGE_INTRO);
4790 gtk_assistant_set_page_complete (GTK_ASSISTANT (field_assistant), intro, assist_init);
4791 preview_but = create_button ("Preview", IMG_STOCK, EDITF, -1, -1, GTK_RELIEF_NORMAL, G_CALLBACK(show_force_field_preview), NULL);
4792 gtk_assistant_add_action_widget (GTK_ASSISTANT (field_assistant), preview_but);
4793
4794 if (assist_init)
4795 {
4798 hide_show_this_pages (0, MAXDATC, tmp_field -> prepare_file[0], 0);
4799 hide_show_this_pages (MAXDATC-1, MAXDATC+MAXDATA, tmp_field -> prepare_file[1], 1);
4800 }
4801 else
4802 {
4805 }
4806
4807 gtk_assistant_set_forward_page_func (GTK_ASSISTANT (field_assistant), on_assistant_go_forward, NULL, NULL);
4808 g_signal_connect (G_OBJECT (field_assistant), "prepare", G_CALLBACK(on_assistant_prepare), NULL);
4809 g_signal_connect (G_OBJECT (field_assistant), "cancel", G_CALLBACK(on_assistant_cancel), NULL);
4810 g_signal_connect (G_OBJECT (field_assistant), "close", G_CALLBACK(on_assistant_close), NULL);
4811 g_signal_connect (G_OBJECT (field_assistant), "apply", G_CALLBACK(on_assistant_apply), NULL);
4813
4814 for (i=0; i<2; i++)
4815 {
4816 saved_label_format[i] = tmp_view -> anim -> last -> img -> labels_format[i];
4817 saved_label_position[i] = tmp_view -> anim -> last -> img -> labels_position[i];
4818 tmp_view -> anim -> last -> img -> labels_position[i] = 0;
4819 tmp_view -> anim -> last -> img -> labels_format[i] = ID_IN_MOLECULE;
4820 }
4821
4822 //g_debug ("Number of pages in the assitant: %d", gtk_assistant_get_n_pages (GTK_ASSISTANT (field_assistant)));
4823 //g_debug ("Active page is: %d", gtk_assistant_get_current_page (GTK_ASSISTANT (fwin)));
4824}
insertion_menu mol[]
Definition w_library.c:193
Binding to the Fortran90 subroutines.
int selected_aspec
Definition popup.c:180
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:3058
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:1171
G_MODULE_EXPORT void edit_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
edit field property callback
Definition dlp_edit.c:2993
G_MODULE_EXPORT void remove_field_prop(GSimpleAction *action, GVariant *parameter, gpointer data)
remove field property callback
Definition dlp_edit.c:3298
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:4352
int feunit_fbd[2][FFOURBODY][FFOURBODY_P]
Definition dlp_field.c:769
GtkWidget * field_i_lab[2]
Definition dlp_field.c:3906
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:2693
void close_the_assistant(GtkAssistant *assistant)
classical force field creation close the assistant
Definition dlp_field.c:3922
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:1920
void on_assistant_apply(GtkAssistant *assistant, gpointer data)
on classical force field assistant apply - creating the dialog
Definition dlp_field.c:4638
GtkWidget * field_i_combo[2]
Definition dlp_field.c:3908
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:3907
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:3970
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:3131
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:4365
G_MODULE_EXPORT void select_field_action(GtkToggleButton *but, gpointer data)
select force field creation option toggle callback GTK3
Definition dlp_field.c:4274
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:2800
int saved_label_position[2]
Definition dlp_field.c:3913
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:3258
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:3695
GtkWidget * vbox_init(int p)
classical force field assistant prepare the field object configuration widgets
Definition dlp_field.c:2190
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:3188
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:4237
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:3292
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:3393
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:3054
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:2283
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:1770
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:3309
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:3516
GtkWidget * cwin
Definition dlp_field.c:973
gchar * pop_remove(int i)
get remove string label
Definition dlp_field.c:2707
void check_tersoffs(int id, int key)
check non bonded potential
Definition dlp_edit.c:2957
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:4010
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:2310
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:2723
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:3428
int actel
Definition dlp_field.c:2499
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:3532
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:1786
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:2339
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:4472
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:3483
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:2073
GtkWidget * field_i_box[2]
Definition dlp_field.c:3905
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:2002
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:3411
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:4168
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:1606
int atom_init
Definition dlp_field.c:950
gchar * pop_info(int i, int id)
get popup information message
Definition dlp_field.c:2509
void remove_classical_assistant_pages()
classical force field creation remove assistant pages
Definition dlp_field.c:4147
void get_is_energy(int i, int l)
get the energy unit linked parameter list
Definition dlp_field.c:1816
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:768
gboolean append_pages
Definition dlp_field.c:135
GtkWidget * field_i_prep[2]
Definition dlp_field.c:3904
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:3995
gboolean assist_init
Definition dlp_field.c:3911
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:3742
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:2728
GtkWidget * preview_but
Definition dlp_field.c:3910
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:4306
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:3326
GtkWidget * create_combo_mol(int f)
classical force field create molecule selection combo box
Definition dlp_field.c:2479
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:4079
GtkWidget * create_field_tree(int f)
classical force field create the list store selection widgets
Definition dlp_field.c:3544
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:4023
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:4546
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:2051
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:4673
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:3208
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:2671
void hide_show_this_pages(int start, int end, int status, int delta)
classical force field assistant show / hide pages
Definition dlp_field.c:4127
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:3150
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:3345
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:3759
gchar * set_field_label(int f, int m)
prepare classical force field description string
Definition dlp_field.c:1636
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:2753
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:3909
G_MODULE_EXPORT void changed_init_box(GtkComboBox *box, gpointer data)
classical force field change initialization parameter
Definition dlp_field.c:4416
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:1934
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:3373
int saved_label_format[2]
Definition dlp_field.c:3912
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:2986
#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:552
#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:1024
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:830
#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:367
@ 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:139
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:561
#define EDITF
Definition global.h:204
void run_this_gtk_dialog(GtkWidget *dial, GCallback handler, gpointer data)
run a GTK (3 and 4) basic GtkDialog
Definition gtk-misc.c:492
@ IMG_NONE
Definition global.h:260
@ IMG_STOCK
Definition global.h:264
void set_renderer_color(int tocol, GtkCellRenderer *renderer, ColRGBA col)
set the color of a GtkCellRenderer
Definition gtk-misc.c:1653
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:1199
GtkTextBuffer * add_buffer(GCallback handler, gpointer data, gchar *text)
create a GtkTextBuffer
Definition gtk-misc.c:1171
GtkWidget * create_scroll(GtkWidget *box, int dimx, int dimy, int shadow)
create a scroll window
Definition gtk-misc.c:1960
GtkWidget * dialogmodal(gchar *str, GtkWindow *parent)
Create a new dialog modal window.
Definition gtk-misc.c:510
project * proj
#define BSEP
Definition global.h:245
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:2301
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:641
GtkWidget * stock_image(const gchar *stock_id)
create a GtkImage for the Gtk database
Definition gtk-misc.c:1364
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:2387
GtkWidget * fbox(GtkWidget *box, char *lab)
Definition gtk-misc.c:1941
gchar * file_chooser_get_current_folder(GtkFileChooser *chooser)
get the current folder for a GtkFileChooser
Definition gtk-misc.c:2152
#define APPLY
Definition global.h:220
GtkWidget * check_button(gchar *text, int dimx, int dimy, gboolean state, GCallback handler, gpointer data)
create a check button
Definition gtk-misc.c:1799
@ CONTAINER_SCR
Definition global.h:251
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:1863
GtkWidget * create_combo()
create a GtkCombox widget, note deprecated in GTK4
Definition gtk-misc.c:923
GtkWidget * dialog_get_content_area(GtkWidget *widg)
prepare GtkWidget to insert content in a GtkDialog window
Definition gtk-misc.c:825
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
Definition gtk-misc.c:1585
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:299
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
Definition gtk-misc.c:206
#define CANCEL
Definition global.h:215
void destroy_this_dialog(GtkDialog *dialog)
destroy a GtkDialog
Definition gtk-misc.c:2065
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
Definition gtk-misc.c:813
void combo_text_append(GtkWidget *combo, gchar *text)
append text in GtkComboBox widget
Definition gtk-misc.c:900
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:2102
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
Definition gtk-misc.c:2034
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
Definition gtk-misc.c:226
#define MAXDATC
Number of tabs for the description of the classical calculation.
Definition global.h:693
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
Definition gtk-misc.c:189
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:758
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
Definition gtk-misc.c:801
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:2223
#define MAXDATA
Number of tabs for the description of the classical force field.
Definition global.h:698
void destroy_this_native_dialog(GtkNativeDialog *dialog)
destroy a GtkNativeDialog
Definition gtk-misc.c:2084
void show_the_widgets(GtkWidget *widg)
show GtkWidget
Definition gtk-misc.c:173
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:189
@ ID_IN_MOLECULE
Definition glview.h:219
#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:82
integer(kind=c_int) function molecules(frag_and_mol, allbonds)
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
Function declarations for reading atomes project file Function declarations for saving atomes proje...
Definition glwin.h:875
int c
Definition global.h:107
int b
Definition tab-1.c:95
int a
Definition tab-1.c:95
int status
Definition w_advance.c:160
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