From e5aaf440ca73762aab9a2d5eccf74dcea2651b45 Mon Sep 17 00:00:00 2001 From: massgh Date: Tue, 26 Apr 2022 14:29:41 -0400 Subject: [PATCH] 1.9.5 --- Vasp2Visual/Vasp2Visual.psd1 | 2 +- Vasp2Visual/Version2/GeneralFunctions.psm1 | 17 +++++------------ Vasp2Visual/Version2/PlotXml.psm1 | 7 +------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Vasp2Visual/Vasp2Visual.psd1 b/Vasp2Visual/Vasp2Visual.psd1 index 9f47fa5..f5b3965 100644 --- a/Vasp2Visual/Vasp2Visual.psd1 +++ b/Vasp2Visual/Vasp2Visual.psd1 @@ -12,7 +12,7 @@ RootModule = 'RootModule.psm1' # Version number of this module. -ModuleVersion = '1.9.4.0' +ModuleVersion = '1.9.5.0' # Supported PSEditionsls diff --git a/Vasp2Visual/Version2/GeneralFunctions.psm1 b/Vasp2Visual/Version2/GeneralFunctions.psm1 index 4086c66..0a23caf 100644 --- a/Vasp2Visual/Version2/GeneralFunctions.psm1 +++ b/Vasp2Visual/Version2/GeneralFunctions.psm1 @@ -96,22 +96,15 @@ function Get-POSCAR { $var_dict = $var_dict.Replace(")", $rep) } Write-Host "Use Pivotpy in Python for full functionality!" -ForegroundColor Yellow - $py_str = "vd = {1}`nfrom pivotpy.api import download_structure`ngp = download_structure('{0}',**vd).poscars`n" -f $Formula, $var_dict - $py_str += "import json`ns=json.dumps([{k:v for k,v in _g.to_dict().items() if 'write' not in k} for _g in gp])`nprint(s)" + $py_str = "vd = {1}`nfrom pivotpy.api import download_structure`noutput = download_structure('{0}',**vd)`n" -f $Formula, $var_dict + $py_str += "import json`ns=json.dumps([_g.export_poscar().text_plain for _g in output])`nprint(s)" Write-Host $py_str # Run it finally Using Default python on System preferably. - if($null -ne (Get-Command python3* -ErrorAction SilentlyContinue)){ - Write-Host ("Running using {0}" -f (python3 -V)) -ForegroundColor Green - $json = $py_str | python3 - ConvertFrom-Json $json - }elseif($null -ne (Get-Command python -ErrorAction SilentlyContinue)){ + if($null -ne (Get-Command python -ErrorAction SilentlyContinue)){ Write-Host ("Running using {0}" -f (python -V)) -ForegroundColor Green - $json = $py_str | python - ConvertFrom-Json $json - }elseif($null -ne (Get-Command pytnon2* -ErrorAction SilentlyContinue)){ - Write-Host ("Required Python >= 3.6, but {0} found, try upgrading Python." -f (python2 -V)) -ForegroundColor Red + $py_str | python | ConvertFrom-Json }else{ - Write-Host "Python Installation not found. Copy code below and run yourself or use '-SavePyFile'." -ForegroundColor Red + Write-Host "Python Installation not found. Copy code below and run yourself with a python executable" -ForegroundColor Red Write-Host $py_str -ForegroundColor Yellow } } diff --git a/Vasp2Visual/Version2/PlotXml.psm1 b/Vasp2Visual/Version2/PlotXml.psm1 index ead2c9d..19d289f 100644 --- a/Vasp2Visual/Version2/PlotXml.psm1 +++ b/Vasp2Visual/Version2/PlotXml.psm1 @@ -129,14 +129,9 @@ function New-Figure { if($PSBoundParameters.ContainsKey('SavePyFile')){$init | Set-Content $SavePyFile} Write-Host "Running Following Code`n--------------------------`n" $init "`n" -ForegroundColor Cyan # Run it finally Using Default python on System preferably. - if($null -ne (Get-Command python3* -ErrorAction SilentlyContinue)){ - Write-Host ("Running using {0}" -f (python3 -V)) -ForegroundColor Green - $init | python3 - }elseif($null -ne (Get-Command python -ErrorAction SilentlyContinue)){ + if($null -ne (Get-Command python -ErrorAction SilentlyContinue)){ Write-Host ("Running using {0}" -f (python -V)) -ForegroundColor Green $init | python - }elseif($null -ne (Get-Command pytnon2* -ErrorAction SilentlyContinue)){ - Write-Host ("Required Python >= 3.6, but {0} found, try upgrading Python." -f (python2 -V)) -ForegroundColor Red }else{ Write-Host "Python Installation not found. Copy code below and run yourself or use '-SavePyFile'." -ForegroundColor Red Write-Host $init -ForegroundColor Yellow