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
c03f9c50
Commit
c03f9c50
authored
5 years ago
by
Mark Driver
Browse files
Options
Downloads
Patches
Plain Diff
update to CLI adding extra subparser and updating help information.
parent
ceea4b6a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
phasecalculator/phasecalculatorcli.py
+50
-4
50 additions, 4 deletions
phasecalculator/phasecalculatorcli.py
with
50 additions
and
4 deletions
phasecalculator/phasecalculatorcli.py
+
50
−
4
View file @
c03f9c50
...
...
@@ -22,17 +22,21 @@ Script with CLI for phasecalculator.
import
logging
import
argparse
import
textwrap
import
phasecalculator.runners.phasecalculatorrunner
as
phasecrun
import
phasecalculator.io.systemcollectionprocessor
as
sysproc
import
phasecalculator.io.phasecsvconverter
as
csvconv
from
phasecalculator.classes.runtimeinformation
import
RuntimeInformation
from
phasecalculator.classes.outputinformation
import
OutputInformation
from
phasecalculator.classes.system
import
System
,
SystemCollection
import
puresolventinformation.information
as
pureinf
logging
.
basicConfig
()
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
.
setLevel
(
logging
.
WARN
)
INFO_LOGGER
=
logging
.
getLogger
(
__name__
)
INFO_LOGGER
.
setLevel
(
logging
.
INFO
)
def
main
():
"""
Main function run when program called.
...
...
@@ -236,6 +240,27 @@ def run_system_collection(system_collection, **kwargs):
for
system_info
in
system_collection
.
system_list
:
phasecrun
.
run_all_analysis
(
system_info
,
**
kwargs
)
def
get_acceptable_solvent_names
():
"""
Get Acceptable solvent names.
Returns
-------
Str
Solvent names, formatted 1 per line.
"""
solvent_names
=
pureinf
.
get_name_inchikey_mapping
().
keys
()
return
"
\n
"
.
join
(
solvent_names
)
def
solvent_names
(
args
):
"""
Output solvent names by using a logger.
Returns
-------
None.
"""
INFO_LOGGER
.
info
(
"
Solvent names:
\n
%s
"
,
get_acceptable_solvent_names
())
def
create_phasecalculator_argparser
():
"""
Create Argument parser for Phasecalculator module.
...
...
@@ -247,7 +272,7 @@ def create_phasecalculator_argparser():
"""
description
=
"""
Phase Calculator provides methods to perform FGIP,
similarity and VLE analysis for solvents.
"""
epilog
=
"""
E
xample usage
"""
epilog
=
"""
For e
xample usage
see submodule help
"""
phase_argparser
=
argparse
.
ArgumentParser
(
description
=
description
,
epilog
=
epilog
,
...
...
@@ -257,7 +282,11 @@ similarity and VLE analysis for solvents."""
subparsers
=
phase_argparser
.
add_subparsers
(
title
=
"
commands
"
,
dest
=
"
command
"
)
calc_description
=
"""
Calculation runner based on input System XML.
"""
calc_epilog
=
""""""
calc_epilog
=
textwrap
.
dedent
(
"""
Example Usage:
python -m phasecalculator calculate -f systemcollection.xml
Where systemcollection.xml was generated with inpgen. For large phase sets you need to set memreq to match your current hardware limit.
"""
)
calc_argparser
=
subparsers
.
add_parser
(
"
calculate
"
,
...
...
@@ -283,7 +312,13 @@ similarity and VLE analysis for solvents."""
calc_argparser
.
set_defaults
(
func
=
process_phasecalculator
)
inpgen_description
=
"""
Input SystemCollection XML generation.
"""
inpgen_epilog
=
""""""
inpgen_epilog
=
textwrap
.
dedent
(
"""
\
Example usage:
python -m phasecalculator inpgen -p $CONDA_PREFIX/lib/python3.7/site-packages/phasecalculator/test/resources/examplephasecomp.csv -f -j PATH_TO_JAR
Where PATH_TO_JAR is replaced with the SSIP phasetransfer jar file location.
"""
)
inpgen_argparser
=
subparsers
.
add_parser
(
"
inpgen
"
,
...
...
@@ -323,7 +358,18 @@ similarity and VLE analysis for solvents."""
"
-v
"
,
"
--vle
"
,
action
=
"
store_true
"
,
help
=
"
Calculate VLE for input solvents
"
)
inpgen_argparser
.
add_argument
(
"
--filename
"
,
type
=
str
,
default
=
"
systemcollection.xml
"
"
--filename
"
,
type
=
str
,
default
=
"
systemcollection.xml
"
,
help
=
"
filename for XML file.
"
,
)
inpgen_argparser
.
set_defaults
(
func
=
process_inputgen
)
solvname_description
=
"""
Display acceptable solvent molecule names for inclusion in a phases csv file.
"""
solvnames_epilog
=
"
Solvent molecule names:
\n
"
+
get_acceptable_solvent_names
()
+
"
\n
"
solvent_nameparser
=
subparsers
.
add_parser
(
"
solventnames
"
,
description
=
solvname_description
,
epilog
=
solvnames_epilog
,
help
=
"
Get list of aceptable pure solvent names.
"
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
)
solvent_nameparser
.
set_defaults
(
func
=
solvent_names
)
return
phase_argparser
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