Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-quasi-harmonic-properties
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-quasi-harmonic-properties
Commits
57c4b80e
Commit
57c4b80e
authored
8 years ago
by
Mohamed, Fawzi Roberto (fawzi)
Browse files
Options
Downloads
Patches
Plain Diff
Henrik's initial version of quasi harmonic parser
parents
Branches
Branches containing commit
Tags
0.0.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-quasi-harmonic-properties/qhp.py
+72
-0
72 additions, 0 deletions
parser/parser-quasi-harmonic-properties/qhp.py
with
72 additions
and
0 deletions
parser/parser-quasi-harmonic-properties/qhp.py
0 → 100644
+
72
−
0
View file @
57c4b80e
import
numpy
as
np
from
nomadcore.unit_conversion.unit_conversion
import
convert_unit_function
from
nomadcore.parser_backend
import
*
from
nomadcore.local_meta_info
import
loadJsonFile
,
InfoKindEl
from
phonopy.units
import
EvTokJmol
,
Kb
as
kBoltzmann
parser_info
=
{
"
name
"
:
"
parser_quasi_harmonic_properties
"
,
"
version
"
:
"
1.0
"
}
path
=
"
../../../../nomad-meta-info/meta_info/nomad_meta_info/quasi-harmonic-properties.nomadmetainfo.json
"
metaInfoPath
=
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
path
))
metaInfoEnv
,
warns
=
loadJsonFile
(
filePath
=
metaInfoPath
,
dependencyLoader
=
None
,
extraArgsHandling
=
InfoKindEl
.
ADD_EXTRA_ARGS
,
uri
=
None
)
def
parse
(
name
):
Parse
=
JsonParseEventsWriterBackend
(
metaInfoEnv
)
Parse
.
startedParsingSession
(
name
,
parser_info
)
sRun
=
Parse
.
openSection
(
"
section_run
"
)
system
=
Parse
.
openSection
(
"
section_system
"
)
Parse
.
addValue
(
"
spacegroup_3D_number
"
,
spacegroup
)
springermat
=
Parse
.
openSection
(
"
section_springer_material
"
)
Parse
.
addValue
(
"
springer_formula
"
,
material
)
Parse
.
closeSection
(
"
section_springer_material
"
,
springermat
)
Parse
.
closeSection
(
"
section_system
"
,
system
)
results
=
Parse
.
openSection
(
"
section_single_configuration_calculation
"
)
sTD
=
Parse
.
openSection
(
"
section_thermodynamical_properties
"
)
fref
=
Parse
.
openSection
(
"
section_calculation_to_folder_refs
"
)
Parse
.
addValue
(
"
calculation_to_folder_kind
"
,
"
folder_containing_calculations
"
)
Parse
.
addValue
(
"
calculation_to_folder_external_url
"
,
name
)
Parse
.
closeSection
(
"
section_calculation_to_folder_refs
"
,
fref
)
Parse
.
addArrayValues
(
"
thermodynamical_property_temperature
"
,
T
)
Parse
.
addArrayValues
(
"
thermodynamical_property_heat_capacity_C_v
"
,
cV
)
Parse
.
addArrayValues
(
"
x_qhp_quasi_harmonic_free_energy
"
,
Free
)
Parse
.
addArrayValues
(
"
x_qhp_quasi_harmonic_bulk_modulus
"
,
B
)
Parse
.
addArrayValues
(
"
x_qhp_quasi_harmonic_volume
"
,
V
)
Parse
.
addArrayValues
(
"
x_qhp_quasi_harmonic_thermal_expansion
"
,
alpha
)
Parse
.
closeSection
(
"
section_thermodynamical_properties
"
,
sTD
)
Parse
.
closeSection
(
"
section_single_configuration_calculation
"
,
results
)
Parse
.
closeSection
(
"
section_run
"
,
sRun
)
Parse
.
finishedParsingSession
(
"
ParseSuccess
"
,
None
)
if
__name__
==
'
__main__
'
:
import
sys
parser
=
argparse
.
ArgumentParser
(
description
=
'
Parses a txt file containing quasi harmonic data.
'
)
parser
.
add_argument
(
'
mainFileUri
'
,
help
=
'
The uri of the main file associated with this calculation.
'
)
parser
.
add_argument
(
'
mainFilePath
'
,
default
=
None
,
help
=
'
The path to the main file associated with this calculation.
'
)
args
=
parser
.
parse_args
()
if
args
.
mainFilePath
:
mainDir
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
args
.
mainFilePath
)))
os
.
chdir
(
mainDir
)
with
open
(
"
Quasiharmonic_properties.txt
"
)
as
qh
:
for
line
in
qh
:
if
"
Quasi-harmonic
"
in
line
:
spacegroup
=
line
.
split
()[
-
1
]
material
=
line
.
split
()[
-
3
]
name
=
args
.
mainFileUri
T
,
V
,
alpha
,
B
,
Free
,
cV
=
np
.
loadtxt
(
"
Quasiharmonic_properties.txt
"
)
cV
=
kBoltzmann
/
JmolToEv
*
cV
cubAtocubm
=
convert_unit_function
(
'
a**3
'
,
'
m**3
'
)
eVpercubAtoJoulespercubm
=
convert_unit_function
(
'
eV*a**-3
'
,
'
joules*m**-3
'
)
eVtoJoules
=
convert_unit_function
(
'
eV
'
,
'
joules
'
)
eVperKtoJoules
=
convert_unit_function
(
'
eV*K**-1
'
,
'
joules*K**-1
'
)
Free
=
eVtoJoules
(
Free
)
V
=
cubAtocubm
(
V
)
B
=
eVpercubAtoJoulespercubm
(
B
)
cV
=
eVperKtoJoules
(
cV
)
parse
(
name
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment