FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
phasecalculator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
Hunter Group
SSIPtools
SSIMPLEapps
phasecalculator
Commits
31e2da19
Commit
31e2da19
authored
5 years ago
by
Mark Driver
Browse files
Options
Downloads
Patches
Plain Diff
doc update.
parent
b1acdfa1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
phasecalculator/phasecalculatorcli.py
+145
-5
145 additions, 5 deletions
phasecalculator/phasecalculatorcli.py
with
145 additions
and
5 deletions
phasecalculator/phasecalculatorcli.py
+
145
−
5
View file @
31e2da19
...
@@ -35,6 +35,14 @@ LOGGER.setLevel(logging.WARN)
...
@@ -35,6 +35,14 @@ LOGGER.setLevel(logging.WARN)
def
main
():
def
main
():
"""
Main function run when program called.
Returns
-------
None
Process result.
"""
# Create parser
# Create parser
parser
=
create_phasecalculator_argparser
()
parser
=
create_phasecalculator_argparser
()
# parse args
# parse args
...
@@ -42,14 +50,51 @@ def main():
...
@@ -42,14 +50,51 @@ def main():
return
process_args
(
args
)
return
process_args
(
args
)
def
process_args
(
args
):
def
process_args
(
args
):
"""
Process CLI Arguments.
Parameters
----------
args : argparse.Namespace
Arguments from reading command line.
Returns
-------
None
Process result.
"""
return
args
.
func
(
args
)
return
args
.
func
(
args
)
def
process_inputgen
(
args
):
def
process_inputgen
(
args
):
"""
Process arguments to run input file creation for phase calculation.
Parameters
----------
args : argparse.Namespace
Arguments from reading command line.
Returns
-------
None.
"""
output_filename
=
args
.
filename
output_filename
=
args
.
filename
system_collection
=
create_system_collection
(
args
)
system_collection
=
create_system_collection
(
args
)
sysproc
.
write_system_collection_file
(
system_collection
,
output_filename
)
sysproc
.
write_system_collection_file
(
system_collection
,
output_filename
)
def
process_phasecalculator
(
args
):
def
process_phasecalculator
(
args
):
"""
Process arguments to run phase calculation.
Parameters
----------
args : argparse.Namespace
Arguments from reading command line.
Returns
-------
None.
"""
xml_filename
=
args
.
file
xml_filename
=
args
.
file
system_collection
=
read_calculator_xml
(
xml_filename
)
system_collection
=
read_calculator_xml
(
xml_filename
)
if
args
.
memreq
is
not
None
:
if
args
.
memreq
is
not
None
:
...
@@ -58,6 +103,19 @@ def process_phasecalculator(args):
...
@@ -58,6 +103,19 @@ def process_phasecalculator(args):
run_system_collection
(
system_collection
)
run_system_collection
(
system_collection
)
def
create_system_collection
(
args
):
def
create_system_collection
(
args
):
"""
Create SystemCollection from input arguments
Parameters
----------
args : argparse.Namespace
Arguments from argparse read of command line input.
Returns
-------
SystemCollection
SystemCollection.
"""
phases
=
read_phasecsv
(
args
.
phases
)
phases
=
read_phasecsv
(
args
.
phases
)
jar_path
=
args
.
jar
jar_path
=
args
.
jar
scratch_dir
=
args
.
scratch
scratch_dir
=
args
.
scratch
...
@@ -72,22 +130,105 @@ def create_system_collection(args):
...
@@ -72,22 +130,105 @@ def create_system_collection(args):
return
SystemCollection
([
system
])
return
SystemCollection
([
system
])
def
create_output_inf
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
):
def
create_output_inf
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
):
"""
Create OutputInformation
Parameters
----------
fgip_output : bool
FGIP output result.
similarity_output : bool
Similarity output result.
similarity_output_type : str
Output type, see schema for restriction.
vle_output : bool
VLE output result.
Returns
-------
OutputInformation
Output information for calculation.
"""
return
OutputInformation
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
)
return
OutputInformation
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
)
def
create_runtime_inf
(
jar_path
,
scratch_dir
,
output_dir
):
def
create_runtime_inf
(
jar_path
,
scratch_dir
,
output_dir
):
"""
Create RuntimeInformation
Parameters
----------
jar_path : str
Jar file location.
scratch_dir : str
Scratch directory path.
output_dir : str
Output directory path.
Returns
-------
RuntimeInformation
Runtime information for calculation.
"""
return
RuntimeInformation
(
jar_path
,
scratch_dir
,
output_dir
)
return
RuntimeInformation
(
jar_path
,
scratch_dir
,
output_dir
)
def
read_calculator_xml
(
xml_filename
):
def
read_calculator_xml
(
xml_filename
):
"""
Read SystemCollection XML.
Parameters
----------
xml_filename : str
filename for SystemCollection XML.
Returns
-------
SystemCollection
System collection for calculations to run.
"""
return
sysproc
.
read_system_collection_file
(
xml_filename
)
return
sysproc
.
read_system_collection_file
(
xml_filename
)
def
read_phasecsv
(
csv_filename
):
def
read_phasecsv
(
csv_filename
):
"""
Read CSV file containing phase infomration and create Phases object.
Parameters
----------
csv_filename : str
phase information CSV file.
Returns
-------
Phases
Phases representation of information.
"""
return
csvconv
.
convert_csv_file_to_phases
(
csv_filename
)
return
csvconv
.
convert_csv_file_to_phases
(
csv_filename
)
def
run_system_collection
(
system_collection
,
**
kwargs
):
def
run_system_collection
(
system_collection
,
**
kwargs
):
"""
Run all systems in collection.
Parameters
----------
system_collection : SystemCollection
system collection.
memory_req : str, optional
Memory settings for jar executable. The default is None.
Returns
-------
None.
"""
for
system_info
in
system_collection
.
system_list
:
for
system_info
in
system_collection
.
system_list
:
phasecrun
.
run_all_analysis
(
system_info
,
**
kwargs
)
phasecrun
.
run_all_analysis
(
system_info
,
**
kwargs
)
def
create_phasecalculator_argparser
():
def
create_phasecalculator_argparser
():
"""
Create Argument parser for Phasecalculator module.
Returns
-------
ArgumentParser
"""
description
=
"""
Phase Calculator provides methods to perform FGIP,
description
=
"""
Phase Calculator provides methods to perform FGIP,
similarity and VLE analysis for solvents.
"""
similarity and VLE analysis for solvents.
"""
epilog
=
"""
Example usage
"""
epilog
=
"""
Example usage
"""
...
@@ -96,19 +237,18 @@ similarity and VLE analysis for solvents."""
...
@@ -96,19 +237,18 @@ similarity and VLE analysis for solvents."""
conflict_handler
=
'
resolve
'
,
conflict_handler
=
'
resolve
'
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
subparsers
=
phase_argparser
.
add_subparsers
(
title
=
"
commands
"
,
dest
=
"
command
"
)
subparsers
=
phase_argparser
.
add_subparsers
(
title
=
"
commands
"
,
dest
=
"
command
"
)
calc_description
=
"""
Calculation runner based on input System XML.
"""
calc_description
=
"""
Calculation runner based on input System XML.
"""
calc_epilog
=
""""""
calc_epilog
=
""""""
calc_argparser
=
subparsers
.
add_parser
(
"
calculate
"
,
description
=
calc_description
,
calc_argparser
=
subparsers
.
add_parser
(
"
calculate
"
,
description
=
calc_description
,
epilog
=
calc_epilog
,
epilog
=
calc_epilog
,
help
=
"
calculate phase properties.
"
,
help
=
"
calculate phase properties.
"
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
calc_argparser
.
add_argument
(
"
-i
"
,
"
-f
"
,
"
--file
"
,
type
=
str
,
required
=
True
,
calc_argparser
.
add_argument
(
"
-i
"
,
"
-f
"
,
"
--file
"
,
type
=
str
,
required
=
True
,
help
=
""
)
help
=
"
filename for SystemCollectionXML
"
)
calc_argparser
.
add_argument
(
"
--memreq
"
,
type
=
str
,
default
=
None
,
calc_argparser
.
add_argument
(
"
--memreq
"
,
type
=
str
,
default
=
None
,
help
=
""
)
help
=
"
memory specifier for jar call. Defaults to system default.
"
)
calc_argparser
.
set_defaults
(
func
=
process_phasecalculator
)
calc_argparser
.
set_defaults
(
func
=
process_phasecalculator
)
inpgen_description
=
"""
Input SystemCollection XML generation.
"""
inpgen_description
=
"""
Input SystemCollection XML generation.
"""
...
...
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