Skip to content

Instantly share code, notes, and snippets.

View ghutchis's full-sized avatar

Geoff Hutchison ghutchis

View GitHub Profile
#!/usr/bin/env python
from __future__ import print_function
import sys
from cclib.parser import ccopen
import logging
def spectra(etens, etoscs, low = 0.5, high = 10.0, resolution = 0.01, smear = 0.04):
"""Return arrays of the energies and intensities of a Lorentzian-blurred spectrum"""
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1a53e8cdd..bbf92481c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -23,7 +23,7 @@ set (cpptests
)
set (alias_parts 1)
set (automorphism_parts 1 2 3 4 5 6 7 8 9 10)
-set (builder_parts 1 2 3 4 5)
+set (builder_parts 1 2 3 4 5 6)
@ghutchis
ghutchis / selected atoms.diff
Created February 11, 2020 20:44
Diff for selected atoms
diff --git a/avogadro/qtgui/interfacescript.cpp b/avogadro/qtgui/interfacescript.cpp
index f0ad088..c0c2141 100644
--- a/avogadro/qtgui/interfacescript.cpp
+++ b/avogadro/qtgui/interfacescript.cpp
@@ -458,6 +458,14 @@ bool InterfaceScript::insertMolecule(QJsonObject& json,
if (m_moleculeExtension == QLatin1String("None"))
return true;
+ // insert the selected atoms
+ QJsonArray selectedList;
@ghutchis
ghutchis / ob-optimize.py
Created January 24, 2020 20:52
Open Babel optimizer
#!/usr/bin/env python
import sys, os
from openbabel import pybel
# read through multiple files on command-line
for argument in sys.argv[1:]:
filename, extension = os.path.splitext(argument)
@ghutchis
ghutchis / ch3co2.sdf
Created October 29, 2019 14:20
CH3CO2- example
ch3co2.sdf
ChemDraw10291910202D
4 3 0 0 0 0 0 0 0 0999 V2000
-0.7145 -0.6187 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 -0.2062 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.7145 -0.6187 0.0000 O 0 5 0 0 0 0 0 0 0 0 0 0
0.0000 0.6187 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
@ghutchis
ghutchis / benzene2d.sdf
Created October 29, 2019 14:17
Benzene SDF (2d vs. 3d)
OpenBabel10291910162D
6 6 0 0 0 0 0 0 0 0999 V2000
-0.8660 -0.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7321 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.7321 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8660 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@ghutchis
ghutchis / scan-dihedrals.py
Created October 1, 2019 16:31
Scan dihedral angles using Open Babel (here using random angles)
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
import math
import random
import pybel
git fetch origin # get tags
git checkout openbabel-3-0-0a1
cp -pr openbabel openbabel-3.0.0a1
cd openbabel-3.0.0a1
rm .travis.yml authors.txt
find . -name "*~" | xargs rm
find . -name ".git*" | xargs rm -r
(cd scripts/python/; rm -fr build)
(cd scripts/java/; rm -fr org)
@ghutchis
ghutchis / globalopt.py
Created August 7, 2019 01:25
Convert non-3D molecules to 3D using Open Babel
#!/usr/bin/env python
import sys, os
import pybel
ob = pybel.ob
# read through multiple files on command-line
for argument in sys.argv[1:]:
@ghutchis
ghutchis / correlated-smarts.py
Created July 18, 2019 17:23
looking for correlated dihedral angles
#!/usr/bin/env python
import sys
import os
import glob
import pybel
# don't need to reimport openbabel
ob = pybel.ob