atomes 1.3.1
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-2026 by CNRS and University of Strasbourg */
15
21
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 xmlChar * content;
536 int val;
537 int j, k;
538 node = findnode (racine -> children, "settings");
539 if (node == NULL) return 0;
540 s_node = node -> properties;
541 if (s_node == NULL) return 0;
542 while (s_node)
543 {
544 num_node = s_node -> children;
545 if (num_node == NULL) return 0;
546 if (g_strcmp0 ("num",(char *)s_node -> name) == 0)
547 {
548 content = xmlNodeGetContent(num_node);
549 val = (int) string_to_double ((gpointer)content);
550 xmlFree (content);
551 }
552 s_node = s_node -> next;
553 }
554 if (! val) return 0;
555 spg -> nums = val;
556 spg -> settings = g_malloc0(spg -> nums*sizeof*spg -> settings);
557 node = node -> children;
558 if (node == NULL) return 0;
559 j = 0;
560 for (sp_node = node; sp_node; sp_node = sp_node -> next)
561 {
562 if (sp_node -> type == XML_ELEMENT_NODE)
563 {
564 s_node = sp_node -> properties;
565 if (s_node == NULL) return 0;
566 while (s_node)
567 {
568 the_setting = s_node -> children;
569 if (the_setting == NULL) return 0;
570 content = xmlNodeGetContent(the_setting);
571 if (g_strcmp0 ("name",(char *)s_node -> name) == 0)
572 {
573 spg -> settings[j].name = g_strdup_printf ("%s", content);
574 }
575 else if (g_strcmp0 ("origin",(char *)s_node -> name) == 0)
576 {
577 spg -> settings[j].origin = (int) string_to_double ((gpointer)content);
578 }
579 else if (g_strcmp0 ("x",(char *)s_node -> name) == 0)
580 {
581 spg -> settings[j].pos[0] = g_strdup_printf ("%s", content);
582 }
583 else if (g_strcmp0 ("y",(char *)s_node -> name) == 0)
584 {
585 spg -> settings[j].pos[1] = g_strdup_printf ("%s", content);
586 }
587 else if (g_strcmp0 ("z",(char *)s_node -> name) == 0)
588 {
589 spg -> settings[j].pos[2] = g_strdup_printf ("%s", content);
590 }
591 xmlFree (content);
592 s_node = s_node -> next;
593 }
594 ps_node = findnode (sp_node -> children, "points");
595 if (ps_node)
596 {
597 p_node = ps_node -> properties;
598 if (p_node == NULL) return 0;
599 while (p_node)
600 {
601 num_node = p_node -> children;
602 if (num_node == NULL) return 0;
603 if (g_strcmp0 ("num",(char *)p_node -> name) == 0)
604 {
605 content = xmlNodeGetContent(num_node);
606 val = (int) string_to_double ((gpointer)content);
607 xmlFree (content);
608 }
609 p_node = p_node -> next;
610 }
611 if (! val) return 0;
612 spg -> settings[j].nump = val;
613 spg -> settings[j].points = g_malloc0(val*sizeof*spg -> settings[j].points);
614 ps_node = ps_node -> children;
615 if (ps_node == NULL) return 0;
616 k = 0;
617 for (pp_node = ps_node; pp_node; pp_node = pp_node->next)
618 {
619 if (pp_node -> type == XML_ELEMENT_NODE)
620 {
621 s_node = pp_node -> properties;
622 if (s_node == NULL) return 0;
623 spg -> settings[j].points[k] = g_malloc0(3*sizeof*spg -> settings[j].points[k]);
624 while (s_node)
625 {
626 the_point = s_node -> children;
627 if (the_point == NULL) return 0;
628 content = xmlNodeGetContent(the_point);
629 if (g_strcmp0 ("x",(char *)s_node -> name) == 0)
630 {
631 spg -> settings[j].points[k][0] = g_strdup_printf ("%s", content);
632 }
633 else if (g_strcmp0 ("y",(char *)s_node -> name) == 0)
634 {
635 spg -> settings[j].points[k][1] = g_strdup_printf ("%s", content);
636 }
637 else if (g_strcmp0 ("z",(char *)s_node -> name) == 0)
638 {
639 spg -> settings[j].points[k][2] = g_strdup_printf ("%s", content);
640 }
641 xmlFree (content);
642 s_node = s_node -> next;
643 }
644 k ++;
645 }
646 }
647 }
648 j ++;
649 }
650 }
651 return 1;
652}
653
662{
663 int i, j;
664 xmlDoc * doc;
665 xmlTextReaderPtr reader;
666 xmlNodePtr racine, node, num_node;
667 xmlNodePtr cp_node, wp_node, wc_node;
668 xmlNodePtr the_wyck, the_pos;
669 xmlAttrPtr c_node, w_node, p_node;
670 xmlChar * content;
671
672 space_group * spg = g_malloc0(sizeof*spg);
673 reader = xmlReaderForFile(filetoread, NULL, 0);
674 if (reader == NULL)
675 {
676 return NULL;
677 }
678 else
679 {
680 doc = xmlParseFile(filetoread);
681 if (doc == NULL) return 0;
682 racine = xmlDocGetRootElement(doc);
683 if (g_strcmp0 ((char *)(racine -> name), "sg-xml") != 0) return clean_sgl_data (doc, reader);
684 spg = g_malloc0(sizeof*spg);
685 node = findnode (racine -> children, "space-group");
686 if (node == NULL) return clean_sgl_data (doc, reader);
687 content = xmlNodeGetContent(node);
688 spg -> name = g_strdup_printf ("%s", content);
689 xmlFree (content);
690
691 node = findnode (racine -> children, "sg-num");
692 if (node == NULL) return clean_sgl_data (doc, reader);
693 content = xmlNodeGetContent(node);
694 spg -> id = (int) string_to_double ((gpointer)content);
695 xmlFree (content);
696
697 node = findnode (racine -> children, "hm-symbol");
698 if (node == NULL) return clean_sgl_data (doc, reader);
699 content = xmlNodeGetContent(node);
700 spg -> hms = g_strdup_printf ("%s", content);
701 xmlFree (content);
702
703 node = findnode (racine -> children, "bravais");
704 if (node == NULL) return clean_sgl_data (doc, reader);
705 content = xmlNodeGetContent(node);
706 spg -> bravais = g_strdup_printf ("%s", content);
707 xmlFree (content);
708
709 // Settings
710 if (!get_this_group_data (spg, racine)) return clean_sgl_data (doc, reader);
711
712 node = findnode(racine -> children, "wyckoff");
713 if (node == NULL) return clean_sgl_data (doc, reader);
714 c_node = node -> properties;
715 if (c_node == NULL) return clean_sgl_data (doc, reader);
716 while (c_node)
717 {
718 num_node = c_node -> children;
719 if (num_node == NULL) return clean_sgl_data (doc, reader);
720 if (g_strcmp0 ("num",(char *)c_node -> name) == 0)
721 {
722 content = xmlNodeGetContent(num_node);
723 spg -> numw = (int) string_to_double ((gpointer)content);
724 xmlFree (content);
725 }
726 c_node = c_node -> next;
727 }
728 if (! spg -> numw) return clean_sgl_data (doc, reader);
729 spg -> wyckoff = g_malloc0(spg -> numw*sizeof*spg -> wyckoff);
730 i = 0;
731 node = node -> children;
732 if (node == NULL) return clean_sgl_data (doc, reader);
733 for (cp_node = node; cp_node; cp_node = cp_node->next)
734 {
735 if (cp_node -> type == XML_ELEMENT_NODE)
736 {
737 w_node = cp_node -> properties;
738 if (w_node == NULL) return clean_sgl_data (doc, reader);
739 while (w_node)
740 {
741 the_wyck = w_node -> children;
742 if (the_wyck == NULL) return clean_sgl_data (doc, reader);
743 content = xmlNodeGetContent(the_wyck);
744 if (g_strcmp0 ("mul",(char *)w_node -> name) == 0)
745 {
746 spg -> wyckoff[i].multi = (int)string_to_double ((gpointer)content);
747 }
748 else if (g_strcmp0 ("let",(char *)w_node -> name) == 0)
749 {
750 spg -> wyckoff[i].let = g_strdup_printf ("%s", content);
751 }
752 else if (g_strcmp0 ("site",(char *)w_node -> name) == 0)
753 {
754 spg -> wyckoff[i].site = g_strdup_printf ("%s", content);
755 }
756 xmlFree (content);
757 w_node = w_node -> next;
758 }
759 spg -> wyckoff[i].pos = g_malloc0(spg -> wyckoff[i].multi*sizeof*spg -> wyckoff[i].pos);
760 wp_node = cp_node -> children;
761 if (wp_node == NULL) return clean_sgl_data (doc, reader);
762 j = 0;
763 for (wc_node = wp_node; wc_node; wc_node = wc_node->next)
764 {
765 if (wc_node -> type == XML_ELEMENT_NODE)
766 {
767 p_node = wc_node -> properties;
768 if (p_node == NULL) return clean_sgl_data (doc, reader);
769 spg -> wyckoff[i].pos[j] = g_malloc0(3*sizeof*spg -> wyckoff[i].pos[j]);
770 while (p_node)
771 {
772 the_pos = p_node -> children;
773 if (the_pos == NULL) return clean_sgl_data (doc, reader);
774 content = xmlNodeGetContent(the_pos);
775 if (g_strcmp0 ("x",(char *)p_node -> name) == 0)
776 {
777 spg -> wyckoff[i].pos[j][0] = g_strdup_printf ("%s", content);
778 }
779 else if (g_strcmp0 ("y",(char *)p_node -> name) == 0)
780 {
781 spg -> wyckoff[i].pos[j][1] = g_strdup_printf ("%s", content);
782 }
783 else if (g_strcmp0 ("z",(char *)p_node -> name) == 0)
784 {
785 spg -> wyckoff[i].pos[j][2] = g_strdup_printf ("%s", content);
786 }
787 xmlFree (content);
788 p_node = p_node -> next;
789 }
790 j ++;
791 }
792 }
793 i ++;
794 }
795 }
796
797 xmlFreeDoc(doc);
798 xmlFreeTextReader(reader);
799 xmlCleanupParser();
800 return spg;
801 }
802}
Function declarations for the crystal builder.
gchar * groups[230]
Definition cbuild_sg.c:43
gchar * hmsymbols[230]
Definition cbuild_sg.c:274
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
space_group * read_sg_xml_file(const char *filetoread)
read space group data from XML file
Definition cbuild_sg.c:661
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:611
Global variable declarations Global convenience function declarations Global data structure defin...
gchar * name
Definition glwin.h:660