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
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
Hunter Group
SSIPtools
SSIMPLEapps
phasecalculator
Commits
7501532a
Commit
7501532a
authored
5 years ago
by
Mark Driver
Browse files
Options
Downloads
Patches
Plain Diff
update to add check to make sure phases have fully assigned molefractions during initialisation.
parent
4560b4ba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#26093
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
phasecalculator/classes/phase.py
+16
-0
16 additions, 0 deletions
phasecalculator/classes/phase.py
with
16 additions
and
0 deletions
phasecalculator/classes/phase.py
+
16
−
0
View file @
7501532a
...
@@ -55,6 +55,8 @@ class Phase(object):
...
@@ -55,6 +55,8 @@ class Phase(object):
"""
"""
self
.
molecule_list
=
molecule_list
self
.
molecule_list
=
molecule_list
self
.
temperature
=
temperature
self
.
temperature
=
temperature
if
not
self
.
total_molefraction_is_one
():
raise
ValueError
(
"
Total molefractions of phase not equal to one
"
)
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
"""
Overload equality comparison operator.
"""
Overload equality comparison operator.
...
@@ -146,6 +148,20 @@ class Phase(object):
...
@@ -146,6 +148,20 @@ class Phase(object):
"""
"""
return
Temperature
.
parse_xml
(
temperature_xml
)
return
Temperature
.
parse_xml
(
temperature_xml
)
def
total_molefraction_is_one
(
self
):
"""
Calculate total molefraction of the molecule and check this is 1.0.
Returns
-------
bool
True if total molefraction of components is one.
"""
molefraction_total
=
0.0
for
mole_frac
in
self
.
get_molefractions_by_molecule
().
values
():
molefraction_total
+=
mole_frac
return
(
abs
(
1.0
-
molefraction_total
)
<
1e-5
)
def
write_to_xml
(
self
):
def
write_to_xml
(
self
):
"""
Write information to Etree representation of XML.
"""
Write information to Etree representation of XML.
...
...
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