atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
la_print.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
22/*
23* This file: 'la_print.c'
24*
25* Contains:
26*
27
28 - The functions to print the LAMMPS input file(s)
29
30*
31* List of functions:
32
33 int get_mol_id_from_model_id (int at);
34 int print_lammps_dihedral (int did, int di, GtkTextBuffer * buf, field_struct * dh);
35 int print_lammps_angle (int aid, int ai, GtkTextBuffer * buf, field_struct * an);
36 int print_lammps_bond (int bid, int bi, GtkTextBuffer * buf, field_struct * bd);
37 int is_this_new_prop (int sid, field_prop * init, field_prop * to_check);
38 int get_type_struct_to_print (field_molecule * tfmol, int sid);
39 int get_different_atoms ();
40
41 gboolean are_different_field_atoms (field_atom* at, field_atom* bt);
42
43 void print_lammps_mass (GtkTextBuffer * buf);
44 void print_lammps_atoms (GtkTextBuffer * buf);
45 void print_lammps_atom_file (GtkTextBuffer * buf);
46
47 field_atom* get_print_atom (int aid);
48
49*/
50
51#include "dlp_field.h"
52#include "interface.h"
53
55enum lammps_atom_types { // comments = corresponding data file formats
56 l_angle = 0,
58 l_body = 2,
59 l_bond = 3,
62 l_dpd = 6,
63 l_edpd = 7,
66 l_full = 10,
67 l_line = 11,
68 l_mdpd = 12,
70 l_peri = 14,
71 l_smd = 15,
72 l_sph = 16,
73 l_sphere = 17,
74 l_spin = 18,
75 l_tdpd = 19,
77 l_tri = 21,
79 l_hybrid = 23
80};
81
82extern gboolean in_bond (int at, int bd[2]);
83extern int get_num_vdw_max ();
84extern gchar * get_body_element_name (field_nth_body * body, int aid, int nbd);
85extern int get_num_struct_to_print (field_molecule * fmol, int sid);
86extern gboolean are_identical_prop (int ti, int ai, field_prop * pro_a, field_prop * pro_b);
87extern void merging_atoms (field_atom* to_merge, field_atom* to_remove, gboolean upda);
88extern char * vect_comp[3];
89
98{
99 int i;
100 tmp_fmol = tmp_field -> first_molecule;
101 field_atom* fat;
102 while (tmp_fmol)
103 {
104 fat = tmp_fmol -> first_atom;
105 while (fat)
106 {
107 for (i=0; i< fat -> num; i++)
108 {
109 if (at == fat -> list[i]) return tmp_fmol -> id;
110 }
111 fat = fat -> next;
112 }
113 tmp_fmol = tmp_fmol -> next;
114 }
115 return -1;
116}
117
119
130int print_lammps_dihedral (int did, int di, GtkTextBuffer * buf, field_struct * dh)
131{
132 int a, c, i, j, k, l, m, n, o, p;
133 gchar * str;
134 field_prop * tp_prop;
135 gboolean same_atom = FALSE;
136 gboolean * already_done;
137 if (tmp_fat -> id == tmp_fdt -> id && tmp_fbt -> id && tmp_fct -> id)
138 {
139 same_atom = TRUE;
140 already_done = allocbool (tmp_fmol -> mol -> natoms);
141 }
142 int * ids = allocint(4);
143 for (i=0; i<tmp_fat -> num; i++)
144 {
145 j = tmp_fat -> list[i];
146 a = ids[0] = tmp_fat -> list_id[i];
147 if (same_atom) already_done[a] = TRUE;
148 for (k=0; k<tmp_proj -> atoms[0][j].numv; k++)
149 {
150 l = tmp_proj -> atoms[0][j].vois[k];
151 if (tmp_proj -> atoms[0][l].faid == tmp_fbt -> id)
152 {
153 ids[1] = tmp_proj -> atoms[0][l].fid;
154 for (m=0; m<tmp_proj -> atoms[0][l].numv; m++)
155 {
156 n = tmp_proj -> atoms[0][l].vois[m];
157 if (n != j && tmp_proj -> atoms[0][n].faid == tmp_fct -> id)
158 {
159 ids[2] = tmp_proj -> atoms[0][n].fid;
160 for (o=0; o<tmp_proj -> atoms[0][n].numv; o++)
161 {
162 p = tmp_proj -> atoms[0][n].vois[o];
163 c = ids[3] = tmp_proj -> atoms[0][p].fid;
164 if (p != j && p != l && tmp_proj -> atoms[0][p].faid == tmp_fdt -> id && (! same_atom || (same_atom && ! already_done[c])))
165 {
166 tmp_fprop = get_active_prop_using_atoms (dh -> other, 4, ids);
167 if (tmp_fprop == NULL) tmp_fprop = dh -> def;
168 tp_prop = print_prop[2*di];
169 while (! are_identical_prop (2*di+1, 0, tmp_fprop, tp_prop) && tp_prop -> next) tp_prop = tp_prop -> next;
170 if (tp_prop -> use)
171 {
172 str = g_strdup_printf ("%5d %5d %10d %10d %10d %10d\n", did+1, tp_prop -> pid, j+1, l+1, n+1, p+1);
173 print_info (str, NULL, buf);
174 g_free (str);
175 did ++;
176 }
177 }
178 }
179 }
180 }
181 }
182 }
183 }
184 g_free (ids);
185 if (same_atom) g_free (already_done);
186 return did;
187}
188
199int print_lammps_angle (int aid, int ai, GtkTextBuffer * buf, field_struct * an)
200{
201 int i, j, k, l, m, o, p, q;
202 gchar * str;
203 field_prop * tp_prop;
204 int * ids = allocint(3);
205 gboolean same_atom = FALSE;
206 gboolean * already_done;
207 if (tmp_fat -> id == tmp_fct -> id)
208 {
209 same_atom = TRUE;
210 already_done = allocbool (tmp_fmol -> mol -> natoms);
211 }
212
213 for (i=0; i<tmp_fat -> num; i++)
214 {
215 j = tmp_fat -> list[i];
216 k = ids[0] = tmp_proj -> atoms[0][j].fid;
217 if (same_atom) already_done[k] = TRUE;
218 for (l=0; l<tmp_proj -> atoms[0][j].numv; l++)
219 {
220 m = tmp_proj -> atoms[0][j].vois[l];
221 if (tmp_proj -> atoms[0][m].faid == tmp_fbt -> id)
222 {
223 ids[1] = tmp_proj -> atoms[0][m].fid;
224 for (o=0; o<tmp_proj -> atoms[0][m].numv; o++)
225 {
226 p = tmp_proj -> atoms[0][m].vois[o];
227 q = ids[2] = tmp_proj -> atoms[0][p].fid;
228 if (p != j && tmp_proj -> atoms[0][p].faid == tmp_fct -> id && (! same_atom || (same_atom && ! already_done[q])))
229 {
230 tmp_fprop = get_active_prop_using_atoms (an -> other, 3, ids);
231 if (tmp_fprop == NULL) tmp_fprop = an -> def;
232 tp_prop = print_prop[2*ai];
233 while (! are_identical_prop (2*ai+1, 0, tmp_fprop, tp_prop)) tp_prop = tp_prop -> next;
234 if (tp_prop -> use)
235 {
236 str = g_strdup_printf ("%5d %5d %10d %10d %10d\n", aid+1, tp_prop -> pid, j+1, m+1, p+1);
237 print_info (str, NULL, buf);
238 g_free (str);
239 aid ++;
240 }
241 }
242 }
243 }
244 }
245 }
246 g_free (ids);
247 if (same_atom) g_free (already_done);
248 return aid;
249}
250
261int print_lammps_bond (int bid, int bi, GtkTextBuffer * buf, field_struct * bd)
262{
263 int i, j, k, l, m, n;
264 gchar * str;
265 field_prop * tp_prop;
266 int * ids = allocint(2);
267 gboolean same_atom = FALSE;
268 gboolean * already_done;
269 if (tmp_fat -> id == tmp_fbt -> id)
270 {
271 same_atom = TRUE;
272 already_done = allocbool (tmp_fmol -> mol -> natoms);
273 }
274 for (i=0; i<tmp_fat -> num; i++)
275 {
276 j = tmp_fat -> list[i];
277 k = ids[0] = tmp_fat -> list_id[i];
278 if (same_atom) already_done[k] = TRUE;
279 for (l=0; l<tmp_proj -> atoms[0][j].numv; l++)
280 {
281 m = tmp_proj -> atoms[0][j].vois[l];
282 n = ids[1] = tmp_proj -> atoms[0][m].fid;
283 if (tmp_proj -> atoms[0][m].faid == tmp_fbt -> id && (! same_atom || (same_atom && ! already_done[n])))
284 {
285 tmp_fprop = get_active_prop_using_atoms (bd -> other, 2, ids);
286 if (tmp_fprop == NULL) tmp_fprop = bd -> def;
287 tp_prop = print_prop[2*bi];
288 while (! are_identical_prop (2*bi+1, 0, tmp_fprop, tp_prop)) tp_prop = tp_prop -> next;
289 if (tmp_fprop -> use)
290 {
291 str = g_strdup_printf ("%5d %5d %10d %10d\n", bid+1, tp_prop -> pid, j+1, m+1);
292 print_info (str, NULL, buf);
293 g_free (str);
294 bid ++;
295 }
296 }
297 }
298 }
299 g_free (ids);
300 if (same_atom) g_free (already_done);
301 return bid;
302}
303
313int is_this_new_prop (int sid, field_prop * init, field_prop * to_check)
314{
315 field_prop * tmp_pr = init;
316 gboolean add_prop = TRUE;
317 while (tmp_pr)
318 {
319 if (are_identical_prop (sid+1, 0, to_check, tmp_pr))
320 {
321 add_prop = FALSE;
322 break;
323 }
324 else if (tmp_pr -> next)
325 {
326 tmp_pr = tmp_pr -> next;
327 }
328 else
329 {
330 break;
331 }
332 }
333 if (add_prop)
334 {
335 tmp_pr -> next = duplicate_field_prop (to_check, sid);
336 tmp_pr -> next -> pid = tmp_pr -> pid + 1;
337 }
338 return (add_prop) ? 1 : 0;
339}
340
350{
351 int pid = 0;
352 tmp_fstr = tfmol -> first_struct[sid];
353 while (tmp_fstr)
354 {
355 if (tmp_fstr -> def -> use)
356 {
357 if (! print_prop[sid])
358 {
359 print_prop[sid] = duplicate_field_prop (tmp_fstr -> def, sid);
360 pid = print_prop[sid] -> pid = 1;
361 }
362 else
363 {
364 pid += is_this_new_prop (sid, print_prop[sid], tmp_fstr -> def);
365 }
366 }
367 if (tmp_fstr -> other)
368 {
369 tmp_fprop = tmp_fstr -> other;
370 while (tmp_fprop)
371 {
372 if (tmp_fprop -> use && ! are_identical_prop (sid+1, 0, tmp_fstr -> def, tmp_fprop))
373 {
374 if (! print_prop[sid])
375 {
377 pid = print_prop[sid] -> pid = 1;
378 }
379 else
380 {
381 pid += is_this_new_prop (sid, print_prop[sid], tmp_fprop);
382 }
383 }
384 tmp_fprop = tmp_fprop -> next;
385 }
386 }
387 tmp_fstr = tmp_fstr -> next;
388 }
389 return pid;
390}
391
393
403{
404 if (g_strcmp0(at -> name, bt -> name) != 0) return TRUE;
405 if (at -> sp != bt -> sp) return TRUE;
406 if (at -> mass != bt -> mass) return TRUE;
407 if (at -> charge != bt -> charge) return TRUE;
408 return FALSE;
409}
410
417{
418 int numat = 0;
419 tmp_fmol = tmp_field -> first_molecule;
420 all_at = NULL;
421 gboolean append;
422 while (tmp_fmol)
423 {
424 tmp_fat = tmp_fmol -> first_atom;
425 while (tmp_fat)
426 {
427 if (! all_at)
428 {
430 numat = all_at -> id = 1;
431 }
432 else
433 {
434 append = TRUE;
435 tmp_fbt = all_at;
436 while (tmp_fbt)
437 {
439 {
440 merging_atoms (tmp_fbt, tmp_fat, FALSE);
441 append = FALSE;
442 break;
443 }
444 tmp_fbt = tmp_fbt -> next;
445 }
446 if (append)
447 {
448 tmp_fbt = all_at;
449 while (tmp_fbt -> next) tmp_fbt = tmp_fbt -> next;
451 numat = tmp_fbt -> next -> id = tmp_fbt -> id + 1;
452 }
453 }
454 tmp_fat = tmp_fat -> next;
455 }
456 tmp_fmol = tmp_fmol -> next;
457 }
458 return numat;
459}
460
468void print_lammps_mass (GtkTextBuffer * buf)
469{
470 gchar * str;
471 print_info ("\nMasses\n\n", "bold", buf);
472 tmp_fat = all_at;
473 while (tmp_fat)
474 {
475 str = g_strdup_printf ("\t%d\t%f\n", tmp_fat -> id, tmp_fat -> mass);
476 print_info (str, NULL, buf);
477 g_free (str);
478 tmp_fat = tmp_fat -> next;
479 }
480}
481
490{
491 int i;
492 tmp_fat = all_at;
493 while (tmp_fat)
494 {
495 for (i=0; i<tmp_fat -> num; i++)
496 {
497 if (tmp_fat -> list[i] == aid) return tmp_fat;
498 }
499 tmp_fat = tmp_fat -> next;
500 }
501 return NULL;
502}
503
511void print_lammps_atoms (GtkTextBuffer * buf)
512{
513 int i; //, j, k;
514 // * field_molecule * la_mol;
515 field_atom* la_ats;
516 gchar * pos, * atid, * atype; //* molid, * amass;
517 gchar * str;
518 print_info ("\nAtoms\n\n", "bold", buf);
519 for (i=0; i<tmp_proj -> natomes; i++)
520 {
521 atid = g_strdup_printf ("%10d", i+1);
522 // * la_mol = get_active_field_molecule_from_model_id (tmp_proj, i);
523 // molid = g_strdup_printf ("%5d", la_mol -> id+1);
524 la_ats = get_print_atom (i);
525 atype = g_strdup_printf ("%5d", la_ats -> id);
526 pos = g_strdup_printf ("%f\t%f\t%f", tmp_proj -> atoms[0][i].x, tmp_proj -> atoms[0][i].y, tmp_proj -> atoms[0][i].z);
527 // amass = g_strdup_printf ("%f", la_ats -> mass);
528 /* switch ()
529 {
530 case l_angle:
531 // atom-ID molecule-ID atom-type x y z
532 str = g_strdup_printf ("%s\t%s\t%s\t%s\n", atid, molid, atype, pos);
533 print_info (str, NULL, buf);
534 g_free (str);
535 break;
536 case l_atomic: */
537 // atom-ID atom-type x y z
538 str = g_strdup_printf ("%s\t%s\t%s\n", atid, atype, pos);
539 print_info (str, NULL, buf);
540 g_free (str);
541 /*break;
542 case l_body:
543 // atom-ID atom-type bodyflag mass x y z
544 break;
545 case l_bond:
546 // atom-ID molecule-ID atom-type x y z
547 str = g_strdup_printf ("%s\t%s\t%s\t%s\n", atid, molid, atype, pos);
548 print_info (str, NULL, buf);
549 g_free (str);
550 break;
551 case l_charge:
552 // atom-type q x y z
553 break;
554 case l_dipole:
555 // atom-ID atom-type q x y z mux muy muz
556 break;
557 case l_dpd:
558 // atom-ID atom-type theta x y z
559 break;
560 case l_edpd:
561 // atom-ID atom-type edpd_temp edpd_cv x y z
562 break;
563 case l_electron:
564 // atom-ID atom-type q spin eradius x y z
565 break;
566 case l_ellipsoid:
567 // atom-ID atom-type ellipsoidflag density x y z
568 break;
569 case l_full:
570 // atom-ID molecule-ID atom-type q x y z
571 break;
572 case l_line:
573 // atom-ID molecule-ID atom-type lineflag density x y z
574 break;
575 case l_mdpd:
576 // atom-ID atom-type rho x y z
577 break;
578 case l_molecular:
579 // atom-ID molecule-ID atom-type x y z
580 break;
581 case l_peri:
582 // atom-ID atom-type volume density x y z
583 break;
584 case l_smd:
585 // atom-ID atom-type molecule volume mass kernel-radius contact-radius x0 y0 z0 x y z
586 break;
587 case l_sph:
588 // atom-ID atom-type rho esph cv x y z
589 break;
590 case l_sphere:
591 // atom-ID atom-type diameter density x y z
592 break;
593 case l_spin:
594 // atom-ID atom-type x y z spx spy spz sp
595 break;
596 case l_tdpd:
597 // atom-ID atom-type x y z cc1 cc2 … ccNspecies
598 break;
599 case l_template:
600 // atom-ID atom-type molecule-ID template-index template-atom x y z
601 break;
602 case l_tri:
603 // atom-ID molecule-ID atom-type triangleflag density x y z
604 break;
605 case l_wavepacket:
606 // atom-ID atom-type charge spin eradius etag cs_re cs_im x y z
607 break;
608 }*/
609 }
610}
611
619void print_lammps_atom_file (GtkTextBuffer * buf)
620{
621 int i, j; //, k, l;
622 gchar * str;
623
624 GtkTextIter bStart;
625 GtkTextIter bEnd;
626
627 gtk_text_buffer_get_start_iter (buf, & bStart);
628 gtk_text_buffer_get_end_iter (buf, & bEnd);
629 gtk_text_buffer_delete (buf, & bStart, & bEnd);
630
631 //str = g_strdup_printf ("# This file was created using %s\n", PACKAGE);
632 //print_info (str, NULL, buf);
633 //g_free (str);
634 print_info ("LAMMPS Atom File\n\n", NULL, buf);
635 str = g_strdup_printf ("%12d", tmp_proj -> natomes);
636 print_info (str, "bold_blue", buf);
637 g_free (str);
638 print_info (" atoms", "bold", buf);
639 print_info ("\n", NULL, buf);
640 gchar * str_title[4] = {" bond", " angle", " dihedral", " improper"};
641
642 for (i=0; i<4; i++)
643 {
644 tmp_fmol = tmp_field -> first_molecule;
645 j = 0;
646 while (tmp_fmol)
647 {
648 if (tmp_field -> afp[i*2+15])
649 {
651 }
652 tmp_fmol = tmp_fmol -> next;
653 }
654 if (j > 0)
655 {
656 str = g_strdup_printf ("%12d", j);
657 print_info (str, "bold_blue", buf);
658 g_free (str);
659 print_info (str_title[i], "bold", buf);
660 print_info ("s\n", "bold", buf);
661 }
662 }
663 print_info ("\n", NULL, buf);
664 int numat = get_different_atoms ();
665 str = g_strdup_printf ("%12d", numat);
666 print_info (str, "bold_red", buf);
667 g_free (str);
668 print_info (" atom types", "bold", buf);
669 print_info ("\n", NULL, buf);
670 int ntypes[4];
671 for (i=0; i<4; i++)
672 {
673 ntypes[i] = 0;
674 print_prop[2*i] = NULL;
675 if (tmp_field -> afp[i*2+15])
676 {
677 tmp_fmol = tmp_field -> first_molecule;
678 while (tmp_fmol)
679 {
681 ntypes[i] += j;
682 tmp_fmol = tmp_fmol -> next;
683 }
684 if (ntypes[i] > 0)
685 {
686 str = g_strdup_printf ("%12d", ntypes[i]);
687 print_info (str, "bold_red", buf);
688 g_free (str);
689 print_info (str_title[i], "bold", buf);
690 print_info (" types\n", "bold", buf);
691 }
692 }
693 }
694
695 // Lattice
696 print_info ("\n", NULL, buf);
697 /*xlo xhi
698 ylo yhi
699 zlo zhi*/
700 if (tmp_proj -> cell.pbc)
701 {
702 j = 0;
703 for (i=0; i<3; i++)
704 {
705 str = g_strdup_printf ("%f %f %slo %shi\n", 0.0, tmp_proj -> cell.box[0].param[0][i], vect_comp[i], vect_comp[i]);
706 print_info (str, NULL, buf);
707 g_free (str);
708 if (tmp_proj -> cell.box[0].param[1][i] != 90.0) j=1;
709 }
710 if (j)
711 {
712 float lx, ly, lz;
713 float xy, xz, yz;
714 lx = tmp_proj -> cell.box[0].param[0][0];
715 xy = tmp_proj -> cell.box[0].param[0][1] * cos(tmp_proj -> cell.box[0].param[1][2]*pi/180.0);
716 xz = tmp_proj -> cell.box[0].param[0][2] * cos(tmp_proj -> cell.box[0].param[1][1]*pi/180.0);
717 ly = sqrt(tmp_proj -> cell.box[0].param[0][1]*tmp_proj -> cell.box[0].param[0][1] -xy*xy);
718 yz = (tmp_proj -> cell.box[0].param[0][1]*(tmp_proj -> cell.box[0].param[0][2]*cos(tmp_proj -> cell.box[0].param[1][0]*pi/180.0)) - xy*xz) / ly;
719 lz = sqrt(tmp_proj -> cell.box[0].param[0][2]*tmp_proj -> cell.box[0].param[0][2] - xz*xz - yz*yz);
720 str = g_strdup_printf ("%f %f %f\n", lx, ly, lz);
721 print_info (str, NULL, buf);
722 g_free (str);
723 }
724 }
725 else
726 {
727 // min(pos), max(pos)
728 }
729
730 // Masses
731 print_lammps_mass (buf);
732
733 gchar * coeffs[13]={"Pair", "Bond", "Angle", "Dihedral", "Improper", "BondBond", "BondAngle", "MiddleBondTorsion",
734 "EndBondTorsion", "AngleTorsion", "AngleAngleTorsion", "BondBond13", "AngleAngle"};
735 // > 5 = CVFF force field ?
736
737 /* if (tmp_field -> afp[23])
738 {
739 j=0;
740 tmp_fbody = tmp_field -> first_body[0];
741 while (tmp_fbody)
742 {
743 if (tmp_fbody -> use) j++;
744 tmp_fbody = tmp_fbody -> next;
745 }
746 if (j > 0)
747 {
748 k = get_num_vdw_max ();
749 l = k * (k+1) / 2;
750 str = g_strdup_printf ("%s Coeffs\n\n", coeffs[0]);
751 print_info(str, "bold", buf);
752 g_free (str);
753 tmp_fbody = tmp_field -> first_body[0];
754 while (tmp_fbody)
755 {
756 if (tmp_fbody -> use)
757 {
758 print_lam_body (buf, l, tmp_fbody);
759 }
760 tmp_fbody = tmp_fbody -> next;
761 }
762 }
763 } */
764
765 for (i=0; i<4; i++)
766 {
767 if (ntypes[i])
768 {
769 str = g_strdup_printf ("\n%s Coeffs\n\n", coeffs[i+1]);
770 print_info (str, "bold", buf);
771 g_free (str);
772 tmp_fprop = print_prop[2*i];
773 while (tmp_fprop)
774 {
775 str = g_strdup_printf (" %5d", tmp_fprop -> pid);
776 print_info (str, NULL, buf);
777 g_free (str);
778 for (j=0; j<fvalues[activef][2*i+1][tmp_fprop -> key]; j++)
779 {
780 str = g_strdup_printf (" %15.10f", tmp_fprop -> val[j]);
781 print_info (str, NULL, buf);
782 g_free (str);
783 }
784 print_info ("\n", NULL, buf);
785 tmp_fprop = tmp_fprop -> next;
786 }
787 }
788 }
789
790 // Atoms
791 print_lammps_atoms (buf);
792
793 for (i=0; i<4; i++)
794 {
795 j = 0;
796 if (ntypes[i])
797 {
798 str = g_strdup_printf ("\n%ss\n\n", coeffs[i+1]);
799 print_info(str, "bold", buf);
800 g_free (str);
801 tmp_fmol = tmp_field -> first_molecule;
802 while (tmp_fmol)
803 {
805 {
806 tmp_fstr = tmp_fmol -> first_struct[i*2];
807 while (tmp_fstr)
808 {
809 tmp_fat = get_active_atom (tmp_fmol -> id, tmp_fstr -> aid[0]);
810 tmp_fbt = get_active_atom (tmp_fmol -> id, tmp_fstr -> aid[1]);
811 if (i > 0) tmp_fct = get_active_atom (tmp_fmol -> id, tmp_fstr -> aid[2]);
812 if (i > 1) tmp_fdt = get_active_atom (tmp_fmol -> id, tmp_fstr -> aid[3]);
813 if (i == 0) j = print_lammps_bond (j, i, buf, tmp_fstr);
814 if (i == 1) j = print_lammps_angle (j, i, buf, tmp_fstr);
815 if (i == 2) j = print_lammps_dihedral (j, i, buf, tmp_fstr);
816 // if (i == 3) j = print_lammps_improper (j, i, buf, tmp_fstr);
817 tmp_fstr = tmp_fstr -> next;
818 }
819 }
820 tmp_fmol = tmp_fmol -> next;
821 }
822 }
823 }
824}
insertion_menu mol[]
Definition w_library.c:193
int atoms[NUM_STYLES][2]
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_atom * get_active_atom(int a, int b)
retrieve field atom
Definition dlp_active.c:145
float val
Definition dlp_init.c:117
field_prop * duplicate_field_prop(field_prop *old_prop, int ti)
create a copy of a field property
Definition dlp_copy.c:218
field_atom * duplicate_field_atom(field_atom *old_fat)
create copy of a field atom data structure
Definition dlp_copy.c:67
int fvalues[2][15][21]
Definition dlp_field.c:255
project * tmp_proj
Definition dlp_field.c:953
field_atom * tmp_fat
Definition dlp_field.c:957
field_struct * tmp_fstr
Definition dlp_field.c:964
field_molecule * tmp_fmol
Definition dlp_field.c:955
field_atom * tmp_fdt
Definition dlp_field.c:957
field_prop * tmp_fprop
Definition dlp_field.c:963
field_atom * tmp_fct
Definition dlp_field.c:957
field_atom * tmp_fbt
Definition dlp_field.c:957
classical_field * tmp_field
Definition dlp_field.c:951
Variable declarations for the creation of the DL_POLY input file(s)
gboolean afp[MAXDATA]
field_molecule * to_remove
Definition dlp_mol.c:61
double pi
Definition global.c:195
gboolean * allocbool(int val)
allocate a gboolean * pointer
Definition global.c:266
int activef
Definition global.c:161
int * allocint(int val)
allocate an int * pointer
Definition global.c:326
void print_info(gchar *str, gchar *stag, GtkTextBuffer *buffer)
print information in GtkTextBuffer
Definition interface.c:738
Messaging function declarations.
lammps_atom_types
Definition la_print.c:55
@ l_angle
Definition la_print.c:56
@ l_sph
Definition la_print.c:72
@ l_ellipsoid
Definition la_print.c:65
@ l_hybrid
Definition la_print.c:79
@ l_line
Definition la_print.c:67
@ l_electron
Definition la_print.c:64
@ l_full
Definition la_print.c:66
@ l_spin
Definition la_print.c:74
@ l_mdpd
Definition la_print.c:68
@ l_peri
Definition la_print.c:70
@ l_sphere
Definition la_print.c:73
@ l_wavepacket
Definition la_print.c:78
@ l_body
Definition la_print.c:58
@ l_dpd
Definition la_print.c:62
@ l_template
Definition la_print.c:76
@ l_dipole
Definition la_print.c:61
@ l_bond
Definition la_print.c:59
@ l_smd
Definition la_print.c:71
@ l_molecular
Definition la_print.c:69
@ l_edpd
Definition la_print.c:63
@ l_tdpd
Definition la_print.c:75
@ l_charge
Definition la_print.c:60
@ l_atomic
Definition la_print.c:57
@ l_tri
Definition la_print.c:77
field_prop * print_prop[8]
Definition la_print.c:118
void print_lammps_mass(GtkTextBuffer *buf)
pritn LAMMPS atomic masses
Definition la_print.c:468
int is_this_new_prop(int sid, field_prop *init, field_prop *to_check)
check if field property exists, if not add it
Definition la_print.c:313
int print_lammps_bond(int bid, int bi, GtkTextBuffer *buf, field_struct *bd)
print LAMMPS bond
Definition la_print.c:261
field_atom * get_print_atom(int aid)
get LAMMPS field atom
Definition la_print.c:489
char * vect_comp[3]
Definition edit_menu.c:82
int get_mol_id_from_model_id(int at)
get field molecule id using atom id
Definition la_print.c:97
int get_type_struct_to_print(field_molecule *tfmol, int sid)
build the list of 'sid' type structural property(ies) to print
Definition la_print.c:349
int get_different_atoms()
create the list of all different field atoms
Definition la_print.c:416
gboolean are_identical_prop(int ti, int ai, field_prop *pro_a, field_prop *pro_b)
are the 2 field property identicals ?
Definition dlp_edit.c:135
int print_lammps_angle(int aid, int ai, GtkTextBuffer *buf, field_struct *an)
print LAMMPS angle
Definition la_print.c:199
int get_num_vdw_max()
Get the number of field shell interactions.
Definition dlp_edit.c:2002
void merging_atoms(field_atom *to_merge, field_atom *to_remove, gboolean upda)
merge the field atom to remove with already other field atom
Definition dlp_atom.c:577
void print_lammps_atom_file(GtkTextBuffer *buf)
print LAMMPS atom file
Definition la_print.c:619
int get_num_struct_to_print(field_molecule *fmol, int sid)
find the number of structural element(s) to print
Definition dlp_print.c:1026
gboolean are_different_field_atoms(field_atom *at, field_atom *bt)
check if two field atoms are different
Definition la_print.c:402
gboolean in_bond(int at, int bd[2])
is atom at in bond bd
Definition dlp_init.c:892
field_atom * all_at
Definition la_print.c:392
void print_lammps_atoms(GtkTextBuffer *buf)
print LAMMPS atoms
Definition la_print.c:511
int print_lammps_dihedral(int did, int di, GtkTextBuffer *buf, field_struct *dh)
print LAMMPS dihedral
Definition la_print.c:130
gchar * get_body_element_name(field_nth_body *body, int aid, int nbd)
get field body potential element name
Definition dlp_edit.c:1934
double z
Definition ogl_draw.c:57
double y
Definition ogl_draw.c:57
double x
Definition ogl_draw.c:57
int c
Definition tab-1.c:95
int a
Definition tab-1.c:95
gboolean append(atom_search *asearch, project *this_proj, int i, int j)
test if the atom 'i' of species 'j' must be added to the tree store or not
Definition w_search.c:756