├── .hgignore ├── COPYING ├── DESCRIPTION ├── INDEX ├── NEWS ├── README.md ├── VELAS_Tree.txt ├── doc ├── Contents.m ├── InputTemplateA.txt ├── InputTemplateB.txt ├── InputTemplateC.txt ├── InputTemplateD.txt ├── SupportedColormaps.txt ├── VELAS Manual.pdf ├── VELAS logo info.txt ├── VELAS_GUI.png ├── VELAS_Logo.png ├── colormapScale.tiff ├── property.m ├── velasLogo.png └── ~$LAS Manual.docx ├── inst ├── .gitattributes ├── .gitignore ├── GUI │ ├── checkCS.m │ ├── checkPlane.m │ ├── convertString2Num.m │ ├── customCMRdbtn.m │ ├── customFlipChk.m │ ├── exitUI.m │ ├── getUiInput.m │ ├── importUI.m │ ├── isMatrixLegel.m │ ├── mpapiUI.m │ ├── plotUI.m │ ├── queryApiUI.m │ ├── resetUI.m │ ├── runUI.m │ ├── saveConfigUI.m │ ├── setColormapCustom.m │ ├── setColormapFig.m │ ├── setPlotFont.m │ ├── setTrueFalse.m │ └── setmapproFontColor.m ├── README.md ├── basic │ ├── dir2Vec.m │ ├── dir2Vec2d.m │ ├── dir2Vec3V.m │ ├── getCoef1.m │ ├── getCoef2.m │ ├── getCoef2D.m │ ├── getInput.m │ ├── getMaxMinNeg.m │ ├── getPosNeg.m │ ├── initOutput.m │ ├── isAllPositive.m │ ├── isOctave.m │ ├── iscontains.m │ ├── maxminSearch.m │ ├── nsign.m │ ├── roundN.m │ ├── set2ones.m │ ├── set2zeros.m │ └── str2numb.m ├── drawing │ ├── SphericalPlot3D.m │ ├── UnitSphericalPlot3D.m │ ├── drawPolar.m │ ├── getColorMap.m │ ├── getPropName.m │ ├── getRadiusTicks.m │ ├── head2Tail.m │ ├── interpColormap.m │ ├── isExistColormap.m │ ├── longlat2Cartesian.m │ ├── mapProjection.m │ ├── selectcolor.m │ ├── setColor.m │ ├── spherical2Cartesian.m │ ├── velasColormap.m │ └── velasColormap.mat ├── install_VELAS.m ├── mpapi │ ├── json2struct.m │ ├── mpDataBaseOffline.mat │ ├── mpapiElastic.m │ ├── mpapiElasticOffline.m │ ├── weboptionsNew.m │ ├── webreadNew.m │ └── webwriteNew.m ├── properties │ ├── calcAnisotropy.m │ ├── calcBulk.m │ ├── calcCauchyPressure.m │ ├── calcCompress.m │ ├── calcFractureToughness.m │ ├── calcHardness.m │ ├── calcIntersectCurve.m │ ├── calcPoisson.m │ ├── calcPugh.m │ ├── calcPwaveModulus.m │ ├── calcShear.m │ ├── calcYoung.m │ ├── checkProperties.m │ ├── checkStability.m │ ├── getBondType.m │ ├── getCrystalType.m │ ├── getDuctility.m │ ├── isNegativePoisson.m │ ├── isStable.m │ └── mechanics.m ├── tools │ ├── demo.m │ └── dir2Plane.m ├── uninstall_VELAS.m ├── velasGUI.m ├── velasPlot.m └── velasScript.m └── velas.yaml /.hgignore: -------------------------------------------------------------------------------- 1 | syntax: regexp 2 | # The recurrent (^|/) idiom in the regexps below should be understood 3 | # to mean "at any directory" while the ^ idiom means "from the 4 | # project's top-level directory". 5 | 6 | (^|/).*\.dvi$ 7 | (^|/).*\.pdf$ 8 | (^|/).*\.o$ 9 | (^|/).*\.oct$ 10 | (^|/).*\.octlink$ 11 | (^|/)octave-core$ 12 | (^|/)octave-workspace$ 13 | (^|/).*\.tar\.gz$ 14 | 15 | ## Our Makefile target 16 | ^target/ 17 | 18 | ## Files generated automatically by autoconf and the configure script 19 | ^src/aclocal\.m4$ 20 | ^src/configure$ 21 | ^src/autom4te\.cache($|/) 22 | ^src/config\.log$ 23 | ^src/config\.status$ 24 | ^src/Makefile$ 25 | ^src/.*\.m$ 26 | 27 | # e.g. doc/faq/OctaveFAQ.info 28 | # doc/interpreter/octave.info-4 29 | ^doc/.*\.info(-\d)?$ 30 | ^doc/\w*/stamp-vti$ 31 | ^doc/\w*/version\.texi$ 32 | 33 | # Emacs tools create these 34 | (^|/)TAGS$ 35 | (^|/)semantic.cache$ 36 | 37 | # Other text editors often create these 38 | (^|/)~.* 39 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Name: VELAS 2 | Version: 1.0.6 3 | Date: 2023-09-05 4 | Author: Ran Zheng 5 | Maintainer: Ran Zheng 6 | Title: Visualization and analysis of ELAstic aniSotropy 7 | Description: Package for the visualization and analysis of elastic anisotropy 8 | Depends: octave (>= 5.2.0) 9 | Autoload: no 10 | License: GPLv3+ 11 | -------------------------------------------------------------------------------- /INDEX: -------------------------------------------------------------------------------- 1 | VELAS >> Visualization and analysis of ELAstic aniSotropy 2 | Entry 3 | velasGUI 4 | velasScript 5 | basic 6 | dir2Vec 7 | dir2Vec2d 8 | dir2Vec3V 9 | getCoef1 10 | getCoef2 11 | getCoef2D 12 | getInput 13 | getMaxMinNeg 14 | getPosNeg 15 | initOutput 16 | isAllPositive 17 | iscontains 18 | isOctave 19 | maxminSearch 20 | nsign 21 | roundN 22 | set2ones 23 | set2zeros 24 | str2numb 25 | doc 26 | VELAS Manual 27 | SupportedColormaps 28 | InputTemplateA 29 | InputTemplateB 30 | InputTemplateC 31 | InputTemplateD 32 | drawing 33 | SphericalPlot3D 34 | UnitSphericalPlot3D 35 | drawPolar 36 | getColorMap 37 | getPropName 38 | getRadiusTicks 39 | head2Tail 40 | interpColormap 41 | isExistColormap 42 | longlat2Cartesian 43 | mapProjection 44 | selectcolor 45 | setColor 46 | spherical2Cartesian 47 | velasColormap 48 | GUI 49 | checkCS 50 | checkPlane 51 | convertString2Num 52 | customCMRdbtn 53 | customFlipChk 54 | exitUI 55 | getUiInput 56 | importUI 57 | isMatrixLegel 58 | mpapiUI 59 | plotUI 60 | queryApiUI 61 | resetUI 62 | runUI 63 | saveConfigUI 64 | setColormapCustom 65 | setColormapFig 66 | setPlotFont 67 | setTrueFalse 68 | setmapproFontColor 69 | mpapi 70 | json2struct 71 | mpapiElastic 72 | mpapiElasticOffline 73 | weboptionsNew 74 | webreadNew 75 | webwriteNew 76 | properties 77 | calcAnisotropy 78 | calcBulk 79 | calcCauchyPressure 80 | calcCompress 81 | calcFractureToughness 82 | calcHardness 83 | calcIntersectCurve 84 | calcPoisson 85 | calcPugh 86 | calcPwaveModulus 87 | calcShear 88 | calcYoung 89 | checkProperties 90 | checkStability 91 | getBondType 92 | getCrystalType 93 | getDuctility 94 | isNegativePoisson 95 | isStable 96 | mechanics 97 | tools 98 | dir2Plane 99 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | VELAS v1.0.6 [05/09/2023]: Bug Fixes and improvements 2 | ----------------------------------------------------------------------------------------- 3 | **Fix bugs and performance enhancements 4 | **Allow user to add density, volume and number of atoms of crystal to calculate other 5 | related properties. 6 | **Update the logo information 7 | **rearrange the GUI of VELAS 8 | **Supporting the calculation of average sound velocity/Fracture Toughness 9 | /Debye temperature/Heat Capacity/Melting temperature/Thermal expansion 10 | /Minimum thermal conductivity using VRH 11 | 12 | VELAS v1.0.5 [21/04/2023]: Bug Fixes and improvements 13 | ----------------------------------------------------------------------------------------- 14 | **Fix bugs in install_VELAS.m and uninstall_VELAS.m 15 | **Rename LICENSE.md to COPYING in order to submit to gnu-octave/packages. 16 | **Add DESCRIPTION file 17 | **Add INDEX file 18 | **Add .hgignore file 19 | 20 | VELAS v1.0.4 [18/10/2022]: Bug Fixes and improvements 21 | ----------------------------------------------------------------------------------------- 22 | **add install_VELAS and uninstall_VELAS function to facilitate installation and use. 23 | **Fixe bugs in velasGUI.m. 24 | 25 | [21/09/2022] 26 | **Remove the colormap: 'jet','rainbow','hsv','colorcube','flag','lines','prism', and 27 | added new colormap, supporting 75 kinds of colormap. Also supports custom colormap. 28 | **Remove some functions related to colormap. 29 | **Add flipping colormap. 30 | **Optimize plot functions. 31 | **Optimize the GUI interface. 32 | **Fixes bugs in importUI.m. 33 | 34 | VELAS v1.0.3 [31/08/2022]: Bug Fixes and improvements 35 | ----------------------------------------------------------------------------------------- 36 | **Change the default colormap from 'jet' to 'viridis'. 37 | **Fixes bugs 38 | 39 | VELAS v1.0.2 [30/07/2022]: Bug Fixes and improvements 40 | ----------------------------------------------------------------------------------------- 41 | **Fixes bugs in velasPlot.m. 42 | **Fixes bugs in plotUI.m. 43 | **Add new function colormapdata into drawing Model. 44 | **Add new colormap ('turbo', 'colorcube', 'flag', 'lines', 'prism') into velasGUI.m. 45 | 46 | VELAS v1.0.1 [22/07/2021]: Bug Fixes and improvements 47 | ----------------------------------------------------------------------------------------- 48 | **Fixes bugs in velasGUI.m. 49 | **Change the input setting of Fracture Toughness in getInput.m. 50 | **Fixes bugs in importUI.m. 51 | **Add new file resetUI.m into GUI Model. 52 | 53 | VELAS v1.0.1 [13/07/2021]: 54 | ----------------------------------------------------------------------------------------- 55 | **First Edition of VELAS 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | ![GitHub issues](https://img.shields.io/github/issues/ranzhengcode/VELAS?logo=github) 5 | ![GitHub repo size](https://img.shields.io/github/repo-size/ranzhengcode/VELAS?logo=github) 6 | ![GitHub all releases](https://img.shields.io/github/downloads/ranzhengcode/VELAS/total?logo=github) 7 | [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/ranzhengcode/VELAS?logo=Github)](https://github.com/ranzhengcode/VELAS/releases/tag/velas-1.0.0) 8 | [![GitHub](https://img.shields.io/github/license/ranzhengcode/VELAS?logo=GitHub)](https://github.com/ranzhengcode/VELAS/blob/main/LICENSE.md) 9 | 10 | **VELAS** is a user-friendly open-source toolbox for **the visualization and analysis of elastic anisotropy** written in **GNU Octave** that can be used for **any crystal symmetry**. 11 | 12 | ### Meaning of VELAS 13 | **VELAS** is derived from the combination of the letters **V**, **ELA** and **S** in "**V**isualization and analysis of **ELA**stic ani**S**otropy" and has no connection or relationship to any known trademarks, places or people that might be called "**VELAS**". 14 | 15 | [VELAS Manual, PDF](https://github.com/ranzhengcode/VELAS/blob/main/doc/VELAS%20Manual.pdf) 16 | 17 | ## Highlights 18 | - **Easy** to install and use, **no** compilation required and **no** dependence on any third-party libraries. 19 | - A fully interactive graphical interactive interface (**GUI**). 20 | - Support for a wide range of visualisation schemes such as **map projection** and **unit sphere projection**. 21 | - Supports the determination of the mechanical stability of crystals at **atmospheric** and **high pressures** using the **Born mechanical stability criterion**. 22 | - Support for analysis of properties such as **hardness**, **fracture toughness**, **average Cauchy pressure**, **areal Poisson’s ratio**, etc. 23 | - Provides a **native interface** for calling data from the new (default) and legacy APIs of the [Materials Project's database](https://next-gen.materialsproject.org/). 24 | 25 | ## Graphical User Interface (GUI) 26 |
27 | 28 | ## INSTALL 29 | ### Installation Scheme A 30 | - (1) install VELAS using **pkg** command in GNU Octave **command windows** as following: 31 | ``` 32 | pkg install "https://github.com/ranzhengcode/VELAS/archive/refs/tags/v1.0.6.tar.gz" 33 | ``` 34 | - (2) And then using **pkg load velas** to load VELAS. 35 | - (3) Type **velasGUI** to run VELAS. 36 | - (4) **Enjoy**! 37 | ### Installation Scheme B 38 | - (1) Unzip the downloaded **VELAS** archive into any available path; 39 | - (2) Run **install_VELAS** or **velasGUI**, VELAS will be automatically installed. 40 | ### **Enjoy**! 41 | 42 | ## GET STARTED 43 | VELAS supports both **script** and **GUI** to run. 44 | - **1**: Run **VELAS** using **velasScript**. Type `velasScript` in the **command window** of **GNU Octave** and press **Enter** to run. 45 | - **2**: Run **VELAS** using **velasGUI**. Type `velasGUI` in the **command window** of **GNU Octave** and press **Enter** to run. 46 | 47 | ## Tested systems 48 | **Windows 10** and **Ubuntu 18.04**. 49 | 50 | ## Languages 51 | **GUN Octave** (Ver. 5.2.0 - latest, Recommended), in full support of **MATLAB**. 52 | 53 | ## ColorMap 54 | **Support 75 kinds of colormap:** 55 | 'viridis' (default), 'inferno', 'plasma', 'magma', 'rocket', 'mako', 'flare', 'crest', 'vlag', 'icefire','seismic' 56 | 'cool', 'summer', 'copper', 'hot', 'ocean', 'gray', 'bone', 'Spectral', 'coolwarm', 'pink', 'spring', 'autumn', 57 | 'winter', 'thermal', 'haline', 'solar', 'ice', 'deep', 'dense', 'algae', 'matter', 'turbid', 'speed', 'amp', 58 | 'tempo', 'rain', 'phase', 'balance', 'delta', 'curl', 'diff', 'tarn', 'cubehelix', 'turbo','Blues', 'BuGn', 59 | 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 60 | 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd', 'afmhot', 'gistheat', 'BrBG', 'bwr', 'coolwarmC', 'PiYG', 'PRGn', 61 | 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn' 62 | **Note: If the colormap above is not in the drop-down list box, check the custom colormap checkbox and enter the name of one of the above colormaps.** 63 | 64 | **Setting your own colormap:** 65 | You can define your own colormap and store it in the valesColormap.mat file, and then import your colormap via custom colormap. 66 | **Note: the name of the colormap you define cannot be the same as the existing colormap in valesColormap.mat, otherwise it will overwrite the existing colormap.** 67 | 68 | ## Supported systems 69 | GNU/Linux, BSD, macOS, Windows. 70 | 71 | ## Contact Information 72 | **Email**: ranzheng@outlook.com 73 | Please **don't hesitate** to contact us if you have any questions about **using VELAS** or suggestions for **improving VELAS**. 74 | 75 | ## How to Cite 76 | Z. Ran, C.M. Zou, Z.J. Wei, et al., VELAS: An open-source toolbox for visualization and analysis of elastic anisotropy. Computer Physics Communications, 283 (2023) 108540. 77 | [**DOI:https://doi.org/10.1016/j.cpc.2022.108540**](https://doi.org/10.1016/j.cpc.2022.108540). 78 | -------------------------------------------------------------------------------- /VELAS_Tree.txt: -------------------------------------------------------------------------------- 1 | VELAS-1.0.6 2 | ├─.hgignore 3 | ├─COPYING 4 | ├─DESCRIPTION 5 | ├─INDEX 6 | ├─NEWS 7 | ├─README.md 8 | ├─velas.yaml 9 | ├─VELAS_Tree.txt 10 | ├─inst 11 | | ├─.gitattributes 12 | | ├─.gitignore 13 | | ├─install_VELAS.m 14 | | ├─README.md 15 | | ├─uninstall_VELAS.m 16 | | ├─velasGUI.m 17 | | ├─velasPlot.m 18 | | ├─velasScript.m 19 | | ├─tools 20 | | | ├─demo.m 21 | | | └dir2Plane.m 22 | | ├─properties 23 | | | ├─calcAnisotropy.m 24 | | | ├─calcBulk.m 25 | | | ├─calcCauchyPressure.m 26 | | | ├─calcCompress.m 27 | | | ├─calcFractureToughness.m 28 | | | ├─calcHardness.m 29 | | | ├─calcIntersectCurve.m 30 | | | ├─calcPoisson.m 31 | | | ├─calcPugh.m 32 | | | ├─calcPwaveModulus.m 33 | | | ├─calcShear.m 34 | | | ├─calcYoung.m 35 | | | ├─checkProperties.m 36 | | | ├─checkStability.m 37 | | | ├─getBondType.m 38 | | | ├─getCrystalType.m 39 | | | ├─getDuctility.m 40 | | | ├─isNegativePoisson.m 41 | | | ├─isStable.m 42 | | | └mechanics.m 43 | | ├─mpapi 44 | | | ├─json2struct.m 45 | | | ├─mpapiElastic.m 46 | | | ├─mpapiElasticOffline.m 47 | | | ├─mpDataBaseOffline.mat 48 | | | ├─weboptionsNew.m 49 | | | ├─webreadNew.m 50 | | | └webwriteNew.m 51 | | ├─GUI 52 | | | ├─checkCS.m 53 | | | ├─checkPlane.m 54 | | | ├─convertString2Num.m 55 | | | ├─customCMRdbtn.m 56 | | | ├─customFlipChk.m 57 | | | ├─exitUI.m 58 | | | ├─getUiInput.m 59 | | | ├─importUI.m 60 | | | ├─isMatrixLegel.m 61 | | | ├─mpapiUI.m 62 | | | ├─plotUI.m 63 | | | ├─queryApiUI.m 64 | | | ├─resetUI.m 65 | | | ├─runUI.m 66 | | | ├─saveConfigUI.m 67 | | | ├─setColormapCustom.m 68 | | | ├─setColormapFig.m 69 | | | ├─setmapproFontColor.m 70 | | | ├─setPlotFont.m 71 | | | └setTrueFalse.m 72 | | ├─drawing 73 | | | ├─drawPolar.m 74 | | | ├─getColorMap.m 75 | | | ├─getPropName.m 76 | | | ├─getRadiusTicks.m 77 | | | ├─head2Tail.m 78 | | | ├─interpColormap.m 79 | | | ├─isExistColormap.m 80 | | | ├─longlat2Cartesian.m 81 | | | ├─mapProjection.m 82 | | | ├─selectcolor.m 83 | | | ├─setColor.m 84 | | | ├─spherical2Cartesian.m 85 | | | ├─SphericalPlot3D.m 86 | | | ├─UnitSphericalPlot3D.m 87 | | | ├─velasColormap.m 88 | | | └velasColormap.mat 89 | | ├─basic 90 | | | ├─dir2Vec.m 91 | | | ├─dir2Vec2d.m 92 | | | ├─dir2Vec3V.m 93 | | | ├─getCoef1.m 94 | | | ├─getCoef2.m 95 | | | ├─getCoef2D.m 96 | | | ├─getInput.m 97 | | | ├─getMaxMinNeg.m 98 | | | ├─getPosNeg.m 99 | | | ├─initOutput.m 100 | | | ├─isAllPositive.m 101 | | | ├─iscontains.m 102 | | | ├─isOctave.m 103 | | | ├─maxminSearch.m 104 | | | ├─nsign.m 105 | | | ├─roundN.m 106 | | | ├─set2ones.m 107 | | | ├─set2zeros.m 108 | | | └str2numb.m 109 | ├─doc 110 | | ├─colormapScale.tiff 111 | | ├─Contents.m 112 | | ├─InputTemplateA.txt 113 | | ├─InputTemplateB.txt 114 | | ├─InputTemplateC.txt 115 | | ├─InputTemplateD.txt 116 | | ├─property.m 117 | | ├─SupportedColormaps.txt 118 | | ├─VELAS logo info.txt 119 | | ├─VELAS Manual.pdf 120 | | ├─velasLogo.png 121 | | ├─VELAS_GUI.png 122 | | └VELAS_Logo.png 123 | -------------------------------------------------------------------------------- /doc/Contents.m: -------------------------------------------------------------------------------- 1 | 2 | %{ 3 | Glimpse of VELAS 4 | 5 | +-------- basic ------------ basic functions 6 | | 7 | +-------- doc -------------- doc files 8 | | 9 | +-------- drawing ---------- plot functions 10 | | 11 | +-------- examples --------- examples files 12 | | 13 | velas-1.0.0 --+-------- GUI -------------- GUI functions 14 | | 15 | +-------- properties ------- properties functions 16 | | 17 | +-------- velasGUI.m ------- main GUI 18 | | 19 | +-------- velasPlot.m ------ Independent plot 20 | | 21 | +--------- velasScript.m --- calc without GUI 22 | 23 | %} 24 | 25 | %{ 26 | basic folder: 27 | 28 | char - Convert to a character array. 29 | double - Convert to a double array. 30 | string - Convert to a string array. 31 | strings - Create string array with no characters. 32 | cellstr - Convert to a cell array of character vectors. 33 | blanks - Character vector of spaces. 34 | %} 35 | 36 | %{ 37 | drawing folder: 38 | 39 | iscellstr - True for cell array of character vectors. 40 | ischar - True for character array. 41 | isstring - True for string array. 42 | isstrprop - Check whether elements are of a specified category. 43 | %} 44 | 45 | %{ 46 | examples folder: 47 | 48 | iscellstr - True for cell array of character vectors. 49 | ischar - True for character array. 50 | isstring - True for string array. 51 | isstrprop - Check whether elements are of a specified category. 52 | %} 53 | 54 | %{ 55 | GUI folder: 56 | 57 | iscellstr - True for cell array of character vectors. 58 | ischar - True for character array. 59 | isstring - True for string array. 60 | isstrprop - Check whether elements are of a specified category. 61 | %} 62 | 63 | %{ 64 | properties folder: 65 | 66 | iscellstr - True for cell array of character vectors. 67 | ischar - True for character array. 68 | isstring - True for string array. 69 | isstrprop - Check whether elements are of a specified category. 70 | %} 71 | 72 | -------------------------------------------------------------------------------- /doc/InputTemplateA.txt: -------------------------------------------------------------------------------- 1 | 2 | # Elements of stiffness matrix C (GPa) or Compliance matrix S (GPa^-1), non-zero elements or all elements 3 | # Ref.: Journal of Modern Physics, 2018, 9, 775-805 4 | Cfull 5 | 496.34 93.982 50.24 0 0 0 6 | 93.982 496.34 50.24 0 0 0 7 | 50.24 50.24 533.13 0 0 0 8 | 0 0 0 157.5 0 0 9 | 0 0 0 0 157.5 0 10 | 0 0 0 0 0 201.17 11 | 12 | # External isostatic pressure of crystal (GPa), default:0 GPa 13 | pressure 0.00 14 | 15 | # density of crystal cell (g/cm^3), default: 1.0 (g/cm^3) 16 | density 1.0 17 | 18 | # volume of crystal cell (A^3), default: 1.0 (A^3) 19 | volume 1.0 20 | 21 | # total number of atoms in crystal cell 22 | atomnum 1 23 | 24 | # 3D mesh number of theta(θ), phi(φ), chi (χ) 25 | nmesh3d 200.00 400.00 360.00 26 | 27 | # 2D mesh number of theta(θ) 28 | nmesh2d 400.00 29 | 30 | # Precision control, Less than teps will be considered equal to 0 31 | teps 1.0e-06 32 | 33 | # properties — Pro(2*8) 34 | # Young Compressibility Shear Poisson Bulk Pugh ratio Hardness Fracture Toughness 35 | # 3D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 36 | # 2D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 37 | properties 38 | 1 1 1 1 1 1 1 1 39 | 1 1 1 1 1 1 1 1 40 | 41 | # Offline mode or Online mode to call Materials Project, the value is "yes" (default)/"no" 42 | # Note: In offline mode, it's no need to provide x-api-key, both MPID and Pretty Formula are supported; 43 | # In online mode, x-api-key must be provided, and only MPID query is supported 44 | mponline no 45 | 46 | # The Material ID for Materials Project, the value is "none"/"mp-xxxx"/"mvc-xxxx", such as "mp-7631","mvc-6281",and "none" (default). 47 | mpid none 48 | 49 | # The X-Api-Key for Materials Projec. tVelas provides offline mode and online mode to call API, the value is "none" or your personal access api 50 | xapikey none 51 | 52 | # Indicating which version of API to use, [New]: next-gen.materialsproject.org. [Legacy]: materialsproject.org 53 | # "new" refers to new version api (default), "old"/"legacy" refers to legacy version api 54 | mpapiver new 55 | 56 | # The model of Vickers hardness, 'Hv M' for Mazhnik's model, 'Hv C' for Chen's model, 'Hv C' for Tian's model 57 | Hv M 58 | 59 | # The model and input parameters of fracture toughness, Kic Model materials: Model -> M (Mazhnik's model)/ N (Niu's model); materials -> IC(ionic or covalent) / M (pure metals) / IM (intermetallics) 60 | # Input parameters of fracture toughness, the order: V0 gEFr m n XA XB (Notes: If you want to calulate fracture toughness, all parameters should be provided!) 61 | KIC M M 0.0 0.0 0.0 0.0 0.0 0.0 62 | 63 | # Do you want to output the average value? (avg yes or avg no), default: avgno. 64 | avg no 65 | 66 | # Colormap: 'jet','rainbow','hot', ocean','hsv','cool','spring','summer','autumn','winter','gray','bone','copper','pink','viridis','cubehelix' 67 | cmap hot 68 | 69 | # 3D Unit Spherical or not? (unitsph yes or unitsph no), default: No 70 | unitsph no 71 | 72 | # Map Projection or not? (default: Yes) % {'Gall-Peters' (GP),'Robinson' (R),'Hammer-Aitoff' (HA),'Mollweide' (M)}; 73 | map yes M 74 | 75 | # line style 76 | lstyle -- 77 | 78 | # print or not? (print yes or print no), default: No 79 | print no 80 | 81 | # dpi 82 | dpi 600 83 | 84 | # Plane to be calculated [XYZ coordinates] 85 | planeXY 86 | 1.00 0.00 0.00 87 | 0.00 1.00 0.00 88 | 0.00 0.00 1.00 89 | -------------------------------------------------------------------------------- /doc/InputTemplateB.txt: -------------------------------------------------------------------------------- 1 | 2 | # Elements of stiffness matrix C (GPa) or Compliance matrix S (GPa^-1), non-zero elements or all elements 3 | # Ref.: Science, 1992, 257, 650-652, Doi:10.1126/science.257.5070.650 4 | 5 | # Elements of stiffness matrix C, non-zero elements or all elements 6 | tetr 59.4 42.4 67.2 25.7 3.8 -4.4 7 | 8 | # External isostatic pressure of crystal (GPa), default:0 GPa 9 | pressure 0.00 10 | 11 | 12 | # density of crystal cell (g/cm^3), default: 1.0 (g/cm^3) 13 | density 1.0 14 | 15 | # volume of crystal cell (A^3), default: 1.0 (A^3) 16 | volume 1.0 17 | 18 | # total number of atoms in crystal cell 19 | atomnum 1 20 | 21 | nmesh3d 200.00 400.00 360.00 # 3D mesh number of theta(θ), phi(φ), chi (χ) 22 | 23 | # properties — Pro(2*8) 24 | properties 25 | 1 1 1 1 1 1 1 1 26 | 1 1 1 1 1 1 1 1 27 | 28 | # Offline mode or Online mode to call Materials Project, the value is "no" (default)/"yes" 29 | mponline no 30 | 31 | # Indicating which version of API to use, [New]: next-gen.materialsproject.org. [Legacy]: materialsproject.org 32 | mpapiver new 33 | 34 | # The model and input parameters of fracture toughness 35 | # Input parameters of fracture toughness, the order: V0 gEFr m n XA XB 36 | KIC M IC 0.00 0.00 0.00 0.00 0.00 0.00 37 | 38 | # Map Projection or not? (default: Yes) % {'Gall-Peters' (GP),'Robinson' (R),'Hammer-Aitoff' (HA),'Mollweide' (M)}; 39 | map yes M 40 | 41 | # line style 42 | lstyle -- 43 | 44 | -------------------------------------------------------------------------------- /doc/InputTemplateC.txt: -------------------------------------------------------------------------------- 1 | 2 | # Elements of stiffness matrix C (GPa) or Compliance matrix S (GPa^-1), non-zero elements or all elements 3 | # Ref.: http://progs.coudert.name/elate/mp?query=mp-2593 4 | Sfull 5 | 0.00795257374204743 -0.00303643724696356 -0.00303643724696356 0 0 0 6 | -0.00303643724696356 0.00795257374204743 -0.00303643724696356 0 0 0 7 | -0.00303643724696356 -0.00303643724696356 0.00795257374204743 0 0 0 8 | 0 0 0 0.00775193798449612 0 0 9 | 0 0 0 0 0.00775193798449612 0 10 | 0 0 0 0 0 0.00775193798449612 11 | 12 | # External isostatic pressure of crystal (GPa), default:0 GPa 13 | pressure 0.00 14 | 15 | # density of crystal cell (g/cm^3), default: 1.0 (g/cm^3) 16 | density 1.0 17 | 18 | # volume of crystal cell (A^3), default: 1.0 (A^3) 19 | volume 1.0 20 | 21 | # total number of atoms in crystal cell 22 | atomnum 1 23 | 24 | # 3D mesh number of theta(θ), phi(φ), chi (χ) 25 | nmesh3d 200.00 400.00 360.00 26 | 27 | # 2D mesh number of theta(θ) 28 | nmesh2d 400.00 29 | 30 | # Precision control, Less than teps will be considered equal to 0 31 | teps 1.0e-06 32 | 33 | # properties — Pro(2*8) 34 | # Young Compressibility Shear Poisson Bulk Pugh ratio Hardness Fracture Toughness 35 | # 3D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 36 | # 2D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 37 | properties 38 | 1 1 1 1 1 1 1 1 39 | 1 1 1 1 1 1 1 1 40 | 41 | # Offline mode or Online mode to call Materials Project, the value is "no" (default)/"yes" 42 | # Note: In offline mode, it's no need to provide x-api-key, both MPID and Pretty Formula are supported; 43 | # In online mode, x-api-key must be provided, and only MPID query is supported 44 | mponline no 45 | 46 | # The Material ID for Materials Project, the value is "none"/"mp-xxxx"/"mvc-xxxx", such as "mp-7631","mvc-6281",and "none" (default). 47 | mpid none 48 | 49 | # The X-Api-Key for Materials ProjectVelas provides offline mode and online mode to call API, the value is "none" or your personal access api 50 | xapikey none 51 | 52 | # Indicating which version of API to use, [New]: next-gen.materialsproject.org. [Legacy]: materialsproject.org 53 | # "new" refers to new version api (default), "old"/"legacy" refers to legacy version api 54 | mpapiver new 55 | 56 | # The model of Vickers hardness, Hv M for Mazhnik's model, Hv C for Chen's model, Hv C for Tian's model 57 | Hv M 58 | 59 | # The model and input parameters of fracture toughness, Kic Model materials: Model -> M (Mazhnik's model)/ N (Niu's model); materials -> IC(ionic or covalent) / M (metals) / IM (intermetallics) 60 | # Input parameters of fracture toughness, the order: V0 gEFr m n XA XB 61 | KIC M IC 0.00 0.00 0.00 0.00 0.00 0.00 62 | 63 | # Do you want to output the average value? (avg yes or avg no), default: avg no. 64 | avg no 65 | 66 | # Colormap: 'jet','rainbow','hot', ocean','hsv','cool','spring','summer','autumn','winter','gray','bone','copper','pink','viridis','cubehelix' 67 | cmap hot 68 | 69 | # 3D Unit Spherical or not? (unitsph yes or unitsph no), default: No 70 | unitsph no 71 | 72 | # Map Projection or not? (default: Yes) % {'Gall-Peters' (GP),'Robinson' (R),'Hammer-Aitoff' (HA),'Mollweide' (M)}; 73 | map yes M 74 | 75 | # line style 76 | lstyle -- 77 | 78 | # print or not? (print yes or print no), default: No 79 | print no 80 | 81 | # dpi 82 | dpi 600 83 | 84 | # Plane to be calculated [spherical coordinates] 85 | planeSPH rad 86 | pi/2 0.00 87 | pi/2 pi/2 88 | 0.00 0.00 89 | -------------------------------------------------------------------------------- /doc/InputTemplateD.txt: -------------------------------------------------------------------------------- 1 | 2 | # Offline mode or Online mode to call Materials Project, the value is "no" (default)/"yes" 3 | # Note: In offline mode, it's no need to provide x-api-key, both MPID and Pretty Formula are supported; 4 | # In online mode, x-api-key must be provided, and only MPID query is supported 5 | mponline no 6 | 7 | # The Material ID for Materials Project, the value is "none"/"mp-xxxx"/"mvc-xxxx", such as "mp-7631","mvc-6281",and "none" (default). 8 | mpid none 9 | 10 | # The X-Api-Key for Materials ProjectVelas provides offline mode and online mode to call API, the value is "none" or your personal access api 11 | xapikey none 12 | 13 | # Indicating which version of API to use, [New]: next-gen.materialsproject.org. [Legacy]: materialsproject.org 14 | # "new" refers to new version api (default), "old"/"legacy" refers to legacy version api 15 | mpapiver new 16 | 17 | # External isostatic pressure of crystal (GPa), default:0 GPa 18 | pressure 0.00 19 | 20 | # density of crystal cell (g/cm^3), default: 1.0 (g/cm^3) 21 | density 1.0 22 | 23 | # volume of crystal cell (A^3), default: 1.0 (A^3) 24 | volume 1.0 25 | 26 | # total number of atoms in crystal cell 27 | atomnum 1 28 | 29 | # 3D mesh number of theta(θ), phi(φ), chi (χ) 30 | nmesh3d 200.00 400.00 360.00 31 | 32 | # 2D mesh number of theta(θ) 33 | nmesh2d 400.00 34 | 35 | # Precision control, Less than teps will be considered equal to 0 36 | teps 1.0e-06 37 | 38 | # properties — Pro(2*8) 39 | # Young Compressibility Shear Poisson Bulk Pugh ratio Hardness Fracture Toughness 40 | # 3D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 41 | # 2D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 42 | properties 43 | 1 1 1 1 1 1 1 1 44 | 1 1 1 1 1 1 1 1 45 | 46 | # The model of Vickers hardness, Hv M for Mazhnik's model, Hv C for Chen's model, Hv C for Tian's model 47 | Hv M 48 | 49 | # The model and input parameters of fracture toughness, Kic Model materials: Model -> M (Mazhnik's model)/ N (Niu's model); materials -> IC(ionic or covalent) / M (metals) / IM (intermetallics) 50 | # Input parameters of fracture toughness, the order: V0 gEFr m n XA XB 51 | KIC M IC 0.00 0.00 0.00 0.00 0.00 0.00 52 | 53 | # Do you want to output the average value? (avg yes or avg no), default: avgno. 54 | avg no 55 | 56 | # Colormap: 'jet','rainbow','hot', ocean','hsv','cool','spring','summer','autumn','winter','gray','bone','copper','pink','viridis','cubehelix' 57 | cmap hot 58 | 59 | # 3D Unit Spherical or not? (unitsph yes or unitsph no), default: No 60 | unitsph no 61 | 62 | # Map Projection or not? (default: Yes) % {'Gall-Peters' (GP),'Robinson' (R),'Hammer-Aitoff' (HA),'Mollweide' (M)}; 63 | map yes M 64 | 65 | # line style 66 | lstyle -- 67 | 68 | # print or not? (print yes or print no), default: No 69 | print no 70 | 71 | # dpi 72 | dpi 600 73 | 74 | # Plane to be calculated [XYZ coordinates] 75 | planeXY 76 | 1.00 0.00 0.00 77 | 0.00 1.00 0.00 78 | 0.00 0.00 1.00 79 | -------------------------------------------------------------------------------- /doc/SupportedColormaps.txt: -------------------------------------------------------------------------------- 1 | 2 | Support 75 kinds of colormap: 3 | 4 | 'viridis' (default), 'inferno', 'plasma', 'magma', 'rocket', 'mako', 'flare', 'crest', 'vlag', 'icefire','seismic' 5 | 'cool', 'summer', 'copper', 'hot', 'ocean', 'gray', 'bone', 'Spectral', 'coolwarm', 'pink', 'spring', 'autumn', 6 | 'winter', 'thermal', 'haline', 'solar', 'ice', 'deep', 'dense', 'algae', 'matter', 'turbid', 'speed', 'amp', 7 | 'tempo', 'rain', 'phase', 'balance', 'delta', 'curl', 'diff', 'tarn', 'cubehelix', 'turbo','Blues', 'BuGn', 8 | 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 9 | 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd', 'afmhot', 'gistheat', 'BrBG', 'bwr', 'coolwarmC', 'PiYG', 'PRGn', 10 | 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn' 11 | 12 | Note: If the colormap above is not in the drop-down list box, check the custom colormap checkbox and enter the name of one of the above colormaps. 13 | 14 | Import your own colormap: 15 | You can define your own colormap and store it in the valesColormap.mat file, and then import your colormap via custom colormap. 16 | 17 | Note: the name of the colormap you define cannot be the same as the existing colormap in valesColormap.mat, otherwise it will overwrite the existing colormap. -------------------------------------------------------------------------------- /doc/VELAS Manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/VELAS Manual.pdf -------------------------------------------------------------------------------- /doc/VELAS logo info.txt: -------------------------------------------------------------------------------- 1 | 2 | +-----------------------------------------------------------------------------+' 3 | | |' 4 | | V V EEEEEEE L A SSSSSSS |' 5 | | V V E L A A S |' 6 | | V V EEEEEEE L AAAAA SSSSSSS |' 7 | | V V E L A A S |' 8 | | V EEEEEEE LLLLLLL A A SSSSSSS |' 9 | | |' 10 | | VELAS version 1.0.6 |' 11 | | Author: Zheng Ran |' 12 | | Email:ranzheng@outlook.com |' 13 | | |' 14 | | If you use VELAS in your resarch, please cite: |' 15 | | |' 16 | | "Z. Ran, et al., Computer Physics Communications, 283 (2023) 108540, |' 17 | | DOI:https://doi.org/10.1016/j.cpc.2022.108540" |' 18 | +-----------------------------------------------------------------------------+' 19 | -------------------------------------------------------------------------------- /doc/VELAS_GUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/VELAS_GUI.png -------------------------------------------------------------------------------- /doc/VELAS_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/VELAS_Logo.png -------------------------------------------------------------------------------- /doc/colormapScale.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/colormapScale.tiff -------------------------------------------------------------------------------- /doc/property.m: -------------------------------------------------------------------------------- 1 | % For properties 2 | %{ 3 | properties — Pro(2*8) 4 | 5 | Young Compressibility Shear Poisson Bulk Pugh Ratio Hardness Fracture Toughness 6 | 3D mode: 1 1 1 1 1 1 1 1 7 | 2D mode: 1 1 1 1 1 1 1 1 8 | 9 | Young3D — Pro(1,1), Young2D — Pro(2,1); 10 | Compressibility3D — Pro(1,2), Compressibility2D — Pro(2,2); 11 | Shear3D — Pro(1,3), Shear2D — Pro(2,3); 12 | Poisson3D — Pro(1,4), Poisson2D — Pro(2,4); 13 | Bulk3D — Pro(1,5), Bulk2D — Pro(2,5); 14 | PughRatio3D — Pro(1,6), PughRatio2D — Pro(2,6), 15 | Hardness3D — Pro(1,7), Hardness2D — Pro(2,7); 16 | FractureToughness3D — Pro(1,8), FractureToughness3D — Pro(2,8); 17 | %} 18 | -------------------------------------------------------------------------------- /doc/velasLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/velasLogo.png -------------------------------------------------------------------------------- /doc/~$LAS Manual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/doc/~$LAS Manual.docx -------------------------------------------------------------------------------- /inst/.gitattributes: -------------------------------------------------------------------------------- 1 | *.m linguist-language=Octave 2 | *.m linguist-detectable=true 3 | -------------------------------------------------------------------------------- /inst/.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | /ar-lib 5 | /mdate-sh 6 | /py-compile 7 | /test-driver 8 | /ylwrap 9 | 10 | # http://www.gnu.org/software/autoconf 11 | 12 | autom4te.cache 13 | /autoscan.log 14 | /autoscan-*.log 15 | /aclocal.m4 16 | /compile 17 | /config.guess 18 | /config.h.in 19 | /config.log 20 | /config.status 21 | /config.sub 22 | /configure 23 | /configure.scan 24 | /depcomp 25 | /install-sh 26 | /missing 27 | /stamp-h1 28 | 29 | # https://www.gnu.org/software/libtool/ 30 | 31 | /ltmain.sh 32 | 33 | # http://www.gnu.org/software/texinfo 34 | 35 | /texinfo.tex 36 | 37 | # http://www.gnu.org/software/m4/ 38 | 39 | m4/libtool.m4 40 | m4/ltoptions.m4 41 | m4/ltsugar.m4 42 | m4/ltversion.m4 43 | m4/lt~obsolete.m4 44 | 45 | # Generated Makefile 46 | # (meta build system like autotools, 47 | # can automatically generate from config.status script 48 | # (which is called by configure script)) 49 | Makefile 50 | -------------------------------------------------------------------------------- /inst/GUI/checkCS.m: -------------------------------------------------------------------------------- 1 | function [nC,mLegel] = checkCS(C,val) 2 | 3 | mLegel = false; 4 | nC = zeros(6,6); 5 | if ~isempty(C) 6 | hC = size(C,1); 7 | switch(hC) 8 | case 1 9 | wC = length(C{1,1}); 10 | switch(wC) 11 | case {2,3,5,6,7,9,13,21} 12 | mLegel = true; 13 | C = C{1,1}; 14 | switch(val) 15 | case 2 16 | % 3 independent elastic constants: C11, C44, C12; 17 | nC(1,1) = C(1); 18 | nC(1,2) = C(3); 19 | nC(4,4) = C(2); 20 | nC(2,2)=nC(1,1); 21 | nC(3,3)=nC(1,1); 22 | nC(5,5)=nC(4,4); 23 | nC(6,6)=nC(4,4); 24 | nC(1,3)=nC(1,2); 25 | nC(2,3)=nC(1,2); 26 | % Constructing symmetric matrix 27 | nC = nC+triu(nC,1)'; 28 | case 3 29 | % 5 independent elastic constants: C11, C33, C44, C12, C13 30 | nC(1,1) = C(1); 31 | nC(1,2) = C(4); 32 | nC(1,3) = C(5); 33 | nC(3,3) = C(2); 34 | nC(4,4) = C(3); 35 | nC(5,5) = nC(4,4); 36 | nC(6,6) = (nC(1,1)-nC(1,2))/2; 37 | nC(2,2) = nC(1,1); 38 | nC(2,3) = nC(1,3); 39 | % Constructing symmetric matrix 40 | nC = nC + triu(nC,1)'; 41 | case 4 42 | % tpye1: 6 independent elastic constants: C11, C33, C44, C66, C12, C13 43 | % tpye2: 7 independent elastic constants: C11, C33, C44, C66, C12, C13, C16 44 | len = length(C); 45 | switch(len) 46 | case 6 47 | nC(1,1) = C(1); 48 | nC(3,3) = C(2); 49 | nC(4,4) = C(3); 50 | nC(6,6) = C(4); 51 | nC(1,2) = C(5); 52 | nC(1,3) = C(6); 53 | nC(2,2) = nC(1,1); 54 | nC(2,3) = nC(1,3); 55 | nC(5,5) = nC(4,4); 56 | case 7 57 | nC(1,1) = C(1); 58 | nC(3,3) = C(2); 59 | nC(4,4) = C(3); 60 | nC(6,6) = C(4); 61 | nC(1,2) = C(5); 62 | nC(1,3) = C(6); 63 | nC(1,6) = C(7); 64 | nC(2,2) = nC(1,1); 65 | nC(2,3) = nC(1,3); 66 | nC(3,2) = nC(1,3); 67 | nC(5,5) = nC(4,4); 68 | nC(2,6) = -nC(1,6); 69 | end 70 | % Constructing symmetric matrix 71 | nC = nC + triu(nC,1)'; 72 | case 5 73 | % type1: 6 independent elastic constants: C11, C33, C44, C12, C13, C14 74 | % type2: 7 independent elastic constants: C11, C33, C44, C12, C13, C14, C15 75 | len = length(C); 76 | switch(len) 77 | case 6 78 | nC(1,1) = C(1); 79 | nC(1,2) = C(4); 80 | nC(1,3) = C(5); 81 | nC(1,4) = C(6); 82 | nC(3,3) = C(2); 83 | nC(4,4) = C(3); 84 | nC(2,2) = nC(1,1); 85 | nC(2,3) = nC(1,3); 86 | nC(5,5) = nC(4,4); 87 | nC(6,6) = (nC(1,1)-nC(1,2))/2; 88 | nC(2,4) = -nC(1,4); 89 | nC(5,6) = nC(1,4); 90 | case 7 91 | nC(1,1) = C(1); 92 | nC(1,2) = C(4); 93 | nC(1,3) = C(5); 94 | nC(1,4) = C(6); 95 | nC(1,5) = C(7); 96 | nC(2,2) = nC(1,1); 97 | nC(3,3) = C(2); 98 | nC(4,4) = C(3); 99 | nC(5,5) = nC(4,4); 100 | nC(6,6) = (nC(1,1)-nC(1,2))./2; 101 | nC(2,3) = nC(1,3); 102 | nC(2,4) = -nC(1,4); 103 | nC(2,5) = -nC(1,5); 104 | nC(4,6) = nC(2,5); 105 | nC(5,6) = nC(1,4); 106 | end 107 | % Constructing symmetric matrix 108 | nC = nC + triu(nC,1)'; 109 | case 6 110 | % 9 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C23 111 | nC(1,1) = C(1); 112 | nC(1,2) = C(7); 113 | nC(1,3) = C(8); 114 | nC(2,2) = C(2); 115 | nC(2,3) = C(9); 116 | nC(3,3) = C(3); 117 | nC(4,4) = C(4); 118 | nC(5,5) = C(5); 119 | nC(6,6) = C(6); 120 | % Constructing symmetric matrix 121 | nC = nC + triu(nC,1)'; 122 | case 7 123 | %{ 124 | type1: 13 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C15, C23, C25, C35, C46 125 | type2: 13 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C16, C23, C26, C36, C45 126 | %} 127 | switch(monoType) 128 | case 1 129 | nC(1,1) = C(1); 130 | nC(2,2) = C(2); 131 | nC(3,3) = C(3); 132 | nC(4,4) = C(4); 133 | nC(5,5) = C(5); 134 | nC(6,6) = C(6); 135 | nC(1,2) = C(7); 136 | nC(1,3) = C(8); 137 | nC(1,5) = C(9); 138 | nC(2,3) = C(10); 139 | nC(2,5) = C(11); 140 | nC(3,5) = C(12); 141 | nC(4,6) = C(13); 142 | case 2 143 | nC(1,1) = C(1); 144 | nC(2,2) = C(2); 145 | nC(3,3) = C(3); 146 | nC(4,4) = C(4); 147 | nC(5,5) = C(5); 148 | nC(6,6) = C(6); 149 | nC(1,2) = C(7); 150 | nC(1,3) = C(8); 151 | nC(1,6) = C(9); 152 | nC(2,3) = C(10); 153 | nC(2,6) = C(11); 154 | nC(3,6) = C(12); 155 | nC(4,5) = C(13); 156 | end 157 | % Constructing symmetric matrix 158 | nC = nC + triu(nC,1)'; 159 | case 8 160 | %{ 161 | 21 independent elastic constants: C11, C12, C13, C14, C15, C16, 162 | C22, C23, C24, C25, C26, 163 | C33, C34, C35, C36, 164 | C44, C45, C46, 165 | C55, C56, 166 | C66 167 | %} 168 | nC(1,1) = C(1); 169 | nC(1,2) = C(2); 170 | nC(1,3) = C(3); 171 | nC(1,4) = C(4); 172 | nC(1,5) = C(5); 173 | nC(1,6) = C(6); 174 | nC(2,2) = C(7); 175 | nC(2,3) = C(8); 176 | nC(2,4) = C(9); 177 | nC(2,5) = C(10); 178 | nC(2,6) = C(11); 179 | nC(3,3) = C(12); 180 | nC(3,4) = C(13); 181 | nC(3,5) = C(14); 182 | nC(3,6) = C(15); 183 | nC(4,4) = C(16); 184 | nC(4,5) = C(17); 185 | nC(4,6) = C(18); 186 | nC(5,5) = C(19); 187 | nC(5,5) = C(20); 188 | nC(6,6) = C(21); 189 | % Constructing symmetric matrix 190 | nC = nC + triu(nC,1)'; 191 | case 9 192 | % 2 independent elastic constants: C11, C12; 193 | nC(1,1) = C(1); 194 | nC(1,2) = C(3); 195 | 196 | nC(2,2) = nC(1,1); 197 | nC(3,3) = nC(1,1); 198 | nC(4,4) = (nC(1,1)-nC(1,2))/2; 199 | nC(5,5) = nC(4,4); 200 | nC(6,6) = nC(4,4); 201 | nC(1,3) = nC(1,2); 202 | nC(2,3) = nC(1,2); 203 | % Constructing symmetric matrix 204 | nC = nC+triu(nC,1)'; 205 | end 206 | otherwise 207 | nC = []; 208 | msgbox({'The elastic constant matrix must be 1×m (m ≤ 21), m should be one of [2,3,5,6,7,9,13,21].','Please supplement and try again.'}, 'VELAS reminder','error'); 209 | end 210 | case 6 211 | wC1 = size(C{1},2); 212 | wC2 = size(C{2},2); 213 | wC3 = size(C{3},2); 214 | wC4 = size(C{4},2); 215 | wC5 = size(C{5},2); 216 | wC6 = size(C{6},2); 217 | Cond1 = wC1==6 & wC2==6 & wC3==6 & wC4==6 & wC5==6 & wC6==6; 218 | Cond2 = wC1==1 & wC2==2 & wC3==3 & wC4==4 & wC5==5 & wC6==6; 219 | Cond3 = wC1==6 & wC2==5 & wC3==4 & wC4==3 & wC5==2 & wC6==1; 220 | 221 | if Cond1 || Cond2 || Cond3 222 | mLegel = true; 223 | if Cond1 224 | nC = cell2mat(C); 225 | end 226 | 227 | if Cond2 228 | for k =1:6 229 | nC(k,1:k) = C{k}; 230 | end 231 | % Constructing symmetric matrix 232 | nC = nC + tril(nC,-1)'; 233 | end 234 | 235 | if Cond3 236 | for k =1:6 237 | nC(k,k:end) = C{k}; 238 | end 239 | % Constructing symmetric matrix 240 | nC = nC + triu(nC,1)'; 241 | end 242 | else 243 | nC = []; 244 | msgbox({'The elastic constant matrix must be a 6×6 symmetric matrix in full or in triangular form (upper or lower).','Please supplement and try again.'}, 'VELAS reminder','error'); 245 | end 246 | otherwise 247 | nC = []; 248 | msgbox({'The elastic constant matrix must be 1 * m (m ≤ 21), 6×6 symmetric matrix in full or in triangular form (upper or lower).','Please supplement and try again.'}, 'VELAS reminder','error'); 249 | end 250 | else 251 | nC = []; 252 | msgbox({'The elastic constant matrix cannot be empty.','Please supplement and try again.'}, 'VELAS reminder','error'); 253 | end -------------------------------------------------------------------------------- /inst/GUI/checkPlane.m: -------------------------------------------------------------------------------- 1 | function Plane = checkPlane(str) 2 | 3 | hStr = size(str,1); 4 | switch(hStr) 5 | case 1 6 | if ischar(str) 7 | loc = strfind(str,'|'); 8 | end 9 | if ~isempty(loc) 10 | tC = regexp(str,'\|','split'); 11 | lenT = length(tC); 12 | tP = []; 13 | for k = 1:lenT 14 | tP = [tP;str2num(tC{k})]; 15 | end 16 | Plane = num2str(tP); 17 | else 18 | Plane = str; 19 | end 20 | otherwise 21 | Plane = str; 22 | end -------------------------------------------------------------------------------- /inst/GUI/convertString2Num.m: -------------------------------------------------------------------------------- 1 | function [num,eqflag] = convertString2Num(str) 2 | 3 | hC = size(str,1); 4 | digts = [num2str(iscell(str)),num2str(ischar(str))]; 5 | num = []; 6 | eqflag = false; 7 | switch(digts) 8 | case '01' 9 | try 10 | loc = strfind(str,'|'); 11 | catch 12 | loc = []; 13 | end 14 | if ~isempty(loc) 15 | tC = regexp(str,'\|','split'); 16 | lenC = length(tC); 17 | for k = 1:lenC 18 | num = [num;{str2num(tC{k})}]; 19 | end 20 | else 21 | for k = 1:hC 22 | num = [num;{str2num(str(k,:))}]; 23 | end 24 | end 25 | if ~any(diff(cellfun(@length,num))) 26 | eqflag = true; 27 | end 28 | case '10' 29 | for k = 1:hC 30 | num = [num;{str2num(str{k})}]; 31 | end 32 | if ~any(diff(cellfun(@length,num))) 33 | eqflag = true; 34 | end 35 | otherwise 36 | msgbox({'The input must be char or cell type.','Please check and try again.'}, 'VELAS reminder','error'); 37 | end -------------------------------------------------------------------------------- /inst/GUI/customCMRdbtn.m: -------------------------------------------------------------------------------- 1 | function customCMRdbtn() 2 | 3 | global VELAS 4 | 5 | val = get(VELAS.cmapcustom,'value'); 6 | 7 | if val 8 | VELAS.cmcstomflag = true; 9 | set(VELAS.cmapcustom,'value',1); 10 | set(VELAS.custcmapname,'Enable','on'); 11 | set(VELAS.setbtn,'Enable','on'); 12 | set(VELAS.cmappop,'Enable','off'); 13 | else 14 | VELAS.cmcstomflag = false; 15 | set(VELAS.cmapcustom,'value',0); 16 | set(VELAS.custcmapname,'Enable','off'); 17 | set(VELAS.custcmapname,'String','viridis'); 18 | VELAS.customcmap = 'viridis'; 19 | set(VELAS.setbtn,'Enable','off'); 20 | set(VELAS.cmappop,'Enable','on'); 21 | end 22 | -------------------------------------------------------------------------------- /inst/GUI/customFlipChk.m: -------------------------------------------------------------------------------- 1 | function customFlipChk() 2 | 3 | global VELAS 4 | 5 | if VELAS.cmcstomflag 6 | cmapstr = get(VELAS.custcmapname,'String'); 7 | if isExistColormap(cmapstr) 8 | cmap = cmapstr; 9 | else 10 | cmap = VELAS.customcmap; 11 | end 12 | else 13 | cmapstr = get(VELAS.cmappop,'String'); 14 | cmap = cmapstr{get(VELAS.cmappop,'Value')}; 15 | end 16 | 17 | val = get(VELAS.flipcmap,'value'); 18 | 19 | if val 20 | set(VELAS.flipcmap,'value',1); 21 | VELAS.flipflag = true; 22 | [~,colorm] = interpColormap(cmap,256,true); % 'viridis' 23 | else 24 | set(VELAS.flipcmap,'value',0); 25 | VELAS.flipflag = false; 26 | [~,colorm] = interpColormap(cmap,256,false); % 'viridis' 27 | end 28 | 29 | set(VELAS.aximg,'CData',colorm); -------------------------------------------------------------------------------- /inst/GUI/exitUI.m: -------------------------------------------------------------------------------- 1 | function exitUI() 2 | 3 | global VELAS 4 | 5 | C = get(VELAS.CS,'String'); 6 | if ~isempty(C) 7 | if VELAS.saveflag 8 | close(VELAS.hfig); 9 | else 10 | answer = questdlg({'The input configuration has not been saved.',' Are you sure you want to exit this program?'}, ... 11 | 'VELAS reminder', ... 12 | 'Yes','No','No'); 13 | % Handle response 14 | switch answer 15 | case 'Yes' % Exit 16 | close(VELAS.hfig); 17 | case 'No' % Save and exit. 18 | mLegel = isMatrixLegel(); 19 | if mLegel 20 | saveConfigUI; 21 | close(VELAS.hfig); 22 | else 23 | 24 | end 25 | end 26 | end 27 | else 28 | close(VELAS.hfig); 29 | end 30 | -------------------------------------------------------------------------------- /inst/GUI/getUiInput.m: -------------------------------------------------------------------------------- 1 | function Re = getUiInput() 2 | 3 | %{ 4 | ========================== Processing input file ======================== 5 | Input parameter: 6 | — filename, the input file name that contains the file path. 7 | Out parameter: 8 | — Re, return all the input parameters in the input file. 9 | %} 10 | 11 | global VELAS 12 | 13 | tC = get(VELAS.CS,'String'); 14 | [tC,~] = convertString2Num(tC); 15 | 16 | val = get(VELAS.Cpop,'Value'); 17 | tcryType = get(VELAS.Cpop,'String'); 18 | cryType = tcryType{val}; 19 | planeSph = false; 20 | [C,mLegel] = checkCS(tC,val); 21 | 22 | if mLegel 23 | m = size(C,1); 24 | % {'none','Cubic','Hexagonal','Tetragonal','Trigonal','Orthorhombic','Monoclinic','Triclinic','Isotropic'}; 25 | if val ~= 1 || m == 6 26 | 27 | % Compliance matrix Sij 28 | S = inv(C); 29 | valS = get(VELAS.Sij,'Value'); 30 | if valS == 1 31 | tC = S; 32 | S = C; 33 | C = tC; 34 | end 35 | 36 | % For structure under pressure 37 | prs = get(VELAS.basepressure,'String'); 38 | if isempty(prs) 39 | pressure = 0; % default:0 GPa 40 | else 41 | pressure = str2num(prs); 42 | end 43 | 44 | % Density 45 | den = get(VELAS.baseden,'String'); 46 | if isempty(den) 47 | pressure = 1.0; % default:1.0 g/cm^3 48 | else 49 | density = str2num(den); 50 | end 51 | 52 | % Volume 53 | vol = get(VELAS.basevol,'String'); 54 | if isempty(vol) 55 | volume = 1.0; % default:1.0 A^3 56 | else 57 | volume = str2num(vol); 58 | end 59 | 60 | % For structure under pressure 61 | atomn = get(VELAS.baseatomn,'String'); 62 | if isempty(atomn) 63 | atomnum = 0; % default:0 GPa 64 | else 65 | atomnum = str2num(atomn); 66 | end 67 | 68 | % mesh number of theta(θ) (default:200), phi(φ) (default:400), chi (χ) (default:400) 69 | 70 | mesh3d = get(VELAS.basenmesh3d,'String'); 71 | if isempty(mesh3d) 72 | ntheta = 200; 73 | nphi = 400; 74 | nchi = 400; 75 | else 76 | nmesh3d = str2num(mesh3d); 77 | len = length(mesh3d); 78 | switch(len) 79 | case 1 80 | ntheta = nmesh3d; 81 | nphi = nmesh3d; 82 | nchi = nmesh3d; 83 | case 2 84 | ntheta = nmesh3d(1); 85 | nphi = nmesh3d(2); 86 | nchi = nmesh3d(2); 87 | case 3 88 | ntheta = nmesh3d(1); 89 | nphi = nmesh3d(2); 90 | nchi = nmesh3d(3); 91 | otherwise 92 | ntheta = nmesh3d(1); 93 | nphi = nmesh3d(2); 94 | nchi = nmesh3d(3); 95 | end 96 | end 97 | 98 | 99 | % mesh number of theta in 2D Plane, (default:400) 100 | mesh2d = get(VELAS.basenmesh2d,'String'); 101 | if isempty(mesh2d) 102 | ntheta2d = 400; 103 | else 104 | nmesh2d = str2num(mesh2d); 105 | len = length(mesh2d); 106 | switch(len) 107 | case 1 108 | ntheta2d = nmesh2d(1); 109 | otherwise 110 | ntheta2d = nmesh2d(1); 111 | end 112 | end 113 | 114 | % Precision control, Less than teps will be considered equal to 0 115 | teps = get(VELAS.baseteps,'String'); 116 | if isempty(teps) 117 | teps = 1e-10; 118 | else 119 | teps = str2num(teps); 120 | len = length(teps); 121 | switch(len) 122 | case 1 123 | teps = teps(1); 124 | otherwise 125 | teps = teps(1); 126 | end 127 | end 128 | tplane = get(VELAS.baseplane,'String'); 129 | if isempty(tplane) 130 | planeC = [1 0 0; 0 1 0; 0 0 1]; 131 | else 132 | % tplane = checkPlane(tplane); 133 | [tplane,eqflag] = convertString2Num(tplane); 134 | if ~eqflag 135 | msgbox({'The size of (hkl) must be m*3 or m*2 (m >=1).','Please check and try again.'}, 'VELAS reminder','error'); 136 | end 137 | Sphflag = get(VELAS.baseplaneSph,'Value'); 138 | switch(Sphflag) 139 | case 0 140 | planeC = cell2mat(tplane); 141 | planeSph = false; 142 | planeAng = false; 143 | planeS = []; 144 | 145 | case 1 146 | len = size(tplane,1); 147 | planeC = zeros(len,3); 148 | planeS = zeros(len,2); 149 | planeSph = true; 150 | 151 | radflag = get(VELAS.baseplaneAng,'Value'); 152 | switch(radflag) 153 | case 0 154 | planeAng = true; 155 | for k = 1:len 156 | pL = tplane{k,1}; 157 | planetheta = pL(1); 158 | planephi = pL(2); 159 | planex = sin(planetheta)*cos(planephi); 160 | planey = sin(planetheta)*sin(planephi); 161 | planez = cos(planetheta); 162 | planeC(k,:) = [planex,planey,planez]; 163 | planeS(k,:) = pL; 164 | end 165 | case 1 166 | planeAng = false; 167 | for k = 1:len 168 | pL = tplane{k,1}; 169 | planetheta = pL(1); 170 | planephi = pL(2); 171 | planex = sind(planetheta)*cosd(planephi); 172 | planey = sind(planetheta)*sind(planephi); 173 | planez = cosd(planetheta); 174 | planeC(k,:) = [planex,planey,planez]; 175 | planeS(k,:) = pL; 176 | end 177 | end 178 | end 179 | end 180 | 181 | 182 | %% Properties 183 | %{ 184 | properties — Pro(2*8) 185 | 186 | Young Compressibility Shear Poisson Bulk Pugh Ratio Hardness Fracture Toughness 187 | 3D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 188 | 2D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 189 | 190 | Young3D — Pro(1,1), Young2D — Pro(2,1); 191 | Compressibility3D — Pro(1,2), Compressibility2D — Pro(2,2); 192 | Shear3D — Pro(1,3), Shear2D — Pro(2,3); 193 | Poisson3D — Pro(1,4), Poisson2D — Pro(2,4); 194 | Bulk3D — Pro(1,5), Bulk2D — Pro(2,5); 195 | PughRatio3D — Pro(1,6), PughRatio2D — Pro(2,6), 196 | Hardness3D — Pro(1,7), Hardness2D — Pro(2,7); 197 | FractureToughness3D — Pro(1,8), FractureToughness3D — Pro(2,8); 198 | %} 199 | 200 | Pro = zeros(2,8); 201 | 202 | proE = get(VELAS.proYoung,'Value'); % Young (GPa) 203 | proLC = get(VELAS.proLC,'Value'); % Linear Compressibility (TPa^-1) 204 | proG = get(VELAS.proShear,'Value'); % Shear (GPa) 205 | proP = get(VELAS.proPoisson,'Value'); % Poisson's Ratio 206 | proB = get(VELAS.proBulk,'Value'); % Bulk (GPa) 207 | proPr = get(VELAS.proPugh,'Value'); % Pugh Ratio 208 | 209 | Hvflag = get(VELAS.proHv,'Value'); % Vickers Hardness (GPa) 210 | switch(Hvflag) 211 | case 2 212 | Re.HvModel = 'M'; 213 | case 3 214 | Re.HvModel = 'C'; 215 | case 4 216 | Re.HvModel = 'T'; 217 | end 218 | if Hvflag ~= 1 219 | proHv = 1; 220 | else 221 | proHv = 0; 222 | end 223 | 224 | 225 | KICtype = get(VELAS.proKICtppop,'Value'); % Fracture Toughness (KIC, MPa*m^(1/2)) 226 | KICmode = get(VELAS.proKICmdpop,'Value'); 227 | KIC = []; 228 | switch(KICtype) 229 | case 2 230 | KIC.material = 'IC'; 231 | case 3 232 | KIC.material = 'M'; 233 | case 4 234 | KIC.material = 'IM'; 235 | end 236 | 237 | switch(KICmode) 238 | case 2 239 | KIC.model = 'N'; 240 | case 3 241 | KIC.model = 'M'; 242 | end 243 | 244 | if KICtype ~= 1 && KICmode ~= 1 245 | proKIC = 1; 246 | else 247 | proKIC = 0; 248 | end 249 | 250 | basepop = get(VELAS.basepop,'Value'); 251 | % {'3D','2D','Both'} 252 | switch(basepop) 253 | case 1 % 3D 254 | Pro = zeros(2,8); 255 | Pro(1,:) = [proE proLC proG proP proB proPr proHv proKIC]; 256 | case 2 % 2D 257 | Pro = zeros(2,8); 258 | Pro(2,:) = [proE proLC proG proP proB proPr proHv proKIC]; 259 | case 3 % both 260 | Pro(1,:) = [proE proLC proG proP proB proPr proHv proKIC]; 261 | Pro(2,:) = Pro(1,:); 262 | end 263 | 264 | % % For fracture toughness Parameters 265 | V0 = get(VELAS.proKICV0,'String'); % In fact, V0 = volume/atomnum. 266 | if density ~= 1 && volume ~= 1 267 | KIC.V0 = volume/atomnum; 268 | set(VELAS.proKICV0,'String',num2str(KIC.V0,5)); 269 | else 270 | if ~isempty(V0) 271 | KIC.V0 = str2num(V0); 272 | else 273 | KIC.V0 = 1.0; 274 | set(VELAS.proKICV0,'String',num2str(KIC.V0,5)); 275 | end 276 | end 277 | 278 | gEFr = get(VELAS.proKICgEFr,'String'); 279 | if ~isempty(gEFr) 280 | KIC.gEFr = str2num(gEFr); 281 | end 282 | 283 | m = get(VELAS.proKICm,'String'); 284 | if ~isempty(m) 285 | KIC.m = str2num(m); 286 | end 287 | 288 | n = get(VELAS.proKICn,'String'); 289 | if ~isempty(n) 290 | KIC.n = str2num(n); 291 | end 292 | 293 | XA = get(VELAS.proKICXA,'String'); 294 | if ~isempty(XA) 295 | KIC.XA = str2num(XA); 296 | end 297 | 298 | XB = get(VELAS.proKICXB,'String'); 299 | if ~isempty(XB) 300 | KIC.XB = str2num(XB); 301 | end 302 | 303 | % Do you want to output the average value? (yes or no), default: No. 304 | avgOut = get(VELAS.proAvg,'Value'); 305 | if avgOut 306 | avgout = true; 307 | else 308 | avgout = false; 309 | end 310 | 311 | % colormap 312 | cmapstr = get(VELAS.cmappop,'String'); 313 | Re.cmap = cmapstr{get(VELAS.cmappop,'Value')}; 314 | 315 | % Plotting 3D Unit Spherical 316 | Re.dounitsph = get(VELAS.p3dUSph,'Value'); % true or false 317 | 318 | % map projection 319 | Re.domap = get(VELAS.p2dMPro,'Value'); % true or false 320 | mpstr = get(VELAS.p2dMMod,'String'); 321 | Re.mpmode = mpstr{get(VELAS.p2dMMod,'Value')}; % {'Gall-Peters','Robinson','Hammer-Aitoff','Mollweide'}; 322 | 323 | 324 | % print & dpi 325 | Re.doprint = get(VELAS.doprint,'Value'); % true or false 326 | if ~isempty(get(VELAS.dpi,'String')) 327 | Re.dpi = get(VELAS.dpi,'String'); % Resolution, this value is not the real DPI, just control the size of pic. 328 | else 329 | Re.dpi = num2str(600); 330 | end 331 | 332 | lstylVal = get(VELAS.p2dLStl,'Value'); 333 | switch(lstylVal) 334 | case 1 335 | Re.lineStyle = '--'; 336 | case 2 337 | Re.lineStyle = ':'; 338 | case 3 339 | Re.lineStyle = '-.'; 340 | case 4 341 | Re.lineStyle = '-'; 342 | end 343 | 344 | % output of input data 345 | % Output filename 346 | filename = get(VELAS.Cfname,'String'); 347 | if isempty(filename) 348 | filename = strcat(pwd,filesep,'VELAS',datestr(now,'ddHHMMSS'),'.txt'); 349 | set(VELAS.Cfname,'String',filename); 350 | end 351 | Re.filename = filename; 352 | Re.C = C; 353 | Re.S = S; 354 | Re.cryType = cryType; 355 | Re.pressure = pressure; 356 | Re.density = density; 357 | Re.volume = volume; 358 | Re.atomnum = atomnum; 359 | Re.ntheta = ntheta; 360 | Re.nphi = nphi; 361 | Re.nchi = nchi; 362 | Re.ntheta2d = ntheta2d; 363 | Re.teps = teps; 364 | Re.Pro = Pro; 365 | Re.planeSph = planeSph; 366 | Re.planeAng = planeAng; 367 | Re.planeC = planeC; 368 | Re.planeS = planeS; 369 | Re.KIC = KIC; 370 | Re.avgout = avgout; 371 | else 372 | msgbox({'A suitable crystal system should be selected first, or a 6 * 6 elastic constant symmetric matrix should be provided.','Please supplement and try again.'}, 'VELAS reminder','error'); 373 | end 374 | end 375 | -------------------------------------------------------------------------------- /inst/GUI/importUI.m: -------------------------------------------------------------------------------- 1 | function importUI() 2 | 3 | global VELAS 4 | 5 | [filen, pathn] = uigetfile({'*.txt'},'Select an input file'); 6 | if isequal(filen,0) 7 | errordlg('No file selected.','VELAS reminder'); 8 | else 9 | % [~,tname,~] = fileparts(filen); 10 | resetUI(); % reset UI 11 | filename = strcat(pathn,filen); 12 | inputData = getInput(filename); 13 | VELAS.inputData = inputData; 14 | 15 | VELAS.importflag = true; 16 | 17 | %% Input: elastic tensor (also called stiffness matrix) 18 | 19 | % filename 20 | set(VELAS.Cfname,'String',filename); 21 | % If the input is Stifness matrix C, please don't check this 22 | switch(lower(inputData.cryType)) 23 | % {'none','Cubic','Hexagonal','Tetragonal','Trigonal','Orthorhombic','Monoclinic','Triclinic','Isotropic'} 24 | case 'cubic' 25 | set(VELAS.Cpop,'Value',2); 26 | case 'hexagonal' 27 | set(VELAS.Cpop,'Value',3); 28 | case 'tetragonal' 29 | set(VELAS.Cpop,'Value',4); 30 | case 'trigonal' 31 | set(VELAS.Cpop,'Value',5); 32 | case 'orthorhombic' 33 | set(VELAS.Cpop,'Value',6); 34 | case 'monoclinic' 35 | set(VELAS.Cpop,'Value',7); 36 | case 'triclinic' 37 | set(VELAS.Cpop,'Value',8); 38 | case 'isotropic' 39 | set(VELAS.Cpop,'Value',9); 40 | end 41 | 42 | % Crystal System 43 | set(VELAS.CS,'String',num2str(roundN(inputData.C,2))); 44 | 45 | % Materials Project API 46 | set(VELAS.mponline,'Value',VELAS.inputData.mponline); 47 | switch(lower(VELAS.inputData.mpapiver)) 48 | case 'new' 49 | set(VELAS.mpapiver,'Value',0); 50 | case {'old','legacy'} 51 | set(VELAS.mpapiver,'Value',1); 52 | end 53 | if strcmp(lower(VELAS.inputData.mpid),'none') 54 | set(VELAS.mpmid,'String',''); 55 | else 56 | set(VELAS.mpmid,'String', VELAS.inputData.mpid); 57 | end 58 | 59 | if strcmp(lower(VELAS.inputData.xapikey),'none') 60 | set(VELAS.mpapikey,'String',''); 61 | else 62 | set(VELAS.mpapikey,'String', VELAS.inputData.xapikey); 63 | end 64 | 65 | %% Basic parameters 66 | 67 | % Caculation Mode 68 | flag3d = any(inputData.Pro(1,:)); 69 | flag2d = any(inputData.Pro(2,:)); 70 | flagtp = [num2str(flag3d),num2str(flag2d)]; 71 | switch(flagtp) 72 | case '00' 73 | set(VELAS.basepop,'Value',1); 74 | case '10' 75 | set(VELAS.basepop,'Value',2); 76 | case '01' 77 | set(VELAS.basepop,'Value',3); 78 | case '11' 79 | set(VELAS.basepop,'Value',4); 80 | end 81 | 82 | % Structure under Pressure (GPa) 83 | set(VELAS.basepressure,'String',num2str(inputData.pressure)); 84 | 85 | % 3D mesh number of [θ, φ, χ] 86 | set(VELAS.basenmesh3d,'String',num2str([inputData.ntheta inputData.nphi inputData.nchi])); 87 | 88 | % volume of crystal cell (A^3) 89 | set(VELAS.basevol,'String',num2str(inputData.volume)); 90 | 91 | % '2D mesh number of [θ] 92 | set(VELAS.basenmesh2d,'String',num2str(inputData.ntheta2d)); 93 | 94 | % Density of crystal cell 95 | set(VELAS.baseden,'String',num2str(inputData.density)); 96 | 97 | % Precision control, teps. 98 | set(VELAS.baseteps,'String',num2str(inputData.teps)); 99 | 100 | % total number of atoms in crystal cell 101 | % Density of crystal cell 102 | set(VELAS.baseatomn,'String',num2str(inputData.atomnum)); 103 | 104 | % Plane for 2D Calculation 105 | if inputData.planeSph 106 | set(VELAS.baseplaneSph,'Value',1); 107 | if inputData.planeAng 108 | set(VELAS.baseplaneRad,'Value',0); 109 | else 110 | set(VELAS.baseplaneRad,'Value',1); 111 | end 112 | 113 | if ~isempty(inputData.planeS) 114 | set(VELAS.baseplane,'String',num2str(inputData.planeS)); 115 | else 116 | set(VELAS.baseplane,'String',''); 117 | end 118 | else 119 | set(VELAS.baseplaneSph,'Value',0); 120 | if ~isempty(inputData.planeC) 121 | set(VELAS.baseplane,'String',num2str(inputData.planeC)); 122 | else 123 | set(VELAS.baseplane,'String',''); 124 | end 125 | 126 | end 127 | 128 | %% Properties 129 | %{ 130 | properties — Pro(2*8) 131 | 132 | Young Compressibility Shear Poisson Bulk Pugh Ratio Hardness Fracture Toughness 133 | 3D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 134 | 2D mode: 1/0 1/0 1/0 1/0 1/0 1/0 1/0 1/0 135 | 136 | Young3D — Pro(1,1), Young2D — Pro(2,1); 137 | Compressibility3D — Pro(1,2), Compressibility2D — Pro(2,2); 138 | Shear3D — Pro(1,3), Shear2D — Pro(2,3); 139 | Poisson3D — Pro(1,4), Poisson2D — Pro(2,4); 140 | Bulk3D — Pro(1,5), Bulk2D — Pro(2,5); 141 | PughRatio3D — Pro(1,6), PughRatio2D — Pro(2,6), 142 | Hardness3D — Pro(1,7), Hardness2D — Pro(2,7); 143 | FractureToughness3D — Pro(1,8), FractureToughness3D — Pro(2,8); 144 | %} 145 | 146 | % Young (GPa) 147 | if inputData.Pro(1,1) || inputData.Pro(2,1) 148 | set(VELAS.proYoung,'Value',1); 149 | else 150 | set(VELAS.proYoung,'Value',0); 151 | end 152 | 153 | % Linear Compressibility (TPa^-1) 154 | if inputData.Pro(1,2) || inputData.Pro(2,2) 155 | set(VELAS.proLC,'Value',1); 156 | else 157 | set(VELAS.proLC,'Value',0); 158 | end 159 | 160 | % Shear (GPa) 161 | if inputData.Pro(1,3) || inputData.Pro(2,3) 162 | set(VELAS.proShear,'Value',1); 163 | else 164 | set(VELAS.proShear,'Value',0); 165 | end 166 | 167 | % Poisson's Ratio 168 | if inputData.Pro(1,4) || inputData.Pro(2,4) 169 | set(VELAS.proPoisson,'Value',1); 170 | else 171 | set(VELAS.proPoisson,'Value',0); 172 | end 173 | 174 | % Bulk (GPa) 175 | if inputData.Pro(1,5) || inputData.Pro(2,5) 176 | set(VELAS.proBulk,'Value',1); 177 | else 178 | set(VELAS.proBulk,'Value',0); 179 | end 180 | 181 | % Pugh Ratio 182 | if inputData.Pro(1,6) || inputData.Pro(2,6) 183 | set(VELAS.proPugh,'Value',1); 184 | else 185 | set(VELAS.proPugh,'Value',0); 186 | end 187 | 188 | % Vickers Hardness (GPa) 189 | % {'none','Mazhnik''s model','Chen''s model','Tian''s model'} 190 | if inputData.Pro(1,7) || inputData.Pro(2,7) 191 | switch(inputData.HvModel) 192 | case {'M'} 193 | set(VELAS.proHv,'Value',2); 194 | case {'C'} 195 | set(VELAS.proHv,'Value',3); 196 | case {'T'} 197 | set(VELAS.proHv,'Value',4); 198 | end 199 | else 200 | set(VELAS.proHv,'Value',1); 201 | end 202 | 203 | switch(inputData.KIC.material) 204 | % {'none','Ionic/Covalent','Pure metal','Intermetallic'} 205 | case 'IC' 206 | set(VELAS.proKICtppop,'Value',2); 207 | case 'M' 208 | set(VELAS.proKICtppop,'Value',3); 209 | case 'IM' 210 | set(VELAS.proKICtppop,'Value',4); 211 | otherwise 212 | set(VELAS.proKICtppop,'Value',1); 213 | end 214 | 215 | switch(inputData.KIC.model) 216 | % {'none','Niu''s model','Mazhnik''s model'} 217 | case {'N','Niu'} 218 | set(VELAS.proKICmdpop,'Value',2); 219 | case {'M','Mazhnik'} 220 | set(VELAS.proKICmdpop,'Value',3); 221 | otherwise 222 | set(VELAS.proKICmdpop,'Value',1); 223 | end 224 | 225 | 226 | % Fracture Toughness (KIC, MPa*m^(1/2)) 227 | if ~isempty(inputData.KIC.V0) && ~isequal(inputData.KIC.V0,0) 228 | set(VELAS.proKICV0,'String',num2str(inputData.KIC.V0)); 229 | else 230 | set(VELAS.proKICV0,'String',''); 231 | end 232 | 233 | if ~isempty(inputData.KIC.gEFr) && ~isequal(inputData.KIC.gEFr,0) 234 | set(VELAS.proKICgEFr,'String',num2str(inputData.KIC.gEFr)); 235 | else 236 | set(VELAS.proKICgEFr,'String',''); 237 | end 238 | 239 | if ~isempty(inputData.KIC.m) && ~isequal(inputData.KIC.m,0) 240 | set(VELAS.proKICm,'String',num2str(inputData.KIC.m)); 241 | else 242 | set(VELAS.proKICm,'String',''); 243 | end 244 | 245 | if ~isempty(inputData.KIC.n) && ~isequal(inputData.KIC.n,0) 246 | set(VELAS.proKICn,'String',num2str(inputData.KIC.n)); 247 | else 248 | set(VELAS.proKICn,'String',''); 249 | end 250 | 251 | if ~isempty(inputData.KIC.XA) && ~isequal(inputData.KIC.XA,0) 252 | set(VELAS.proKICXA,'String',num2str(inputData.KIC.XA)); 253 | else 254 | set(VELAS.proKICXA,'String',''); 255 | end 256 | 257 | if ~isempty(inputData.KIC.XB) && ~isequal(inputData.KIC.XB,0) 258 | set(VELAS.proKICXB,'String',num2str(inputData.KIC.XB)); 259 | else 260 | set(VELAS.proKICXB,'String',''); 261 | end 262 | 263 | 264 | % Do you want to output the average value? (default: No) 265 | if inputData.avgout 266 | set(VELAS.proAvg,'Value',1); 267 | else 268 | set(VELAS.proAvg,'Value',0); 269 | end 270 | 271 | % color map 272 | cmapall = get(VELAS.cmappop,'String'); 273 | cloc = find(strcmp(inputData.cmap,cmapall)==1); 274 | if ~isempty(cloc) 275 | set(VELAS.cmappop,'Value',cloc); 276 | else 277 | set(VELAS.cmappop,'Value',1); 278 | end 279 | setColormapFig; 280 | 281 | % 3D Unit Spherica 282 | if inputData.dounitsph 283 | set(VELAS.p3dUSph,'Value',1); 284 | end 285 | 286 | % Map Projection 287 | if inputData.domap 288 | set(VELAS.p2dMPro,'Value',1); 289 | end 290 | 291 | switch(inputData.mpmode) 292 | case {'Gall-Peters'} 293 | set(VELAS.p2dMMod,'Value',1); 294 | case {'Robinson'} 295 | set(VELAS.p2dMMod,'Value',2); 296 | case {'Hammer-Aitoff'} 297 | set(VELAS.p2dMMod,'Value',3); 298 | case {'Mollweide'} 299 | set(VELAS.p2dMMod,'Value',4); 300 | otherwise 301 | set(VELAS.p2dMMod,'Value',4); % default: 'Mollweide' 302 | end 303 | 304 | switch(inputData.lineStyle) 305 | case '--' 306 | set(VELAS.p2dLStl,'Value',1); 307 | case ':' 308 | set(VELAS.p2dLStl,'Value',2); 309 | case '-.' 310 | set(VELAS.p2dLStl,'Value',3); 311 | case '-' 312 | set(VELAS.p2dLStl,'Value',4); 313 | otherwise 314 | set(VELAS.p2dLStl,'Value',1); 315 | end 316 | 317 | % print 318 | if inputData.doprint 319 | set(VELAS.doprint,'Value',1); 320 | end 321 | set(VELAS.dpi,'String',num2str(inputData.dpi)); 322 | 323 | hmsg = msgbox('Import completed!', 'VELAS reminder','help'); 324 | pause(0.8); 325 | if ishandle(hmsg) 326 | close(hmsg); 327 | end 328 | end 329 | -------------------------------------------------------------------------------- /inst/GUI/isMatrixLegel.m: -------------------------------------------------------------------------------- 1 | function Re = isMatrixLegel() 2 | 3 | global VELAS 4 | 5 | C = get(VELAS.CS,'String'); 6 | 7 | if ~isempty(C) 8 | hC = size(C,1); 9 | switch(hC) 10 | case 1 11 | if ischar(C) 12 | loc = strfind(C,'|'); 13 | end 14 | if ~isempty(loc) 15 | tC = regexp(C,'\|','split'); 16 | if iscell(tC) 17 | wC1 = size(str2num(tC{1}),2); 18 | wC2 = size(str2num(tC{2}),2); 19 | wC3 = size(str2num(tC{3}),2); 20 | wC4 = size(str2num(tC{4}),2); 21 | wC5 = size(str2num(tC{5}),2); 22 | wC6 = size(str2num(tC{6}),2); 23 | else 24 | wC1 = size(str2num(tC(1,:)),2); 25 | wC2 = size(str2num(tC(2,:)),2); 26 | wC3 = size(str2num(tC(3,:)),2); 27 | wC4 = size(str2num(tC(4,:)),2); 28 | wC5 = size(str2num(tC(5,:)),2); 29 | wC6 = size(str2num(tC(6,:)),2); 30 | end 31 | 32 | Cond1 = wC1==6 & wC2==6 & wC3==6 & wC4==6 & wC5==6 & wC6==6; 33 | Cond2 = wC1==1 & wC2==2 & wC3==3 & wC4==4 & wC5==5 & wC6==6; 34 | Cond3 = wC1==6 & wC2==5 & wC3==4 & wC4==3 & wC5==2 & wC6==1; 35 | if Cond1 || Cond2 || Cond3 36 | Re = true; 37 | else 38 | Re = false; 39 | msgbox({'The elastic constant matrix must be a 6×6 symmetric matrix in full or in triangular form (upper or lower).','Please supplement and try again.'}, 'VELAS reminder','error'); 40 | end 41 | else 42 | wC = length(str2num(C)); 43 | switch(wC) 44 | case {2,3,5,6,7,9,13,21} 45 | Re = true; 46 | otherwise 47 | Re = false; 48 | msgbox({'The elastic constant matrix must be 1 * m (m ≤ 21), m should be one of [2,3,5,6,7,9,13,21].','Please supplement and try again.'}, 'VELAS reminder','error'); 49 | end 50 | end 51 | case 6 52 | wC1 = size(str2num(C(1,:)),2); 53 | wC2 = size(str2num(C(2,:)),2); 54 | wC3 = size(str2num(C(3,:)),2); 55 | wC4 = size(str2num(C(4,:)),2); 56 | wC5 = size(str2num(C(5,:)),2); 57 | wC6 = size(str2num(C(6,:)),2); 58 | Cond1 = wC1==6 & wC2==6 & wC3==6 & wC4==6 & wC5==6 & wC6==6; 59 | Cond2 = wC1==1 & wC2==2 & wC3==3 & wC4==4 & wC5==5 & wC6==6; 60 | Cond3 = wC1==6 & wC2==5 & wC3==4 & wC4==3 & wC5==2 & wC6==1; 61 | if Cond1 || Cond2 || Cond3 62 | Re = true; 63 | else 64 | Re = false; 65 | msgbox({'The elastic constant matrix must be a 6×6 symmetric matrix in full or in triangular form (upper or lower).','Please supplement and try again.'}, 'VELAS reminder','error'); 66 | end 67 | otherwise 68 | Re = false; 69 | msgbox({'The elastic constant matrix must be 1 * m (m ≤ 21), 6×6 symmetric matrix in full or in triangular form (upper or lower).','Please supplement and try again.'}, 'VELAS reminder','error'); 70 | end 71 | else 72 | Re = false; 73 | msgbox({'The elastic constant matrix cannot be empty.','Please supplement and try again.'}, 'VELAS reminder','error'); 74 | end -------------------------------------------------------------------------------- /inst/GUI/mpapiUI.m: -------------------------------------------------------------------------------- 1 | function mpapiUI() 2 | 3 | global VELAS 4 | 5 | -------------------------------------------------------------------------------- /inst/GUI/queryApiUI.m: -------------------------------------------------------------------------------- 1 | function queryApiUI() 2 | 3 | global VELAS 4 | 5 | mpid = get(VELAS.mpmid,'String'); 6 | xapikey = get(VELAS.mpapikey,'String'); 7 | flag = [num2str(isempty(mpid)),num2str(isempty(xapikey))]; 8 | 9 | VELAS.mpid = mpid; 10 | VELAS.xapikey = xapikey; 11 | if get(VELAS.mponline,'value') 12 | switch(flag) 13 | case '11' 14 | errordlg('Both X-API-KEY and Material ID cannot be empty.','VELAS reminder'); 15 | return; 16 | case '01' 17 | errordlg('The X-API-KEY cannot be empty.','VELAS reminder'); 18 | return; 19 | case '10' 20 | errordlg('The Material ID cannot be empty.','VELAS reminder'); 21 | return; 22 | end 23 | else 24 | if isempty(mpid) 25 | errordlg('The Material ID cannot be empty.','VELAS reminder'); 26 | return; 27 | end 28 | end 29 | 30 | if get(VELAS.mpapiver,'Value') 31 | VELAS.mpapiverflag = true; % using Legacy API 32 | end 33 | 34 | if get(VELAS.mponline,'Value') 35 | VELAS.mponlineflag = true; 36 | end 37 | 38 | if VELAS.mponlineflag 39 | 40 | outputs = mpapiElastic(mpid,xapikey,VELAS.mpapiverflag); 41 | 42 | if ~VELAS.mpapiverflag 43 | set(VELAS.CS,'String',num2str(roundN(outputs.data.elasticity.elastic_tensor,2))); 44 | 45 | switch(lower(outputs.data.symmetry.crystal_system)) 46 | % {'none','Cubic','Hexagonal','Tetragonal','Trigonal','Orthorhombic','Monoclinic','Triclinic','Isotropic'} 47 | case 'cubic' 48 | set(VELAS.Cpop,'Value',2); 49 | case 'hexagonal' 50 | set(VELAS.Cpop,'Value',3); 51 | case 'tetragonal' 52 | set(VELAS.Cpop,'Value',4); 53 | case 'trigonal' 54 | set(VELAS.Cpop,'Value',5); 55 | case 'orthorhombic' 56 | set(VELAS.Cpop,'Value',6); 57 | case 'monoclinic' 58 | set(VELAS.Cpop,'Value',7); 59 | case 'triclinic' 60 | set(VELAS.Cpop,'Value',8); 61 | case 'isotropic' 62 | set(VELAS.Cpop,'Value',9); 63 | end 64 | 65 | else 66 | set(VELAS.CS,'String',num2str(roundN(outputs.response.elasticity.elastic_tensor,2))); 67 | 68 | switch(lower(outputs.response.spacegroup.crystal_system)) 69 | % {'none','Cubic','Hexagonal','Tetragonal','Trigonal','Orthorhombic','Monoclinic','Triclinic','Isotropic'} 70 | case 'cubic' 71 | set(VELAS.Cpop,'Value',2); 72 | case 'hexagonal' 73 | set(VELAS.Cpop,'Value',3); 74 | case 'tetragonal' 75 | set(VELAS.Cpop,'Value',4); 76 | case 'trigonal' 77 | set(VELAS.Cpop,'Value',5); 78 | case 'orthorhombic' 79 | set(VELAS.Cpop,'Value',6); 80 | case 'monoclinic' 81 | set(VELAS.Cpop,'Value',7); 82 | case 'triclinic' 83 | set(VELAS.Cpop,'Value',8); 84 | case 'isotropic' 85 | set(VELAS.Cpop,'Value',9); 86 | end 87 | end 88 | else 89 | 90 | outputs = mpapiElasticOffline(mpid); 91 | if ~isempty(outputs) 92 | set(VELAS.CS,'String',num2str(roundN(outputs.elasticTensor,2))); 93 | 94 | switch(lower(outputs.crystalSystem)) 95 | % {'none','Cubic','Hexagonal','Tetragonal','Trigonal','Orthorhombic','Monoclinic','Triclinic','Isotropic'} 96 | case 'cubic' 97 | set(VELAS.Cpop,'Value',2); 98 | case 'hexagonal' 99 | set(VELAS.Cpop,'Value',3); 100 | case 'tetragonal' 101 | set(VELAS.Cpop,'Value',4); 102 | case 'trigonal' 103 | set(VELAS.Cpop,'Value',5); 104 | case 'orthorhombic' 105 | set(VELAS.Cpop,'Value',6); 106 | case 'monoclinic' 107 | set(VELAS.Cpop,'Value',7); 108 | case 'triclinic' 109 | set(VELAS.Cpop,'Value',8); 110 | case 'isotropic' 111 | set(VELAS.Cpop,'Value',9); 112 | end 113 | end 114 | end -------------------------------------------------------------------------------- /inst/GUI/resetUI.m: -------------------------------------------------------------------------------- 1 | function resetUI() 2 | 3 | global VELAS 4 | 5 | %% Input: elastic tensor (also called stiffness matrix) 6 | set(VELAS.Cfname,'String',''); 7 | set(VELAS.Sij,'Value',0); 8 | set(VELAS.Cpop,'Value',1); 9 | set(VELAS.CS,'String',''); 10 | 11 | set(VELAS.mpmid,'String',''); 12 | set(VELAS.mponline,'Value',0); 13 | set(VELAS.mpapikey,'String',''); 14 | set(VELAS.mpapiver,'Value',0); 15 | 16 | %% Basic parameters 17 | set(VELAS.basepop,'Value',1); 18 | set(VELAS.basepressure,'String','0'); 19 | set(VELAS.basenmesh3d,'String','200 400 360'); 20 | set(VELAS.basenmesh2d,'String','400'); 21 | set(VELAS.baseteps,'String','1e-10'); 22 | set(VELAS.baseplaneSph,'Value',0); 23 | set(VELAS.baseplaneRad,'Value',0); 24 | set(VELAS.baseplane,'String',''); 25 | 26 | %% Properties 27 | set(VELAS.proYoung,'Value',1); 28 | set(VELAS.proLC,'Value',1); 29 | set(VELAS.proShear,'Value',1); 30 | set(VELAS.proPoisson,'Value',1); 31 | set(VELAS.proBulk,'Value',0); 32 | set(VELAS.proPugh,'Value',0); 33 | set(VELAS.proHv,'Value',1); 34 | 35 | set(VELAS.proKICV0,'String',''); 36 | set(VELAS.proKICgEFr,'String',''); 37 | set(VELAS.proKICm,'String',''); 38 | set(VELAS.proKICn,'String',''); 39 | set(VELAS.proKICXA,'String',''); 40 | set(VELAS.proKICXB,'String',''); 41 | set(VELAS.proKICtppop,'Value',1); 42 | set(VELAS.proKICmdpop,'Value',1); 43 | 44 | set(VELAS.proAvg,'Value',0); 45 | 46 | %% Plot setting 47 | set(VELAS.cmappop,'Value',1); 48 | setColormapFig; 49 | set(VELAS.pltdirct,'Value',1); 50 | set(VELAS.p3dUSph,'Value',0); 51 | set(VELAS.p2dMPro,'Value',1); 52 | set(VELAS.p2dMMod ,'Value',1); 53 | set(VELAS.p2dLStl,'Value',1); 54 | set(VELAS.doprint,'Value',0); 55 | set(VELAS.dpi,'String','600'); 56 | 57 | -------------------------------------------------------------------------------- /inst/GUI/runUI.m: -------------------------------------------------------------------------------- 1 | function runUI() 2 | 3 | global VELAS 4 | 5 | C = get(VELAS.CS,'String'); 6 | 7 | if VELAS.importflag 8 | VELAS.runflag = true; 9 | inputData = getUiInput; 10 | % filename = inputData.filename; 11 | % [pathn,filen,~] = fileparts(filename); 12 | % matnameInput = strcat(filen,'Input.mat'); 13 | % matnameOutput = strcat(filen,'Output.mat'); 14 | % inmatname = strcat(pathn,filesep,matnameInput); 15 | 16 | % save(inmatname,'inputData'); 17 | initR = initOutput(); 18 | checkStability(inputData,initR); 19 | % outmatname = strcat(pathn,filesep,matnameOutput); 20 | % save(outmatname,'outputData'); 21 | else 22 | if ~isempty(C) 23 | VELAS.runflag = true; 24 | inputData = getUiInput; 25 | % filename = inputData.filename; 26 | % [pathn,filen,~] = fileparts(filename); 27 | % matnameInput = strcat(filen,'Input.mat'); 28 | % matnameOutput = strcat(filen,'Output.mat'); 29 | % inmatname = strcat(pathn,filesep,matnameInput); 30 | % save(inmatname,'inputData'); 31 | 32 | initR = initOutput(); 33 | checkStability(inputData,initR); 34 | % outmatname = strcat(pathn,filesep,matnameOutput); 35 | % save(outmatname,'outputData'); 36 | else 37 | VELAS.runflag = false; 38 | msgbox({'The elastic constant matrix cannot be empty.','Please supplement and try again.'}, 'VELAS reminder','error'); 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /inst/GUI/setColormapCustom.m: -------------------------------------------------------------------------------- 1 | function setColormapCustom() 2 | 3 | %{ 4 | [1] The color maps viridis, magma, inferno, and plasma were created by Stéfan van der Walt ([@stefanv](https://github.com/stefanv)) 5 | and Nathaniel Smith ([@njsmith](https://github.com/njsmith)). 6 | 7 | [2] Please cite the following paper if you use 'cubehelix' in any publications: 8 | Green, D. A., 2011, A colour scheme for the display of astronomical intensity images , Bulletin of the Astronomical Society of India, 39, 289. 9 | 10 | [3] A collection of colormaps from https://matplotlib.org/cmocean/ 11 | cmocean: 'thermal' 'haline' 'solar' 'ice' 'deep' 'dense' 'algae' 'matter' 'turbid' 'speed' 'amp' 'tempo' 'rain' 'phase' 'balance' 'delta' 'curl' 'diff' 'tarn' 12 | Please cite the following paper if you use 'cmocean' colormap sets in any publications: 13 | Thyng, K. M., Greene, C. A., Hetland, R. D., Zimmerle, H. M., & DiMarco, S. F. (2016). True colors of oceanography. Oceanography, 29(3), 10. 14 | 15 | [4] A collection of colormaps from https://seaborn.pydata.org/ 16 | seaborn: ["rocket", "mako", "flare", "crest", "vlag", "icefire", "Spectral", "coolwarm"] 17 | Please cite the following paper if you use 'seaborn' colormap sets in any publications: 18 | Waskom, M. L., (2021). seaborn: statistical data visualization. Journal of Open Source Software, 6(60), 3021, https://doi.org/10.21105/joss.03021 19 | 20 | 21 | 22 | %} 23 | global VELAS 24 | 25 | incmapname = get(VELAS.custcmapname,'String'); 26 | 27 | if ~isExistColormap(incmapname) 28 | incmapname = 'viridis'; 29 | VELAS.customcmap = 'viridis'; 30 | else 31 | VELAS.customcmap = incmapname; 32 | end 33 | 34 | [~,colorm] = interpColormap(incmapname,256,VELAS.flipflag); % 'viridis' 35 | set(VELAS.aximg,'CData',colorm); 36 | -------------------------------------------------------------------------------- /inst/GUI/setColormapFig.m: -------------------------------------------------------------------------------- 1 | function setColormapFig() 2 | 3 | %{ 4 | [1] The color maps viridis, magma, inferno, and plasma were created by Stéfan van der Walt ([@stefanv](https://github.com/stefanv)) 5 | and Nathaniel Smith ([@njsmith](https://github.com/njsmith)). 6 | 7 | [2] Please cite the following paper if you use 'cubehelix' in any publications: 8 | Green, D. A., 2011, A colour scheme for the display of astronomical intensity images , Bulletin of the Astronomical Society of India, 39, 289. 9 | 10 | [3] A collection of colormaps from https://matplotlib.org/cmocean/ 11 | cmocean: 'thermal' 'haline' 'solar' 'ice' 'deep' 'dense' 'algae' 'matter' 'turbid' 'speed' 'amp' 'tempo' 'rain' 'phase' 'balance' 'delta' 'curl' 'diff' 'tarn' 12 | Please cite the following paper if you use 'cmocean' colormap sets in any publications: 13 | Thyng, K. M., Greene, C. A., Hetland, R. D., Zimmerle, H. M., & DiMarco, S. F. (2016). True colors of oceanography. Oceanography, 29(3), 10. 14 | 15 | [4] A collection of colormaps from https://seaborn.pydata.org/ 16 | seaborn: ["rocket", "mako", "flare", "crest", "vlag", "icefire", "Spectral", "coolwarm"] 17 | Please cite the following paper if you use 'seaborn' colormap sets in any publications: 18 | Waskom, M. L., (2021). seaborn: statistical data visualization. Journal of Open Source Software, 6(60), 3021, https://doi.org/10.21105/joss.03021 19 | 20 | 21 | 22 | %} 23 | global VELAS 24 | 25 | 26 | val = get(VELAS.cmappop,'Value'); 27 | str = get(VELAS.cmappop,'String'); 28 | 29 | flag = str{val}; 30 | switch(flag) 31 | case 'viridis' 32 | [~,colorm] = interpColormap('viridis',256,VELAS.flipflag); % 'viridis' 33 | case 'cool' 34 | [~,colorm] = interpColormap('cool',256,VELAS.flipflag); % 'cool' 35 | case 'summer' 36 | [~,colorm] = interpColormap('summer',256,VELAS.flipflag); % 'summer' 37 | case 'copper' 38 | [~,colorm] = interpColormap('copper',256,VELAS.flipflag); % 'copper' 39 | case 'hot' 40 | [~,colorm] = interpColormap('hot',256,VELAS.flipflag); % 'hot' 41 | case 'ocean' 42 | [~,colorm] = interpColormap('ocean',256,VELAS.flipflag); % 'ocean' 43 | case 'gray' 44 | [~,colorm] = interpColormap('gray',256,VELAS.flipflag); % 'gray' 45 | case 'bone' 46 | [~,colorm] = interpColormap('bone',256,VELAS.flipflag); % 'bone' 47 | case 'pink' 48 | [~,colorm] = interpColormap('pink',256,VELAS.flipflag); % 'pink' 49 | case 'spring' 50 | [~,colorm] = interpColormap('spring',256,VELAS.flipflag); % 'spring' 51 | case 'autumn' 52 | [~,colorm] = interpColormap('autumn',256,VELAS.flipflag); % 'autumn' 53 | case 'winter' 54 | [~,colorm] = interpColormap('winter',256,VELAS.flipflag); % 'winter' 55 | case 'cubehelix' 56 | % Green, D. A., 2011, ‘A colour scheme for the display of astronomical intensity images’, Bulletin of the Astronomical Society of India, 39, 289. 57 | % Please cite this paper if you use ‘cubehelix’ in any publications. 58 | [~,colorm] = interpColormap('cubehelix',256,VELAS.flipflag); %'cubehelix' 59 | case 'turbo' 60 | [~,colorm] = interpColormap('turbo',256,VELAS.flipflag); % 'turbo' 61 | case 'thermal' 62 | [~,colorm] = interpColormap('thermal',256,VELAS.flipflag); 63 | case 'haline' 64 | [~,colorm] = interpColormap('haline',256,VELAS.flipflag); 65 | case 'solar' 66 | [~,colorm] = interpColormap('solar',256,VELAS.flipflag); 67 | case 'ice' 68 | [~,colorm] = interpColormap('ice',256,VELAS.flipflag); 69 | case 'deep' 70 | [~,colorm] = interpColormap('deep',256,VELAS.flipflag); 71 | case 'dense' 72 | [~,colorm] = interpColormap('dense',256,VELAS.flipflag); 73 | case 'algae' 74 | [~,colorm] = interpColormap('algae',256,VELAS.flipflag); 75 | case 'matter' 76 | [~,colorm] = interpColormap('matter',256,VELAS.flipflag); 77 | case 'turbid' 78 | [~,colorm] = interpColormap('turbid',256,VELAS.flipflag); 79 | case 'speed' 80 | [~,colorm] = interpColormap('speed',256,VELAS.flipflag); 81 | case 'amp' 82 | [~,colorm] = interpColormap('amp',256,VELAS.flipflag); 83 | case 'tempo' 84 | [~,colorm] = interpColormap('tempo',256,VELAS.flipflag); 85 | case 'rain' 86 | [~,colorm] = interpColormap('rain',256,VELAS.flipflag); 87 | case 'phase' 88 | [~,colorm] = interpColormap('phase',256,VELAS.flipflag); 89 | case 'balance' 90 | [~,colorm] = interpColormap('balance',256,VELAS.flipflag); 91 | case 'delta' 92 | [~,colorm] = interpColormap('delta',256,VELAS.flipflag); 93 | case 'curl' 94 | [~,colorm] = interpColormap('curl',256,VELAS.flipflag); 95 | case 'diff' 96 | [~,colorm] = interpColormap('diff',256,VELAS.flipflag); 97 | case 'tarn' 98 | [~,colorm] = interpColormap('tarn',256,VELAS.flipflag); 99 | case 'inferno' 100 | [~,colorm] = interpColormap('inferno',256,VELAS.flipflag); 101 | case 'magma' 102 | [~,colorm] = interpColormap('magma',256,VELAS.flipflag); 103 | case 'plasma' 104 | [~,colorm] = interpColormap('plasma',256,VELAS.flipflag); 105 | case 'rocket' 106 | [~,colorm] = interpColormap('rocket',256,VELAS.flipflag); 107 | case 'mako' 108 | [~,colorm] = interpColormap('mako',256,VELAS.flipflag); 109 | case 'flare' 110 | [~,colorm] = interpColormap('flare',256,VELAS.flipflag); 111 | case 'crest' 112 | [~,colorm] = interpColormap('crest',256,VELAS.flipflag); 113 | case 'vlag' 114 | [~,colorm] = interpColormap('vlag',256,VELAS.flipflag); 115 | case 'icefire' 116 | [~,colorm] = interpColormap('icefire',256,VELAS.flipflag); 117 | case 'Spectral' 118 | [~,colorm] = interpColormap('Spectral',256,VELAS.flipflag); 119 | case 'coolwarm' 120 | [~,colorm] = interpColormap('coolwarm',256,VELAS.flipflag); 121 | otherwise % Default Colormap 122 | [~,colorm] = interpColormap('viridis',256,VELAS.flipflag); % 'viridis' 123 | end 124 | set(VELAS.aximg,'CData',colorm); 125 | -------------------------------------------------------------------------------- /inst/GUI/setPlotFont.m: -------------------------------------------------------------------------------- 1 | function setPlotFont() 2 | 3 | global VELAS 4 | 5 | uifont = uisetfont; 6 | if isstruct(uifont) 7 | VELAS.fontname = uifont.FontName; 8 | VELAS.fontweight = uifont.FontWeight; 9 | VELAS.fontangle = uifont.FontAngle; 10 | VELAS.fontsize = uifont.FontSize; 11 | end -------------------------------------------------------------------------------- /inst/GUI/setTrueFalse.m: -------------------------------------------------------------------------------- 1 | function Re = setTrueFalse(x) 2 | %{ 3 | x == 0, return 'False'; 4 | x == 1, return 'True'; 5 | %} 6 | switch(x) 7 | case 0 8 | Re = ' F '; % False 9 | case 1 10 | Re = ' T '; % True 11 | end -------------------------------------------------------------------------------- /inst/GUI/setmapproFontColor.m: -------------------------------------------------------------------------------- 1 | function setmapproFontColor() 2 | 3 | global VELAS 4 | 5 | VELAS.mpfontcolor = selectcolor; -------------------------------------------------------------------------------- /inst/README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | ![GitHub issues](https://img.shields.io/github/issues/ranzhengcode/VELAS?logo=github) 5 | ![GitHub repo size](https://img.shields.io/github/repo-size/ranzhengcode/VELAS?logo=github) 6 | ![GitHub all releases](https://img.shields.io/github/downloads/ranzhengcode/VELAS/total?logo=github) 7 | [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/ranzhengcode/VELAS?logo=Github)](https://github.com/ranzhengcode/VELAS/releases/tag/velas-1.0.0) 8 | [![GitHub](https://img.shields.io/github/license/ranzhengcode/VELAS?logo=GitHub)](https://github.com/ranzhengcode/VELAS/blob/main/LICENSE.md) 9 | 10 | **VELAS** is a user-friendly open-source toolbox for **the visualization and analysis of elastic anisotropy** written in **GNU Octave** that can be used for **any crystal symmetry**. 11 | 12 | ### Meaning of VELAS 13 | **VELAS** is derived from the combination of the letters **V**, **ELA** and **S** in "**V**isualization and analysis of **ELA**stic ani**S**otropy" and has no connection or relationship to any known trademarks, places or people that might be called "**VELAS**". 14 | 15 | [VELAS Manual, PDF](https://github.com/ranzhengcode/VELAS/blob/main/doc/VELAS%20Manual.pdf) 16 | 17 | ## Highlights 18 | - **Easy** to install and use, **no** compilation required and **no** dependence on any third-party libraries. 19 | - A fully interactive graphical interactive interface (**GUI**). 20 | - Support for a wide range of visualisation schemes such as **map projection** and **unit sphere projection**. 21 | - Supports the determination of the mechanical stability of crystals at **atmospheric** and **high pressures** using the **Born mechanical stability criterion**. 22 | - Support for analysis of properties such as **hardness**, **fracture toughness**, **average Cauchy pressure**, **areal Poisson’s ratio**, etc. 23 | - Provides a **native interface** for calling data from the new (default) and legacy APIs of the [Materials Project's database](https://next-gen.materialsproject.org/). 24 | 25 | ## Graphical User Interface (GUI) 26 |
27 | 28 | ## INSTALL 29 | ### Installation Scheme A 30 | - (1) install VELAS using **pkg** command in GNU Octave **command windows** as following: 31 | ``` 32 | pkg install "https://github.com/ranzhengcode/VELAS/archive/refs/tags/v1.0.5.tar.gz" 33 | ``` 34 | - (2) And then using **pkg load velas** to load VELAS. 35 | - (3) Type **velasGUI** to run VELAS. 36 | - (4) **Enjoy**! 37 | ### Installation Scheme B 38 | - (1) Unzip the downloaded **VELAS** archive into any available path; 39 | - (2) Run **install_VELAS** or **velasGUI**, VELAS will be automatically installed. 40 | ### Installation Scheme C 41 | - (1) Unzip the downloaded **VELAS** archive into any available path; 42 | - (2) Start **GNU Octave** and click on the **Edit** option in the menu bar; 43 | - (3) Click on **Set Path** in the **Edit** drop-down box; 44 | - (4) Click **Add Folder** in the **Set Path** dialog box; 45 | - (5) Click on **Folder with Subfolders** in the **Add Folder** drop-down list box; 46 | - (6) In the pop-up dialog box, find the path of the unpacked VELAS folder in **(1)**, and select the VELAS folder, then click **Choose**; 47 | - (7) Click **Save** in the **Set Path** dialog box to complete the installation; 48 | - (8) **Enjoy**! 49 | 50 | ## GET STARTED 51 | VELAS supports both **script** and **GUI** to run. 52 | - **1**: Run **VELAS** using **velasScript**. Type `velasScript` in the **command window** of **GNU Octave** and press **Enter** to run. 53 | - **2**: Run **VELAS** using **velasGUI**. Type `velasGUI` in the **command window** of **GNU Octave** and press **Enter** to run. 54 | 55 | ## Tested systems 56 | **Windows 10** and **Ubuntu 18.04**. 57 | 58 | ## Languages 59 | **GUN Octave** (Ver. 5.2.0 - latest, Recommended), in full support of **MATLAB**. 60 | 61 | ## ColorMap 62 | **Support 75 kinds of colormap:** 63 | 'viridis' (default), 'inferno', 'plasma', 'magma', 'rocket', 'mako', 'flare', 'crest', 'vlag', 'icefire','seismic' 64 | 'cool', 'summer', 'copper', 'hot', 'ocean', 'gray', 'bone', 'Spectral', 'coolwarm', 'pink', 'spring', 'autumn', 65 | 'winter', 'thermal', 'haline', 'solar', 'ice', 'deep', 'dense', 'algae', 'matter', 'turbid', 'speed', 'amp', 66 | 'tempo', 'rain', 'phase', 'balance', 'delta', 'curl', 'diff', 'tarn', 'cubehelix', 'turbo','Blues', 'BuGn', 67 | 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 68 | 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd', 'afmhot', 'gistheat', 'BrBG', 'bwr', 'coolwarmC', 'PiYG', 'PRGn', 69 | 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn' 70 | **Note: If the colormap above is not in the drop-down list box, check the custom colormap checkbox and enter the name of one of the above colormaps.** 71 | 72 | **Setting your own colormap:** 73 | You can define your own colormap and store it in the valesColormap.mat file, and then import your colormap via custom colormap. 74 | **Note: the name of the colormap you define cannot be the same as the existing colormap in valesColormap.mat, otherwise it will overwrite the existing colormap.** 75 | 76 | ## Supported systems 77 | GNU/Linux, BSD, macOS, Windows. 78 | 79 | ## Contact Information 80 | **Email**: ranzheng@outlook.com 81 | Please **don't hesitate** to contact us if you have any questions about **using VELAS** or suggestions for **improving VELAS**. 82 | 83 | ## How to Cite 84 | Z. Ran, C.M. Zou, Z.J. Wei, et al., VELAS: An open-source toolbox for visualization and analysis of elastic anisotropy. Computer Physics Communications, 283 (2023) 108540. 85 | [**DOI:https://doi.org/10.1016/j.cpc.2022.108540**](https://doi.org/10.1016/j.cpc.2022.108540). 86 | -------------------------------------------------------------------------------- /inst/basic/dir2Vec.m: -------------------------------------------------------------------------------- 1 | function [K,K1,K2,K3] = dir2Vec(theta, phi) 2 | 3 | % Convert direction to vector coordinates 4 | 5 | K1 = sin(theta).*cos(phi); 6 | K2 = sin(theta).*sin(phi); 7 | K3 = cos(theta); 8 | K = [K1,K2,K3]; -------------------------------------------------------------------------------- /inst/basic/dir2Vec2d.m: -------------------------------------------------------------------------------- 1 | function K = dir2Vec2d(theta) 2 | 3 | K = [cos(theta) sin(theta)]; 4 | -------------------------------------------------------------------------------- /inst/basic/dir2Vec3V.m: -------------------------------------------------------------------------------- 1 | function [V1,V2,V3] = dir2Vec3V(thetaTmp, phiTmp, nChi) 2 | 3 | % Convert direction to vector coordinates 4 | 5 | lena = size(thetaTmp,1); 6 | theta = repmat(thetaTmp,1,nChi); 7 | phi = repmat(phiTmp,1,nChi); 8 | chiTmp = linspace(0,pi,nChi); 9 | chi = repmat(chiTmp,lena,1); 10 | V1 = cos(theta).*cos(phi).*cos(chi) - sin(phi).*sin(chi); 11 | V2 = cos(theta).*sin(phi).*cos(chi) + cos(phi).*sin(chi); 12 | V3 = -sin(theta).*cos(chi); -------------------------------------------------------------------------------- /inst/basic/getCoef1.m: -------------------------------------------------------------------------------- 1 | function [k11,k12,k13,k22,k23,k33] = getCoef1(k) 2 | 3 | % Combination of coefficient of k 4 | 5 | k11 = k(:,1).*k(:,1); 6 | k12 = k(:,1).*k(:,2); 7 | k13 = k(:,1).*k(:,3); 8 | k22 = k(:,2).*k(:,2); 9 | k23 = k(:,2).*k(:,3); 10 | k33 = k(:,3).*k(:,3); -------------------------------------------------------------------------------- /inst/basic/getCoef2.m: -------------------------------------------------------------------------------- 1 | function [v11,v12,v13,v22,v23,v33] = getCoef2(v1,v2,v3) 2 | 3 | % Combination of coefficient of v 4 | 5 | v11 = v1.*v1; 6 | v12 = v1.*v2; 7 | v13 = v1.*v3; 8 | v22 = v2.*v2; 9 | v23 = v2.*v3; 10 | v33 = v3.*v3; -------------------------------------------------------------------------------- /inst/basic/getCoef2D.m: -------------------------------------------------------------------------------- 1 | function [k11,k12,k13,k22,k23,k33,theta,phi] = getCoef2D(x,n2d,planeC) 2 | 3 | 4 | 5 | epsilon = 1e-8; 6 | planex = planeC(1); 7 | planey = planeC(2); 8 | planez = planeC(3); 9 | % Normalized plane 10 | temp = sqrt(planex^2+planey^2+planez^2); 11 | planex = planex/temp; 12 | planey = planey/temp; 13 | planez = planez/temp; 14 | 15 | if isempty(x) 16 | theta2d = linspace(0,2*pi,n2d); 17 | else 18 | n2d = length(x); 19 | theta2d = x; 20 | end 21 | 22 | k11 = zeros(n2d,1); 23 | k12 = zeros(n2d,1); 24 | k13 = zeros(n2d,1); 25 | k22 = zeros(n2d,1); 26 | k23 = zeros(n2d,1); 27 | k33 = zeros(n2d,1); 28 | theta = zeros(n2d,1); 29 | phi = zeros(n2d,1); 30 | for t = 1:n2d 31 | thetaTmp = theta2d(t); 32 | % build the wave vector 33 | if (abs(planex) <= epsilon)&&(abs(planez) <= epsilon) % reference/0 "y" 34 | k(1) = cos(thetaTmp); 35 | k(2) = 0; 36 | k(3) = sin(thetaTmp); 37 | elseif (abs(planez) <= epsilon)&&(abs(planey) <= epsilon) % reference/0 "x" 38 | k(1) = 0; 39 | k(2) = cos(thetaTmp); 40 | k(3) = sin(thetaTmp); 41 | else 42 | temp = sqrt(planex^2+planez^2); 43 | k(1)=(planez*cos(thetaTmp)-planex*planey*sin(thetaTmp))/temp; 44 | k(2)=(planex^2+planez^2)*sin(thetaTmp)/temp; 45 | k(3)=(-planex*cos(thetaTmp)-planey*planez*sin(thetaTmp))/temp; 46 | end 47 | if (1 -(abs(k(3))) <= epsilon) 48 | theta(t) = 0; 49 | phi(t) = 0; 50 | else 51 | theta(t) = acos(k(3)); 52 | if (k(2) <= epsilon) 53 | if ((abs(k(1))-abs(sin(theta(t))))<=epsilon) 54 | tempo = 0.999999*k(1)/sin(theta(t)); 55 | else 56 | tempo = k(1)/sin(theta(t)); 57 | end 58 | phi(t) = nsign(acos(tempo),k(2)); 59 | else 60 | phi(t) = nsign(acos(k(1)/sin(theta(t))),k(2)); 61 | end 62 | end 63 | 64 | k11(t)=k(1)*k(1); 65 | k12(t)=k(1)*k(2); 66 | k13(t)=k(1)*k(3); 67 | k22(t)=k(2)*k(2); 68 | k23(t)=k(2)*k(3); 69 | k33(t)=k(3)*k(3); 70 | end -------------------------------------------------------------------------------- /inst/basic/getMaxMinNeg.m: -------------------------------------------------------------------------------- 1 | function Re = getMaxMinNeg(Data,flag) 2 | 3 | %{ 4 | Input parameter: 5 | data, which is a m*n matrix. 6 | flag, 'max', 'min' or 'neg'. 7 | Out parameter: 8 | Re, return maximum, minimum positive or minimum negative value in column of Data according to flag. 9 | %} 10 | 11 | switch(flag) 12 | case 'max' % maximum 13 | % Re = arrayfun(@(t) max(Data(Data(:,t)>0,t)), 1:size(Data,2),'UniformOutput',false); 14 | % loc = cellfun(@isempty,Re); 15 | % if any(loc) 16 | % Re(loc) = num2cell(0); 17 | % end 18 | Re = max(Data); 19 | case 'min' % minimum positive 20 | Re = arrayfun(@(t) min(Data(Data(:,t)>0,t)), 1:size(Data,2),'UniformOutput',false); 21 | loc = cellfun(@isempty,Re); 22 | if any(loc) 23 | Re(loc) = num2cell(0); 24 | end 25 | Re = cell2mat(Re); 26 | case 'neg' % minimum negative 27 | Re = arrayfun(@(t) min(Data(Data(:,t)<0,t)), 1:size(Data,2),'UniformOutput',false); 28 | loc = cellfun(@isempty,Re); 29 | if any(loc) 30 | Re(loc) = num2cell(0); 31 | end 32 | Re = -cell2mat(Re); 33 | end -------------------------------------------------------------------------------- /inst/basic/getPosNeg.m: -------------------------------------------------------------------------------- 1 | function Re = getPosNeg(Data,flag) 2 | 3 | %{ 4 | Input parameter: 5 | — data, which is a m*n matrix. 6 | — flag, 'pos' or 'neg'. 7 | Out parameter: 8 | — Re, return positive or negative value in Data according to flag. 9 | %} 10 | 11 | switch(flag) 12 | case 'pos' % positive 13 | Re = zeros(length(Data),1); 14 | Re(Data>0) = Data(Data>0); 15 | case 'neg' % negative 16 | Re = zeros(length(Data),1); 17 | Re(Data<0) = Data(Data<0); 18 | end -------------------------------------------------------------------------------- /inst/basic/initOutput.m: -------------------------------------------------------------------------------- 1 | function Re = initOutput() 2 | 3 | % Initialize output results 4 | 5 | hmsg = msgbox('Initialize output results!', 'VELAS reminder','help'); 6 | pause(0.8); 7 | if ishandle(hmsg) 8 | close(hmsg); 9 | end 10 | 11 | Re.C = []; 12 | Re.N = []; 13 | Re.n2d = 200; 14 | Re.nChi = 200; 15 | Re.S = []; 16 | Re.pressure = 0; 17 | Re.planeC = []; 18 | Re.teps = 1e-10; 19 | 20 | Re.lamda = []; 21 | 22 | Re.Bv = []; 23 | Re.Br = []; 24 | Re.Bh = []; 25 | 26 | Re.Gv = []; 27 | Re.Gr = []; 28 | Re.Gh = []; 29 | 30 | Re.Ev = []; 31 | Re.Er = []; 32 | Re.Eh = []; 33 | 34 | Re.nuv = []; 35 | Re.nur = []; 36 | Re.nuh = []; 37 | 38 | Re.lamestv = []; 39 | Re.lamestr = []; 40 | Re.lamesth = []; 41 | Re.lamendv = []; 42 | Re.lamendr = []; 43 | Re.lamendh = []; 44 | 45 | Re.AU = []; 46 | Re.AL = []; 47 | 48 | %% 3D 49 | Re.meshedTheta = []; 50 | Re.meshedPhi = []; 51 | 52 | Re.E = []; 53 | Re.Emax = []; 54 | Re.EmaxTP = []; 55 | Re.Ehklmax = []; 56 | Re.Emin = []; 57 | Re.EminTP = []; 58 | Re.Ehklmin = []; 59 | Re.beta = []; 60 | Re.betamax = []; 61 | Re.betamaxTP = []; 62 | Re.betahklmax = []; 63 | Re.betamin = []; 64 | Re.betaminTP = []; 65 | Re.betahklmin = []; 66 | 67 | Re.G = []; 68 | Re.Gmax = []; 69 | Re.GMmax = []; 70 | Re.GmaxTP = []; 71 | Re.Ghklmax = []; 72 | Re.Gmin = []; 73 | Re.Gmmin = []; 74 | Re.GminTP = []; 75 | Re.Ghklmin = []; 76 | Re.Gavg = []; 77 | 78 | Re.P = []; 79 | Re.PMax = []; 80 | Re.Pmmax = []; 81 | Re.Phklmax = []; 82 | Re.PMinp = []; 83 | Re.PminpTP = []; 84 | Re.Phklminp = []; 85 | Re.PMinn = []; 86 | Re.PminnTP = []; 87 | Re.Phklminn = []; 88 | Re.Pavg = []; 89 | 90 | Re.Hv = []; 91 | Re.Hvmax = []; 92 | Re.Hvmmax = []; 93 | Re.HvmaxTP = []; 94 | Re.Hvhklmax = []; 95 | Re.Hvmin = []; 96 | Re.Hvmmin = []; 97 | Re.HvminTP = []; 98 | Re.Hvhklmin = []; 99 | Re.Hvavg = []; 100 | 101 | %% 2D 102 | Re.theta2d = []; 103 | 104 | Re.E2d = []; 105 | Re.E2dmax = []; 106 | Re.E2dmaxTheta = []; 107 | Re.E2dmin = []; 108 | Re.E2dminTheta = []; 109 | 110 | Re.beta2d = []; 111 | Re.beta2dmax = []; 112 | Re.beta2dmaxTheta = []; 113 | Re.beta2dmin = []; 114 | Re.beta2dminTheta = []; 115 | Re.beta2davg = []; 116 | 117 | Re.B2d = []; 118 | Re.B2dmax = []; 119 | Re.B2dmaxTheta = []; 120 | Re.B2dmin = []; 121 | Re.B2dminTheta = []; 122 | Re.B2davg = []; 123 | 124 | Re.G2d = []; 125 | Re.G2dmax = []; 126 | Re.G2dmmax = []; 127 | Re.G2dmaxTheta = []; 128 | Re.G2dmin = []; 129 | Re.G2dmmin = []; 130 | Re.G2dminTheta = []; 131 | Re.G2davg = []; 132 | 133 | Re.P2d = []; 134 | Re.P2dmax = []; 135 | Re.P2dmmax = []; 136 | Re.P2dmaxTheta = []; 137 | Re.P2dminp = []; 138 | Re.P2dmminp = []; 139 | Re.P2dminpTheta = []; 140 | Re.P2dminn = []; 141 | Re.P2dmminn = []; 142 | Re.P2dminnTheta = []; 143 | Re.P2dmin = []; 144 | Re.P2dminTheta = []; 145 | Re.P2davg = []; 146 | -------------------------------------------------------------------------------- /inst/basic/isAllPositive.m: -------------------------------------------------------------------------------- 1 | function Re = isAllPositive(D) 2 | 3 | %{ 4 | Input parameter: D, which is a m*1 or 1*m matrix. 5 | 6 | Out parameter: Re, if all elements of D are positive, Re = true; 7 | else, Re = false; 8 | %} 9 | 10 | lenA = length(D); 11 | lenB = length(D(D>0)); 12 | Re = lenA==lenB; -------------------------------------------------------------------------------- /inst/basic/isOctave.m: -------------------------------------------------------------------------------- 1 | function flag = isOctave() 2 | 3 | %Determine if the current compilation environment is Octave or MATLAB 4 | 5 | env = ver; 6 | if sum(strcmp({env.Name},'Octave')) 7 | flag = true; 8 | else 9 | flag = false; 10 | end -------------------------------------------------------------------------------- /inst/basic/iscontains.m: -------------------------------------------------------------------------------- 1 | function re = iscontains(A,B) 2 | 3 | if isempty(strfind(A,B)) 4 | re = false; 5 | else 6 | re = true; 7 | end -------------------------------------------------------------------------------- /inst/basic/maxminSearch.m: -------------------------------------------------------------------------------- 1 | function [Re,TP,hkl] = maxminSearch(x0,fun,teps) 2 | 3 | %{ 4 | ========================= max or min search ============================== 5 | Input parameter: 6 | x0, Initial value of optimization function fun. 7 | fun, optimization function 8 | teps, the difference between a number and 0 or 1, if less than or equal to teps, it is considered to be equal to 0 or 1. 9 | Out parameter: 10 | Re, return minimum. 11 | TP, angle corresponding to minimum value 12 | hkl, direction of minimum value. 13 | %} 14 | 15 | len = size(x0,1); 16 | TP = zeros(size(x0)); 17 | Re = zeros(len,1); 18 | 19 | for k = 1:len 20 | options = optimset('TolFun',1e-8,'TolX',1e-8); 21 | TP(k,:) = fminsearch(fun,x0(k,:),options); 22 | Re(k,:) = fun(TP(k,:)); 23 | end 24 | if size(TP,2) == 2 25 | hkl = dir2Vec(TP(:,1), TP(:,2)); 26 | hkl = set2zeros(hkl,teps); 27 | TP = set2zeros(TP,teps); 28 | hkl = set2ones(hkl,teps); 29 | else 30 | hkl = []; 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /inst/basic/nsign.m: -------------------------------------------------------------------------------- 1 | function re = nsign(A,B) 2 | if B>=0 3 | re = abs(A); 4 | else 5 | re = -abs(A); 6 | end -------------------------------------------------------------------------------- /inst/basic/roundN.m: -------------------------------------------------------------------------------- 1 | function oA = roundN(A,N) 2 | 3 | %{ 4 | oA = round(A,N) rounds to N digits: 5 | 6 | N > 0: round to N digits to the right of the decimal point. 7 | N = 0: round to the nearest integer. 8 | N < 0: round to N digits to the left of the decimal point. 9 | %} 10 | 11 | oA = round(A*10^N)/10^N; -------------------------------------------------------------------------------- /inst/basic/set2ones.m: -------------------------------------------------------------------------------- 1 | function k = set2ones(k,teps) 2 | k((1+k(:,1)) 8192 69 | lenD = 8192; 70 | end 71 | cmap = interpColormap(cmap,lenD,flipflag); 72 | colormap(cmap); 73 | shading interp; 74 | box on; 75 | % set(gca,'BoxStyle','full'); 76 | view(30,30); % 查看角度, 根据需要更改. (30,30)可能更合适 77 | % 设置坐标轴 78 | set(gca,'box','on',... 79 | 'LineWidth',1.5,... 80 | 'FontName','Times New Roman',... 81 | 'FontWeight','bold',... 82 | 'FontSize',15,... 83 | 'gridcolor',[0.5 0.5 0.5],... 84 | 'GridLineStyle','--',... 85 | 'GridAlpha',0.25,... 86 | 'XMinorTick','on',.... 87 | 'YMinorTick','on',... 88 | 'XMinorGrid','on',.... 89 | 'YMinorGrid','on',.... 90 | 'MinorGridAlpha',0.05,... 91 | 'minorgridlinestyle',':'); 92 | axis equal; 93 | % axpos = get(gca,'Position'); 94 | % cpos = get(cbar,'Position'); 95 | % cpos(1) = axpos(1)+axpos(3)+0.05; 96 | % cpos(2) = axpos(2)+0.1; 97 | % cpos(3) = 0.618*cpos(3); 98 | % set(cbar,'Position',cpos); 99 | % camlight('headlight'); 100 | % lighting gouraud; 101 | else 102 | 103 | handle = surf(X,Y,Z,r,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting,'EdgeAlpha',0); 104 | box on; 105 | view(30,30); 106 | set(gca,'box','on',... 107 | 'LineWidth',1.5,... 108 | 'FontName','Times New Roman',... 109 | 'FontWeight','bold',... 110 | 'FontSize',15,... 111 | 'gridcolor',[0.5 0.5 0.5],... 112 | 'GridLineStyle','--',... 113 | 'GridAlpha',0.25,... 114 | 'XMinorTick','on',.... 115 | 'YMinorTick','on',... 116 | 'XMinorGrid','on',.... 117 | 'YMinorGrid','on',.... 118 | 'MinorGridAlpha',0.05,... 119 | 'minorgridlinestyle',':'); 120 | axis equal; 121 | % camlight('right'); 122 | % lighting gouraud; 123 | 124 | end 125 | elseif ischar(r) 126 | fun = str2func(r); 127 | R = fun(theta,phi); 128 | X = R.*L1; Y = R.*L2; Z = R.*L3; 129 | if isempty(pureColor) 130 | handle = surf(X,Y,Z,R,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting); 131 | lenD = length(unique(r(:))); 132 | if lenD > 8192 133 | lenD = 8192; 134 | end 135 | cmap = interpColormap(cmap,lenD,flipflag); 136 | colormap(cmap); 137 | shading interp; 138 | cbar=colorbar; title(cbar, 'GPa','FontName','Times New Roman','FontSize',20,'FontWeight','bold'); 139 | else 140 | cdata=cat(3,pureColor(1)*ones(size(X)),pureColor(2)*ones(size(X)),pureColor(3)*ones(size(X))); 141 | handle = surf(X,Y,Z,cdata,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting); 142 | lenD = length(unique(cdata(:))); 143 | if lenD > 8192 144 | lenD = 8192; 145 | end 146 | cmap = interpColormap(cmap,lenD,flipflag); 147 | colormap(cmap); 148 | shading interp; 149 | end 150 | camlight; 151 | lighting gouraud; 152 | else 153 | msgbox('The input radius format does not meet the requirements.', 'Warning','error'); 154 | return; 155 | end 156 | -------------------------------------------------------------------------------- /inst/drawing/UnitSphericalPlot3D.m: -------------------------------------------------------------------------------- 1 | function [handle,X,Y,Z] = UnitSphericalPlot3D(r,theta,phi,varargin) 2 | 3 | faceColor = 'flat'; 4 | edgeColor = [0 0 0]; 5 | lineStyle = '-'; 6 | faceAlpha = 1; 7 | faceLighting = 'flat'; 8 | pureColor = []; 9 | cmap = 'viridis'; 10 | flipflag = false; 11 | switch(nargin) 12 | case 4 13 | faceColor = varargin{1}; 14 | case 5 15 | faceColor = varargin{1}; 16 | edgeColor = varargin{2}; 17 | case 6 18 | faceColor = varargin{1}; 19 | edgeColor = varargin{2}; 20 | lineStyle = varargin{3}; 21 | case 7 22 | faceColor = varargin{1}; 23 | edgeColor = varargin{2}; 24 | lineStyle = varargin{3}; 25 | faceAlpha = varargin{4}; 26 | case 8 27 | faceColor = varargin{1}; 28 | edgeColor = varargin{2}; 29 | lineStyle = varargin{3}; 30 | faceAlpha = varargin{4}; 31 | faceLighting = varargin{5}; 32 | case 9 33 | faceColor = varargin{1}; 34 | edgeColor = varargin{2}; 35 | lineStyle = varargin{3}; 36 | faceAlpha = varargin{4}; 37 | faceLighting = varargin{5}; 38 | pureColor = varargin{6}; 39 | case 10 40 | faceColor = varargin{1}; 41 | edgeColor = varargin{2}; 42 | lineStyle = varargin{3}; 43 | faceAlpha = varargin{4}; 44 | faceLighting = varargin{5}; 45 | pureColor = varargin{6}; 46 | cmap = varargin{7}; 47 | case 11 48 | faceColor = varargin{1}; 49 | edgeColor = varargin{2}; 50 | lineStyle = varargin{3}; 51 | faceAlpha = varargin{4}; 52 | faceLighting = varargin{5}; 53 | pureColor = varargin{6}; 54 | cmap = varargin{7}; 55 | flipflag = varargin{8}; 56 | end 57 | X = sin(theta).*cos(phi); 58 | Y = sin(theta).*sin(phi); 59 | Z = cos(theta); 60 | if isnumeric(r) 61 | lenr = length(r); 62 | if lenr == 1 63 | r = r*ones(size(X)); 64 | end 65 | 66 | if isempty(pureColor) 67 | handle = surf(X,Y,Z,r,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting,'EdgeAlpha',0); 68 | lenD = length(unique(r(:))); 69 | if lenD > 8192 70 | lenD = 8192; 71 | end 72 | cmap = interpColormap(cmap,lenD,flipflag); 73 | colormap(cmap); 74 | box on; 75 | view(30,30); 76 | 77 | set(gca,'box','on',... 78 | 'LineWidth',1.5,... 79 | 'FontName','Times New Roman',... 80 | 'FontWeight','bold',... 81 | 'FontSize',15,... 82 | 'gridcolor',[0.5 0.5 0.5],... 83 | 'GridLineStyle','--',... 84 | 'GridAlpha',0.25,... 85 | 'XMinorTick','on',.... 86 | 'YMinorTick','on',... 87 | 'XMinorGrid','on',.... 88 | 'YMinorGrid','on',.... 89 | 'MinorGridAlpha',0.05,... 90 | 'minorgridlinestyle',':'); 91 | axis equal; 92 | 93 | else 94 | 95 | handle = surf(X,Y,Z,r,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting,'EdgeAlpha',0); 96 | box on; 97 | view(30,30); 98 | set(gca,'box','on',... 99 | 'LineWidth',1.5,... 100 | 'FontName','Times New Roman',... 101 | 'FontWeight','bold',... 102 | 'FontSize',15,... 103 | 'gridcolor',[0.5 0.5 0.5],... 104 | 'GridLineStyle','--',... 105 | 'GridAlpha',0.25,... 106 | 'XMinorTick','on',.... 107 | 'YMinorTick','on',... 108 | 'XMinorGrid','on',.... 109 | 'YMinorGrid','on',.... 110 | 'MinorGridAlpha',0.05,... 111 | 'minorgridlinestyle',':'); 112 | axis equal; 113 | 114 | end 115 | elseif ischar(r) 116 | fun = str2func(r); 117 | R = fun(theta,phi); 118 | if isempty(pureColor) 119 | handle = surf(X,Y,Z,R,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting); 120 | lenD = length(unique(R(:))); 121 | if lenD > 8192 122 | lenD = 8192; 123 | end 124 | cmap = interpColormap(cmap,lenD,flipflag); 125 | colormap(cmap); 126 | cbar=colorbar; title(cbar, 'GPa','FontName','Times New Roman','FontSize',20,'FontWeight','bold'); 127 | else 128 | cdata=cat(3,pureColor(1)*ones(size(X)),pureColor(2)*ones(size(X)),pureColor(3)*ones(size(X))); 129 | handle = surf(X,Y,Z,cdata,'FaceColor',faceColor, 'EdgeColor',edgeColor,'LineStyle',lineStyle,'FaceAlpha',faceAlpha,'FaceLighting',faceLighting); 130 | lenD = length(unique(cdata(:))); 131 | if lenD > 8192 132 | lenD = 8192; 133 | end 134 | cmap = interpColormap(cmap,lenD,flipflag); 135 | colormap(cmap); 136 | end 137 | camlight; 138 | lighting gouraud; 139 | else 140 | msgbox('The input radius format does not meet the requirements.', 'VELAS reminder','error'); 141 | return; 142 | end 143 | -------------------------------------------------------------------------------- /inst/drawing/drawPolar.m: -------------------------------------------------------------------------------- 1 | function drawPolar(Axes, R, varargin) 2 | 3 | %{ 4 | Adds a polar grid to the specified axis. 5 | Input parameters: 6 | Axes -- the handle of the specified axis; 7 | R -- a series of scale values on the specified axis; 8 | Rc -- Inner radius of polar grid, default: 0; 9 | color -- The color of the grid, default: [0.82 0.82 0.82]; 10 | linewidth -- Width of grid lines, default: 1.2; 11 | font -- Font settings in Grid, font is a structure data, 12 | including: 13 | font.fontname, default: 'Times New Roman'; 14 | font.fontweight, default: 'normal'; 15 | font.fontangle, default: 'normal'; 16 | font.fontsize, default: 14; 17 | 18 | %} 19 | % nAng, Rc, color, linwidth, font 20 | narginchk(2,7); 21 | 22 | switch(nargin) 23 | case 2 24 | nAng = 13; 25 | Rc = 0; 26 | color = [0.82 0.82 0.82]; 27 | linwidth = 1.2; 28 | font.fontname = 'Times New Roman'; 29 | font.fontweight = 'normal'; 30 | font.fontangle = 'normal'; 31 | font.fontsize = 14; 32 | case 3 33 | nAng = varargin{1}; 34 | Rc = 0; 35 | color = [0.82 0.82 0.82]; 36 | linwidth = 1.2; 37 | font.fontname = 'Times New Roman'; 38 | font.fontweight = 'normal'; 39 | font.fontangle = 'normal'; 40 | font.fontsize = 14; 41 | case 4 42 | nAng = varargin{1}; 43 | Rc = varargin{2}; 44 | color = [0.82 0.82 0.82]; 45 | linwidth = 1.2; 46 | font.fontname = 'Times New Roman'; 47 | font.fontweight = 'normal'; 48 | font.fontangle = 'normal'; 49 | font.fontsize = 14; 50 | case 5 51 | nAng = varargin{1}; 52 | Rc = varargin{2}; 53 | color = varargin{3}; 54 | linwidth = 1.2; 55 | font.fontname = 'Times New Roman'; 56 | font.fontweight = 'normal'; 57 | font.fontangle = 'normal'; 58 | font.fontsize = 14; 59 | case 6 60 | nAng = varargin{1}; 61 | Rc = varargin{2}; 62 | color = varargin{3}; 63 | linwidth = varargin{4}; 64 | font.fontname = 'Times New Roman'; 65 | font.fontweight = 'normal'; 66 | font.fontangle = 'normal'; 67 | font.fontsize = 14; 68 | case 7 69 | nAng = varargin{1}; 70 | Rc = varargin{2}; 71 | color = varargin{3}; 72 | linwidth = varargin{4}; 73 | font = varargin{5}; 74 | end 75 | 76 | if find(R == Rc) 77 | drc = false; 78 | else 79 | try 80 | NR = [R Rc]; 81 | catch 82 | NR = [R; Rc]; 83 | end 84 | loc = find(sort(NR)== Rc); 85 | R = NR(loc:end); 86 | end 87 | 88 | % Circle of polar 89 | theC = linspace(0,2*pi,200); 90 | cX = cos(theC); 91 | cY = sin(theC); 92 | tAng = 0.42*pi; 93 | labx = R*cos(tAng); 94 | laby = R*sin(tAng); 95 | nCir = length(R); 96 | 97 | % Line of polar 98 | theL = linspace(0,2*pi,nAng); 99 | tLin = linspace(0,360,nAng); 100 | lXO = max(R)*cos(theL); 101 | lYO = max(R)*sin(theL); 102 | lXI = Rc*cos(theL); 103 | lYI = Rc*sin(theL); 104 | labAngX = 1.07*max(R)*sin(theL); 105 | lanAngY = 1.07*max(R)*cos(theL); 106 | N = max(nCir,nAng-1); 107 | 108 | hold on 109 | 110 | if nCir <= nAng-1 111 | for m = 1:N 112 | plot(Axes, [lXI(m) lXO(m)], [lYI(m) lYO(m)], 'color', color,'LineWidth', linwidth); 113 | % adding the label of Angle 114 | text(lanAngY(m),labAngX(m),num2str(tLin(m)),... 115 | 'horizontalalignment','center',... 116 | 'FontSize',font.fontsize,... 117 | 'FontName',font.fontname,... 118 | 'FontWeight',font.fontweight,... 119 | 'FontAngle',font.fontangle,... 120 | 'handlevisibility','off'); 121 | 122 | if m <= nCir 123 | plot(Axes, R(m).*cX, R(m).*cY, 'color', color, 'LineWidth', linwidth); 124 | % adding the value of Radius 125 | if R(m) ~= 0 126 | text(labx(m), laby(m), num2str(R(m)),... 127 | 'FontSize',font.fontsize,... 128 | 'FontName',font.fontname,... 129 | 'FontWeight',font.fontweight,... 130 | 'FontAngle',font.fontangle); 131 | end 132 | end 133 | end 134 | else 135 | for m = 1:N 136 | if m <= nAng-1 137 | plot(Axes, [lXI(m) lXO(m)], [lYI(m) lYO(m)], 'color', color,'LineWidth', linwidth); 138 | text(lanAngY(m),labAngX(m),num2str(tLin(m)),... 139 | 'horizontalalignment','center',... 140 | 'FontSize',font.fontsize,... 141 | 'FontName',font.fontname,... 142 | 'FontWeight',font.fontweight,... 143 | 'FontAngle',font.fontangle,... 144 | 'handlevisibility','off'); 145 | end 146 | 147 | plot(Axes, R(m).*cX, R(m).*cY, 'color', color, 'LineWidth', linwidth); 148 | if R(m) ~= 0 149 | text(labx(m), laby(m), num2str(R(m)),... 150 | 'FontSize',font.fontsize,... 151 | 'FontName',font.fontname,... 152 | 'FontWeight',font.fontweight,... 153 | 'FontAngle',font.fontangle); 154 | end 155 | 156 | end 157 | end 158 | hold off 159 | end 160 | -------------------------------------------------------------------------------- /inst/drawing/getColorMap.m: -------------------------------------------------------------------------------- 1 | function [map,colorm] = getColorMap(flag,N) 2 | 3 | % Source:https://github.com/tricialyjun/pridemap 4 | 5 | % ---------- 6 | % Tricia LYJ, 20201117 7 | % @tricialyjun 8 | 9 | switch(flag) 10 | case {'red','r'} 11 | r = linspace(0.99 ,0.90, N); 12 | g = linspace(0.905 ,0.05, N); 13 | b = linspace(0.905 ,0.05, N); 14 | case {'blue','b'} 15 | r = linspace(0.9000, 0.00, N); 16 | g = linspace(0.9350, 0.35, N); 17 | b = linspace(0.9900, 0.90, N); 18 | case {'green','g'} 19 | r = linspace(0.9000, 0.00, N); 20 | g = linspace(0.9600, 0.60, N); 21 | b = linspace(0.9150, 0.15, N); 22 | case {'orange','o'} 23 | r = linspace(1, 1.00, N); 24 | g = linspace(0.95, 0.50, N); 25 | b = linspace(0.9, 0.00, N); 26 | case {'violet','v'} 27 | r = linspace(0.9450, 0.4500, N); 28 | g = linspace(0.9050, 0.0500, N); 29 | b = linspace(0.9500, 0.5000, N); 30 | case {'yellow','y'} 31 | r = linspace(1.0000, 1.00, N); 32 | g = linspace(0.9850, 0.85, N); 33 | b = linspace(0.9150, 0.15, N); 34 | otherwise 35 | errordlg('No such colormap scheme.','VELAS reminder'); 36 | end 37 | 38 | map = ([r', g', b']); 39 | cimg = zeros(1,N,3); 40 | cimg(1,:,:) = map; 41 | colorm = repmat(cimg,32,1,1); 42 | 43 | end -------------------------------------------------------------------------------- /inst/drawing/getPropName.m: -------------------------------------------------------------------------------- 1 | function [mode,name,units,abbr,flname,plane,mma] = getPropName(fname) 2 | 3 | if iscontains(fname,'2D') 4 | mode = '2D'; 5 | % patern for plane 6 | exprp = '(?<=\().*?(?=\))'; 7 | [matchp,~] = regexp(fname,exprp,'match','split'); 8 | plane = matchp{end}; 9 | % patern for property 10 | exprn = '(?<=_2D_).*?(?=\()'; 11 | [matchn,~] = regexp(fname,exprn,'match','split'); 12 | proname = matchn{1}; 13 | switch(proname) 14 | case 'E' 15 | name = 'Young''s Modulus'; 16 | units = 'GPa'; 17 | abbr = 'E'; 18 | flname = 'Young'; 19 | mma = []; 20 | case 'beta' 21 | name = 'Linear Compressibility'; 22 | units = 'TPa^{-1}'; 23 | abbr = 'LC'; 24 | flname = 'LinCompress'; 25 | mma = []; 26 | case 'B' 27 | name = 'Bulk Modulus'; 28 | units = 'GPa'; 29 | abbr = 'B'; 30 | flname = 'Bulk'; 31 | mma = []; 32 | case 'G' 33 | name = 'Shear Modulus'; 34 | units = 'GPa'; 35 | abbr = 'G'; 36 | flname = 'Shear'; 37 | mma = []; 38 | case 'P' 39 | name = 'Poisson''s Ratio'; 40 | units = []; 41 | abbr = '\lambda'; 42 | flname = 'Poisson'; 43 | mma = []; 44 | case 'Hv' 45 | name = 'Vickers Hardness'; 46 | units = 'GPa'; 47 | abbr = 'Hv'; 48 | flname = 'Hardness'; 49 | mma = []; 50 | case 'Pr' 51 | name = 'Pugh Ratio'; 52 | units = []; 53 | abbr = 'Pr'; 54 | flname = 'Pugh'; 55 | mma = []; 56 | case 'Kic' 57 | name = 'Fracture Toughness'; 58 | units = 'MPa·m^{1/2}'; 59 | abbr = 'K_{IC}'; 60 | flname = 'FractToughness'; 61 | mma = []; 62 | end 63 | return; 64 | end 65 | 66 | if iscontains(fname,'3D') 67 | mode = '3D'; 68 | plane = []; 69 | % patern for property 70 | exprn = '(?<=_3D_).*?(?=.dat)'; 71 | [matchn,~] = regexp(fname,exprn,'match','split'); 72 | proname = matchn{1}; 73 | switch(proname) 74 | case 'E' 75 | name = 'Young''s Modulus'; 76 | units = 'GPa'; 77 | abbr = 'E'; 78 | flname = 'Young'; 79 | mma = 'Positive'; 80 | case 'Eneg' 81 | name = 'Young''s Modulus'; 82 | units = 'GPa'; 83 | abbr = 'E'; 84 | flname = 'Young'; 85 | mma = 'Negative'; 86 | case 'beta' 87 | name = 'Linear Compressibility'; 88 | units = 'TPa^{-1}'; 89 | abbr = 'LC'; 90 | flname = 'LinCompress'; 91 | mma = 'Positive'; 92 | case 'betaneg' 93 | name = 'Linear Compressibility'; 94 | units = 'TPa^{-1}'; 95 | abbr = 'LC_{neg}'; 96 | flname = 'LinCompress'; 97 | mma = 'Negative'; 98 | case 'B' 99 | name = 'Bulk Modulus'; 100 | units = 'GPa'; 101 | abbr = 'B_{neg}'; 102 | flname = 'Bulk'; 103 | mma = 'Positive'; 104 | case 'Bneg' 105 | name = 'Bulk Modulus'; 106 | units = 'GPa'; 107 | abbr = 'B'; 108 | flname = 'Bulk'; 109 | mma = 'Negative'; 110 | case 'Gmax' 111 | name = 'Shear Modulus'; 112 | units = 'GPa'; 113 | abbr = 'G_{max}'; 114 | flname = 'Shear'; 115 | mma = 'Maximum'; 116 | case 'Gminp' 117 | name = 'Shear Modulus'; 118 | units = 'GPa'; 119 | abbr = 'G_{min +}'; 120 | flname = 'Shear'; 121 | mma = 'Minimum positive'; 122 | case 'Gminn' 123 | name = 'Shear Modulus'; 124 | units = 'GPa'; 125 | abbr = 'G_{min -}'; 126 | flname = 'Shear'; 127 | mma = 'Minimum negative'; 128 | case 'Gavg' 129 | name = 'Shear Modulus'; 130 | units = 'GPa'; 131 | abbr = 'G_{avg}'; 132 | flname = 'Shear'; 133 | mma = 'Average'; 134 | case 'Pmax' 135 | name = 'Poisson''s Ratio'; 136 | units = []; 137 | abbr = '\lambda_{max}'; 138 | flname = 'Poisson'; 139 | mma = 'Maximum'; 140 | case 'Pminp' 141 | name = 'Poisson''s Ratio'; 142 | units = []; 143 | abbr = '\lambda_{min +}'; 144 | flname = 'Poisson'; 145 | mma = 'Minimum positive'; 146 | case 'Pminn' 147 | name = 'Poisson''s Ratio'; 148 | units = []; 149 | abbr = '\lambda_{min -}'; 150 | flname = 'Poisson'; 151 | mma = 'Minimum negative'; 152 | case 'Pavg' 153 | name = 'Poisson''s Ratio'; 154 | units = []; 155 | abbr = '\lambda_{avg}'; 156 | flname = 'Poisson'; 157 | mma = 'Average'; 158 | case 'Prmax' 159 | name = 'Pugh Ratio'; 160 | units = []; 161 | abbr = 'Pr_{max}'; 162 | flname = 'Pugh'; 163 | mma = 'Maximum'; 164 | case 'Prmin' 165 | name = 'Pugh Ratio'; 166 | units = []; 167 | abbr = 'Pr_{min}'; 168 | flname = 'Pugh'; 169 | mma = 'Minimum'; 170 | case 'Hvmax' 171 | name = 'Vickers Hardness'; 172 | units = 'GPa'; 173 | abbr = 'Hv_{max}'; 174 | flname = 'Hardness'; 175 | mma = 'Maximum'; 176 | case 'Hvmin' 177 | name = 'Vickers Hardness'; 178 | units = 'GPa'; 179 | abbr = 'Hv_{min}'; 180 | flname = 'Hardness'; 181 | mma = 'Minimum'; 182 | case 'Hvavg' 183 | name = 'Vickers Hardness'; 184 | units = 'GPa'; 185 | abbr = 'Hv_{avg}'; 186 | flname = 'Hardness'; 187 | mma = 'Average'; 188 | case 'Kicmax' 189 | name = 'Fracture Toughness'; 190 | units = 'MPa·m^{1/2}'; 191 | abbr = 'K_{ICmax}'; 192 | flname = 'FracToughness'; 193 | mma = 'Maximum'; 194 | case 'Kicmin' 195 | name = 'Fracture Toughness'; 196 | units = 'MPa·m^{1/2}'; 197 | abbr = 'K_{ICmin}'; 198 | flname = 'FracToughness'; 199 | mma = 'Minimum'; 200 | case 'Kicavg' 201 | name = 'Fracture Toughness'; 202 | units = 'MPa·m^{1/2}'; 203 | flname = 'FracToughness'; 204 | abbr = 'K_{ICavg}'; 205 | mma = 'Average'; 206 | end 207 | return; 208 | end 209 | plane = []; 210 | mode = []; 211 | units = []; 212 | abbr = []; 213 | name = []; 214 | mma = []; 215 | end -------------------------------------------------------------------------------- /inst/drawing/getRadiusTicks.m: -------------------------------------------------------------------------------- 1 | function R = getRadiusTicks(theta,tR,varargin) 2 | 3 | narginchk(2,5); 4 | 5 | fig = figure; 6 | hold on; 7 | switch(nargin) 8 | case 2 9 | [tx,ty] = head2Tail(tR.*cos(theta),tR.*sin(theta)); 10 | 11 | tRmax = max(tR); 12 | 13 | plot(tx, ty); 14 | 15 | case 3 16 | % varargin{1} -- negative value 17 | [xpos,ypos] = head2Tail(tR.*cos(theta),tR.*sin(theta)); 18 | [xneg,yneg] = head2Tail(varargin{1}.*cos(theta),varargin{1}.*sin(theta)); 19 | 20 | tRmax = max(max(tR),max(varargin{1})); 21 | 22 | plot(xpos,ypos); 23 | plot(xneg,yneg); 24 | 25 | case 4 26 | % varargin{1} -- min value 27 | % varargin{2} -- average value 28 | [xmax,ymax] = head2Tail(tR.*cos(theta),tR.*sin(theta)); 29 | [xmin,ymin] = head2Tail(varargin{1}.*cos(theta),varargin{1}.*sin(theta)); 30 | [xavg,yavg] = head2Tail(varargin{2}.*cos(theta),varargin{2}.*sin(theta)); 31 | 32 | tRmax = max([max(tR),max(varargin{1}),max(varargin{2})]); 33 | 34 | plot(xmax,ymax); 35 | plot(xmin,ymin); 36 | plot(xavg,yavg); 37 | 38 | case 5 39 | % varargin{1} -- min positive value 40 | % varargin{2} -- min negative value 41 | % varargin{3} -- average value 42 | [xmax,ymax] = head2Tail(tR.*cos(theta),tR.*sin(theta)); 43 | [xminp,yminp] = head2Tail(varargin{1}.*cos(theta),varargin{1}.*sin(theta)); 44 | [xminn,yminn] = head2Tail(varargin{2}.*cos(theta),varargin{2}.*sin(theta)); 45 | [xavg,yavg] = head2Tail(varargin{3}.*cos(theta),varargin{3}.*sin(theta)); 46 | 47 | tRmax = max([max(tR),max(varargin{1}),max(varargin{2}),max(varargin{2})]); 48 | 49 | plot(xmax,ymax); 50 | plot(xminp,yminp); 51 | plot(xminn,yminn); 52 | plot(xavg,yavg); 53 | 54 | end 55 | hold off 56 | 57 | Xlim = get(gca, 'XLim'); 58 | Ylim = get(gca, 'YLim'); 59 | 60 | if max(Xlim) > max(Ylim) 61 | R = get(gca, 'XTick'); 62 | Maxlim = max(Xlim); 63 | else 64 | R = get(gca, 'YTick'); 65 | Maxlim = max(Ylim); 66 | end 67 | 68 | R = R(ceil(length(R)/2):end); 69 | 70 | if tRmax > Maxlim 71 | if abs(unique(roundN(diff(R)/2,6))) >= 1 72 | dlt = roundN(unique(diff(R))/2,0); 73 | else 74 | dlt = unique(roundN(diff(R),6))/2; 75 | end 76 | Maxlim = ceil(tRmax/dlt)*dlt; 77 | R = 0:dlt:Maxlim; 78 | else 79 | if abs(unique(roundN(diff(R)/2,6))) >= 1 80 | dlt = roundN(unique(diff(R))/2,0); 81 | else 82 | dlt = unique(roundN(diff(R),6))/2; 83 | end 84 | Maxlim = ceil(Maxlim/dlt)*dlt; 85 | R = 0:dlt:Maxlim; 86 | end 87 | 88 | delete(fig); -------------------------------------------------------------------------------- /inst/drawing/head2Tail.m: -------------------------------------------------------------------------------- 1 | % 2 | function [nx,ny] = head2Tail(X,Y) 3 | 4 | % Realize the end to end connection of data points 5 | 6 | [m,n] = size(X); 7 | validateattributes(Y,{'numeric'},{'size',[m,n]}); 8 | if m < n 9 | nx = [X,X(1)]; 10 | ny = [Y,Y(1)]; 11 | else 12 | nx = [X;X(1)]; 13 | ny = [Y;Y(1)]; 14 | end -------------------------------------------------------------------------------- /inst/drawing/interpColormap.m: -------------------------------------------------------------------------------- 1 | function [cOut,colorm] = interpColormap(cmap,N,varargin) 2 | 3 | narginchk(2,3); 4 | 5 | switch(nargin) 6 | case 2 7 | flipflag = false; 8 | case 3 9 | tflag = varargin{1}; 10 | if ~islogical(tflag) 11 | flipflag = false; 12 | else 13 | flipflag = tflag; 14 | end 15 | end 16 | 17 | if ischar(cmap) 18 | cmap = velasColormap(cmap,flipflag); 19 | end 20 | if N ~= 256 21 | lenc = length(cmap); 22 | [cmx,cmy] = meshgrid(1:3,1:lenc); 23 | [cxx,cyy] = meshgrid(1:3,linspace(1,lenc,N)); 24 | cOut = interp2(cmx,cmy,cmap,cxx,cyy); 25 | else 26 | cOut = cmap; 27 | end 28 | 29 | cimg = zeros(1,N,3); 30 | cimg(1,:,:) = cOut; 31 | colorm = repmat(cimg,32,1,1); 32 | -------------------------------------------------------------------------------- /inst/drawing/isExistColormap.m: -------------------------------------------------------------------------------- 1 | function re = isExistColormap(incmapname) 2 | 3 | if ischar(incmapname) 4 | vpath = which('velasColormap'); 5 | [vpath,~,~] = fileparts(vpath); 6 | vcmapname = [vpath,filesep,'velasColormap.mat']; 7 | load(vcmapname); 8 | if exist(incmapname,'var') 9 | re = true; 10 | else 11 | re = false; 12 | end 13 | else 14 | re = false; 15 | end -------------------------------------------------------------------------------- /inst/drawing/longlat2Cartesian.m: -------------------------------------------------------------------------------- 1 | function [X,Y] = longlat2Cartesian(long,lat,flag) 2 | 3 | %{ 4 | Author: Aleš Bezděk, Josef Sebera 5 | Modified: Zheng Ran 6 | 7 | Ref: 8 | [1]. Bezděk A, Sebera J, Matlab script for 3D visualizing geodata on a rotating globe, Computers & Geosciences,2013(56):127-130. 9 | 10 | [2]. Bezděk A, Sebera J, 2013. MATLAB script for visualizing geoid height and other elevation data on rotating 3D globe. EGU General Assembly, Vienna, Austria, 7–12 April; Geophysical Research Abstracts, Vol. 15, EGU2013-5142. 11 | 12 | [3]. Snyder, John P., Voxland, Philip M.,An Album of Map Projections, U.S. Geological Survey (1989) 13 | %} 14 | 15 | R = 1; 16 | switch flag 17 | case {'Gall-Peters','GP','gp'} 18 | X = R*long/sqrt(2); 19 | Y = R*sqrt(2)*sin(lat); 20 | case {'Hammer-Aitoff','HA','ha'} 21 | t = sqrt(1+cos(lat).*cos(long/2)); 22 | X = R*2*sqrt(2)*cos(lat).*sin(long/2)./t; 23 | Y = R*sqrt(2)*sin(lat)./t; 24 | case {'Mollweide','M','m'} 25 | 26 | % Have to use interative scheme to get intermediate variable "theta". 27 | % cos(theta) changed to cos(2*theta) -thanks Zhigang Xu! Dec 2006. 28 | % 29 | %The program has a divide by zero 30 | %error when theta= (pi/2). I've introduced the variable "notpoles" 31 | %to handle this exception, although there are certainly other ways to 32 | % deal with the special cases = Kevin Lewis Feb 2011 33 | % (my note - I'm just taking this as is) 34 | % May/2012 - added a bunch more 'notpoles' references (thanks to M. Losch) 35 | theta = (asin(lat*2/pi)+lat)/2; 36 | notpoles = find(abs(theta).001) && k<15 41 | theta(notpoles) = theta(notpoles)+dt(notpoles); % fixed May 2012 42 | dt = -(2*theta+sin(2*theta)-pi*sin(lat))./(2+2*cos(2*theta)); 43 | k = k+1; 44 | end 45 | if k == 15 46 | warning('Iterative coordinate conversion is not converging!'); 47 | end 48 | theta(notpoles) = theta(notpoles)+dt(notpoles); % fixed May 2012 49 | 50 | X = R*2*sqrt(2)*long.*cos(theta)/pi; 51 | Y = R*sqrt(2)*sin(theta); 52 | 53 | case {'Robinson','R','r'} 54 | % Table of scaling values needed for Robinson projection copied from the wikipedia entry for the robinson projection 55 | Rob=[... 56 | 00 1.0000 0.0000; 57 | 05 0.9986 0.0620; 58 | 10 0.9954 0.1240; 59 | 15 0.9900 0.1860; 60 | 20 0.9822 0.2480; 61 | 25 0.9730 0.3100; 62 | 30 0.9600 0.3720; 63 | 35 0.9427 0.4340; 64 | 40 0.9216 0.4958; 65 | 45 0.8962 0.5571; 66 | 50 0.8679 0.6176; 67 | 55 0.8350 0.6769; 68 | 60 0.7986 0.7346; 69 | 65 0.7597 0.7903; 70 | 70 0.7186 0.8435; 71 | 75 0.6732 0.8936; 72 | 80 0.6213 0.9394; 73 | 85 0.5722 0.9761; 74 | 90 0.5322 1.0000]; 75 | Rob(:,1) = Rob(:,1)*pi/180; 76 | Rob(:,3) = Rob(:,3); 77 | Robo = [flipud(Rob); Rob(2:end,:).*repmat([-1 1 -1],18,1) ]; 78 | % Use splines to interpolate this to many more points - then we can use 79 | % linear interpolate below and both the forward and reverse maps will be identical 80 | tRob = (pi/2:-.05*pi/180:-pi/2)'; 81 | tRob(:,2) = interp1(Robo(:,1),Robo(:,2),tRob(:,1)); 82 | tRob(:,3) = interp1(Robo(:,1),Robo(:,3),tRob(:,1)); 83 | 84 | X = 0.8487*R*interp1(tRob(:,1),tRob(:,2),lat).*long; 85 | Y = 1.3523*R*interp1(tRob(:,1),tRob(:,3),lat); 86 | 87 | end -------------------------------------------------------------------------------- /inst/drawing/mapProjection.m: -------------------------------------------------------------------------------- 1 | function [handle,X,Y,data] = mapProjection(data,theta,phi,proname,varargin) 2 | 3 | % lat [pi/2,-pi/2] 4 | % long [-pi,pi] 5 | 6 | flag = 'Mollweide'; % name={'Gall-Peters','Robinson','Hammer-Aitoff','Mollweide'}; 7 | nmesh = 7; 8 | cmap = 'viridis'; 9 | flipflag = false; 10 | lineStyle = '--'; 11 | font.fontname = 'Times New Roman'; 12 | font.fontweight = 'Bold'; 13 | font.fontcolor = 'k'; 14 | font.fontsize = 13; 15 | font.mpfontcolor = 'k'; 16 | switch(nargin) 17 | case 5 18 | flag = varargin{1}; 19 | case 6 20 | flag = varargin{1}; 21 | nmesh = varargin{2}; 22 | case 7 23 | flag = varargin{1}; 24 | nmesh = varargin{2}; 25 | cmap = varargin{3}; 26 | case 8 27 | flag = varargin{1}; 28 | nmesh = varargin{2}; 29 | cmap = varargin{3}; 30 | flipflag = varargin{4}; 31 | case 9 32 | flag = varargin{1}; 33 | nmesh = varargin{2}; 34 | cmap = varargin{3}; 35 | flipflag = varargin{4}; 36 | lineStyle = varargin{5}; 37 | case 10 38 | flag = varargin{1}; 39 | nmesh = varargin{2}; 40 | cmap = varargin{3}; 41 | flipflag = varargin{4}; 42 | lineStyle = varargin{5}; 43 | font = varargin{6}; 44 | end 45 | 46 | lat = fliplr((pi/2-theta)'); 47 | long = fliplr((pi-phi)'); 48 | data = fliplr(data'); 49 | [X,Y] = longlat2Cartesian(long,lat,flag); %First find the points outside 50 | 51 | [MM,NN] = size(X); 52 | figname = ['The ',flag,' projection of ',proname]; 53 | figure('Position',[396.20 103.40 1220.75 863.18],... 54 | 'Color','w','Name',figname,... 55 | 'NumberTitle','off'); 56 | handle = pcolor(X,Y,data); 57 | lenD = length(unique(data(:))); 58 | if lenD > 8192 59 | lenD = 8192; 60 | end 61 | cmap = interpColormap(cmap,lenD,flipflag); 62 | colormap(cmap); 63 | shading interp; 64 | 65 | hold on; 66 | 67 | locX = round(linspace(1,NN,nmesh)); 68 | locY = round(linspace(1,MM,nmesh)); 69 | Xlabel = linspace(-180,180,nmesh); 70 | Ylabel = fliplr(linspace(-90,90,nmesh)); 71 | 72 | lcolor = 0.95*ones(1,3); 73 | plot(X(:,locX),Y(:,locX),'Color',lcolor,'LineStyle',lineStyle); 74 | plot(X(locY,:)',Y(locY,:)','Color',lcolor,'LineStyle',lineStyle); 75 | hold off; 76 | 77 | switch(flag) 78 | case {'Gall-Peters','GP','gp','Robinson','R','r'} 79 | xAxis = X(locY,1); 80 | yAxis = Y(locY,1); 81 | for k = 1:nmesh 82 | text(xAxis(k)-0.3,yAxis(k)+0.02,num2str(Ylabel(k)),'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 83 | end 84 | 85 | xAxis = X(end,locX); 86 | yAxis = Y(end,locX); 87 | for k = 1:nmesh 88 | text(xAxis(k)-0.05,yAxis(k)-0.1,num2str(Xlabel(k)),'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 89 | end 90 | case {'Hammer-Aitoff','HA','ha','Mollweide','M','m'} 91 | % 92 | xAxis = X(locY,1); 93 | yAxis = Y(locY,1); 94 | for k = 1:nmesh 95 | str = num2str(num2str(Ylabel(k))); 96 | len = length(str); 97 | switch(len) 98 | case 1 99 | text(xAxis(k)-0.3,yAxis(k),str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 100 | case 2 101 | if k == 1 102 | text(xAxis(k)-0.06,yAxis(k)+0.1,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 103 | elseif k == nmesh 104 | text(xAxis(k)-0.1,yAxis(k)-0.1,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 105 | else 106 | text(xAxis(k)-0.3,yAxis(k),str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 107 | end 108 | case 3 109 | if k == 1 110 | text(xAxis(k)-0.06,yAxis(k)+0.1,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 111 | elseif k == nmesh 112 | text(xAxis(k)-0.1,yAxis(k)-0.1,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 113 | else 114 | if k < round((1+nmesh)/2) 115 | text(xAxis(k)-0.2,yAxis(k)+0.05,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 116 | else 117 | text(xAxis(k)-0.2,yAxis(k)-0.08,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 118 | end 119 | end 120 | case 4 121 | if k == 1 122 | text(xAxis(k)-0.06,yAxis(k)+0.1,str); 123 | elseif k == nmesh 124 | text(xAxis(k)-0.1,yAxis(k)-0.1,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 125 | else 126 | if k < round((1+nmesh)/2) 127 | text(xAxis(k)-0.2,yAxis(k)+0.05,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 128 | else 129 | text(xAxis(k)-0.2,yAxis(k)-0.08,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 130 | end 131 | end 132 | case 5 133 | if k < round((1+nmesh)/2) 134 | text(xAxis(k)-0.25,yAxis(k)+0.05,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 135 | else 136 | text(xAxis(k)-0.25,yAxis(k)-0.08,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 137 | end 138 | case 6 139 | if k < round((1+nmesh)/2) 140 | text(xAxis(k)-0.30,yAxis(k)+0.05,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 141 | else 142 | text(xAxis(k)-0.30,yAxis(k)-0.08,str,'Color',font.fontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 143 | end 144 | end 145 | end 146 | % 147 | xAxis = X(round((1+MM)/2),locX); 148 | yAxis = Y(round((1+MM)/2),locX); 149 | for k = 1:nmesh 150 | str = num2str(Xlabel(k)); 151 | len = length(str); 152 | switch(len) 153 | case 1 154 | text(xAxis(k)-0.03,yAxis(k)+0.01,str,'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 155 | case 2 156 | text(xAxis(k)-0.06,yAxis(k)+0.01,str,'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 157 | case 3 158 | text(xAxis(k)-0.1,yAxis(k)+0.01,str,'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 159 | case 4 160 | text(xAxis(k)-0.115,yAxis(k)+0.01,str,'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 161 | case 5 162 | text(xAxis(k)-0.14,yAxis(k)+0.01,str,'Color',font.mpfontcolor,'FontWeight',font.fontweight,'FontSize',font.fontsize,'FontName',font.fontname); 163 | end 164 | end 165 | end 166 | 167 | axis equal; 168 | axis off; -------------------------------------------------------------------------------- /inst/drawing/setColor.m: -------------------------------------------------------------------------------- 1 | function [cOut,colorm] = setColor(flag,N) 2 | 3 | switch(flag) 4 | case {'r','red'} 5 | cOri = [255,255,255; 6 | 255 0 0]/255; 7 | % cOri = [246,216,201 8 | % 245,196,173; 9 | % 244,154,123; 10 | % 222,96,77; 11 | % 180,4,38 12 | % 222,96,77; 13 | % 244,154,123; 14 | % 245,196,173; 15 | % 246,216,201]/255; 16 | 17 | case {'b','blue'} 18 | cOri = [59,76,192; 19 | 98,130,234; 20 | 141,176,254; 21 | 184,208,249; 22 | 207,223,250; 23 | 184,208,249; 24 | 141,176,254; 25 | 98,130,234; 26 | 59,76,192]/255; 27 | % cOri = [207,223,250; 28 | % 184,208,249; 29 | % 141,176,254; 30 | % 98,130,234; 31 | % 59,76,192 32 | % 98,130,234; 33 | % 141,176,254; 34 | % 184,208,249; 35 | % 207,223,250]/255; 36 | 37 | 38 | case {'g','green'} 39 | 40 | cOri = [22,136,51 41 | 61,153,85; 42 | 121,178,136; 43 | 181,204,187; 44 | 195,230,200 45 | 181,204,187; 46 | 121,178,136; 47 | 61,153,85; 48 | 22,136,51]/255; 49 | % cOri = [195,230,200; 50 | % 181,204,187; 51 | % 121,178,136; 52 | % 61,153,85; 53 | % 22,136,51 54 | % 61,153,85; 55 | % 121,178,136; 56 | % 181,204,187; 57 | % 195,230,200]/255; 58 | end 59 | 60 | % cOri = flipud(cOri); 61 | lenc = length(cOri); 62 | [cmx,cmy] = meshgrid(1:3,1:lenc); 63 | [cxx,cyy] = meshgrid(1:3,linspace(1,lenc,N)); 64 | cOut = interp2(cmx,cmy,cOri,cxx,cyy); 65 | 66 | cimg = zeros(1,N,3); 67 | cimg(1,:,:) = cOut; 68 | colorm = repmat(cimg,32,1,1); 69 | -------------------------------------------------------------------------------- /inst/drawing/spherical2Cartesian.m: -------------------------------------------------------------------------------- 1 | function [X, Y, Z] = spherical2Cartesian(theta,phi,R) 2 | 3 | %{ 4 | Converts from Spherical (r,θ,φ) to Cartesian (x,y,z) coordinates in 3-dimensions. 5 | 6 | Input: 7 | ntheta - mesh number of theta(θ) 8 | nphi - mesh number of phi(φ) 9 | R - spherical coordinate distance 10 | output: 11 | XZY - 3D Cartesian coordinates 12 | %} 13 | 14 | L1 = sin(theta).*cos(phi); 15 | L2 = sin(theta).*sin(phi); 16 | L3 = cos(theta); 17 | 18 | X = R.*L1; 19 | Y = R.*L2; 20 | Z = R.*L3; -------------------------------------------------------------------------------- /inst/drawing/velasColormap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/inst/drawing/velasColormap.mat -------------------------------------------------------------------------------- /inst/install_VELAS.m: -------------------------------------------------------------------------------- 1 | 2 | % install VELAS automatically using the [addpath] function. 3 | try 4 | if isempty(which('velasGUI')) 5 | addpath(fullfile(pwd)); 6 | addpath(fullfile(pwd,'basic')); 7 | addpath(fullfile(pwd,'drawing')); 8 | addpath(fullfile(pwd,'GUI')); 9 | addpath(fullfile(pwd,'mpapi')); 10 | addpath(fullfile(pwd,'properties')); 11 | else 12 | velaspath = fileparts(which('velasGUI')); 13 | addpath(fullfile(velaspath)); 14 | addpath(fullfile(velaspath,'basic')); 15 | addpath(fullfile(velaspath,'drawing')); 16 | addpath(fullfile(velaspath,'GUI')); 17 | addpath(fullfile(velaspath,'mpapi')); 18 | addpath(fullfile(velaspath,'properties')); 19 | end 20 | savepath; 21 | disp('VELAS installation completed. Enjoy!'); 22 | disp('Please don''t hesitate to contact us if you have any questions about using VELAS or suggestions for improving VELAS.'); 23 | disp('Email: ranzheng@outlook.com'); 24 | catch 25 | disp('There is a problem with the [addpath] function. Please add the path manually according to the VELAS Manual.'); 26 | end 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /inst/mpapi/mpDataBaseOffline.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ranzhengcode/VELAS/fa93a3f4a7da817a8d4b8b54ba60601713dab82a/inst/mpapi/mpDataBaseOffline.mat -------------------------------------------------------------------------------- /inst/mpapi/mpapiElastic.m: -------------------------------------------------------------------------------- 1 | function outputs = mpapiElastic(mpid,xapikey,verflag) 2 | 3 | % 4 | 5 | if ispc 6 | comd = 'ping -n 2 www.google.com'; 7 | else 8 | comd = 'ping -c 2 www.google.com'; 9 | end 10 | 11 | [netstate,~] = system(comd); 12 | 13 | if netstate == 0 14 | if isOctave 15 | if ~verflag 16 | % api.materialsproject.org [new api] 17 | try 18 | urlnew = ['https://api.materialsproject.org/elasticity/',mpid,'/?_fields=pretty_formula%2Celasticity&_all_fields=false']; 19 | options = weboptionsNew('RequestMethod','get',... 20 | 'KeyName', 'X-API-KEY', ... 21 | 'KeyValue', xapikey,... 22 | 'Timeout',5); 23 | outputs = webreadNew(urlnew,options); 24 | outputs = json2struct(outputs); 25 | outputs = outputs.data{1,1}; 26 | pause(0.2); 27 | 28 | urlbase = ['https://api.materialsproject.org/summary/',mpid,'/?_fields=volume%2Cdensity%2Csymmetry&_all_fields=false']; 29 | options = weboptionsNew('RequestMethod','get',... 30 | 'KeyName', 'X-API-KEY', ... 31 | 'KeyValue', xapikey,... 32 | 'Timeout',5); 33 | crysys = webreadNew(urlbase,options); 34 | crysys = json2struct(crysys); 35 | crysys = crysys.data{1,1}; 36 | 37 | toutputs.data.pretty_formula = outputs.pretty_formula; 38 | toutputs.data.volume = crysys.volume; 39 | toutputs.data.density = crysys.density; 40 | toutputs.data.symmetry = crysys.symmetry; 41 | toutputs.data.elasticity = outputs.elasticity; 42 | 43 | outputs = toutputs; 44 | 45 | catch 46 | outputs = []; 47 | hmsg = msgbox(['Item with task_id = ', mpid,' not found, please try Legacy API.'], 'VELAS reminder','error'); 48 | pause(0.8); 49 | if ishandle(hmsg) 50 | close(hmsg); 51 | end 52 | end 53 | 54 | else 55 | % www.materialsproject.org [Legacy API] 56 | try 57 | criteria = ['{"material_id": "',mpid,'"}']; 58 | props = '["pretty_formula","spacegroup","volume","density","elasticity"]'; 59 | urlold = 'https://materialsproject.org/rest/v2/query'; 60 | options = weboptionsNew('RequestMethod','post',... 61 | 'KeyName', 'X-API-KEY', ... 62 | 'KeyValue', xapikey,... 63 | 'Timeout',5); 64 | outputs = webwriteNew(urlold,{'criteria',criteria,'properties',props}',options); 65 | outputs = json2struct(outputs); 66 | outputs.response = outputs.response{1,1}; 67 | catch 68 | outputs = []; 69 | hmsg = msgbox(['Item with task_id = ', mpid,' not found, please visit the official website of Materials Project.'], 'VELAS reminder','error'); 70 | pause(0.8); 71 | if ishandle(hmsg) 72 | close(hmsg); 73 | end 74 | end 75 | end 76 | 77 | else 78 | if ~verflag 79 | % api.materialsproject.org [New API] 80 | urlnew = ['https://api.materialsproject.org/elasticity/',mpid,'/?_fields=pretty_formula%2Celasticity&_all_fields=false']; 81 | urlsys = ['https://api.materialsproject.org/summary/',mpid,'/?_fields=symmetry%2Cvolume%2Cdensity&_all_fields=false']; 82 | options = weboptions('RequestMethod','get',... 83 | 'ContentType','json',... 84 | 'HeaderFields',{'accept','application/json';'X-API-KEY',xapikey}); 85 | try 86 | outputs = webread(urlnew,options); 87 | 88 | crysys = webread(urlsys,options); 89 | outputs.data.volume = crysys.data.volume; 90 | outputs.data.density = crysys.data.density; 91 | outputs.data.symmetry = crysys.data.symmetry; 92 | 93 | catch 94 | outputs = []; 95 | hmsg = msgbox(['Item with task_id = ', mpid,' not found, please try Legacy API.'], 'VELAS reminder','error'); 96 | pause(0.8); 97 | if ishandle(hmsg) 98 | close(hmsg); 99 | end 100 | end 101 | 102 | else 103 | % www.materialsproject.org [Legacy API] 104 | urlold = 'https://www.materialsproject.org/rest/v2/query'; 105 | criteria = ['{"task_id":"',mpid,'"}']; 106 | props = '["pretty_formula","spacegroup","volume","density","elasticity"]'; 107 | 108 | options = weboptions('RequestMethod','post',... 109 | 'KeyName', 'X-API-KEY', ... 110 | 'KeyValue', xapikey); 111 | try 112 | outputs = webwrite(urlold,'criteria',criteria,'properties',props,options); 113 | catch 114 | outputs = []; 115 | hmsg = msgbox(['Item with task_id = ', mpid,' not found, please visit the official website of Materials Project.'], 'VELAS reminder','error'); 116 | pause(0.8); 117 | if ishandle(hmsg) 118 | close(hmsg); 119 | end 120 | end 121 | end 122 | end 123 | else 124 | error('Your network does not have access to the Materials Project API!'); 125 | end -------------------------------------------------------------------------------- /inst/mpapi/mpapiElasticOffline.m: -------------------------------------------------------------------------------- 1 | function outputs = mpapiElasticOffline(mpid) 2 | dbdir = which('mpDataBaseOffline.mat'); 3 | if exist(dbdir,'file') 4 | load(dbdir,'data'); 5 | if ~isempty(strfind(mpid,'mp-')) || ~isempty(strfind(mpid,'mvc-')) 6 | loc = find(strcmp(mpid,{data.material_id})==1); 7 | if ~isempty(loc) 8 | outputs = data(loc); 9 | else 10 | outputs = []; 11 | errordlg(['Item with task_id = ', mpid,' not found, please try onlnine API with your personal x-api-key.'],'VELAS reminder'); 12 | return; 13 | end 14 | else 15 | loc = find(strcmp(mpid,{data.formula})==1); 16 | if ~isempty(loc) 17 | len = length(loc); 18 | outputs = data(loc); 19 | nd = squeeze(struct2cell(outputs))'; 20 | allRow = cell(1,len+1); 21 | mpmx = max([cellfun(@length,nd(:,1));11]); 22 | frmx = max([cellfun(@length,nd(:,2));7]); 23 | demx = max([cellfun(@length,cellfun(@num2str,nd(:,4),'UniformOutput',false));7]); 24 | csmx = max([cellfun(@length,nd(:,5));13]); 25 | 26 | tmpid = repmat(' ',[1 mpmx]); 27 | tfrid = repmat(' ',[1 frmx]); 28 | tdeid = repmat(' ',[1 demx]); 29 | tcsid = repmat(' ',[1 csmx]); 30 | tmpid(1:11) = 'Material_ID'; 31 | tfrid(1:7) = 'Formula'; 32 | tdeid(1:7) = 'Density'; 33 | tcsid(1:13) = 'CrystalSystem'; 34 | allRow{1} = [tmpid,' ',tfrid,' ',tdeid,' ',tcsid]; 35 | 36 | for tk = 2:len+1 37 | tmpid = repmat(' ',[1 mpmx]); 38 | tfrid = repmat(' ',[1 frmx]); 39 | tdeid = repmat(' ',[1 demx]); 40 | tcsid = repmat(' ',[1 csmx]); 41 | tlen = length(nd{tk-1,1}); 42 | tmpid(1:tlen) = nd{tk-1,1}; 43 | tlen = length(nd{tk-1,2}); 44 | tfrid(1:tlen) = nd{tk-1,2}; 45 | tlen = length(num2str(nd{tk-1,4})); 46 | tdeid(1:tlen) = num2str(nd{tk-1,4}); 47 | tlen = length(nd{tk-1,5}); 48 | tcsid(1:tlen) = nd{tk-1,5}; 49 | allRow{tk} = [tmpid,' ',tfrid,' ',tdeid,' ',tcsid]; 50 | end 51 | 52 | [sel, ok] = listdlg('Name','VELAS reminder','ListString', allRow,... 53 | 'PromptString','Please select one and press OK!',... 54 | 'SelectionMode', 'Single',... 55 | 'ListSize',[250 400]); 56 | if (ok == 1) 57 | if sel ~= 1 58 | outputs = outputs(sel-1); 59 | else 60 | outputs = []; 61 | errordlg('Cannot select header.','VELAS reminder'); 62 | return; 63 | end 64 | else 65 | outputs = []; 66 | errordlg('You cancelled.','VELAS reminder'); 67 | return; 68 | end 69 | else 70 | outputs = []; 71 | errordlg(['Pretty Formula: ', mpid,' not found, please try onlnine API with MP-ID and your personal x-api-key.'],'VELAS reminder'); 72 | return; 73 | end 74 | end 75 | else 76 | outputs = []; 77 | errordlg('The database.mat file dose not exist, please prepare database.mat file','VELAS reminder'); 78 | return; 79 | end -------------------------------------------------------------------------------- /inst/mpapi/webreadNew.m: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## 3 | ## Copyright (C) 2018-2021 The Octave Project Developers 4 | ## 5 | ## See the file COPYRIGHT.md in the top-level directory of this 6 | ## distribution or . 7 | ## 8 | ## This file is part of Octave. 9 | ## 10 | ## Octave is free software: you can redistribute it and/or modify it 11 | ## under the terms of the GNU General Public License as published by 12 | ## the Free Software Foundation, either version 3 of the License, or 13 | ## (at your option) any later version. 14 | ## 15 | ## Octave is distributed in the hope that it will be useful, but 16 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ## GNU General Public License for more details. 19 | ## 20 | ## You should have received a copy of the GNU General Public License 21 | ## along with Octave; see the file COPYING. If not, see 22 | ## . 23 | ## 24 | ######################################################################## 25 | 26 | ## -*- texinfo -*- 27 | ## @deftypefn {} {@var{response} =} webread (@var{url}) 28 | ## @deftypefnx {} {@var{response} =} webread (@var{url}, @var{name1}, @var{value1}, @dots{}) 29 | ## @deftypefnx {} {@var{response} =} webread (@dots{}, @var{options}) 30 | ## 31 | ## Read content from RESTful web service. 32 | ## 33 | ## Read content from the web service specified by @var{url} and return the 34 | ## content in @var{response}. 35 | ## 36 | ## All key-value pairs given (@var{name1}, @var{value1}, @dots{}) are appended 37 | ## as query parameters to @var{url}. To place a query in the body of the 38 | ## message, use @code{webwrite}. The web service defines the acceptable query 39 | ## parameters. 40 | ## 41 | ## @var{options} is a @code{weboptions} object that may be used to add other 42 | ## HTTP request options. This argument can be used with either calling form. 43 | ## See @code{help weboptions} for a complete list of supported HTTP options. 44 | ## 45 | ## @seealso{weboptions, webwrite} 46 | ## @end deftypefn 47 | 48 | function response = webreadNew(url, varargin) 49 | 50 | if (nargin == 0) 51 | print_usage(); 52 | endif 53 | 54 | if (! (ischar (url) && isrow (url))) 55 | error ("webread: URL must be a string"); 56 | endif 57 | 58 | if (nargin > 1 && isa (varargin{end}, "weboptionsNew")) 59 | has_weboptions = true; 60 | options = varargin{end}; 61 | varargin(end) = []; 62 | else 63 | has_weboptions = false; 64 | options = weboptions (); 65 | endif 66 | 67 | if (strcmp (options.MediaType, "auto")) 68 | options.MediaType = "application/x-www-form-urlencoded"; 69 | endif 70 | 71 | ## If MediaType is set by the user, append it to other headers. 72 | if (! strcmp (options.CharacterEncoding, "auto")) 73 | % fix for options.HeaderFields size 74 | options.HeaderFields(end+1, 1:2) = {"Content-Type",... 75 | [options.MediaType, ... 76 | "; charset=", options.CharacterEncoding]}; 77 | endif 78 | 79 | if (! isempty (options.KeyName)) 80 | % fix for options.HeaderFields size 81 | if iscell(options.KeyName) 82 | l = length(options.KeyName); 83 | if (size(options.KeyName,1) == 1)&&(l~=1) 84 | options.HeaderFields(end+1:end+l, 1:2) = [options.KeyName', options.KeyValue']; 85 | else 86 | options.HeaderFields(end+1:end+l, 1:2) = [options.KeyName, options.KeyValue]; 87 | end 88 | else 89 | options.HeaderFields(end+1, 1:2) = {options.KeyName, options.KeyValue}; 90 | endif 91 | endif 92 | 93 | if (strcmp(options.RequestMethod, "auto")) 94 | options.RequestMethod = "get"; 95 | endif 96 | 97 | ## Flatten the cell array because the internal processing takes place on 98 | ## a flattened array. 99 | ## options.HeaderFields = options.HeaderFields(:)'; 100 | 101 | nargs = 1 + numel (varargin); 102 | if (nargs == 1) 103 | response = __restful_service__ (url, cell (), options); 104 | elseif (rem (nargs, 2) == 1) 105 | if (! iscellstr (varargin)) 106 | error ("webwrite: KEYS and VALUES must be strings"); 107 | else 108 | response = __restful_service__ (url, varargin, options); 109 | endif 110 | else 111 | error ("webread: KEYS/VALUES must occur in pairs"); 112 | endif 113 | 114 | endfunction 115 | 116 | 117 | ## Test input validation 118 | %!error webread () 119 | %!error webread (1) 120 | %!error webread (["a";"b"]) 121 | %!error webread ("URL", "NAME1", 5) 122 | %!error webread ("URL", "KEY1") 123 | -------------------------------------------------------------------------------- /inst/mpapi/webwriteNew.m: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## 3 | ## Copyright (C) 2018-2021 The Octave Project Developers 4 | ## 5 | ## See the file COPYRIGHT.md in the top-level directory of this 6 | ## distribution or . 7 | ## 8 | ## This file is part of Octave. 9 | ## 10 | ## Octave is free software: you can redistribute it and/or modify it 11 | ## under the terms of the GNU General Public License as published by 12 | ## the Free Software Foundation, either version 3 of the License, or 13 | ## (at your option) any later version. 14 | ## 15 | ## Octave is distributed in the hope that it will be useful, but 16 | ## WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ## GNU General Public License for more details. 19 | ## 20 | ## You should have received a copy of the GNU General Public License 21 | ## along with Octave; see the file COPYING. If not, see 22 | ## . 23 | ## 24 | ######################################################################## 25 | 26 | ## -*- texinfo -*- 27 | ## @deftypefn {} {@var{response} =} webwrite (@var{url}, @var{name1}, @var{value1}, @dots{}) 28 | ## @deftypefnx {} {@var{response} =} webwrite (@var{url}, @var{data}) 29 | ## @deftypefnx {} {@var{response} =} webwrite (@dots{}, @var{options}) 30 | ## 31 | ## Write data to RESTful web services. 32 | ## 33 | ## Write content to the web service specified by @var{url} and return the 34 | ## response in @var{response}. 35 | ## 36 | ## All key-value pairs given (@var{name1}, @var{value1}, @dots{}) are added 37 | ## as pairs of query parameters to the body of request method (@code{get}, 38 | ## @code{post}, @code{put}, etc.). 39 | ## 40 | ## @var{options} is a @code{weboptions} object that may be used to add other 41 | ## HTTP request options. This argument can be used with either calling form. 42 | ## See @code{help weboptions} for a complete list of supported HTTP options. 43 | ## 44 | ## @seealso{weboptions, webread} 45 | ## @end deftypefn 46 | 47 | function response = webwriteNew(url, varargin) 48 | 49 | if (nargin < 2) 50 | print_usage(); 51 | endif 52 | 53 | if (! (ischar (url) && isrow (url))) 54 | error ("webwrite: URL must be a string"); 55 | endif 56 | 57 | if (isa (varargin{end}, "weboptionsNew")) 58 | has_weboptions = true; 59 | options = varargin{end}; 60 | varargin(end) = []; 61 | else 62 | has_weboptions = false; 63 | options = weboptionsNew(); 64 | endif 65 | 66 | if (strcmp (options.MediaType, "auto")) 67 | options.MediaType = "application/x-www-form-urlencoded"; 68 | endif 69 | 70 | ## If MediaType is set by the user, append it to other headers. 71 | if (! strcmp (options.CharacterEncoding, "auto")) 72 | % fix for options.HeaderFields size 73 | options.HeaderFields(end+1, 1:2) = {"Content-Type",... 74 | [options.MediaType, ... 75 | "; charset=", options.CharacterEncoding]}; 76 | endif 77 | 78 | if (! isempty (options.KeyName)) 79 | % fix for options.HeaderFields size 80 | if iscell(options.KeyName) 81 | l = length(options.KeyName); 82 | if (size(options.KeyName,1) == 1)&&(l~=1) 83 | options.HeaderFields(end+1:end+l, 1:2) = [options.KeyName', options.KeyValue']; 84 | else 85 | options.HeaderFields(end+1:end+l, 1:2) = [options.KeyName, options.KeyValue]; 86 | end 87 | else 88 | options.HeaderFields(end+1, 1:2) = {options.KeyName, options.KeyValue}; 89 | endif 90 | endif 91 | 92 | if (strcmp (options.RequestMethod, "auto")) 93 | options.RequestMethod = "post"; 94 | endif 95 | 96 | ## Flatten the cell array because the internal processing takes place on 97 | ## a flattened array. 98 | options.HeaderFields = reshape(options.HeaderFields',1,[]); 99 | 100 | nargs = numel(varargin); 101 | if (nargs == 0) 102 | error ("webwrite: DATA must be a string"); 103 | elseif (nargs == 1) 104 | if (ischar (varargin{1}) && isrow (varargin{1})) 105 | param = strsplit (varargin{1}, {"=", "&"}); 106 | response = __restful_service__ (url, param, options); 107 | % elseif (! iscellstr (varargin)) 108 | % error ("webwrite: DATA must be a string"); 109 | else 110 | response = __restful_service__ (url, varargin{:}, options); 111 | endif 112 | elseif (rem (nargs, 2) == 0) 113 | if (! iscellstr (varargin)) 114 | error ("webwrite: KEYS and VALUES must be strings"); 115 | else 116 | response = __restful_service__ (url, varargin{:}, options); 117 | endif 118 | else 119 | error ("webwrite: KEYS/VALUES must occur in pairs"); 120 | endif 121 | 122 | endfunction 123 | 124 | 125 | ## Test input validation 126 | %!error webwrite () 127 | %!error webwrite ("abc") 128 | %!error webwrite (1, "NAME1", "VALUE1") 129 | %!error webwrite (["a";"b"], "NAME1", "VALUE1") 130 | %!error webwrite ("URL", 1, weboptions ()) 131 | %!error webwrite ("URL", 1) 132 | %!error webwrite ("URL", "NAME1", 5) 133 | %!error webwrite ("URL", "KEY1", "VAL1", "A") 134 | 135 | -------------------------------------------------------------------------------- /inst/properties/calcAnisotropy.m: -------------------------------------------------------------------------------- 1 | function Ax = calcAnisotropy(X) 2 | 3 | %{ 4 | Ax = Xstd/Xmean, if the sign of Xmax and Xmin is same. 5 | Ax = ∞ , If the sign of Xmax and Xmin is opposite. 6 | 7 | %} 8 | 9 | if max(X(:))*min(X(:)) >= 0 10 | % remove zero elements 11 | if any(X(:)==0) 12 | X(X==0) = []; 13 | end 14 | if min(X(:))>0 15 | Ax = std(X(:))/mean(X(:)); 16 | else 17 | Ax = -std(X(:))/mean(X(:)); 18 | end 19 | else 20 | Ax = inf; 21 | end 22 | -------------------------------------------------------------------------------- /inst/properties/calcBulk.m: -------------------------------------------------------------------------------- 1 | function [rB,negFlag] = calcBulk(x,S,n2d,planeC,flagD) 2 | 3 | %{ 4 | ========================== Bulk Modulus ================================ 5 | Input parameter: 6 | �� x, Initial value of optimization function. 7 | �� S, Compliance matrix S 8 | �� n2d, mesh number of [0,2��] in 2D calculation 9 | �� planeC, 2D plane, such as plane (111) 10 | �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D. 11 | Out parameter: 12 | �� P, return Poisson's Ratio. 13 | �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false. 14 | %} 15 | 16 | switch(flagD) 17 | case {'3D','3d'} 18 | k = dir2Vec(x(:,1), x(:,2)); 19 | [k11,k12,k13,k22,k23,k33] = getCoef1(k); 20 | case {'2D','2d'} 21 | [k11,k12,k13,k22,k23,k33,~,~] = getCoef2D(x,n2d,planeC); 22 | end 23 | % ========== Linear Compressibility (from Nye) ================================== 24 | rC = (S(1,1)+S(1,2)+S(1,3)).*k11+(S(1,6)+S(2,6)+S(3,6)).*k12+(S(1,5)+S(2,5)+S(3,5)).*k13... 25 | +(S(1,2)+S(2,2)+S(2,3)).*k22+(S(1,4)+S(2,4)+S(3,4)).*k23... 26 | +(S(1,3)+S(2,3)+S(3,3)).*k33; 27 | % rB = (S(1,1)+S(1,2)+S(1,3)).*k11 +(S(1,2)+S(2,2)+S(2,3)).*k22 + (S(1,3)+S(2,3)+S(3,3)).*k33; 28 | rB = 1000./(3*rC); 29 | 30 | if min(rB) < 0 31 | negFlag = true; 32 | else 33 | negFlag = false; 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /inst/properties/calcCauchyPressure.m: -------------------------------------------------------------------------------- 1 | function Re = calcCauchyPressure(G,B) 2 | % Average Cauchy’s pressure based on Wang's model 3 | % CP/B = -1.620*G/B + 0.955 4 | % ref: RSC Adv., 2016, 6, 44561. 5 | 6 | Re = -1.620*G + 0.955*B; -------------------------------------------------------------------------------- /inst/properties/calcCompress.m: -------------------------------------------------------------------------------- 1 | 2 | function [rC,negFlag] = calcCompress(x,S,n2d,planeC,flagD) 3 | 4 | %{ 5 | ====================== Linear Compressibility =========================== 6 | Input parameter: 7 | �� x, Initial value of optimization function. 8 | �� S, Compliance matrix S 9 | �� n2d, mesh number of [0,2��] in 2D calculation 10 | �� planeC, 2D plane, such as plane (111) 11 | �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D. 12 | Out parameter: 13 | �� P, return Poisson's Ratio. 14 | �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false. 15 | %} 16 | 17 | switch(flagD) 18 | case {'3D','3d'} 19 | k = dir2Vec(x(:,1), x(:,2)); 20 | [k11,k12,k13,k22,k23,k33] = getCoef1(k); 21 | case {'2D','2d'} 22 | [k11,k12,k13,k22,k23,k33,~,~] = getCoef2D(x,n2d,planeC); 23 | end 24 | % ========== Linear Compressibility (from Nye) ================================== 25 | rC = (S(1,1)+S(1,2)+S(1,3)).*k11+(S(1,6)+S(2,6)+S(3,6)).*k12+(S(1,5)+S(2,5)+S(3,5)).*k13... 26 | +(S(1,2)+S(2,2)+S(2,3)).*k22+(S(1,4)+S(2,4)+S(3,4)).*k23... 27 | +(S(1,3)+S(2,3)+S(3,3)).*k33; 28 | 29 | if min(rC) < 0 30 | negFlag = true; 31 | else 32 | negFlag = false; 33 | end 34 | -------------------------------------------------------------------------------- /inst/properties/calcFractureToughness.m: -------------------------------------------------------------------------------- 1 | function Kic = calcFractureToughness(U,V,KIC) 2 | 3 | %{ 4 | ========================== Fracture Toughness ============================= 5 | Input parameter: 6 | Mt is a struct variable: 7 | KIC.model: 8 | if KIC.model = 'M'/'Mazhnik', selecting Mazhnik's model, U = E (Young's modulus), V = P (Poisson's Ratio) 9 | if KIC.model = 'N'/'Niu', selecting Niu's model, U = G (shear modulus), V = B (bulk modulus) 10 | KIC.V0 - V0 is the volume per atom; 11 | KIC.gEFr - gEFr is the relative DOS at the Fermi level; 12 | KIC.material - 'IC' refers to ionic or covalent crystals; 'PM' refers to pure metals; 'IM' refers to intermetallics; 13 | For intermetallics AmBn: KIC.m - m is the number in the chemical formula AmBn; 14 | KIC.n - n is the number in the chemical formula AmBn; 15 | KIC.XA - XA refers to the Allen scale electronegativity of elements A; 16 | KIC.XB - XB refers to the Allen scale electronegativity of elements B; 17 | 18 | Out parameter: 19 | —— Kic, return Fracture Toughness [MPa*m^(1/2)] 20 | refs: 21 | Niu's model: J. Appl. Phys. 125, 065105 (2019) 22 | Kic[Niu] = (1+α)*V0^(1/6)*G*(B/G)^(1/2). 23 | For ionic or covalent crystals: α = 0; 24 | For pure metals: α = 43*(g(E_F)_R)^(1/4); 25 | For intermetallics: α = 43*(g(E_F)_R)^(1/4)*f_EN, where 26 | f_EN = β/[1+((C1_m*C1_n)/C2_(m+n))*sqrt((X_A-X_B)^2/(X_A*X_B))]^γ. 27 | 28 | 29 | Mazhnik's model: J. Appl. Phys. 126, 125109 (2019) 30 | Kic[Mazhnik] = fEN*α^(-1/2)*V0^(1/6)*[α(V)*E]^(3/2). 31 | For ionic or covalent crystals: α = 8840, fEN = 1, 32 | For pure metals: α = 2, fEN = 1, 33 | For intermetallics: α = 2, f_EN = β/[1+((C1_m*C1_n)/C2_(m+n))*sqrt((X_A-X_B)^2/(X_A*X_B))]^γ. 34 | %} 35 | 36 | switch(KIC.model) 37 | case {'N','Niu'} 38 | switch(KIC.material) 39 | case 'IC' 40 | Kic = ((KIC.V0*1e-30)^(1/6))*(1000*U).*(V./U).^(1/2); 41 | case 'M' 42 | alpha = 43*(KIC.gEFr)^(1/4); 43 | Kic = (1+alpha)*((KIC.V0*1e-30)^(1/6))*(1000*U).*(V./U).^(1/2); 44 | case 'IM' 45 | C1m = nchoosek(KIC.m,1); 46 | C1n = nchoosek(KIC.n,1); 47 | C2smn = nchoosek(KIC.m+KIC.n,2); 48 | fEN = 0.3/(1+(C1m*C1n/C2smn)*sqrt((KIC.XA-KIC.XB)^2/(KIC.XA*KIC.XB)))^8; 49 | alpha = 43*((KIC.gEFr)^(1/4))*fEN; 50 | Kic = (1+alpha)*((KIC.V0*1e-30)^(1/6))*(1000*U).*(V./U).^(1/2); 51 | end 52 | case {'M','Mazhnik'} 53 | switch(KIC.material) 54 | case 'IC' 55 | Kic = real((8840)^(-1/2)*((KIC.V0*1e-30)^(1/6))*1000*(((1-13.7*V+48.6*V.^2)./(1-15.2*V+70.2*V.^2-81.5*V.^3)).*U).^(3/2)); 56 | case 'M' 57 | Kic = real((2)^(-1/2)*((KIC.V0*1e-30)^(1/6))*1000*(((1-13.7*V+48.6*V.^2)./(1-15.2*V+70.2*V.^2-81.5*V.^3)).*U).^(3/2)); 58 | case 'IM' 59 | C1m = nchoosek(KIC.m,1); 60 | C1n = nchoosek(KIC.n,1); 61 | C2smn = nchoosek(KIC.m+KIC.n,2); 62 | fEN = 0.3/(1+(C1m*C1n/C2smn)*sqrt((KIC.XA-KIC.XB)^2/(KIC.XA*KIC.XB)))^8; 63 | Kic = real((2)^(-1/2)*fEN*((KIC.V0*1e-30)^(1/6))*1000*(((1-13.7*V+48.6*V.^2)./(1-15.2*V+70.2*V.^2-81.5*V.^3)).*U).^(3/2)); 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /inst/properties/calcHardness.m: -------------------------------------------------------------------------------- 1 | function Hv = calcHardness(U,V,model) 2 | 3 | %{ 4 | ========================== Vickers hardness ============================= 5 | Input parameter: 6 | if flag = 'M', selecting Mazhnik's model, U = E (Young's modulus), V = P (Poisson's Ratio) 7 | if flag = 'C', selecting Chen's model, U = G (shear modulus), V = B (bulk modulus) 8 | if flag = 'T', selecting Tian's model, U = G (shear modulus), V = B (bulk modulus) 9 | Out parameter: 10 | —— Hv, return Vickers hardness. 11 | refs: 12 | Mazhnik's model: J. Appl. Phys. 126, 125109 (2019) 13 | Hv[Mazhnik] = 0.096*((1-8.5*v+19.5*v^2)*E)/(1-7.5*v+12.2*v^2+19.6*v^3). 14 | 15 | Chen's model: Intermetallics 19 (2011) 1275e1281 16 | Hv[chen] = 2*(k^2*G)^0.585-3, where k = G/B. 17 | 18 | Tian's model: Int. Journal of Refractory Metals and Hard Materials 33 (2012) 93�C106 19 | Hv[Tian] = 0.92*k^1.137*G^0.708, where k = G/B. 20 | %} 21 | 22 | switch(model) 23 | case {'M','Mazhnik'} 24 | Hv = 0.096*((1-8.5*V+19.5*V.^2)./(1-7.5*V+12.2*V.^2+19.6*V.^3)).*U; 25 | case {'C','Chen'} 26 | Hv = 2*(U.^3./V.^2).^0.585-3; 27 | case {'T','Tian'} 28 | Hv = 0.92*((U./V).^1.137).*(U.^0.708); 29 | end 30 | -------------------------------------------------------------------------------- /inst/properties/calcIntersectCurve.m: -------------------------------------------------------------------------------- 1 | function xy = calcIntersectCurve(p0, v, exx, eyy, ezz) 2 | 3 | %{ 4 | Author: Mehmet OZTURK - KTU Electrical and Electronics Engineering, Trabzon/Turkey 5 | 6 | Modified by Zheng Ran 7 | 8 | Intersection points of an arbitrary surface S with an arbitrary plane P. 9 | 10 | Input: 11 | p0 - a reference point through which the "center" of plane P must pass 12 | v - normal vector of the plane P 13 | exx, eyy and ezz - the surface S coordinates 14 | 15 | Output: 16 | xy - Intersection points of an arbitrary surface S with an arbitrary plane P 17 | %} 18 | 19 | v = v./norm(v); % normalize the normal vector 20 | 21 | mx = v(1); my=v(2); mz=v(3); 22 | 23 | % elevation and azimuth angels of the normal of the plane 24 | phi = acos(mz./sqrt(mx.*mx + my.*my + mz.*mz)); % 0 <= phi <= 180 25 | teta = atan2(my,mx); 26 | 27 | st=sin(teta); ct=cos(teta); 28 | sp=sin(phi); cp=cos(phi); 29 | 30 | T=[st -ct 0; ct*cp st*cp -sp; ct*sp st*sp cp]; 31 | 32 | % transform surface such that the z axis of the surface coincides with plane normal 33 | exx=exx-p0(1); eyy=eyy-p0(2); ezz=ezz-p0(3); 34 | nexx = exx*T(1,1) + eyy*T(1,2) + ezz*T(1,3); 35 | neyy = exx*T(2,1) + eyy*T(2,2) + ezz*T(2,3); 36 | nezz = exx*T(3,1) + eyy*T(3,2) + ezz*T(3,3); 37 | 38 | % Find the intersections 39 | [M,c] = contour3(nexx,neyy,nezz,[0 0]); 40 | set(c,'Visible','off'); 41 | limit = size(M,2); 42 | i = 1; 43 | ncx = []; ncy=[]; 44 | while(i < limit) 45 | npoints = M(2,i); 46 | nexti = i+npoints+1; 47 | ncx = [ncx M(1,i+1:i+npoints)]; 48 | ncy = [ncy M(2,i+1:i+npoints)]; 49 | i = nexti; 50 | end 51 | 52 | xy = [ncx',ncy']; 53 | % Set less than 1e-10 to 0 54 | xy(abs(xy)<1e-10) = 0; 55 | 56 | % Delete the point with 0 at the end 57 | tmpxy = any(xy,2); 58 | ind = ~logical(flipud(cumsum(flipud(tmpxy)~=0))); 59 | 60 | % output 61 | xy(ind,:) = []; 62 | 63 | 64 | -------------------------------------------------------------------------------- /inst/properties/calcPoisson.m: -------------------------------------------------------------------------------- 1 | 2 | function [P,negFlag] = calcPoisson(x,nChi,S1111,S,n2d,planeC,flag,flagD) 3 | 4 | 5 | %{ 6 | ========================= Poisson's Ratio ============================== 7 | Input parameter: 8 | - x, Initial value of optimization function. 9 | - nChi, mesh number of azimuth - 10 | - S1111, 11 | - S, Compliance matrix S 12 | - n2d, mesh number of [0,2-] in 2D calculation 13 | - planeC, 2D plane, such as plane (111) 14 | - flag, 'max', 'min' or 'neg'. 15 | - flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D. 16 | Out parameter: 17 | - P, return Poisson's Ratio. 18 | - negFlag, if there is a negative Poisson's ratio, then true, otherwise false. 19 | %} 20 | 21 | switch(flagD) 22 | case {'3D','3d'} 23 | k = dir2Vec(x(:,1), x(:,2)); 24 | [k11,k12,k13,k22,k23,k33] = getCoef1(k); 25 | 26 | [v1,v2,v3] = dir2Vec3V(x(:,1), x(:,2), nChi); 27 | [v11,v12,v13,v22,v23,v33] = getCoef2(v1,v2,v3); 28 | 29 | case {'2D','2d'} 30 | 31 | [k11,k12,k13,k22,k23,k33,theta,phi] = getCoef2D(x,n2d,planeC); 32 | 33 | [v1,v2,v3] = dir2Vec3V(theta, phi, nChi); 34 | [v11,v12,v13,v22,v23,v33] = getCoef2(v1,v2,v3); 35 | end 36 | 37 | S1122 = k11.*v11.*S(1,1)+(k11.*v22+k22.*v11).*S(1,2)+(k11.*v33+k33.*v11).*S(1,3)+(k11.*v23+k23.*v11).*S(1,4)+(k11.*v13+k13.*v11).*S(1,5)+(k11.*v12+k12.*v11).*S(1,6)+... 38 | k22.*v22.*S(2,2)+(k22.*v33+k33.*v22).*S(2,3)+(k22.*v23+k23.*v22).*S(2,4)+(k22.*v13+k13.*v22).*S(2,5)+(k22.*v12+k12.*v22).*S(2,6)+... 39 | k33.*v33.*S(3,3)+(k33.*v23+k23.*v33).*S(3,4)+(k33.*v13+k13.*v33).*S(3,5)+(k33.*v12+k12.*v33).*S(3,6)+... 40 | k23.*v23.*S(4,4)+(k23.*v13+k13.*v23).*S(4,5)+(k23.*v12+k12.*v23).*S(4,6)+... 41 | k13.*v13.*S(5,5)+(k13.*v12+k12.*v13).*S(5,6)+... 42 | k12.*v12.*S(6,6); 43 | S1111 = repmat(S1111,1,nChi); 44 | 45 | switch(flag) 46 | case 'normal' 47 | P = (-S1122./S1111)'; 48 | if min(min(P)) < 0 49 | negFlag = true; 50 | else 51 | negFlag = false; 52 | end 53 | case 'max' 54 | tmpnu = (-S1122./S1111)'; 55 | P = arrayfun(@(t) max(tmpnu(tmpnu(:,t)>0,t)), 1:size(tmpnu,2),'UniformOutput',false); 56 | loc = cellfun(@isempty,P); 57 | if any(loc) 58 | P(loc) = num2cell(0); 59 | end 60 | P = max(cell2mat(P)); 61 | case 'min' 62 | tmpnu = (-S1122./S1111)'; 63 | P = arrayfun(@(t) min(tmpnu(tmpnu(:,t)>0,t)), 1:size(tmpnu,2),'UniformOutput',false); 64 | loc = cellfun(@isempty,P); 65 | if any(loc) 66 | P(loc) = num2cell(inf); 67 | end 68 | P = min(cell2mat(P)); 69 | case 'neg' 70 | tmpnu = (-S1122./S1111)'; 71 | P = arrayfun(@(t) min(tmpnu(tmpnu(:,t)<0,t)), 1:size(tmpnu,2),'UniformOutput',false); 72 | loc = cellfun(@isempty,P); 73 | if any(loc) 74 | P(loc) = num2cell(0); 75 | end 76 | P = max(-cell2mat(P)); 77 | case 'avg' 78 | P = mean((-S1122./S1111),2); 79 | end -------------------------------------------------------------------------------- /inst/properties/calcPugh.m: -------------------------------------------------------------------------------- 1 | function Pr = calcPugh(B,G) 2 | 3 | %{ 4 | ========================== Pugh ratio ============================= 5 | Input parameter: 6 | B - bulk modulus 7 | G - shear modulus, 8 | Pr = B/G, where B is bulk modulus, G is shear modulus. 9 | if Pr > 1.75 10 | Re = 'Ductile'; 11 | else 12 | Re = 'Brittle'; 13 | end 14 | Out parameter: 15 | Pr, return Pugh's ratio. 16 | refs: 17 | 18 | %} 19 | Pr = B./G; -------------------------------------------------------------------------------- /inst/properties/calcPwaveModulus.m: -------------------------------------------------------------------------------- 1 | function Pw = calcPwaveModulus(B,G) 2 | 3 | %{ 4 | ========================== Pugh ratio ============================= 5 | Input parameter: 6 | B - bulk modulus 7 | G - shear modulus, 8 | Out parameter: 9 | Pw = B+4*G/3, P-wave modulus. 10 | refs: 11 | 12 | %} 13 | Pw = B+4*G/3; -------------------------------------------------------------------------------- /inst/properties/calcShear.m: -------------------------------------------------------------------------------- 1 | function [shearModulus,negFlag] = calcShear(x,nChi,S,n2d,planeC,flag,flagD) 2 | 3 | %{ 4 | ========================== Shear Modulus ================================ 5 | Input parameter: 6 | x, Initial value of optimization function. 7 | nChi, mesh number of azimuth �� 8 | S, Compliance matrix S 9 | n2d, mesh number of [0,2��] in 2D calculation 10 | planeC, 2D plane, such as plane (111) 11 | flag, 'max', 'min' or 'neg'. 12 | flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D. 13 | Out parameter: 14 | P, return Poisson's Ratio. 15 | negFlag, if there is a negative Poisson's ratio, then true, otherwise false. 16 | %} 17 | 18 | 19 | switch(flagD) 20 | case {'3D','3d'} 21 | k = dir2Vec(x(:,1), x(:,2)); 22 | [k11,k12,k13,k22,k23,k33] = getCoef1(k); 23 | 24 | [v1,v2,v3] = dir2Vec3V(x(:,1), x(:,2), nChi); 25 | [v11,v12,v13,v22,v23,v33] = getCoef2(v1,v2,v3); 26 | 27 | case {'2D','2d'} 28 | 29 | [k11,k12,k13,k22,k23,k33,theta,phi] = getCoef2D(x,n2d,planeC); 30 | 31 | [v1,v2,v3] = dir2Vec3V(theta, phi, nChi); 32 | [v11,v12,v13,v22,v23,v33] = getCoef2(v1,v2,v3); 33 | end 34 | 35 | tmpShear = k11.*v11.*S(1,1)+2.*k12.*v12.*S(1,2)+2.*k13.*v13.*S(1,3)+(k12.*v13+k13.*v12).*S(1,4)+(k11.*v13+k13.*v11).*S(1,5)+(k11.*v12+k12.*v11).*S(1,6)+... 36 | k22.*v22.*S(2,2)+2.*k23.*v23.*S(2,3)+(k22.*v23+k23.*v22).*S(2,4)+(k12.*v23+k23.*v12).*S(2,5)+(k22.*v12+k12.*v22).*S(2,6)+... 37 | k33.*v33.*S(3,3)+(k33.*v23+k23.*v33).*S(3,4)+(k33.*v13+k13.*v33).*S(3,5)+(k13.*v23+k23.*v13).*S(3,6)+... 38 | 1/4*(k22.*v33+2*k23.*v23+k33.*v22).*S(4,4)+1/2*(k12.*v33+k23.*v13+k13.*v23+k33.*v12).*S(4,5)+1/2*(k12.*v23+k22.*v13+k13.*v22+k23.*v12).*S(4,6)+... 39 | 1/4*(k11.*v33+2*k13.*v13+k33.*v11).*S(5,5)+1/2*(k11.*v23+k12.*v13+k13.*v12+k23.*v11).*S(5,6)+... 40 | 1/4*(k11.*v22+2*k12.*v12+k22.*v11).*S(6,6); 41 | switch(flag) 42 | case 'normal' 43 | shearModulus = (1000./(4*tmpShear))'; 44 | if min(min(shearModulus)) < 0 45 | negFlag = true; 46 | else 47 | negFlag = false; 48 | end 49 | case 'max' 50 | tmpG = (1000./(4*tmpShear))'; 51 | shearModulus = arrayfun(@(t) max(tmpG(tmpG(:,t)>0,t)), 1:size(tmpG,2),'UniformOutput',false); 52 | loc = cellfun(@isempty,shearModulus); 53 | if any(loc) 54 | shearModulus(loc) = num2cell(0); 55 | end 56 | shearModulus = max(cell2mat(shearModulus)); 57 | case 'min' 58 | tmpG = (1000./(4*tmpShear))'; 59 | shearModulus = arrayfun(@(t) min(tmpG(tmpG(:,t)>0,t)), 1:size(tmpG,2),'UniformOutput',false); 60 | loc = cellfun(@isempty,shearModulus); 61 | if any(loc) 62 | shearModulus(loc) = num2cell(inf); 63 | end 64 | shearModulus = min(cell2mat(shearModulus)); 65 | case 'neg' 66 | tmpG = (1000./(4*tmpShear))'; 67 | shearModulus = arrayfun(@(t) min(tmpG(tmpG(:,t)<0,t)), 1:size(tmpG,2),'UniformOutput',false); 68 | loc = cellfun(@isempty,shearModulus); 69 | if any(loc) 70 | shearModulus(loc) = num2cell(0); 71 | end 72 | shearModulus = max(-cell2mat(shearModulus)); 73 | case 'avg' 74 | shearModulus = mean(1000./(4*tmpShear),2); 75 | end 76 | 77 | -------------------------------------------------------------------------------- /inst/properties/calcYoung.m: -------------------------------------------------------------------------------- 1 | function [E,rY,negFlag] = calcYoung(x,S,n2d,planeC,flagD) 2 | 3 | %{ 4 | ========================== Youngs Modulus =============================== 5 | Input parameter: 6 | �� x, Initial value of optimization function. 7 | �� S, Compliance matrix S 8 | �� n2d, mesh number of [0,2��] in 2D calculation 9 | �� planeC, 2D plane, such as plane (111) 10 | �� flagD, '3D','3d','2D' or '2d', decide whether to compute 3D or 2D. 11 | Out parameter: 12 | �� P, return Poisson's Ratio. 13 | �� negFlag, if there is a negative Poisson's ratio, then true, otherwise false. 14 | %} 15 | 16 | switch(flagD) 17 | case {'3D','3d'} 18 | k = dir2Vec(x(:,1), x(:,2)); 19 | [k11,k12,k13,k22,k23,k33] = getCoef1(k); 20 | case {'2D','2d'} 21 | [k11,k12,k13,k22,k23,k33,~,~] = getCoef2D(x,n2d,planeC); 22 | end 23 | 24 | rY = k11.*k11*S(1,1)+2*k12.*k12*S(1,2)+2*k13.*k13.*S(1,3)+2*k12.*k13*S(1,4)+2*k11.*k13*S(1,5)+2*k11.*k12*S(1,6)+... 25 | k22.*k22*S(2,2)+2*k23.*k23*S(2,3)+2*k22.*k23*S(2,4)+2*k12.*k23*S(2,5)+2*k12.*k22*S(2,6)+... 26 | k33.*k33*S(3,3)+2*k23.*k33*S(3,4)+2*k13.*k33*S(3,5)+2*k13.*k23*S(3,6)+... 27 | k23.*k23*S(4,4)+2*k13.*k23*S(4,5)+2*k12.*k23*S(4,6)+... 28 | k13.*k13*S(5,5)+2*k12.*k13*S(5,6)+... 29 | k12.*k12*S(6,6); 30 | E = 1000./rY; 31 | 32 | if min(E) < 0 33 | negFlag = true; 34 | else 35 | negFlag = false; 36 | end 37 | 38 | end -------------------------------------------------------------------------------- /inst/properties/checkProperties.m: -------------------------------------------------------------------------------- 1 | 2 | function Re = checkProperties(Pro,flag) -------------------------------------------------------------------------------- /inst/properties/checkStability.m: -------------------------------------------------------------------------------- 1 | function Re = checkStability(inputData,Re) 2 | 3 | %{ 4 | ========= Check the mechanical stability of crystal structure ========== 5 | Input parameter: 6 | filename, the file name that contains the file path. 7 | N, mesh number of azimuth and �� 8 | n2d, mesh number of [0,2π] in 2D calculation 9 | nChi, mesh number of azimuth 10 | Re, initialized output results 11 | teps, the difference between a number and 0 or 1, if less than or equal to teps, it is considered to be equal to 0 or 1. 12 | Out parameter: 13 | Re, output results include various crystal mechanical parameters Or empty. 14 | %} 15 | 16 | lenC = length(unique(nonzeros(inputData.C))); 17 | if isequal(lenC,0) 18 | if inputData.mponline 19 | switch(lower(inputData.mpapiver)) 20 | case 'new' 21 | verflag = 0; 22 | case {'old','legacy'} 23 | verflag = 1; 24 | otherwise 25 | verflag = 0; 26 | end 27 | outputs = mpapiElastic(inputData.mpid,inputData.xapikey,verflag); 28 | if ~verflag 29 | inputData.C = outputs.data.elasticity.elastic_tensor; 30 | inputData.S = inv(inputData.C); 31 | inputData.cryType = outputs.data.symmetry.crystal_system; 32 | else 33 | inputData.C = outputs.response.elasticity.elastic_tensor; 34 | inputData.S = inv(inputData.C); 35 | inputData.cryType = outputs.response.spacegroup.crystal_system; 36 | end 37 | else 38 | outputs = mpapiElasticOffline(inputData.mpid); 39 | inputData.C = outputs.elasticTensor; 40 | inputData.S = inv(inputData.C); 41 | inputData.cryType = outputs.crystalSystem; 42 | end 43 | end 44 | 45 | flag = isStable(inputData.C,inputData.pressure); 46 | 47 | if flag 48 | Re = mechanics(inputData,Re); 49 | else 50 | errordlg('Structure unstable.','VELAS reminder'); 51 | end 52 | 53 | -------------------------------------------------------------------------------- /inst/properties/getBondType.m: -------------------------------------------------------------------------------- 1 | function Re = getBondType(Cp) 2 | % if Cp < 0, covalent bond compounds,else ionic/metallic bonds 3 | if Cp < 0 4 | Re = ' Covalent '; 5 | else 6 | Re = 'Ionic/Metallic'; 7 | end -------------------------------------------------------------------------------- /inst/properties/getCrystalType.m: -------------------------------------------------------------------------------- 1 | function Re = getCrystalType(C) 2 | 3 | % Judging the type of crystal system according to the stiffness matrix C 4 | % Cubic -- 3 independent elastic constants: C11, C44, C12; 5 | % Hexagonal -- 5 independent elastic constants: C11, C33, C44, C12, C13 6 | % Tetragonal -- 7 independent elastic constants: C11, C33, C44, C66, C12, C13, C16 7 | % Trigonal -- 7 independent elastic constants: C11, C33, C44, C12, C13, C14, C15 8 | % Orthorhombic -- 9 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C23 9 | % Monoclinic -- 13 independent elastic constants: C11, C22, C33, C44, C55, C66, C12, C13, C23, C15, C25, C35, C46 10 | % Triclinic -- 21 independent elastic constants: C11, C12, C13, C14, C15, C16,C22, C23, C24, C25, C26, C33, C34, C35, C36, C44, C45, C46, C55, C56, C66 11 | 12 | lenC = length(unique(nonzeros(C))); 13 | 14 | switch(lenC) 15 | case 3 16 | Re = 'Cubic'; 17 | case 6 18 | if (C(6,6) - 0.5*(C(1,1)-C(1,2)))<1e-2 19 | Re = 'Hexagonal'; 20 | else 21 | Re = 'Tetragonal'; 22 | end 23 | case 8 24 | if (C(6,6) - 0.5*(C(1,1)-C(1,2)))<1e-2 25 | Re = 'Trigonal'; 26 | else 27 | Re = 'Tetragonal'; 28 | end 29 | case 9 30 | Re = 'Orthorhombic'; 31 | case 10 32 | Re = 'Trigonal'; 33 | case 13 34 | Re = 'Monoclinic'; 35 | case 21 36 | Re = 'Triclinic'; 37 | end 38 | -------------------------------------------------------------------------------- /inst/properties/getDuctility.m: -------------------------------------------------------------------------------- 1 | function Re = getDuctility(P) 2 | % P = B/G, where B is bulk modulus, G is shear modulus. 3 | if P > 1.75 4 | Re = 'Ductile'; 5 | else 6 | Re = 'Brittle'; 7 | end -------------------------------------------------------------------------------- /inst/properties/isNegativePoisson.m: -------------------------------------------------------------------------------- 1 | function [negFlag,arealP] = isNegativePoisson(Dir,varargin) 2 | 3 | %{ 4 | Input: 5 | Dir - Direction need to be checked, size: 1*3 or 3*1. 6 | Output 7 | negFlag: if true (Negative Poisson’s ratio in Dir); 8 | if false (Positive Poisson’s ratio in Dir). 9 | arealP - Areal Poisson’s ratio in plane(Dir). 10 | 11 | Ref: Guo, C. Y . and Wheeler, L., J. Mech. Phys. Solids, 54, 690–707,2006. 12 | Areal Poisson’s ratio: The average of all values of Poisson’s ratio taken within the plane normal to a chosen direction. 13 | %} 14 | 15 | [m,n] = size(Dir); 16 | narginchk(1,2); 17 | 18 | if (m == 1 && n == 3) || (m == 3 && n == 1) 19 | switch(nargin) 20 | case 1 21 | [filen, pathn] = uigetfile({'*.txt'},'选择文件'); 22 | if isequal(filen,0) 23 | errordlg('打开文件失败!','温馨提示'); 24 | else 25 | filename = strcat(pathn,filen); 26 | inputData = getInput(filename); 27 | end 28 | case 2 29 | matname = varargin{1}; 30 | load(matname); 31 | end 32 | 33 | S = inputData.S; 34 | ntheta2d = inputData.ntheta2d; 35 | nchi = inputData.nchi; 36 | [~,S11112d,~] = calcYoung([],S,ntheta2d,Dir,'2D'); 37 | [P2d,~] = calcPoisson([],nchi,S11112d,S,ntheta2d,Dir,'normal','2D'); 38 | arealP = mean(P2d(:)); 39 | 40 | if arealP >= 0 41 | negFlag = false; 42 | else 43 | negFlag = true; 44 | end 45 | else 46 | hmsg = msgbox(['Expected input to be of size 1x3 or 3x1, but it is of size ',num2str(m),'x',num2str(n),'.'], 'VELAS reminder','help'); 47 | pause(1.2); 48 | if ishandle(hmsg) 49 | close(hmsg); 50 | end 51 | end 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /inst/properties/isStable.m: -------------------------------------------------------------------------------- 1 | function flag = isStable(C,P) 2 | 3 | %{ 4 | Input parameter: C, which is a 6*6 Stifness matrix. 5 | Out parameter: flag, If stable, flag = true; else, flag = false. 6 | 7 | The necessary and sufficient stability conditions for single crystal: 8 | Refs: 9 | [1] T.C.T. TING, Anisotropic Elasticity: Theory and Applications (Oxford University Press,1996, Page 18-21). 10 | [2] F��lix Mouhat and Francois-Xavier Coudert, PHYSICAL REVIEW B 90, 224104 (2014). 11 | [3] G V Sin��ko and N A Smirnov 2002 J. Phys.: Condens. Matter 14 6989. 12 | %} 13 | if P > 1e-4 14 | pC = triu(C,0); 15 | pC(1,1) = C(1,1)-P; 16 | pC(2,2) = C(2,2)-P; 17 | pC(3,3) = C(3,3)-P; 18 | pC(4,4) = 4*(C(4,4)-P); 19 | pC(5,5) = 4*(C(5,5)-P); 20 | pC(6,6) = 4*(C(6,6)-P); 21 | pC(1,2) = C(1,2)+P; 22 | pC(1,3) = C(1,3)+P; 23 | pC(2,3) = C(2,3)+P; 24 | pC(1,4:6) = 2*C(1,4:6); 25 | pC(2,4:6) = 2*C(2,4:6); 26 | pC(3,4:6) = 2*C(3,4:6); 27 | pC(4,5:6) = 4*C(4,5:6); 28 | pC(5,6) = 4*C(5,6); 29 | % Constructing symmetric matrix 30 | C = pC+triu(pC,1)'; 31 | end 32 | det1 = det(C(1,1)); 33 | det2 = det(C(1:2,1:2)); 34 | det3 = det(C(1:3,1:3)); 35 | det4 = det(C(1:4,1:4)); 36 | det5 = det(C(1:5,1:5)); 37 | det6 = det(C); 38 | D = [det1 det2 det3 det4 det5 det6]; 39 | cond1 = isAllPositive(D); 40 | E = eig(C); 41 | cond2 = isAllPositive(E); 42 | 43 | flag = cond1&&cond2; 44 | -------------------------------------------------------------------------------- /inst/tools/demo.m: -------------------------------------------------------------------------------- 1 | 2 | % % The lattice constants 3 | % %% trigonal crystal system 4 | % latconts = [4.5 3.6 4.2 80 45 72]; % a, b, c, alpha, beta, gamma 5 | % % The Miller indices of the crystal direction 6 | % hkl = [1 0 1]; 7 | 8 | %% Cubic crystal system 9 | latconts = [4.5 4.5 4.5 90 90 90]; % a, b, c, alpha, beta, gamma 10 | % The Miller indices of the crystal direction 11 | hkl = [2 0 1]; 12 | 13 | [h,k,l] = deal(hkl(1),hkl(2),hkl(3)); 14 | % One of the planes perpendicular to the direction [hkl] 15 | Pmiller = dir2Plane(latconts,hkl); 16 | 17 | % Display the Miller indices of the plane 18 | disp(['The Miller indices of the plane perpendicular to the [',... 19 | num2str(h),' ', num2str(k),' ', num2str(l),... 20 | '] direction are [',... 21 | num2str(Pmiller(1)), ' ',num2str(Pmiller(2)), ' ',num2str(Pmiller(3)), '].']); 22 | -------------------------------------------------------------------------------- /inst/tools/dir2Plane.m: -------------------------------------------------------------------------------- 1 | function Phkl = dir2Plane(latconts,hkl) 2 | %{ 3 | ========================== Calculate a plane perpendicular to the direction [hkl] ================================ 4 | Input parameter: 5 | latconts: [a, b, c, alpha, beta, gamma], the lattice constants. 6 | hkl: [h,k,l], the Miller indices of the crystal direction. 7 | Out parameter: 8 | Phkl: One of the planes perpendicular to the direction [hkl] 9 | Note: Phkl is not an integer array in most cases, so if you need to convert it to an integer, please do your own calculations. 10 | %} 11 | 12 | 13 | [a,b,c,alpha,beta,gamma] = deal(latconts(1),latconts(2),latconts(3),latconts(4),latconts(5),latconts(6)); 14 | % Convert the lattice constants to Cartesian coordinates 15 | a1 = a; 16 | a2 = 0; 17 | a3 = 0; 18 | 19 | b1 = b*cosd(gamma); 20 | b2 = b*sind(gamma); 21 | b3 = 0; 22 | 23 | c1 = c*cosd(beta); 24 | c2 = c*(cosd(alpha)-cosd(beta)*cosd(gamma))/sind(gamma); 25 | c3 = sqrt(c^2-c1^2-c2^2); 26 | 27 | % Convert the direction [hkl] to Cartesian coordinates 28 | [h,k,l] = deal(hkl(1),hkl(2),hkl(3)); 29 | g1 = h*a1 + k*b1 + l*c1; 30 | g2 = h*a2 + k*b2 + l*c2; 31 | g3 = h*a3 + k*b3 + l*c3; 32 | 33 | % Find a vector that is perpendicular to the direction [hkl] using the cross product 34 | u = cross([g1, g2, g3], rand(1,3)); 35 | 36 | % Find another vector that is perpendicular to both the direction [hkl] and the vector u using the cross product 37 | v = cross([g1, g2, g3], u); 38 | 39 | % Normalize the vectors u and v to unit vectors 40 | u = u/norm(u); 41 | v = v/norm(v); 42 | 43 | % Calculate the normal vector to the plane 44 | n = cross(u, v); 45 | 46 | % Normalize the normal vector to a unit vector 47 | n = n/norm(n); 48 | 49 | % Calculate the Miller indices of the plane 50 | Phkl = [n(1)/a, n(2)/b, n(3)/c]; 51 | -------------------------------------------------------------------------------- /inst/uninstall_VELAS.m: -------------------------------------------------------------------------------- 1 | % uninstall VELAS automatically using the [rvpath] function. 2 | try 3 | if isempty(which('velasGUI')) 4 | rmpath(fullfile(pwd)); 5 | rmpath(fullfile(pwd,'basic')); 6 | rmpath(fullfile(pwd,'drawing')); 7 | rmpath(fullfile(pwd,'GUI')); 8 | rmpath(fullfile(pwd,'mpapi')); 9 | rmpath(fullfile(pwd,'properties')); 10 | else 11 | velaspath = fileparts(which('velasGUI')); 12 | rmpath(fullfile(velaspath)); 13 | rmpath(fullfile(velaspath,'basic')); 14 | rmpath(fullfile(velaspath,'drawing')); 15 | rmpath(fullfile(velaspath,'GUI')); 16 | rmpath(fullfile(velaspath,'mpapi')); 17 | rmpath(fullfile(velaspath,'properties')); 18 | end 19 | disp('VELAS uninstall finished!'); 20 | disp('Thank you for your use and support! If you have any suggestions or comments on VELAS, please email us.'); 21 | disp('Email: ranzheng@outlook.com'); 22 | catch 23 | disp('There is a problem with the [rmpath] function. Please add the path manually according to the VELAS Manual.'); 24 | end 25 | 26 | -------------------------------------------------------------------------------- /inst/velasPlot.m: -------------------------------------------------------------------------------- 1 | 2 | warning off; 3 | 4 | clear; clc; close all; 5 | 6 | vsplot.doplot = true; % doplot should always be true. 7 | 8 | %% print setting 9 | % pic path 10 | vsplot.doprint = false; % true or false 11 | vsplot.dpi = 300; % Resolution, this value is not the real DPI, just control the size of pic. 12 | 13 | % Spherical Unit 3D plot 14 | vsplot.dounitsph = false; % true or false 15 | 16 | % map projection 17 | vsplot.domap = true; % true or false 18 | vsplot.mpmodel = 'Mollweide'; % flag = {'Gall-Peters','Robinson','Hammer-Aitoff','Mollweide'}; 19 | vsplot.nmesh = 7; 20 | vsplot.cmap = 'viridis'; 21 | vsplot.flipflag = false; % determine whether to flip the colormap, flipflag = false (Default). 22 | vsplot.lineStyle = '--'; 23 | 24 | %% Basic setting 25 | % Gridline setting 26 | vsplot.gridSwitch2D = 'off'; 27 | vsplot.gridSwitch3D = 'off'; 28 | 29 | % Font setting 30 | vsplot.fontname = 'Times New Roman'; 31 | vsplot.fontweight = 'bold'; 32 | vsplot.fontangle = 'normal'; 33 | vsplot.fontcolor = 'k'; 34 | vsplot.fontsize = 13; 35 | vsplot.mpfontcolor = [0 0 0]; % Set the xticklabel color of the map projection, black [0 0 0]. 36 | 37 | plotUI(vsplot); 38 | -------------------------------------------------------------------------------- /inst/velasScript.m: -------------------------------------------------------------------------------- 1 | 2 | clc;clear;close all; 3 | format long; 4 | % maximum(blue), minimum positive (green) and minimum negative(red) 5 | global VELAS 6 | 7 | VELAS.uiname = 'VELAS'; 8 | 9 | [filen, pathn] = uigetfile({'*.txt'},'Select input file.','MultiSelect','on'); 10 | if isequal(filen,0) 11 | errordlg('No file selected.','VELAS reminder'); 12 | else 13 | len = length(filen); 14 | for k = 1:len 15 | fname = filen{k}; 16 | % matnameInput = strrep(fname,'.txt','Input.mat'); 17 | % matnameOutput = strrep(fname,'.txt','Output.mat'); 18 | filename = strcat(pathn,fname); 19 | % inmatname = strcat(pathn,matnameInput); 20 | % outmatname = strcat(pathn,matnameOutput); 21 | try % If VELAS is not installed, it will be installed automatically using install_VELAS function. 22 | R = initOutput(); 23 | catch 24 | install_VELAS; 25 | pause(0.5); 26 | R = initOutput(); 27 | end 28 | inputData = getInput(filename); 29 | % save input 30 | % save(inmatname,'inputData'); 31 | checkStability(inputData,R); 32 | % save output 33 | % save(outmatname,'outputData'); 34 | end 35 | end 36 | 37 | -------------------------------------------------------------------------------- /velas.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: "package" 3 | permalink: "velas/" 4 | description: >- 5 | VELAS is a user-friendly open-source toolbox for the visualization and 6 | analysis of elastic anisotropy written in GNU Octave that can be used 7 | for any crystal symmetry. 8 | icon: "https://github.com/ranzhengcode/VELAS/blob/main/doc/velasLogo.png" 9 | links: 10 | - icon: "far fa-copyright" 11 | label: "GPL-3.0-or-later" 12 | url: "https://github.com/ranzhengcode/VELAS/blob/main/LICENSE" 13 | - icon: "fas fa-rss" 14 | label: "news" 15 | url: "https://github.com/ranzhengcode/VELAS/blob/main/NEWS" 16 | - icon: "fas fa-code-branch" 17 | label: "repository" 18 | url: "https://github.com/ranzhengcode/VELAS" 19 | - icon: "fas fa-th-list" 20 | label: "function reference" 21 | url: "https://github.com/ranzhengcode/VELAS/tree/main/doc" 22 | - icon: "fas fa-bug" 23 | label: "report a problem" 24 | url: "https://github.com/ranzhengcode/VELAS/issues" 25 | maintainers: 26 | - name: "Ran Zheng" 27 | contact: "ranzheng@outlook.com" 28 | versions: 29 | - id: "1.0.6" 30 | date: "2023-09-05" 31 | sha256: "f9ffe416518188bda27b2b31f86eb47f4c90327bdaab0fe7578a33a4dfa7fa5f" 32 | url: "https://github.com/ranzhengcode/VELAS/archive/refs/tags/v1.0.6.tar.gz" 33 | depends: 34 | - "octave (>= 5.2.0)" 35 | - "pkg" 36 | --- 37 | --------------------------------------------------------------------------------