MatrixChem
PyCellChemistry documentation index
/Users/lidia/main/research/acbook/web/website/ac-home/pycellchem/pycellchem-2.0/src/MatrixChem.py

#---------------------------------------------------------------------------
#
# MatrixChem.py: matrix chemistry, acbook ch. 3
#
# by Lidia Yamamoto, Belgium, July 2013
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Copyright (C) 2015 Lidia A. R. Yamamoto
# Contact: http://www.artificial-chemistries.org/
#
# This file is part of PyCellChemistry.
#
# PyCellChemistry is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3, as published by the Free Software Foundation.
#
# PyCellChemistry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyCellChemistry, see file COPYING. If not, see
# http://www.gnu.org/licenses/
#


Modules
artchem.BinaryStrings
numpy
sys


Classes
MatrixChem


class MatrixChem
Methods defined here:
__init__(self, nmols=1000)
initialize matrix chemistry with 'nmols' random molecules
fold(self, mol, transpose=False)
fold binary string 'mol' into matrix operator
transpose=False: folds horizontally,
e.g. [ [s1 s2] [s3 s4] ] for N=4
transpose=True: folds vertically,
e.g. [ [s1 s3] [s2 s4] ] for N=4
randmol(self)
generate a random molecule (a molecule is an N-bit integer)
react(self, m1, m2)
chemical reaction: apply operator m1 to operand m2:
P(m1) x m2 => m3
method:
- fold the operator horizontally obtaining matrix fm
- fold the operand vertically obtaining matrix op
- multiply both matrices: the resulting matrix contains
the result in a vertically-folded form
- unfold the result matrix to obtain the product of the reaction

the method adopted here looks different from the original,
but actually it is fully equivalent and it leads to exactly
the same result
reacttable(self)
print all-to-all reaction table
run(self, niter=10000)
run random molecular collisions for 'niter' iterations
squash(self, n)
squash function sigma:
returns one bit out of the given integer n
trace(self)
print debug traces with multiset information
trace_mult(self, time)
output tab-separated line with all molecule counts
trace_title(self, prefix='')
output tab-separated title line for plotting molecule counts;
if prefix is provided, preceeds all molecule names with it
unfold(self, fmat, transpose=False)
unfold integer matrix into binary string, applying squash function
transpose=False: unfolds horizontally
transpose=True: unfolds vertically


Generated automatically by pydoc, July 10, 2015