Chemistry::InternalCoords::Builder - Build a Z-matrix from cartesian coordinates


    use Chemistry::InternalCoords::Builder 'build_zmat'; 

    # $mol is a Chemistry::Mol object

    # don't change the atom order!
    build_zmat($mol, bfs => 0);


This module builds a Z-matrix from the cartesian coordinates of a molecule, making sure that atoms are defined in a way that allows for efficient structure optimizations and Monte Carlo sampling.

By default, the algorithm tries to start at the center of the molecule and builds outward in a breadth-first fashion. Improper dihedrals are used to ensure clean rotation of groups without distortion. All distance and angle references use real bonds and bond angles where possible (the exception being disconnected structures).

This module is part of the PerlMol project,


These functions may be exported, although nothing is exported by default. To export all functions, use the ":all" tag.

build_zmat($mol, %options)

Build a Z-matrix from the cartesian coordinates of the molecule. Side effect warning: by default, this function modifies the molecule heavily! First, it finds the bonds if there are no bonds defined already (for example, if the structure came from and XYZ file with no bond information). Second, it canonicalizes the molecule, as a means of finding the "topological center". Third, it builds the Z-matrix using a breadth-first search. Fourth, it sorts the atoms in the molecule in the order that they were defined in the Z-matrix.



Default: true. Follow the procedure described above. If bfs is false, then the atom order is not modified (that is, the atoms are added sequentially in the order in which they appear in the connection table, instead of using the breadth-first search).


Default: true. Do the canonicalization step as described above. This option only applies when bfs => 1, otherwise it has no effect. If false and bfs => 1, the breadth-first search is done, but starting at the first atom in the connection table.




This version may not work properly for big molecules, because the canonicalization step has a size limit.


Some improvements for handling disconnected structures, such as making sure that the intermolecular distance is short.

Allowing more control over how much the molecule will be modified: sort or not, canonicalize or not...


Chemistry::Mol, Chemistry::Atom, Chemistry::InternalCoords, Chemistry::Bond::Find, Chemistry::Canonicalize,


Ivan Tubert-Brohman <>


Copyright (c) 2004 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.