Source for file Molecule_XYZ.php
Documentation is available at Molecule_XYZ.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
require_once "Science/Chemistry.php";
require_once "Science/Chemistry/Molecule.php";
* Base class representing a Molecule from a XYZ format file
* @author Jesus M. Castagnetto <jmcastagnetto@php.net>
* @package Science_Chemistry
* Energy of the molecule. Optional value in XYZ file format.
* Constructor for the class, accepts 2 optional parameters:
* the data and its source. Possible values for $src: "file", "string"
* @param optional string $xyzdata
* @param optional string $src one of "file" or "string"
* @return object Science_Chemistry_Molecule_XYZ
* method that does the parsing of the XYZ data itself
* @see Science_Chemistry_Molecule_XYZ()
} elseif ($src == "string") {
// first line is number of atoms
// second line is molecule name and energy
preg_match("/^([[:alnum:].]+)[[:space:]]+([[:digit:].-]+)/",trim($line[1 ]),$re);
for ($i=2; $i< count($line); $i++ ) {
$this->atoms[] = $this->parseAtom($line[$i]);
* Parses an XYZ atom record
* @return object Science_Chemistry_Atom
* Generates a string representation of the XYZ molecule
* Overrides parent Science_Chemistry_Molecule::toString() method
$out[] = $this->atoms[$i]->toString ();
} // end of class Science_Chemistry_Molecule_XYZ
// vim: expandtab: ts=4: sw=4
Documentation generated on Mon, 11 Mar 2019 15:48:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|