This repository has been archived by the owner on Apr 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from simphony/feature-material-relation
Feature material relation
- Loading branch information
Showing
25 changed files
with
1,225 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.. auto-generated by material_relations_generate.py script. | ||
.. rubric:: Material relations | ||
|
||
.. currentmodule:: simphony.cuds.material_relations | ||
|
||
.. autosummary:: | ||
|
||
~lennard_jones.LennardJones | ||
~coulomb.Coulomb | ||
|
||
.. rubric:: Implementation | ||
|
||
|
||
.. automodule:: simphony.cuds.material_relations.lennard_jones | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. automodule:: simphony.cuds.material_relations.coulomb | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. auto-generated by material_relations_generate.py script. | ||
============= ======================= ================================================================================================================================ ============================== ======================================================================= | ||
Key Class Description Allowed lengths of materials Supported parameters | ||
============= ======================= ================================================================================================================================ ============================== ======================================================================= | ||
LENNARD_JONES :class:`~.LennardJones` Approximated potential energy of interaction between a pair of neutral atoms or molecules based on their distance of separation. [1, 2] CUBA.CUTOFF_DISTANCE, CUBA.ENERGY_WELL_DEPTH, CUBA.VAN_DER_WAALS_RADIUS | ||
COULOMB :class:`~.Coulomb` Effective potential energy of the interaction between a pair of point charges. [1, 2] CUBA.CUTOFF_DISTANCE, CUBA.DIELECTRIC_CONSTANT | ||
============= ======================= ================================================================================================================================ ============================== ======================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@startuml | ||
class MaterialRelation { | ||
kind: CUDSMaterialRelation | ||
name: str | ||
materials: uuid.UUID[] | ||
parameters: DataContainer | ||
description: str | ||
supported_parameters: CUBA[] | ||
allowed_number_materials: int[] | ||
} | ||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# auto-generated by the material_relations_generate.py script. | ||
from enum import IntEnum, unique | ||
|
||
|
||
@unique | ||
class CUDSMaterialRelation(IntEnum): | ||
|
||
LENNARD_JONES = 1 | ||
COULOMB = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# code auto-generated by the material_relations_generate.py script. | ||
from collections import namedtuple | ||
|
||
from simphony.core.cuba import CUBA | ||
from simphony.core.cuds_material_relation import CUDSMaterialRelation | ||
|
||
|
||
ATTRIBUTES = [ | ||
"number", "class_name", "allowed_number_materials", | ||
"doc_description", "supported_parameters"] | ||
Material_Relation_Definition = namedtuple("Material_Relation_Definition", | ||
ATTRIBUTES) | ||
|
||
Parameter = namedtuple("Parameter", ["cuba_key", "default_value"]) | ||
|
||
|
||
MATERIAL_RELATION_DEFINITIONS = { | ||
CUDSMaterialRelation.LENNARD_JONES: Material_Relation_Definition( | ||
class_name='LennardJones', | ||
number=1, | ||
allowed_number_materials=[1, 2], | ||
doc_description='Approximated potential energy of interaction between a pair of neutral atoms or molecules based on their distance of separation.', # noqa | ||
supported_parameters=[ | ||
Parameter(cuba_key=CUBA.CUTOFF_DISTANCE, | ||
default_value=1.0), | ||
Parameter(cuba_key=CUBA.ENERGY_WELL_DEPTH, | ||
default_value=1.0), | ||
Parameter(cuba_key=CUBA.VAN_DER_WAALS_RADIUS, | ||
default_value=1.0), ] | ||
), | ||
CUDSMaterialRelation.COULOMB: Material_Relation_Definition( | ||
class_name='Coulomb', | ||
number=2, | ||
allowed_number_materials=[1, 2], | ||
doc_description='Effective potential energy of the interaction between a pair of point charges.', # noqa | ||
supported_parameters=[ | ||
Parameter(cuba_key=CUBA.CUTOFF_DISTANCE, | ||
default_value=1.0), | ||
Parameter(cuba_key=CUBA.DIELECTRIC_CONSTANT, | ||
default_value=1.0), ] | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- key: LENNARD_JONES | ||
number: 1 | ||
class_name : LennardJones | ||
allowed_number_materials: [1, 2] | ||
doc_description: Approximated potential energy of interaction between a pair of neutral atoms or molecules based on their distance of separation. | ||
supported_parameters: | ||
- cuba: CUBA.CUTOFF_DISTANCE | ||
default: 1.0 | ||
- cuba: CUBA.ENERGY_WELL_DEPTH | ||
default: 1.0 | ||
- cuba: CUBA.VAN_DER_WAALS_RADIUS | ||
default: 1.0 | ||
- key: COULOMB | ||
number: 2 | ||
class_name : Coulomb | ||
allowed_number_materials: [1, 2] | ||
doc_description: Effective potential energy of the interaction between a pair of point charges. | ||
supported_parameters: | ||
- cuba: CUBA.CUTOFF_DISTANCE | ||
default: 1.0 | ||
- cuba: CUBA.DIELECTRIC_CONSTANT | ||
default: 1.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# code auto-generated by material_relations_generate.py | ||
from simphony.cuds.material_relations.material_relation import ( | ||
MaterialRelation) | ||
from simphony.core.cuba import CUBA | ||
from simphony.core.cuds_material_relation import CUDSMaterialRelation | ||
from simphony.core.data_container import DataContainer | ||
|
||
|
||
class Coulomb(MaterialRelation): | ||
|
||
""" A Coulomb material-relation | ||
Effective potential energy of the interaction between a pair of point charges. | ||
Attributes | ||
---------- | ||
cutoff_distance : <type 'numpy.float64'> | ||
Distance where force is no longer taken into account. | ||
dielectric_constant : <type 'numpy.float64'> | ||
Ratio of the permittivity of a substance to the permittivity of free space or vacuum | ||
""" # noqa | ||
|
||
def __init__( | ||
self, | ||
name, | ||
materials, | ||
description="", | ||
cutoff_distance=1.0, | ||
dielectric_constant=1.0 | ||
): | ||
super(Coulomb, self).__init__( | ||
name=name, | ||
description=description, | ||
kind=CUDSMaterialRelation.COULOMB, | ||
materials=materials, | ||
parameters=DataContainer({ | ||
CUBA.CUTOFF_DISTANCE: cutoff_distance, | ||
CUBA.DIELECTRIC_CONSTANT: dielectric_constant, | ||
}) | ||
) | ||
|
||
@property | ||
def cutoff_distance(self): | ||
return self._parameters[CUBA.CUTOFF_DISTANCE] | ||
|
||
@cutoff_distance.setter | ||
def cutoff_distance(self, value): | ||
self._parameters[CUBA.CUTOFF_DISTANCE] = value | ||
|
||
@property | ||
def dielectric_constant(self): | ||
return self._parameters[CUBA.DIELECTRIC_CONSTANT] | ||
|
||
@dielectric_constant.setter | ||
def dielectric_constant(self, value): | ||
self._parameters[CUBA.DIELECTRIC_CONSTANT] = value |
Oops, something went wrong.