Skip to content

Instantly share code, notes, and snippets.

View andersx's full-sized avatar
🤓
LFG

Anders Steen Christensen andersx

🤓
LFG
View GitHub Profile
@andersx
andersx / mndo99_wrapper.py
Created August 16, 2017 12:12
Wrapper to get energy and gradients from MNDO99
from __future__ import print_function
import os
import numpy as np
__EXECUTABLE__ = "/home/andersx/opt/mndo/mndo99_20121112_intel64_ifort-11.1.080_mkl-10.3.12.361"
def write_om2_gradient(coords, species, filename):
""" Writes an input file to calculate the
OM2 energy and gradient with MNDO99.
@andersx
andersx / reforge.py
Created September 17, 2017 11:03
LOL
import numpy as np
from numpy.random import uniform
def simulate(probability):
n = 1
while uniform() > probability:
n += 1
return n
@andersx
andersx / xyz2om2.f90
Last active January 7, 2021 20:13
Stupid xyz2om2 converter in fortran (cuz it was slow to do 1M files with a python converter)
! PUBLIC DOMAIN LICENSE 2017 BY ANDERS S. CHRISTENSEN
!
! I WROTE THIS BECAUSE I WAS BORED - I DON'T RECOMMEND
! WRITING FILE PARSERS IN FORTRAN BECAUSE IT IS NOT
! PRODUCTIVE.
program convert
implicit none
@andersx
andersx / jan.out
Created January 13, 2018 13:16
1UHE model4_1_r.xyz mopac output
*******************************************************************************
** Site#: 18858 For non-commercial use only Version 18.012L 64BITS **
*******************************************************************************
** Cite this program as: MOPAC2016, Version: 18.012L, James J. P. Stewart, **
** Stewart Computational Chemistry, web: HTTP://OpenMOPAC.net. Days left: 364**
*******************************************************************************
** **
** MOPAC2016 **
** **
*******************************************************************************
@andersx
andersx / mmff94opt.py
Created January 19, 2018 14:18
Commandline script to optimize molecules at the MMFF94 with openbabel, and print to screen.
#!/usr/bin/env python2
# MIT LICENSE, Anders S. Christensen (c) 2018
import sys
import pybel
import openbabel
NAME = {
1: 'H' ,
2: 'He' ,
@andersx
andersx / fchl_example.py
Created January 23, 2018 13:07
Example how to generate a local kernel matrix with FCHL
#!/usr/bin/env python2
import sys
sys.path.insert(0,"/home/andersx/dev/qml/fchl_arad/build/lib.linux-x86_64-2.7")
# sys.path.insert(0,"/home/andersx/dev/qml/fchl/build/lib.linux-x86_64-2.7")
import numpy as np
from time import time
@andersx
andersx / align_multiple.py
Created March 27, 2018 15:05
Example of how to align multiple PDB structures to the same reference.
# The MIT License
#
# Copyright (c) 2010-2018 Anders S. Christensen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@andersx
andersx / render_movie.pml
Created March 28, 2018 13:16
Script to render molecuels in PYMOL
# Envoke by
# > pymol -c render_movie.pml <trajectoryfile.xyz>
# > convert -delay 20 -loop 0 mov*.png <outputfile.gif>
# load opt.xyz
show sticks, all
bg_color white
color grey05, elem c
preset.ball_and_stick(selection='all', mode=1)
set ray_trace_mode, 4
@andersx
andersx / reserver_my_own_node.sh
Created July 12, 2018 09:39
reserve node alchemy
#!/usr/bin/env bash
while :
do
date
ssh -t alchemy slurm_node_reserve 24 4320
ssh -t alchemy slurm_node_extend 4320
sleep 60
@andersx
andersx / bad_conformer_id.py
Created August 2, 2018 08:23
Example that will throw a "ValueError: Bad conformer id" with RDKit
import sys
from rdkit import Chem
from rdkit.Chem import AllChem
if __name__ == "__main__":
# my_smiles = ['C#N', 'C1C(C2C1OC2)O', 'C1C2C3C1C2C3O', 'C1C2COC2C1O', 'C1CC2(C1CC2)O',
# 'C1CC2(C1NC2)O', 'C1CC2(C1OC2)N', 'C1CC2(C1OC2)O', 'C1CC2C1CC2O']
my_smiles = ['C#N', 'C1C(C2C1OC2)O']