ChemShell logo

ChemShell Tutorial

Search the manual:

Structure input using Cartesian coordinates

Molecular structures in Cartesian coordinates are stored in ChemShell using fragment objects. The examples below use the c_create command to create fragment objects, which are automatically saved to disk.

Molecular Case: Water

The ChemShell script water.chm in samples/setup_cartesian creates a water molecule fragment.

c_create coords=water.pun {
coordinates angstrom
o  0.0  0.0  0.0
h  0.0  1.0  0.0
h  0.0 -0.5  0.75
}

Providing you have compiled ChemShell correctly, you should be able to run this script (and all other examples) with a command of the form:

chemsh water.chm

It should produce a file called water.pun that contains the coordinates in ChemShell format. Note that ChemShell's internal length unit is Bohrs. The .pun file extension has no meaning to ChemShell, and you can use any extension you like (or none). Often you will see .c used for Cartesian coordinate fragments as well.

If you look in the water.pun file you will see that connnectivity information (a list of bonded atom pairs) is generated automatically when c_create is run. This list is used whenever force field calculations are performed (MM and QM/MM).

Some visualisers, such as Aten, can read ChemShell fragment files directly. Aten can be used to visualise the result with the command:

aten water.pun

ChemShell can also convert the data into XYZ format for use with other visualisers (such as VMD, which is particularly suited to visualising biomolecules). The water.chm script writes out the data to water.xyz using the following command:

write_xyz coords=water.pun file=water.xyz

Note that XYZ format uses Angstroms as the length unit.

Files created in visualisers such as VMD can be imported into ChemShell by a similar mechanism. For example XYZ files can be imported into ChemShell using the command:

read_xyz file=water.xyz coords=water.pun

PDB files can be imported in the same way using the command read_pdb.

Periodic Case: Sodalite

If you provide a cell_constants record in the c_create command, it is assumed you are providing fractional coordinates of a crystalline system.

The sodalite.chm file gives an example of a crystal geometry input.

c_create coords=sodalite.pun {
space_group
1
cell_constants angstrom
 8.890000 8.890000 8.890000 90.000000 90.000000 90.000000
coordinates
Si    0.25000000   0.50000000   0.00000000
Si    0.25000000   0.00000000  -0.50000000
O    0.13969966   0.15059955  -0.43989989
Si   -0.25000000  -0.50000000   0.00000000
....
}

Note that space group symmetry is not currently supported in ChemShell, so crystal geometries must be specified in P1 symmetry (with the space_group record set to 1).

This example also shows how you can create a file containing more than one unit cell using the extend_fragment command.

extend_fragment coords=sodalite.pun result=sodalite220.pun cell_indices = { 0 1 0 1 0 0 }

In this case the fragment is extended by 2 cells in the first two cell vector directions.

Back to the ChemShell tutorial