Skip to content

Instantly share code, notes, and snippets.

View ghutchis's full-sized avatar

Geoff Hutchison ghutchis

View GitHub Profile
@ghutchis
ghutchis / test-avoscript.py
Created October 1, 2023 23:46
Avogadro Script Command Tester
#!/usr/bin/env python
import sys
import json
import subprocess
# example molecule for testing
water = {
"chemicalJson": 1,
"atoms": {
@ghutchis
ghutchis / atomtype.cpp
Last active March 6, 2024 21:16
Avogadro2 Atom symbols and Neighbors
auto graph = m_molecule->graph();
for (Index i = 0; i < m_molecule->atomCount(); ++i)
{
// print the symbol for the atom
Core::Atom atom = m_molecule->atom(i);
std::string atomType = Core::Elements::symbol(atom.atomicNumber());
std::cout << "Atom " << atomType << " (" << i << ")" << std::endl;
// check neighbors
@ghutchis
ghutchis / scan-dihedrals.py
Created March 24, 2025 21:22
Scan dihedral angles using Open Babel / Pybel
#!/usr/bin/env python
import sys
import os
import math
from openbabel import pybel
# read in a file and scan the torsions
# generate a bunch of XYZ files with varied phi / psi angles