Last active
August 29, 2015 14:27
-
-
Save pepijn-devries/bf82ff25886ab9c800ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a data.frame with atom properties | |
atom.props <- data.frame( | |
symbol = c("O", "N", "C", "H"), | |
vanderwaals = c(1.52, 1.55, 1.7, 1.2), #Van der Waals radii of atoms | |
colour = c("red", "blue", grey(0.1), "white") | |
) | |
# get atoms from the molecule | |
atoms <- get.atoms(molfile) | |
# get 3D locations of atoms as read from the file | |
atom_dat <- data.frame(do.call('rbind', lapply(atoms, get.point3d))) | |
names(atom_dat) <- c("x", "y", "z") | |
# merge with atom info | |
atom_dat$symbol <- unlist(lapply(atoms, get.symbol)) | |
atom_dat <- merge(atom_dat, atom.props, all.x = T, all.y = F) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment