cmf_moldim {conmolfields}R Documentation

Returns dimensions of molecule

Description

Returns dimensions of molecule

Usage

cmf_moldim(mol)

Arguments

mol

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
cmf_moldim <- function(mol) {
  moldim <- list()
  natoms <- length(mol$atoms)
  if (natoms > 0) {
    atom <- mol$atoms[[1]]
    moldim$xmin <- atom$x
    moldim$xmax <- atom$x
    moldim$ymin <- atom$y
    moldim$ymax <- atom$y
    moldim$zmin <- atom$z
    moldim$zmax <- atom$z
    if (natoms > 1) {
      for (iatom in 2:natoms) {
        atom <- mol$atoms[[iatom]]
        if (atom$x < moldim$xmin) moldim$xmin <- atom$x
        if (atom$x > moldim$xmax) moldim$xmax <- atom$x
        if (atom$y < moldim$ymin) moldim$ymin <- atom$y
        if (atom$y > moldim$ymax) moldim$ymax <- atom$y
        if (atom$z < moldim$zmin) moldim$zmin <- atom$z
        if (atom$z > moldim$zmax) moldim$zmax <- atom$z
      }
    }
  }
  moldim
}

[Package conmolfields version 0.0-19 Index]