User Guides Short Intro
Short Introduction to molecule_lib
This is a short introduction to molecule_lib. It is intended to give a broad overview of how the library works. To see what each method or function does, look at Reference page.
We import molecule_lib as follows:
import molecule_lib as mol
Main objects in molecule_lib
In molecule_lib there are two main objects:
-
ABCMolecule: a dataclass containing a molecular structure with a unit cell.
-
XYZMolecule: a dataclass containing a molecular structure without a unit cell.
The ABCCoord, XYZCoord, and LatticeMatrix objects are sub dataclasses used in the creation of the Molecule objects. The Animation objects store molecular simulations with each image being a Molecule dataclass object.
Object creation
The easiest way to create an object is use a library function and an already existing structure file. See read_functions for more detailed information. The code below creates an ABCMolecule object from that existing .vasp structure file.
vasp_file = mol.read_vasp(filepath="test_files/slabs/a-001.vasp")
Common Molecule methods to learn:
Molecule.info() shows a quick summary of the Molecule object.
vasp_file.info()
type: ABCMolecule
filetype: .vasp
total atoms: 96
species info: {'Al': '24', 'O': '48', 'H': '24'}
comment line: '3_OPT_cell (Generated by CrystalMaker X for Windows)'
lattice constant: 1.0
lattice matrix:
[8.7807035882, 0.1780459095, 3.7774054998]
[-1.0698364258, 0.1158044938, -9.5608328356]
[-0.9853331692, 23.1955056605, -0.2016342785]
positional: True
xyz_file = vasp_file.convert()
xyz_file.info()
type: XYZMolecule
filetype: .vasp
total atoms: 96
species info: {'Al': '24', 'O': '48', 'H': '24'}
comment line: '3_OPT_cell (Generated by CrystalMaker X for Windows)'