Make water box#
Generating a box of water molecules with specified dimensions.
The function molsysmt.build.make_water_box() fills a periodic box of specified dimensions with water molecules at standard density.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.build.make_water_box().
Basic usage#
Let’s show how to create a rectangular water box using numpy box dimensions:
import molsysmt as msm
import numpy as np
We define a cubic box of length 2.0 nanometers:
box = np.array([[[2.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 2.0]]]) * msm.pyunitwizard.unit('nm')
Now we pass the box dimensions to molsysmt.build.make_water_box() to generate the solvated box:
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 | 804 | 268 | 268 | 1 | 268 | 1 | 268 | 1 |
We can verify that the oxygen atom coordinates fall strictly within the box boundaries:
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()}')
Min X: 0.004029999999999978 nanometer and Max X: 1.99909 nanometer
See also
Related Tools & References
Make water box: Generate a box of water molecules with
molsysmt.build.make_water_box().Info: Display structural and topological summaries of a molecular system with
molsysmt.basic.info().Get: Retrieve attribute values from a molecular system with
molsysmt.basic.get().Solvate: Add solvent molecules around a molecular system with
molsysmt.build.solvate().