-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic method to set up Monolayer and Solvated Monolayer (#2)
* add basic method to set up monolayer and solvated monolayer * start adding simple tests * Update docstring for most calsses
- Loading branch information
Showing
12 changed files
with
170 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ dependencies: | |
- py3dmol | ||
- python=3.8 | ||
- rdkit | ||
- scipy | ||
- scipy | ||
- pytest |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
from .monolayer import Monolayer | ||
from .monolayer import Monolayer, DualMonolayer | ||
from .solvated_monolayer import SolvatedMonolayer, SolvatedDualMonolayer |
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
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,68 @@ | ||
"""Routines to construct solvated (dual) monolayer.""" | ||
import numpy as np | ||
import mbuild as mb | ||
from mbuild.lib.moieties import H2O | ||
|
||
|
||
class SolvatedMonolayer(mb.Compound): | ||
"""Solvated monolayer system. | ||
Parameters | ||
---------- | ||
monolayer: mb.Compound | ||
The monolayer to be solvated. | ||
solvent: mb.Compound, optional, default=H2O() | ||
The solvent to be used. | ||
n_solvents: int, optional, default=1000 | ||
The number of solvent compounds used. | ||
solvent_box_height: float, optional, default=5 | ||
The height of the solvent box. The base of the box adapt those of the monolayer/surface. | ||
seed: int, optional, default=12345 | ||
Random seed used for any subprocess. | ||
""" | ||
def __init__(self, monolayer, solvent=H2O(), n_solvents=1000, solvent_box_height=5, seed=12345): | ||
super(SolvatedMonolayer, self).__init__() | ||
monolayer_box_lengths = monolayer.get_boundingbox().lengths | ||
solvent_box = [monolayer_box_lengths[0], | ||
monolayer_box_lengths[1], | ||
solvent_box_height] | ||
box_of_solvent = mb.fill_box(compound=solvent, | ||
box=solvent_box, | ||
n_compounds=n_solvents) | ||
box_of_solvent.translate([0, 0, monolayer_box_lengths[2]]) | ||
self.add(monolayer, label="monolayer") | ||
self.add(box_of_solvent, label="solvent") | ||
|
||
|
||
class SolvatedDualMonolayer(mb.Compound): | ||
"""Solvated dual-monolayer system. | ||
Parameters | ||
---------- | ||
dual_monolayer: mb.Compound | ||
The dual-monolayer system to be solvated. | ||
solvent: mb.Compound, optional, default=H2O() | ||
The solvent compound to be used. | ||
n_solvents: int, optional, n=1000 | ||
The number of solvent molecules to be used. | ||
seed: int, optional, default=12345 | ||
Random seed used for any subprocess. | ||
""" | ||
def __init__(self, dual_monolayer, solvent=H2O(), n_solvents=1000, seed=12345): | ||
super(SolvatedDualMonolayer, self).__init__() | ||
top_monolayer = dual_monolayer["top_monolayer"] | ||
top_monolayer_box_lengths = top_monolayer.get_boundingbox().lengths | ||
bottom_monolayer = dual_monolayer["bottom_monolayer"] | ||
bottom_monolayer_box_lengths = bottom_monolayer.get_boundingbox().lengths | ||
dual_monolayer_box_lengths = dual_monolayer.get_boundingbox().lengths | ||
|
||
separation = dual_monolayer_box_lengths[2] - (top_monolayer_box_lengths[2] + bottom_monolayer_box_lengths[2]) | ||
solvent_box = [bottom_monolayer_box_lengths[0], | ||
bottom_monolayer_box_lengths[1], | ||
separation] | ||
box_of_solvent = mb.fill_box(compound=solvent, | ||
box=solvent_box, | ||
n_compounds=n_solvents) | ||
box_of_solvent.translate([0, 0, bottom_monolayer_box_lengths[2]]) | ||
self.add(dual_monolayer, label="monolayers") | ||
self.add(box_of_solvent, label="solvents") |
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,2 @@ | ||
from .silicon_interface import SiliconInterface | ||
from .silica_interface_carve import SilicaInterfaceCarve |
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,12 @@ | ||
import mbuild as mb | ||
from surface_coatings.surfaces import SiliconInterface, SilicaInterfaceCarve | ||
|
||
|
||
class TestSystem(object): | ||
def test_silicon_interface(self): | ||
silicon_surface = SiliconInterface() | ||
assert silicon_surface.periodicity == (True, True, False) | ||
|
||
def test_silica_interface_carve(self): | ||
silica_surface = SilicaInterfaceCarve) | ||
assert silica_surface.periodicity == (True, True, False) |
File renamed without changes.