Make water box#
import molsysmt as msm
from molsysmt import pyunitwizard as puw
import numpy as np
Let’s create a box, in this case rectangular.
box = np.zeros((3,3))
box[0,0] = 10.0
box[1,1] = 10.0
box[2,2] = 6.0
box = msm.pyunitwizard.quantity(box, 'nm')
The function molsysmt.build.make_water_box fills the box with water molecules using a pre-equilibrated 216 water molecules box with the model SPC at 300K.
molsys = msm.build.make_water_box(box)
msm.info(molsys)
| form | n_atoms | n_groups | n_components | n_chains | n_molecules | n_entities | n_waters | n_structures |
|---|---|---|---|---|---|---|---|---|
| molsysmt.MolSys | 60372 | 20124 | 20124 | 1 | 20124 | 1 | 20124 | 1 |
It can be checked that the oxygens of the water molecules added fits in the box:
coordinates = msm.get(molsys, selection='atom_type=="O"', coordinates=True)
print(f'Min X: {coordinates[0,:,0].min()} and Max X: {coordinates[0,:,0].max()}')
print(f'Min Y: {coordinates[0,:,1].min()} and Max Y: {coordinates[0,:,1].max()}')
print(f'Min Z: {coordinates[0,:,2].min()} and Max Z: {coordinates[0,:,2].max()}')
Min X: 0.004029999999999978 nanometer and Max X: 9.99333 nanometer
Min Y: 0.003029999999999977 nanometer and Max Y: 9.99533 nanometer
Min Z: 0.013029999999999986 nanometer and Max Z: 5.99521 nanometer