-
Notifications
You must be signed in to change notification settings - Fork 0
/
materialObject.pro
executable file
·1053 lines (981 loc) · 37.4 KB
/
materialObject.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; *******************************************************************
; Polydefix stress, strain, and texture analysis for experiment in
; angle dispersive geometry
; Copyright (C) 2000-2011 S. Merkel, Universite Lille 1
; http://merkel.zoneo.net/Multifit/
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;
; *******************************************************************
; symmetry codes (numbers and letters, symmetry code in letters in the reference)
; - 0 cubic
; - 1 hexa for hexagonal
; - 2 otho for orthorhombic
; - 3 trig for trigonal
; - 4 mono for monoclinic
; Equation of state (Birch-Mur...)
; - V0: unit cell volume at zero pressure
; - K0: bulk modulus at zero pressure
; - dK0: first derivative of bulk modulus
; elasticmodel:
; 0->isotropic
; 1->anisotropic
; Parameters for isotropic elastic model
; iK[]: K = iK[0] + iK[1] * P + iK[2] * P*P (P deduced from the data and EOS)
; iG[]: G = iG[0] + iG[1] * P + iG[2] * P*P (P deduced from the data and EOS)
; Parameters for anisotropic elastic model
; Cij: Cij = Cij[i,j,0] + Cij[i,j,1] * P + Cij[i,j,2] * P * P(P deduced from the data and EOS)
PRO materialObject__DEFINE
struct = { materialObject, tmp: 0, name:'Not set', symmetry:'', V0:0.0, K0:0.0, dK0:0.0, elasticmodel: 0, iK: fltarr(3), iG: fltarr(3), Cij: fltarr(7,7,3) }
END
function materialObject::Init
for i=0,2 do begin
self.iK[i] = 0.0
self.iG[i] = 0.0
endfor
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
return, 1
end
; *************************************************** Temporary variables **********************
; functions with the tmp variable: usefull to transmit information from actions
; with the object itself...
pro materialObject::setTmp, tmp
self.tmp = tmp
end
function materialObject::getTmp
return, self.tmp
end
; **************************************************** Elastic properties ***********************
pro materialObject::setIsotropicProp, g0, g1, g2
self.iK[0] = 0.
self.iK[1] = 0.
self.iK[2] = 0.
self.iG[0] = g0
self.iG[1] = g1
self.iG[2] = g2
self.elasticmodel=0
end
pro materialObject::setAnisPropOrtho, c11, c22, c33, c12, c13, c23, c44, c55, c66, dc11, dc22, dc33, dc12, dc13, dc23, dc44, dc55, dc66, ddc11, ddc22, ddc33, ddc12, ddc13, ddc23, ddc44, ddc55, ddc66
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
self.Cij[1,1,0] = c11
self.Cij[2,2,0] = c22
self.Cij[3,3,0] = c33
self.Cij[1,2,0] = c12
self.Cij[1,3,0] = c13
self.Cij[2,3,0] = c23
self.Cij[4,4,0] = c44
self.Cij[5,5,0] = c55
self.Cij[6,6,0] = c66
self.Cij[1,1,1] = dc11
self.Cij[2,2,1] = dc22
self.Cij[3,3,1] = dc33
self.Cij[1,2,1] = dc12
self.Cij[1,3,1] = dc13
self.Cij[2,3,1] = dc23
self.Cij[4,4,1] = dc44
self.Cij[5,5,1] = dc55
self.Cij[6,6,1] = dc66
self.Cij[1,1,2] = ddc11
self.Cij[2,2,2] = ddc22
self.Cij[3,3,2] = ddc33
self.Cij[1,2,2] = ddc12
self.Cij[1,3,2] = ddc13
self.Cij[2,3,2] = ddc23
self.Cij[4,4,2] = ddc44
self.Cij[5,5,2] = ddc55
self.Cij[6,6,2] = ddc66
for i=1,6 do begin
for j=1,i-1 do begin
for k=0,2 do begin
self.Cij[i,j,k] = self.Cij[j,i,k]
endfor
endfor
endfor
self.elasticmodel=1
end
pro materialObject::setAnisPropMono, c11, c22, c33, c12, c13, c15, c23, c25, c35, c44, c46, c55, c66, $
dc11, dc22, dc33, dc12, dc13, dc15, dc23, dc25, dc35, dc44, dc46, dc55, dc66, $
ddc11, ddc22, ddc33, ddc12, ddc13, ddc15, ddc23, ddc25, ddc35, ddc44, ddc46, ddc55, ddc66
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
self.Cij[1,1,0] = c11
self.Cij[2,2,0] = c22
self.Cij[3,3,0] = c33
self.Cij[1,2,0] = c12
self.Cij[1,3,0] = c13
self.Cij[1,5,0] = c15
self.Cij[2,3,0] = c23
self.Cij[2,5,0] = c25
self.Cij[3,5,0] = c35
self.Cij[4,4,0] = c44
self.Cij[4,6,0] = c46
self.Cij[5,5,0] = c55
self.Cij[6,6,0] = c66
self.Cij[1,1,1] = dc11
self.Cij[2,2,1] = dc22
self.Cij[3,3,1] = dc33
self.Cij[1,2,1] = dc12
self.Cij[1,3,1] = dc13
self.Cij[1,5,1] = dc15
self.Cij[2,3,1] = dc23
self.Cij[2,5,1] = dc25
self.Cij[3,5,1] = dc35
self.Cij[4,4,1] = dc44
self.Cij[4,6,1] = dc46
self.Cij[5,5,1] = dc55
self.Cij[6,6,1] = dc66
self.Cij[1,1,2] = ddc11
self.Cij[2,2,2] = ddc22
self.Cij[3,3,2] = ddc33
self.Cij[1,2,2] = ddc12
self.Cij[1,3,2] = ddc13
self.Cij[1,5,2] = ddc15
self.Cij[2,3,2] = ddc23
self.Cij[2,5,2] = ddc25
self.Cij[3,5,2] = ddc35
self.Cij[4,4,2] = ddc44
self.Cij[4,6,2] = ddc46
self.Cij[5,5,2] = ddc55
self.Cij[6,6,2] = ddc66
for i=1,6 do begin
for j=1,i-1 do begin
for k=0,2 do begin
self.Cij[i,j,k] = self.Cij[j,i,k]
endfor
endfor
endfor
self.elasticmodel=1
end
pro materialObject::setAnisPropHexa, c11, c33, c12, c13, c44, dc11, dc33, dc12, dc13, dc44, ddc11, ddc33, ddc12, ddc13, ddc44
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
self.Cij[1,1,0] = c11
self.Cij[2,2,0] = c11
self.Cij[3,3,0] = c33
self.Cij[1,2,0] = c12
self.Cij[1,3,0] = c13
self.Cij[2,3,0] = c13
self.Cij[4,4,0] = c44
self.Cij[5,5,0] = c44
self.Cij[6,6,0] = 0.5*(c11-c12)
self.Cij[1,1,1] = dc11
self.Cij[2,2,1] = dc11
self.Cij[3,3,1] = dc33
self.Cij[1,2,1] = dc12
self.Cij[1,3,1] = dc13
self.Cij[2,3,1] = dc13
self.Cij[4,4,1] = dc44
self.Cij[5,5,1] = dc44
self.Cij[6,6,1] = 0.5*(dc11-dc12)
self.Cij[1,1,2] = ddc11
self.Cij[2,2,2] = ddc11
self.Cij[3,3,2] = ddc33
self.Cij[1,2,2] = ddc12
self.Cij[1,3,2] = ddc13
self.Cij[2,3,2] = ddc13
self.Cij[4,4,2] = ddc44
self.Cij[5,5,2] = ddc44
self.Cij[6,6,2] = 0.5*(ddc11-ddc12)
for i=1,6 do begin
for j=1,i-1 do begin
for k=0,2 do begin
self.Cij[i,j,k] = self.Cij[j,i,k]
endfor
endfor
endfor
self.elasticmodel=1
end
pro materialObject::setAnisPropTrig, c11, c33, c12, c13, c14, c15, c44, dc11, dc33, dc12, dc13, dc14, dc15, dc44, ddc11, ddc33, ddc12, ddc13, ddc14, ddc15, ddc44
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
self.Cij[1,1,0] = c11
self.Cij[2,2,0] = c11
self.Cij[3,3,0] = c33
self.Cij[1,2,0] = c12
self.Cij[1,3,0] = c13
self.Cij[2,3,0] = c13
self.Cij[1,4,0] = c14
self.Cij[1,5,0] = c15
self.Cij[2,4,0] = -c14
self.Cij[2,5,0] = -c15
self.Cij[4,6,0] = -c15
self.Cij[5,6,0] = -c14
self.Cij[4,4,0] = c44
self.Cij[5,5,0] = c44
self.Cij[6,6,0] = 0.5*(c11-c12)
self.Cij[1,1,1] = dc11
self.Cij[2,2,1] = dc11
self.Cij[3,3,1] = dc33
self.Cij[1,2,1] = dc12
self.Cij[1,3,1] = dc13
self.Cij[2,3,1] = dc13
self.Cij[1,4,1] = dc14
self.Cij[1,5,1] = dc15
self.Cij[2,4,1] = -dc14
self.Cij[2,5,1] = -dc15
self.Cij[4,6,1] = -dc15
self.Cij[5,6,1] = -dc14
self.Cij[4,4,1] = dc44
self.Cij[5,5,1] = dc44
self.Cij[6,6,1] = 0.5*(dc11-dc12)
self.Cij[1,1,2] = ddc11
self.Cij[2,2,2] = ddc11
self.Cij[3,3,2] = ddc33
self.Cij[1,2,2] = ddc12
self.Cij[1,3,2] = ddc13
self.Cij[2,3,2] = ddc13
self.Cij[1,4,2] = ddc14
self.Cij[1,5,2] = ddc15
self.Cij[2,4,2] = -ddc14
self.Cij[2,5,2] = -ddc15
self.Cij[4,6,2] = -ddc15
self.Cij[5,6,2] = -ddc14
self.Cij[4,4,2] = ddc44
self.Cij[5,5,2] = ddc44
self.Cij[6,6,2] = 0.5*(ddc11-ddc12)
for i=1,6 do begin
for j=1,i-1 do begin
for k=0,2 do begin
self.Cij[i,j,k] = self.Cij[j,i,k]
endfor
endfor
endfor
self.elasticmodel=1
end
pro materialObject::setAnisPropCubic, c11, c12, c44, dc11, dc12, dc44, ddc11, ddc12, ddc44
for i=0,6 do begin
for j=0,6 do begin
for k=0,2 do begin
self.Cij[i,j,k] = 0.0
endfor
endfor
endfor
self.Cij[1,1,0] = c11
self.Cij[2,2,0] = c11
self.Cij[3,3,0] = c11
self.Cij[1,2,0] = c12
self.Cij[1,3,0] = c12
self.Cij[2,3,0] = c12
self.Cij[4,4,0] = c44
self.Cij[5,5,0] = c44
self.Cij[6,6,0] = c44
self.Cij[1,1,1] = dc11
self.Cij[2,2,1] = dc11
self.Cij[3,3,1] = dc11
self.Cij[1,2,1] = dc12
self.Cij[1,3,1] = dc12
self.Cij[2,3,1] = dc12
self.Cij[4,4,1] = dc44
self.Cij[5,5,1] = dc44
self.Cij[6,6,1] = dc44
self.Cij[1,1,2] = ddc11
self.Cij[2,2,2] = ddc11
self.Cij[3,3,2] = ddc11
self.Cij[1,2,2] = ddc12
self.Cij[1,3,2] = ddc12
self.Cij[2,3,2] = ddc12
self.Cij[4,4,2] = ddc44
self.Cij[5,5,2] = ddc44
self.Cij[6,6,2] = ddc44
for i=1,6 do begin
for j=1,i-1 do begin
for k=0,2 do begin
self.Cij[i,j,k] = self.Cij[j,i,k]
endfor
endfor
endfor
self.elasticmodel=1
end
; **************************************************** Set parameters **************************
pro materialObject::setSymmetryFromCode, code
case code OF
0: self.symmetry = 'cubic'
1: self.symmetry = 'hexa'
2: self.symmetry = 'ortho'
3: self.symmetry = 'trig'
4: self.symmetry = 'mono'
else:
endcase
end
pro materialObject::setElasticModel, model
self.elasticmodel = model
end
pro materialObject::setName, name
self.name = name
end
pro materialObject::setEOSParameters, vo, ko, dko
self.V0 = vo
self.K0 = ko
self.dK0 = dKo
end
; **************************************************** Information ******************************
function materialObject::refineUnitCell, latticestrain
cell = OBJ_NEW('unitCellObject', self.symmetry, latticestrain->getName())
if (latticestrain->getSet() eq 1) then begin
; Hexagonal or trigonal
if ((self.symmetry eq 'hexa') or (self.symmetry eq 'trig')) then begin
nuse = latticestrain->getnuse()
d = latticestrain->getd()
dd = latticestrain->getdd()
h = latticestrain->geth()
k = latticestrain->getk()
l = latticestrain->getl()
x = replicate({plane, h:0, k:0, l:0},nuse)
for i=0,nuse-1 do begin
x[i] = {plane, h[i], k[i], l[i]}
endfor
a = [1., 1.6]
fit = MPFITFUN('dhklhexa', x, d, dd, a, perror=perror, YFIT=dfit, /quiet)
cell->setFit, [fit[0], perror[0], fit[1], perror[1]]
txt = "\thkl dm dc diff\n"
for i=0,nuse-1 do begin
txt += "\t" + STRTRIM(STRING(h[i],/PRINT),2)+ STRTRIM(STRING(k[i],/PRINT),2)+ STRTRIM(STRING(l[i],/PRINT),2) + ": " + fltformatA(d[i]) + " (+/-) " + fltformatA(dd[i]) + " " + fltformatA(dfit[i]) + " " + fltformatA(d[i]-dfit[i]) + "\n"
endfor
cell->setDetails, txt
; Orthorhombic
endif else if(self.symmetry eq 'ortho') then begin
nuse = latticestrain->getnuse()
if (nuse ge 3) then begin
d = latticestrain->getd()
dd = latticestrain->getdd()
h = latticestrain->geth()
k = latticestrain->getk()
l = latticestrain->getl()
x = replicate({plane, h:0, k:0, l:0},nuse)
for i=0,nuse-1 do begin
x[i] = {plane, h[i], k[i], l[i]}
endfor
a = [5., 10., 6.]
fit = MPFITFUN('dhklortho', x, d, dd, a, perror=perror, YFIT=dfit, /quiet)
cell->setFit, [fit[0], perror[0], fit[1], perror[1], fit[2], perror[2]]
txt = "\thkl dm dc diff\n"
for i=0,nuse-1 do begin
txt += "\t" + STRTRIM(STRING(h[i],/PRINT),2)+ STRTRIM(STRING(k[i],/PRINT),2)+ STRTRIM(STRING(l[i],/PRINT),2) + ": " + fltformatA(d[i]) + " (+/-) " + fltformatA(dd[i]) + " " + fltformatA(dfit[i]) + " " + fltformatA(d[i]-dfit[i]) + "\n"
endfor
endif else begin
txt = 'not enough planes to refine unit cell!'
endelse
cell->setDetails, txt
; Monoclinic
endif else if(self.symmetry eq 'mono') then begin
nuse = latticestrain->getnuse()
if (nuse ge 4) then begin
d = latticestrain->getd()
dd = latticestrain->getdd()
h = latticestrain->geth()
k = latticestrain->getk()
l = latticestrain->getl()
x = replicate({plane, h:0, k:0, l:0},nuse)
for i=0,nuse-1 do begin
x[i] = {plane, h[i], k[i], l[i]}
endfor
a = [1., 1., 1., 1.75]
fit = MPFITFUN('dhklmono', x, d, dd, a, perror=perror, YFIT=dfit, /quiet)
cell->setFit, [fit[0], perror[0], fit[1], perror[1], fit[2], perror[2], fit[3], perror[3]]
txt = "\thkl dm dc diff\n"
for i=0,nuse-1 do begin
txt += "\t" + STRTRIM(STRING(h[i],/PRINT),2)+ STRTRIM(STRING(k[i],/PRINT),2)+ STRTRIM(STRING(l[i],/PRINT),2) + ": " + fltformatA(d[i]) + " (+/-) " + fltformatA(dd[i]) + " " + fltformatA(dfit[i]) + " " + fltformatA(d[i]-dfit[i]) + "\n"
endfor
endif else begin
txt = 'not enough planes to refine unit cell!'
endelse
cell->setDetails, txt
; cubic
endif else if (self.symmetry eq 'cubic') then begin
nuse = latticestrain->getnuse()
d = latticestrain->getd()
dd = latticestrain->getdd()
h = latticestrain->geth()
k = latticestrain->getk()
l = latticestrain->getl()
x = replicate({plane, h:0, k:0, l:0},nuse)
for i=0,nuse-1 do begin
x[i] = {plane, h[i], k[i], l[i]}
endfor
a = d[0]*sqrt(h[0]*h[0]+k[0]*k[0]+l[0]*l[0])
fit = MPFITFUN('dhklcubic', x, d, dd, a, perror=perror, YFIT=dfit, /quiet)
cell->setFit, [fit[0], perror[0]]
txt = "\thkl dm dc diff\n"
for i=0,nuse-1 do begin
txt += "\t" + STRTRIM(STRING(h[i],/PRINT),2)+ STRTRIM(STRING(k[i],/PRINT),2)+ STRTRIM(STRING(l[i],/PRINT),2) + ": " + fltformatA(d[i]) + " (+/-) " + fltformatA(dd[i]) + " " + fltformatA(dfit[i]) + " " + fltformatA(d[i]-dfit[i]) + "\n"
endfor
cell->setDetails, txt
endif
endif
return, cell
end
function materialObject::birch3, volume
v = volume/self.V0
f = .5*(v^(-2./3.)-1.);
p0 = self.K0;
p1 = 1.5*self.K0*(self.dK0-4.);
FF = p0+p1*f;
p = FF*3.*f*(1.+2.*f)^2.5;
return, p
end
function materialObject::refinePressure, latticestrain
cell = self->refineUnitCell(latticestrain)
V = cell->getVolume()
P = self->birch3(V[0])
PP1 = self->birch3(V[0]+V[1])
PP2 = self->birch3(V[0]-V[1])
dP = 0.5*abs(PP1-PP2)
cell->setPressure, [P,dP]
return, cell
end
function materialObject::refineVolume, latticestrain
cell = self->refineUnitCell(latticestrain)
return, cell
end
; **************************************************** Information ******************************
function materialObject::getName
return, self.name
end
function materialObject::getSymmetry
return, self.symmetry
end
function materialObject::getSymmetryFromCode, code
case code OF
0: return, 'cubic'
1: return, 'hexa'
2: return, 'ortho'
3: return, 'trig'
4: return, 'mono'
else: return, 10
endcase
return, 10
end
function materialObject::getSymmetryCode
case self.symmetry of
'cubic': return, 0
'hexa': return, 1
'ortho': return, 2
'trig': return, 3
'mono': return, 4
else: return, 10
endcase
return, 10
end
function materialObject::getElasticModelCode
return, self.elasticmodel
end
function materialObject::getV0
return, self.V0
end
function materialObject::getK0
return, self.K0
end
function materialObject::getDK0
return, self.dK0
end
function materialObject::getIK, i
return, self.iK[i]
end
function materialObject::getIG, i
return, self.iG[i]
end
function materialObject::getCij, i, j, k
return, self.Cij[i,j,k]
end
function materialObject::infoTxt
str = "Information about this material:\n"
str += "\tName: " + self.name + "\n"
str += "\tSymmetry: " + self.symmetry + "\n"
str += "\tEquation of state parameters: Vo=" + STRTRIM(STRING(self.V0,/PRINT),2) + " Ko=" + STRTRIM(STRING(self.K0,/PRINT),2) + " K'o=" + STRTRIM(STRING(self.dK0,/PRINT),2) + "\n"
if (self.elasticmodel eq 0) then begin
str += "\tElastic model: isotropic\n"
str += "\tG = " + STRTRIM(STRING(self.iG[0],/PRINT),2) + " + " + STRTRIM(STRING(self.iG[1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.iG[2],/PRINT),2) + "*P*P\n"
endif else begin
str += "\tElastic model: anisotropic\n"
if (self.symmetry eq 'hexa') then begin
str += "\tC11 = " + STRTRIM(STRING(self.Cij[1,1,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,1,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,1,2],/PRINT),2) + "*P*P\n"
str += "\tC33 = " + STRTRIM(STRING(self.Cij[3,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[3,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[3,3,2],/PRINT),2) + "*P*P\n"
str += "\tC12 = " + STRTRIM(STRING(self.Cij[1,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,2,2],/PRINT),2) + "*P*P\n"
str += "\tC13 = " + STRTRIM(STRING(self.Cij[1,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,3,2],/PRINT),2) + "*P*P\n"
str += "\tC44 = " + STRTRIM(STRING(self.Cij[4,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,4,2],/PRINT),2) + "*P*P\n"
endif else if (self.symmetry eq 'trig') then begin
str += "\tC11 = " + STRTRIM(STRING(self.Cij[1,1,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,1,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,1,2],/PRINT),2) + "*P*P\n"
str += "\tC33 = " + STRTRIM(STRING(self.Cij[3,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[3,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[3,3,2],/PRINT),2) + "*P*P\n"
str += "\tC12 = " + STRTRIM(STRING(self.Cij[1,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,2,2],/PRINT),2) + "*P*P\n"
str += "\tC13 = " + STRTRIM(STRING(self.Cij[1,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,3,2],/PRINT),2) + "*P*P\n"
str += "\tC14 = " + STRTRIM(STRING(self.Cij[1,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,4,2],/PRINT),2) + "*P*P\n"
str += "\tC15 = " + STRTRIM(STRING(self.Cij[1,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,5,2],/PRINT),2) + "*P*P\n"
str += "\tC44 = " + STRTRIM(STRING(self.Cij[4,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,4,2],/PRINT),2) + "*P*P\n"
endif else if (self.symmetry eq 'ortho') then begin
str += "\tC11 = " + STRTRIM(STRING(self.Cij[1,1,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,1,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,1,2],/PRINT),2) + "*P*P\n"
str += "\tC22 = " + STRTRIM(STRING(self.Cij[2,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[2,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[2,2,2],/PRINT),2) + "*P*P\n"
str += "\tC33 = " + STRTRIM(STRING(self.Cij[3,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[3,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[3,3,2],/PRINT),2) + "*P*P\n"
str += "\tC12 = " + STRTRIM(STRING(self.Cij[1,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,2,2],/PRINT),2) + "*P*P\n"
str += "\tC13 = " + STRTRIM(STRING(self.Cij[1,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,3,2],/PRINT),2) + "*P*P\n"
str += "\tC23 = " + STRTRIM(STRING(self.Cij[2,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[2,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[2,3,2],/PRINT),2) + "*P*P\n"
str += "\tC44 = " + STRTRIM(STRING(self.Cij[4,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,4,2],/PRINT),2) + "*P*P\n"
str += "\tC55 = " + STRTRIM(STRING(self.Cij[5,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[5,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[5,5,2],/PRINT),2) + "*P*P\n"
str += "\tC66 = " + STRTRIM(STRING(self.Cij[6,6,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[6,6,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[6,6,2],/PRINT),2) + "*P*P\n"
endif else if (self.symmetry eq 'mono') then begin
str += "\tC11 = " + STRTRIM(STRING(self.Cij[1,1,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,1,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,1,2],/PRINT),2) + "*P*P\n"
str += "\tC22 = " + STRTRIM(STRING(self.Cij[2,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[2,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[2,2,2],/PRINT),2) + "*P*P\n"
str += "\tC33 = " + STRTRIM(STRING(self.Cij[3,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[3,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[3,3,2],/PRINT),2) + "*P*P\n"
str += "\tC12 = " + STRTRIM(STRING(self.Cij[1,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,2,2],/PRINT),2) + "*P*P\n"
str += "\tC13 = " + STRTRIM(STRING(self.Cij[1,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,3,2],/PRINT),2) + "*P*P\n"
str += "\tC15 = " + STRTRIM(STRING(self.Cij[1,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,5,2],/PRINT),2) + "*P*P\n"
str += "\tC23 = " + STRTRIM(STRING(self.Cij[2,3,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[2,3,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[2,3,2],/PRINT),2) + "*P*P\n"
str += "\tC25 = " + STRTRIM(STRING(self.Cij[2,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[2,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[2,5,2],/PRINT),2) + "*P*P\n"
str += "\tC35 = " + STRTRIM(STRING(self.Cij[3,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[3,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[3,5,2],/PRINT),2) + "*P*P\n"
str += "\tC44 = " + STRTRIM(STRING(self.Cij[4,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,4,2],/PRINT),2) + "*P*P\n"
str += "\tC46 = " + STRTRIM(STRING(self.Cij[4,6,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,6,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,6,2],/PRINT),2) + "*P*P\n"
str += "\tC55 = " + STRTRIM(STRING(self.Cij[5,5,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[5,5,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[5,5,2],/PRINT),2) + "*P*P\n"
str += "\tC66 = " + STRTRIM(STRING(self.Cij[6,6,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[6,6,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[6,6,2],/PRINT),2) + "*P*P\n"
endif else if (self.symmetry eq 'cubic') then begin
str += "\tC11 = " + STRTRIM(STRING(self.Cij[1,1,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,1,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,1,2],/PRINT),2) + "*P*P\n"
str += "\tC12 = " + STRTRIM(STRING(self.Cij[1,2,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[1,2,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[1,2,2],/PRINT),2) + "*P*P\n"
str += "\tC44 = " + STRTRIM(STRING(self.Cij[4,4,0],/PRINT),2) + " + " + STRTRIM(STRING(self.Cij[4,4,1],/PRINT),2) + "*P + " + STRTRIM(STRING(self.Cij[4,4,2],/PRINT),2) + "*P*P\n"
endif
endelse
return, str
end
function materialObject::labelPCSV
case self.symmetry of
'cubic': return, "#" + STRING(9B) + "a" + STRING(9B) + "da" + STRING(9B)+ "V" + STRING(9B) + "dV" + STRING(9B) + "P" + STRING(9B) + "dP"
'hexa': return, "#" + STRING(9B) + "a" + STRING(9B) + "da" + STRING(9B) + "c" + STRING(9B) + "dc" + STRING(9B) + "V" + STRING(9B) + "dV" + STRING(9B) + "P" + STRING(9B) + "dP"
'ortho': return, "#" + STRING(9B) + "a" + STRING(9B) + "da" + STRING(9B) + "b" + STRING(9B) + "db" + STRING(9B) + "c" + STRING(9B) + "dc" + STRING(9B) + "V" + STRING(9B) + "dV" + STRING(9B) + "P" + STRING(9B) + "dP"
'trig': return, "#" + STRING(9B) + "a" + STRING(9B) + "da" + STRING(9B) + "c" + STRING(9B) + "dc" + STRING(9B) + "V" + STRING(9B) + "dV" + STRING(9B) + "P" + STRING(9B) + "dP"
'mono': return, "#" + STRING(9B) + "a" + STRING(9B) + "da" + STRING(9B) + "b" + STRING(9B) + "db" + STRING(9B) + "c" + STRING(9B) + "dc" + STRING(9B) + "beta" + STRING(9B) + "dbeta" + STRING(9B) + "V" + STRING(9B) + "dV" + STRING(9B) + "P" + STRING(9B) + "dP"
else: return, 10
endcase
return, 10
end
; *************************************************** cell parameter stuff ********
; returns an array of string with the name of the unit cell parameters
; e.g. a for cubic, a and c for hexagonal...
function materialObject::getCellParList
case self.symmetry of
'cubic': return, ['a']
'hexa': return, ['a', 'c', 'c/a']
'ortho': return, ['a', 'b' ,'c']
'trig': return, ['a', 'c', 'c/a']
'mono': return, ['a', 'b' ,'c', 'beta']
else: return, ['']
endcase
return, ['']
end
; returns the name of the unit cell parameters number i
; e.g. i=0, a for cubic, i=0, a and i=1, c for hexagonal...
function materialObject::getCellParName, i
case self.symmetry of
'cubic': begin
case i of
0: return, 'a'
else: return, ''
endcase
end
'hexa': begin
case i of
0: return, 'a'
1: return, 'c'
2: return, 'c/a'
else: return, ''
endcase
end
'ortho': begin
case i of
0: return, 'a'
1: return, 'b'
2: return, 'c'
else: return, ''
endcase
end
'trig': begin
case i of
0: return, 'a'
1: return, 'c'
2: return, 'c/a'
else: return, ''
endcase
end
'mono': begin
case i of
0: return, 'a'
1: return, 'b'
2: return, 'c'
3: return, 'beta'
else: return, ''
endcase
end
else: return, ''
endcase
return, ''
end
; *************************************************** stresses ******************
function materialObject::twoGReussCubic, h, k, l, a, p
Cmatrix = fltarr(6,6)
for i=1,6 do begin
for j=1,6 do begin
Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + self.Cij[i,j,2] * p * p
endfor
endfor
; print, 'hkl a p', h, k, l, a, p
; print, 'Cij', self.Cij[*,*,0]
; print, 'C', Cmatrix
S = INVERT(Cmatrix)
tmp1 = h*h + k*k + l*l
tmp2 = h*h*k*k + k*k*l*l + l*l*h*h
Gamma = 1.*tmp2/(tmp1*tmp1)
; print, 'Gamma', Gamma
inv = (S[0,0]-S[0,1]) - 3.*(S[0,0]-S[0,1]-0.5*S[3,3])*Gamma
; print, '2G' , 1./inv
return, 1./inv
end
function materialObject::errTwoGReussCubic, h, k, l, a, p, da, dp
d1 = (self->twoGReussCubic(h, k, l, 1.01*a, p) - self->twoGReussCubic(h, k, l, 0.99*a,p)) / (0.02 * a)
d3 = (self->twoGReussCubic(h, k, l, a,1.01*p) - self->twoGReussCubic(h, k, l, a, 0.99*p)) / (0.02 * p)
err = sqrt( (d1*da)^2 + (d3*dp)^2 )
return, err
end
function materialObject::twoGReussHexa, h, k, l, a, c, p
Cmatrix = fltarr(6,6)
for i=1,6 do begin
for j=1,6 do begin
Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + p * p * self.Cij[i,j,2]
endfor
endfor
; print, 'hkl a c p', h, k, l, a, c, p
; print, 'Cij', self.Cij[*,*,0]
; print, 'C', Cmatrix
S = INVERT(Cmatrix)
M = 4.*c*c*(h*h+h*k+k*k)+3.*a*a*l*l
ll = 3.*a*a*l*l/M
inv = 0.5 * (2.*S[0,0] - S[0,1] - S[0,2]) $
+ ll* (-5.*S[0,0] + S[0,1] + 5.*S[0,2] - S[2,2] + 3.*S[3,3]) $
+ ll*ll* (3.*S[0,0] - 6.*S[0,2] + 3.*S[2,2] - 3.*S[3,3])
; print, '2G' , 1./inv
return, 1./inv
end
function materialObject::errTwoGReussHexa, h, k, l, a, c, p, da, dc, dp
d1 = (self->twoGReussHexa(h, k, l, 1.01*a, c, p) - self->twoGReussHexa(h, k, l, 0.99*a, c, p)) $
/ (0.02 * a)
d2 = (self->twoGReussHexa(h, k, l, a, 1.01*c, p) - self->twoGReussHexa(h, k, l, a, 0.99*c, p)) $
/ (0.02 * c)
d3 = (self->twoGReussHexa(h, k, l, a, c, 1.01*p) - self->twoGReussHexa(h, k, l, a, c, 0.99*p)) $
/ (0.02 * p)
err = sqrt( (d1*da)^2 + (d2*dc)^2 + (d3*dp)^2 )
return, err
end
function materialObject::twoGReussTrig, h, k, l, a, c, p;, T
Cmatrix = fltarr(6,6)
;TC = T - 300.
for i=1,6 do begin
for j=1,6 do begin
Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + self.Cij[i,j,2] * p * p ;+ TC * self.Cij[i,j,3] + TC*TC * self.Cij[i,j,4]
endfor
endfor
S = INVERT(Cmatrix)
M = 4.*c*c*(h*h+h*k+k*k)+3.*a*a*l*l
l1 = sqrt(3.)*c*h/M
l2 = c*(h+2.*k)/M
l3 = sqrt(3.)*a*l/M
inv = 0.5 * (2.*S[0,0] - S[0,1] - S[0,2]) $
+ l3*l3* (-5.*S[0,0] + S[0,1] + 5.*S[0,2] - S[2,2] + 3.*S[3,3]) $
+ l3*l3*l3*l3* (3.*S[0,0] - 6.*S[0,2] + 3.*S[2,2] - 3.*S[3,3]) $
+ 3.*l2*l3*(3.*l1*l1-l2*l2)*S[0,3] $
+ 3.*l1*l3*(3.*l2*l2-l1*l1)*S[1,4]
; print, '2G' , 1./inv
return, 1./inv
end
function materialObject::errTwoGReussTrig, h, k, l, a, c, p, da, dc, dp
d1 = (self->twoGReussTrig(h, k, l, 1.01*a, c, p) - self->twoGReussTrig(h, k, l, 0.99*a, c, p)) $
/ (0.02 * a)
d2 = (self->twoGReussTrig(h, k, l, a, 1.01*c, p) - self->twoGReussTrig(h, k, l, a, 0.99*c, p)) $
/ (0.02 * c)
d3 = (self->twoGReussTrig(h, k, l, a, c, 1.01*p) - self->twoGReussTrig(h, k, l, a, c, 0.99*p)) $
/ (0.02 * p)
err = sqrt( (d1*da)^2 + (d2*dc)^2 + (d3*dp)^2 )
return, err
end
;Probably copy/past error from PolydefixED
;function materialObject::twoGReussCubic, h, k, l, a, p, T
;Cmatrix = fltarr(6,6)
;TC = T - 300.
;for i=1,6 do begin
; for j=1,6 do begin
; Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + self.Cij[i,j,2] * p * p + TC * self.Cij[i,j,3] + TC*TC * self.Cij[i,j,4]
; endfor
;endfor
; print, 'hkl a p', h, k, l, a, p
; print, 'Cij', self.Cij[*,*,0]
; print, 'C', Cmatrix
;S = INVERT(Cmatrix)
;tmp1 = h*h + k*k + l*l
;tmp2 = h*h*k*k + k*k*l*l + l*l*h*h
;Gamma = 1.*tmp2/(tmp1*tmp1)
; print, 'Gamma', Gamma
;inv = (S[0,0]-S[0,1]) - 3.*(S[0,0]-S[0,1]-0.5*S[3,3])*Gamma
; print, '2G' , 1./inv
;return, 1./inv
;end
; N. Hilairet 24/11/11 materialObject::twoGReussOrtho does not work with this function aside
;function dhklOrtho1, a, b, c, h, k, l
;tmp = h*h/(a*a) + k*k/(b*b) + l*l/(c*c)
;return, 1./sqrt(tmp)
;end
function materialObject::twoGReussOrtho, h, k, l, a, b, c, p
Cmatrix = fltarr(6,6)
for i=1,6 do begin
for j=1,6 do begin
Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + p * p * self.Cij[i,j,2]
endfor
endfor
S = INVERT(Cmatrix)
;d = self->dhklOrtho1(a, b, c, h, k, l)
d = 1/( sqrt(h*h/(a*a) + k*k/(b*b) + l*l/(c*c)) )
l1 = h*d/a
l2 = k*d/b
l3 = l*d/c
inv = -(S[0,1]+S[0,2]+S[1,2]) + l1*l1*(S[1,2]-S[0,0]) + $
l2*l2*(S[1,2]-S[1,1]) + l3*l3*(S[0,1]-S[2,2]) + $
3. * ( l1*l1*l1*l1*S[0,0] + l2*l2*l2*l2*S[1,1] + l3*l3*l3*l3*S[2,2] + $
l1*l1*l2*l2*(2.*S[0,1]+S[5,5]) + l2*l2*l3*l3*(2.*S[1,2]+S[3,3]) + l1*l1*l3*l3*(2.*S[0,2]+S[4,4]) )
return, 2./inv
end
function materialObject::errTwoGReussOrtho, h, k, l, a, b, c, p, da, db, dc, dp
d1 = (self->twoGReussOrtho(h, k, l, 1.01*a, b, c, p) - self->twoGReussOrtho(h, k, l, 0.99*a, b, c, p)) $
/ (0.02 * a)
d2 = (self->twoGReussOrtho(h, k, l, a, 1.01*b, c, p) - self->twoGReussOrtho(h, k, l, a, 0.99*b, c, p)) $
/ (0.02 * b)
d3 = (self->twoGReussOrtho(h, k, l, a, b, 1.01*c, p) - self->twoGReussOrtho(h, k, l, a, b, 0.99*c, p)) $
/ (0.02 * c)
d4 = (self->twoGReussOrtho(h, k, l, a, b, c, 1.01*p) - self->twoGReussOrtho(h, k, l, a, b, c, 0.99*p)) $
/ (0.02 * p)
err = sqrt( (d1*da)^2 + (d2*db)^2 + (d3*dc)^2 + (d4*dp)^2 )
return, err
end
function materialObject::twoGReussMono, h, k, l, a, b, c, beta, p
Cmatrix = fltarr(6,6)
for i=1,6 do begin
for j=1,6 do begin
Cmatrix[i-1,j-1] = self.Cij[i,j,0] + p * self.Cij[i,j,1] + p * p * self.Cij[i,j,2]
endfor
endfor
S = INVERT(Cmatrix)
;d = self->dhklOrtho1(a, b, c, h, k, l)
d = 1. / (sqrt( h*h/(a*a*(sin(beta))^2) + k*k/(b*b) + l*l/(c*c*(sin(beta))^2) - 2.*h*l*cos(beta)/(a*c*(sin(beta))^2) ))
l1 = h*d/a
l2 = k*d/b
l3 = (a*l-h*c)*(cos(beta))*d/(a*c*(sin(beta)))
inv = S[0,0]*(3*(l1^4)-l1^2) + S[1,1]*(3*(l2^4)-l2^2) + S[2,2]*(3*(l3^4)-l3^2) $
+ S[0,1]*(6*(l1^2)*(l2^2) - l1^2 - l2^2) + S[0,2]*(6*(l1^2)*(l3^2) - l1^2 - l3^2) + S[0,2]*(6*(l2^2)*(l3^2) - l2^2 - l3^2) $
+ l1*l3*( S[0,4]*(6*(l1^2) -1) + S[1,4]*(6*(l2^2) - 1)+ S[2,4]*(6*(l3^2) -1) ) $
+6*S[3,5]*l1*(l2^2)*l3 + 3*( S[3,3]*(l2^2)*(l3^2)+S[4,4]*(l3^2)*(l1^2)+S[5,5]*(l1^2)*(l2^2) )
return, 2./inv
end
function materialObject::errTwoGReussMono, h, k, l, a, b, c, beta, p, da, db, dc, dbeta, dp
d1 = (self->twoGReussMono(h, k, l, 1.01*a, b, c, beta, p) - self->twoGReussMono(h, k, l, 0.99*a, b, c, beta, p)) $
/ (0.02 * a)
d2 = (self->twoGReussMono(h, k, l, a, 1.01*b, c, beta, p) - self->twoGReussMono(h, k, l, a, 0.99*b, c, beta, p)) $
/ (0.02 * b)
d3 = (self->twoGReussMono(h, k, l, a, b, 1.01*c, beta, p) - self->twoGReussMono(h, k, l, a, b, 0.99*c, beta, p)) $
/ (0.02 * c)
d4 = (self->twoGReussMono(h, k, l, a, b, c, 1.01*beta, p) - self->twoGReussMono(h, k, l, a, b, c, 0.99*beta, p)) $
/ (0.02 * beta)
d5 = (self->twoGReussMono(h, k, l, a, b, c, beta, 1.01*p) - self->twoGReussMono(h, k, l, a, b, c, beta, 0.99*p)) $
/ (0.02 * p)
err = sqrt( (d1*da)^2 + (d2*db)^2 + (d3*dc)^2 + (d4*dbeta)^2 + (d5*dp)^2)
return, err
end
; returns an array of string with the name of the unit cell parameters
; e.g. a for cubic, a and c for hexagonal...
function materialObject::getTwoG, h, k, l, cell
if (self.elasticmodel eq 0) then begin
p = cell->getPressure()
twoG = 2.*(self.iG[0] + p*self.iG[1] + p*p*self.iG[2])
return, twoG
endif else begin
case self.symmetry of
'cubic': begin
a = cell->getCellParValue(0)
p = cell->getPressure()
return, self->twoGReussCubic(h, k, l, a, p)
end
'hexa': begin
a = cell->getCellParValue(0)
c = cell->getCellParValue(1)
p = cell->getPressure()
; print, 'hkl a c p', h, k, l, a, c, p
return, self->twoGReussHexa(h, k, l, a, c, p)
end
'trig': begin
a = cell->getCellParValue(0)
c = cell->getCellParValue(1)
p = cell->getPressure()
; print, 'hkl a c p', h, k, l, a, c, p
return, self->twoGReussTrig(h, k, l, a, c, p)
end
'ortho': begin
a = cell->getCellParValue(0)
b = cell->getCellParValue(1)
c = cell->getCellParValue(2)
p = cell->getPressure()
; print, 'hkl a c p', h, k, l, a, b, c, p
return, self->twoGReussOrtho(h, k, l, a, b, c, p)
end
'mono': begin
a = cell->getCellParValue(0)
b = cell->getCellParValue(1)
c = cell->getCellParValue(2)
beta = cell->getCellParValue(3)
p = cell->getPressure()
; print, 'hkl a c p', h, k, l, a, b, c, p
return, self->twoGReussMono(h, k, l, a, b, c, beta, p)
end
else: return, 0.
endcase
endelse
return, 0.
end
function materialObject::getErrTwoG, h, k, l, cell
if (self.elasticmodel eq 0) then return, 0.
case self.symmetry of
'cubic': begin
a = cell->getCellParValue(0)
da = cell->getCellErrParValue(0)
p = cell->getPressure()
dp = cell->getErrPressure()
return, self->errTwoGReussCubic(h, k, l, a, p, da, dp)
end
'hexa': begin
a = cell->getCellParValue(0)
c = cell->getCellParValue(1)
da = cell->getCellErrParValue(0)
dc = cell->getCellErrParValue(1)
p = cell->getPressure()
dp = cell->getErrPressure()
return, self->errTwoGReussHexa(h, k, l, a, c, p, da, dc, dp)
end
'trig': begin
a = cell->getCellParValue(0)
c = cell->getCellParValue(1)
da = cell->getCellErrParValue(0)
dc = cell->getCellErrParValue(1)
p = cell->getPressure()
dp = cell->getErrPressure()
; print, 'hkl a c p', h, k, l, a, c, p
return, self->errTwoGReussTrig(h, k, l, a, c, p, da, dc, dp)
end
'ortho': begin
a = cell->getCellParValue(0)
b = cell->getCellParValue(1)
c = cell->getCellParValue(2)
da = cell->getCellErrParValue(0)
db = cell->getCellErrParValue(1)
dc = cell->getCellErrParValue(2)
p = cell->getPressure()
dp = cell->getErrPressure()
return, self->errTwoGReussOrtho(h, k, l, a, b, c, p, da, db, dc, dp)
end
'mono': begin
a = cell->getCellParValue(0)
b = cell->getCellParValue(1)
c = cell->getCellParValue(2)
beta = cell->getCellParValue(3)
da = cell->getCellErrParValue(0)
db = cell->getCellErrParValue(1)
dc = cell->getCellErrParValue(2)
dbeta=cell->getCellErrParValue(3)
p = cell->getPressure()
dp = cell->getErrPressure()
return, self->errTwoGReussMono(h, k, l, a, b, c, beta, p, da, db, dc, dbeta, dp)
end
else: return, 0
endcase
return, 0
end
; *************************************************** ASCII Import and Export ****************