atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
cbuild_sg.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: 'cbuild_sg.c'
24*
25* Contains:
26*
27
28 - The functions to read space group data from XML files
29
30*
31* List of functions:
32
33 int get_this_group_data (space_group * spg, xmlNodePtr racine);
34
35 space_group * clean_sgl_data (xmlDoc * doc, xmlTextReaderPtr reader);
36 space_group * read_sg_xml_file (const char * filetoread);
37
38*/
39
40#include "global.h"
41#include "cbuild_edit.h"
42
43gchar * groups[230] = {"P1",
44 "P-1",
45 "P2",
46 "P2<sub>1</sub>",
47 "C2",
48 "Pm",
49 "Pc",
50 "Cm",
51 "Cc",
52 "P2/m",
53 "P2<sub>1</sub>/m",
54 "C2/m",
55 "P2/c",
56 "P2<sub>1</sub>/c",
57 "C2/c",
58 "P222",
59 "P222<sub>1</sub>",
60 "P2<sub>1</sub>2<sub>1</sub>2",
61 "P2<sub>1</sub>2<sub>1</sub>2<sub>1</sub>",
62 "C222<sub>1</sub>",
63 "C222",
64 "F222",
65 "I222",
66 "I2<sub>1</sub>2<sub>1</sub>2<sub>1</sub>",
67 "Pmm2",
68 "Pmc2<sub>1</sub>",
69 "Pcc2",
70 "Pma2",
71 "Pca2<sub>1</sub>",
72 "Pnc2",
73 "Pmn2<sub>1</sub>",
74 "Pba2",
75 "Pna2<sub>1</sub>",
76 "Pnn2",
77 "Cmm2",
78 "Cmc2<sub>1</sub>",
79 "Ccc2",
80 "Amm2",
81 "Aem2",
82 "Ama2",
83 "Aea2",
84 "Fmm2",
85 "Fdd2",
86 "Imm2",
87 "Iba2",
88 "Ima2",
89 "Pmmm",
90 "Pnnn",
91 "Pccm",
92 "Pban",
93 "Pmma",
94 "Pnna",
95 "Pmna",
96 "Pcca",
97 "Pbam",
98 "Pccn",
99 "Pbcm",
100 "Pnnm",
101 "Pmmn",
102 "Pbcn",
103 "Pbca",
104 "Pnma",
105 "Cmcm",
106 "Cmce",
107 "Cmmm",
108 "Cccm",
109 "Cmme",
110 "Ccce",
111 "Fmmm",
112 "Fddd",
113 "Immm",
114 "Ibam",
115 "Ibca",
116 "Imma",
117 "P4",
118 "P4<sub>1</sub>",
119 "P4<sub>2</sub>",
120 "P4<sub>3</sub>",
121 "I4",
122 "I4<sub>1</sub>",
123 "P-4",
124 "I-4",
125 "P4/m",
126 "P4<sub>2</sub>/m",
127 "P4/n",
128 "P4<sub>2</sub>/n",
129 "I4/m",
130 "I4<sub>1</sub>/a",
131 "P422",
132 "P42<sub>1</sub>2",
133 "P4<sub>1</sub>22",
134 "P4<sub>1</sub>2<sub>1</sub>2",
135 "P4<sub>2</sub>22",
136 "P4<sub>2</sub>2<sub>1</sub>2",
137 "P4<sub>3</sub>22",
138 "P4<sub>3</sub>2<sub>1</sub>2",
139 "I422",
140 "I4<sub>1</sub>22",
141 "P4mm",
142 "P4bm",
143 "P4<sub>2</sub>cm",
144 "P4<sub>2</sub>nm",
145 "P4cc",
146 "P4nc",
147 "P4<sub>2</sub>mc",
148 "P4<sub>2</sub>bc",
149 "I4mm",
150 "I4cm",
151 "I4<sub>1</sub>md",
152 "I4<sub>1</sub>cd",
153 "P-42m",
154 "P-42c",
155 "P-42<sub>1</sub>m",
156 "P-42<sub>1</sub>c",
157 "P-4m2",
158 "P-4c2",
159 "P-4b2",
160 "P-4n2",
161 "I-4m2",
162 "I-4c2",
163 "I-42m",
164 "I-42d",
165 "P4/mmm",
166 "P4/mcc",
167 "P4/nbm",
168 "P4/nnc",
169 "P4/mbm",
170 "P4/mnc",
171 "P4/nmm",
172 "P4/ncc",
173 "P4<sub>2</sub>/mmc",
174 "P4<sub>2</sub>/mcm",
175 "P4<sub>2</sub>/nbc",
176 "P4<sub>2</sub>/nnm",
177 "P4<sub>2</sub>/mbc",
178 "P4<sub>2</sub>/mnm",
179 "P4<sub>2</sub>/nmc",
180 "P4<sub>2</sub>/ncm",
181 "I4/mmm",
182 "I4/mcm",
183 "I4<sub>1</sub>/amd",
184 "I4<sub>1</sub>/acd",
185 "P3",
186 "P3<sub>1</sub>",
187 "P3<sub>2</sub>",
188 "R3",
189 "P-3",
190 "R-3",
191 "P312",
192 "P321",
193 "P3<sub>1</sub>12",
194 "P3<sub>1</sub>21",
195 "P3<sub>2</sub>12",
196 "P3<sub>2</sub>21",
197 "R32",
198 "P3m1",
199 "P31m",
200 "P3c1",
201 "P31c",
202 "R3m",
203 "R3c",
204 "P-31m",
205 "P-31c",
206 "P-3m1",
207 "P-3c1",
208 "R-3m",
209 "R-3c",
210 "P6",
211 "P6<sub>1</sub>",
212 "P6<sub>5</sub>",
213 "P6<sub>2</sub>",
214 "P6<sub>4</sub>",
215 "P6<sub>3</sub>",
216 "P-6",
217 "P6/m",
218 "P6<sub>3</sub>/m",
219 "P622",
220 "P6<sub>1</sub>22",
221 "P6<sub>5</sub>22",
222 "P6<sub>2</sub>22",
223 "P6<sub>4</sub>22",
224 "P6<sub>3</sub>22",
225 "P6mm",
226 "P6cc",
227 "P6<sub>3</sub>cm",
228 "P6<sub>3</sub>mc",
229 "P-6m2",
230 "P-6c2",
231 "P-62m",
232 "P-62c",
233 "P6/mmm",
234 "P6/mcc",
235 "P6<sub>3</sub>/mcm",
236 "P6<sub>3</sub>/mmc",
237 "P23",
238 "F23",
239 "I23",
240 "P2<sub>1</sub>3",
241 "I2<sub>1</sub>3",
242 "Pm-3",
243 "Pn-3",
244 "Fm-3",
245 "Fd-3",
246 "Im-3",
247 "Pa-3",
248 "Ia-3",
249 "P432",
250 "P4<sub>2</sub>32",
251 "F432",
252 "F4<sub>1</sub>32",
253 "I432",
254 "P4<sub>3</sub>32",
255 "P4<sub>1</sub>32",
256 "I4<sub>1</sub>32",
257 "P-43m",
258 "F-43m",
259 "I-43m",
260 "P-43n",
261 "F-43c",
262 "I-43d",
263 "Pm-3m",
264 "Pn-3n",
265 "Pm-3n",
266 "Pn-3m",
267 "Fm-3m",
268 "Fm-3c",
269 "Fd-3m",
270 "Fd-3c",
271 "Im-3m",
272 "Ia-3d"};
273
274gchar * hmsymbols[230] = {"P 1",
275 "P -1",
276 "P 1 2 1",
277 "P 1 21 1",
278 "C 1 2 1",
279 "P 1 m 1",
280 "P 1 c 1",
281 "C 1 m 1",
282 "C 1 c 1",
283 "P 1 2/m 1",
284 "P 1 21/m 1",
285 "C 1 2/m 1",
286 "P 1 2/c 1",
287 "P 1 21/c 1",
288 "C 1 2/c 1",
289 "P 2 2 2",
290 "P 2 2 21",
291 "P 21 21 2",
292 "P 21 21 21",
293 "C 2 2 21",
294 "C 2 2 2",
295 "F 2 2 2",
296 "I 2 2 2",
297 "I 21 21 21",
298 "P m m 2",
299 "P m c 21",
300 "P c c 2",
301 "P m a 2",
302 "P c a 21",
303 "P n c 2",
304 "P m n 21",
305 "P b a 2",
306 "P n a 21",
307 "P n n 2",
308 "C m m 2",
309 "C m c 21",
310 "C c c 2",
311 "A m m 2",
312 "A e m 2",
313 "A m a 2",
314 "A e a 2",
315 "F m m 2",
316 "F d d 2",
317 "I m m 2",
318 "I b a 2",
319 "I ma 2",
320 "P 2/m 2/m 2/m",
321 "P 2/n 2/n 2/n",
322 "P 2/c 2/c 2/m",
323 "P 2/b 2/a 2/n",
324 "P 21 /m 2/m 2/a",
325 "P 2/n 21/n 2/a",
326 "P 2/m 2/n 21/a",
327 "P 21/c 2/c 2/a",
328 "P 21/b 21/a 2/m",
329 "P 21/c 21/c 2/n",
330 "P 2/b 21/c 21/m",
331 "P 21/n 21/n 2/m",
332 "P 21/m 21/m 2/n",
333 "P 21/b 2/c 21/n",
334 "P 21/b 21/c 21/a",
335 "P 21/n 21/m 21/a",
336 "C 2/m 2/c 21/m",
337 "C 2/m 2/c 21/e",
338 "C 2/m 2/m 2/m",
339 "C 2/c 2/c 2/m",
340 "C 2/m 2/m 2/e",
341 "C 2/c 2/c 2/e",
342 "F 2/m 2/m 2/m",
343 "F 2/d 2/d 2/d",
344 "I 2/m 2/m 2/m",
345 "I 2/b 2/a 2/m",
346 "I 21/b 21/c 21/a",
347 "I 21/m 21/m 21/a",
348 "P 4",
349 "P 41",
350 "P 42",
351 "P 43",
352 "I 4",
353 "I 41",
354 "P -4",
355 "I -4",
356 "P 4/m",
357 "P 42/m",
358 "P 4/n",
359 "P 42/n",
360 "I 4/m",
361 "I 41/a",
362 "P 4 2 2",
363 "P 4 21 2",
364 "P 41 2 2",
365 "P 41 21 2",
366 "P 42 2 2",
367 "P 42 21 2",
368 "P 43 2 2",
369 "P 43 21 2",
370 "I 4 2 2",
371 "I 41 2 2",
372 "P 4 m m",
373 "P 4 b m",
374 "P 42 c m",
375 "P 42 n m",
376 "P 4 c c",
377 "P 4 n c",
378 "P 42 m c",
379 "P 42 b c",
380 "I 4 m m",
381 "I 4 c m",
382 "I 41 m d",
383 "I 41 c d",
384 "P -4 2 m",
385 "P -4 2 c",
386 "P -4 21 m",
387 "P -4 21 c",
388 "P -4 m 2",
389 "P -4 c 2",
390 "P -4 b 2",
391 "P -4 n 2",
392 "I -4 m 2",
393 "I -4 c 2",
394 "I -4 2 m",
395 "I -4 2 d",
396 "P 4/m 2/m 2/m",
397 "P 4/m 2/c 2/c",
398 "P 4/n 2/b 2/m",
399 "P 4/n 2/n 2/c",
400 "P 4/m 21/b 2/m",
401 "P 4/m 21/b 2/m",
402 "P 4/n 21/m 2/m",
403 "P 4/n 21/c 2/c",
404 "P 42/m 2/m 2/c",
405 "P 42/m 2/c 2/m",
406 "P 42/n 2/b 2/c",
407 "P 42/n 2/n 2/m",
408 "P 42/m 21/b 2/c",
409 "P 42/m 21/n 2/m",
410 "P 42/n 21/m 2/c",
411 "P 42/n 21/c 2/m",
412 "I 4/m 2/m 2/m",
413 "I 4/m 2/c 2/m",
414 "I 41/a 2/m 2/d",
415 "I 41/a 2/c 2/d",
416 "P 3",
417 "P 31",
418 "P 32",
419 "R 3",
420 "P -3",
421 "R -3",
422 "P 3 1 2",
423 "P 3 2 1",
424 "P 31 1 2",
425 "P 31 2 1",
426 "P 32 1 2",
427 "P 32 2 1",
428 "R 3 2",
429 "P 3 m 1",
430 "P 3 1 m",
431 "P 3 c 1",
432 "P 3 1 c",
433 "R 3 m",
434 "R 3 c",
435 "P -3 1 2/m",
436 "P -3 1 2/c",
437 "P -3 2/m 1",
438 "P -3 2/c 1",
439 "R -3 2/m",
440 "R -3 2/c",
441 "P 6",
442 "P 61",
443 "P 65",
444 "P 62",
445 "P 64",
446 "P 63",
447 "P -6",
448 "P 6/m",
449 "P 63/m",
450 "P 6 2 2",
451 "P 61 2 2",
452 "P 65 2 2",
453 "P 62 2 2",
454 "P 64 2 2",
455 "P 63 2 2",
456 "P 6 m m",
457 "P 6 c c",
458 "P 63 c m",
459 "P 63 m c",
460 "P -6 m 2",
461 "P -6 c 2",
462 "P -6 2 m",
463 "P -6 2 c",
464 "P 6/m 2/m 2/m",
465 "P 6/m 2/c 2/c",
466 "P 63/m 2/c 2/m",
467 "P 63/m 2/m 2/c",
468 "P 2 3",
469 "F 2 3",
470 "I 2 3",
471 "P 21 3",
472 "I 21 3",
473 "P 2/m -3",
474 "P 2/n -3",
475 "F 2/m -3",
476 "F 2/d -3",
477 "I 2/m -3",
478 "P 21/a -3",
479 "I 21/a -3",
480 "P 4 3 2",
481 "P 42 3 2",
482 "F 4 3 2",
483 "F 41 3 2",
484 "I 4 3 2",
485 "P 43 3 2",
486 "P 41 3 2",
487 "I 41 3 2",
488 "P -4 3 m",
489 "F -4 3 m",
490 "I -4 3 m",
491 "P -4 3 n",
492 "F -4 3 c",
493 "I -4 3 d",
494 "P 4/m -3 2/m",
495 "P 4/n -3 2/n",
496 "P 42/m -3 2/n",
497 "P 42/n -3 2/m",
498 "F 4/m -3 2/m",
499 "F 4/m -3 2/c",
500 "F 41/d -3 2/m",
501 "F 41/d -3 2/c",
502 "I 4/m -3 2/m",
503 "I 41/a -3 2/d"};
504
513space_group * clean_sgl_data (xmlDoc * doc, xmlTextReaderPtr reader)
514{
515 xmlFreeDoc(doc);
516 xmlFreeTextReader(reader);
517 xmlCleanupParser();
518 return NULL;
519}
520
529int get_this_group_data (space_group * spg, xmlNodePtr racine)
530{
531 xmlNodePtr node, num_node;
532 xmlNodePtr the_setting, the_point;
533 xmlNodePtr sp_node, ps_node, pp_node;
534 xmlAttrPtr s_node, p_node;
535 int val;
536 int j, k;
537 node = findnode (racine -> children, "settings");
538 if (node == NULL) return 0;
539 s_node = node -> properties;
540 if (s_node == NULL) return 0;
541 while (s_node)
542 {
543 num_node = s_node -> children;
544 if (num_node == NULL) return 0;
545 if (g_strcmp0 ("num",(char *)s_node -> name) == 0)
546 {
547 val = (int) string_to_double ((gpointer)xmlNodeGetContent(num_node));
548 }
549 s_node = s_node -> next;
550 }
551 if (! val) return 0;
552 spg -> nums = val;
553 spg -> settings = g_malloc0(spg -> nums*sizeof*spg -> settings);
554 node = node -> children;
555 if (node == NULL) return 0;
556 j = 0;
557 for (sp_node = node; sp_node; sp_node = sp_node -> next)
558 {
559 if (sp_node -> type == XML_ELEMENT_NODE)
560 {
561 s_node = sp_node -> properties;
562 if (s_node == NULL) return 0;
563 while (s_node)
564 {
565 the_setting = s_node -> children;
566 if (the_setting == NULL) return 0;
567 if (g_strcmp0 ("name",(char *)s_node -> name) == 0)
568 {
569 spg -> settings[j].name = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_setting));
570 }
571 else if (g_strcmp0 ("origin",(char *)s_node -> name) == 0)
572 {
573 spg -> settings[j].origin = (int)string_to_double ((gpointer)xmlNodeGetContent(the_setting));
574 }
575 else if (g_strcmp0 ("x",(char *)s_node -> name) == 0)
576 {
577 spg -> settings[j].pos[0] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_setting));
578 }
579 else if (g_strcmp0 ("y",(char *)s_node -> name) == 0)
580 {
581 spg -> settings[j].pos[1] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_setting));
582 }
583 else if (g_strcmp0 ("z",(char *)s_node -> name) == 0)
584 {
585 spg -> settings[j].pos[2] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_setting));
586 }
587 s_node = s_node -> next;
588 }
589 ps_node = findnode (sp_node -> children, "points");
590 if (ps_node)
591 {
592 p_node = ps_node -> properties;
593 if (p_node == NULL) return 0;
594 while (p_node)
595 {
596 num_node = p_node -> children;
597 if (num_node == NULL) return 0;
598 if (g_strcmp0 ("num",(char *)p_node -> name) == 0)
599 {
600 val = (int) string_to_double ((gpointer)xmlNodeGetContent(num_node));
601 }
602 p_node = p_node -> next;
603 }
604 if (! val) return 0;
605 spg -> settings[j].nump = val;
606 spg -> settings[j].points = g_malloc(val*sizeof*spg -> settings[j].points);
607 ps_node = ps_node -> children;
608 if (ps_node == NULL) return 0;
609 k = 0;
610 for (pp_node = ps_node; pp_node; pp_node = pp_node->next)
611 {
612 if (pp_node -> type == XML_ELEMENT_NODE)
613 {
614 s_node = pp_node -> properties;
615 if (s_node == NULL) return 0;
616 spg -> settings[j].points[k] = g_malloc(3*sizeof*spg -> settings[j].points[k]);
617 while (s_node)
618 {
619 the_point = s_node -> children;
620 if (the_point == NULL) return 0;
621 if (g_strcmp0 ("x",(char *)s_node -> name) == 0)
622 {
623 spg -> settings[j].points[k][0] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_point));
624 }
625 else if (g_strcmp0 ("y",(char *)s_node -> name) == 0)
626 {
627 spg -> settings[j].points[k][1] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_point));
628 }
629 else if (g_strcmp0 ("z",(char *)s_node -> name) == 0)
630 {
631 spg -> settings[j].points[k][2] = g_strdup_printf ("%s", (char *)xmlNodeGetContent(the_point));
632 }
633 s_node = s_node -> next;
634 }
635 k ++;
636 }
637 }
638 }
639 j ++;
640 }
641 }
642 return 1;
643}
644
653{
654 int i, j;
655 const xmlChar sgl[8]="sg-xml";
656 xmlDoc * doc;
657 xmlTextReaderPtr reader;
658 xmlNodePtr racine, node, num_node;
659 xmlNodePtr cp_node, wp_node, wc_node;
660 xmlNodePtr the_wyck, the_pos;
661 xmlAttrPtr c_node, w_node, p_node;
662
663 space_group * spg = g_malloc0(sizeof*spg);
664 reader = xmlReaderForFile(filetoread, NULL, 0);
665 if (reader == NULL)
666 {
667 return NULL;
668 }
669 else
670 {
671 doc = xmlParseFile(filetoread);
672 if (doc == NULL) return 0;
673 racine = xmlDocGetRootElement(doc);
674 if (g_strcmp0 ((char *)(racine -> name), (char *)sgl) != 0) return clean_sgl_data (doc, reader);
675 spg = g_malloc0(sizeof*spg);
676 node = findnode (racine -> children, "space-group");
677 if (node == NULL) return clean_sgl_data (doc, reader);
678 spg -> name = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(node));
679
680 node = findnode (racine -> children, "sg-num");
681 if (node == NULL) return clean_sgl_data (doc, reader);
682 spg -> id = (int) string_to_double ((gpointer)xmlNodeGetContent(node));
683
684 node = findnode (racine -> children, "hm-symbol");
685 if (node == NULL) return clean_sgl_data (doc, reader);
686 spg -> hms = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(node));
687
688 node = findnode (racine -> children, "bravais");
689 if (node == NULL) return clean_sgl_data (doc, reader);
690 spg -> bravais = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(node));
691
692 // Settings
693 if (!get_this_group_data (spg, racine)) return clean_sgl_data (doc, reader);
694
695 node = findnode(racine -> children, "wyckoff");
696 if (node == NULL) return clean_sgl_data (doc, reader);
697 c_node = node -> properties;
698 if (c_node == NULL) return clean_sgl_data (doc, reader);
699 while (c_node)
700 {
701 num_node = c_node -> children;
702 if (num_node == NULL) return clean_sgl_data (doc, reader);
703 if (g_strcmp0 ("num",(char *)c_node -> name) == 0)
704 {
705 spg -> numw = (int) string_to_double ((gpointer)xmlNodeGetContent(num_node));
706 }
707 c_node = c_node -> next;
708 }
709 if (! spg -> numw) return clean_sgl_data (doc, reader);
710 spg -> wyckoff = g_malloc0(spg -> numw*sizeof*spg -> wyckoff);
711 i = 0;
712 node = node -> children;
713 if (node == NULL) return clean_sgl_data (doc, reader);
714 for (cp_node = node; cp_node; cp_node = cp_node->next)
715 {
716 if (cp_node -> type == XML_ELEMENT_NODE)
717 {
718 w_node = cp_node -> properties;
719 if (w_node == NULL) return clean_sgl_data (doc, reader);
720 while (w_node)
721 {
722 the_wyck = w_node -> children;
723 if (the_wyck == NULL) return clean_sgl_data (doc, reader);
724 if (g_strcmp0 ("mul",(char *)w_node -> name) == 0)
725 {
726 spg -> wyckoff[i].multi = (int)string_to_double ((gpointer)xmlNodeGetContent(the_wyck));
727 }
728 else if (g_strcmp0 ("let",(char *)w_node -> name) == 0)
729 {
730 spg -> wyckoff[i].let = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(the_wyck));
731 }
732 else if (g_strcmp0 ("site",(char *)w_node -> name) == 0)
733 {
734 spg -> wyckoff[i].site = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(the_wyck));
735 }
736 w_node = w_node -> next;
737 }
738 spg -> wyckoff[i].pos = g_malloc(spg -> wyckoff[i].multi*sizeof*spg -> wyckoff[i].pos);
739 wp_node = cp_node -> children;
740 if (wp_node == NULL) return clean_sgl_data (doc, reader);
741 j = 0;
742 for (wc_node = wp_node; wc_node; wc_node = wc_node->next)
743 {
744 if (wc_node -> type == XML_ELEMENT_NODE)
745 {
746 p_node = wc_node -> properties;
747 if (p_node == NULL) return clean_sgl_data (doc, reader);
748 spg -> wyckoff[i].pos[j] = g_malloc(3*sizeof*spg -> wyckoff[i].pos[j]);
749 while (p_node)
750 {
751 the_pos = p_node -> children;
752 if (the_pos == NULL) return clean_sgl_data (doc, reader);
753 if (g_strcmp0 ("x",(char *)p_node -> name) == 0)
754 {
755 spg -> wyckoff[i].pos[j][0] = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(the_pos));
756 }
757 else if (g_strcmp0 ("y",(char *)p_node -> name) == 0)
758 {
759 spg -> wyckoff[i].pos[j][1] = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(the_pos));
760 }
761 else if (g_strcmp0 ("z",(char *)p_node -> name) == 0)
762 {
763 spg -> wyckoff[i].pos[j][2] = g_strdup_printf ("%s", (gchar *)xmlNodeGetContent(the_pos));
764 }
765 p_node = p_node -> next;
766 }
767 j ++;
768 }
769 }
770 i ++;
771 }
772 }
773
774 xmlFreeDoc(doc);
775 xmlFreeTextReader(reader);
776 xmlCleanupParser();
777 return spg;
778 }
779}
Function declarations for the crystal builder.
gchar * groups[230]
Definition cbuild_sg.c:43
int get_this_group_data(space_group *spg, xmlNodePtr racine)
retrieve space group data
Definition cbuild_sg.c:529
space_group * clean_sgl_data(xmlDoc *doc, xmlTextReaderPtr reader)
clean space group and corresponding XML data
Definition cbuild_sg.c:513
gchar * hmsymbols[230]
Definition cbuild_sg.c:274
space_group * read_sg_xml_file(const char *filetoread)
read space group data from XML file
Definition cbuild_sg.c:652
float val
Definition dlp_init.c:117
int multi
Definition dlp_init.c:121
xmlNodePtr findnode(xmlNodePtr startnode, char *nname)
find XML node
gchar * filetoread
double string_to_double(gpointer string)
convert string to double
Definition global.c:624
Global variable declarations Global convenience function declarations Global data structure defin...
gchar * name
Definition glwin.h:622
gchar * settings[3][10]
Definition w_advance.c:119