1
1
"""Recipes to generate surfaces using mBuild."""
2
2
3
+ import mbuild as mb
3
4
from mbuild .compound import Compound
4
5
from mbuild .lattice import Lattice
5
6
7
+ from flowermd .base import Molecule , System
6
8
7
- class Graphene (Compound ):
9
+
10
+ class Graphene (System ):
8
11
"""Create a rectangular graphene layer or multiple layers.
9
12
10
13
Parameters
@@ -15,10 +18,43 @@ class Graphene(Compound):
15
18
Number of times to repeat graphene lattice in the y-direciton.
16
19
n_layers: int, optional, default 1
17
20
Number of times to repeat the complete layer in the normal direction.
21
+ force_field: force_field : flowermd.ForceField
22
+ The force field to be applied to the surface for paramaterizaiton.
23
+ Note that setting `force_field` does not actually apply the forcefield
24
+ to the molecule. The forcefield in this step is mainly used for
25
+ validation purposes.
26
+ reference_values : dict, required
27
+ A dictionary of reference values for the surface. The keys of the
28
+ dictionary are "length", "energy", and "mass". The values of the
29
+ dictionary are unyt quantities.
30
+ r_cut : float, required
31
+ The cutoff radius for the Lennard-Jones interactions.
18
32
periodicity : tuple of bools, length=3, optional, default=(True, True, False) # noqa: E501
19
33
Whether the Compound is periodic in the x, y, and z directions.
20
34
If None is provided, the periodicity is set to `(False, False, False)`
21
35
which is non-periodic in all directions.
36
+ auto_scale : bool, default=False
37
+ Set to true to use reduced simulation units.
38
+ distance, mass, and energy are scaled by the largest value
39
+ present in the system for each.
40
+ scale_charges : bool, default False
41
+ Set to true to scale charges to net zero.
42
+ remove_charges : bool, default False
43
+ Set to true to remove charges from the system.
44
+ remove_hydrogens : bool, default False
45
+ Set to true to remove hydrogen atoms from the system.
46
+ The masses and charges of the hydrogens are absorbed into
47
+ the heavy atoms they were bonded to.
48
+ pppm_resolution : tuple, default=(8, 8, 8)
49
+ The resolution used in
50
+ `hoomd.md.long_range.pppm.make_pppm_coulomb_force` representing
51
+ number of grid points in the x, y, and z directions.
52
+ ppmp_order : int, default=4
53
+ The order used in
54
+ `hoomd.md.long_range.pppm.make_pppm_coulomb_force` representing
55
+ number of grid points in each direction to assign charges to.
56
+ nlist_buffer : float, default=0.4
57
+ Neighborlist buffer for simulation cell.
22
58
23
59
Notes
24
60
-----
@@ -28,19 +64,38 @@ class Graphene(Compound):
28
64
"""
29
65
30
66
def __init__ (
31
- self , x_repeat , y_repeat , n_layers , periodicity = (True , True , False )
67
+ self ,
68
+ x_repeat ,
69
+ y_repeat ,
70
+ n_layers ,
71
+ base_units = dict (),
72
+ periodicity = (True , True , False ),
32
73
):
33
- super ( Graphene , self ). __init__ (periodicity = periodicity )
74
+ surface = mb . Compound (periodicity = periodicity )
34
75
spacings = [0.425 , 0.246 , 0.35 ]
35
- points = [[1 / 6 , 0 , 0 ], [1 / 2 , 0 , 0 ], [0 , 0.5 , 0 ], [2 / 3 , 1 / 2 , 0 ]]
76
+ points = [
77
+ [1 / 6 , 0 , 0 ],
78
+ [1 / 2 , 0 , 0 ],
79
+ [0 , 1 / 2 , 0 ],
80
+ [2 / 3 , 1 / 2 , 0 ],
81
+ ]
36
82
lattice = Lattice (
37
83
lattice_spacing = spacings ,
38
84
angles = [90 , 90 , 90 ],
39
85
lattice_points = {"A" : points },
40
86
)
41
- carbon = Compound (name = "C" )
87
+ carbon = Compound (name = "C" , element = "C" )
42
88
layers = lattice .populate (
43
89
compound_dict = {"A" : carbon }, x = x_repeat , y = y_repeat , z = n_layers
44
90
)
45
- self .add (layers )
46
- self .freud_generate_bonds ("C" , "C" , dmin = 0.14 , dmax = 0.145 )
91
+ surface .add (layers )
92
+ surface .freud_generate_bonds ("C" , "C" , dmin = 0.14 , dmax = 0.145 )
93
+ surface_mol = Molecule (num_mols = 1 , compound = surface )
94
+ super (Graphene , self ).__init__ (
95
+ molecules = [surface_mol ],
96
+ density = 1.0 ,
97
+ base_units = base_units ,
98
+ )
99
+
100
+ def _build_system (self ):
101
+ return self .all_molecules [0 ]
0 commit comments