Index: realSpaceModeling/Doxyfile
===================================================================
--- realSpaceModeling/Doxyfile	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/Doxyfile	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,1228 @@
+# Doxyfile 1.4.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = SANSsimulation
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = ./
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is YES.
+
+SHOW_DIRECTORIES       = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the progam writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = ./
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: realSpaceModeling/analmodelpy/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,47 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = analmodelpy
+
+# directory structure
+
+BUILD_DIRS = \
+    libanalmodelpy \
+    analmodelpymodule \
+    analmodelpy \
+
+OTHER_DIRS = \
+    tests \
+    examples
+
+RECURSE_DIRS = $(BUILD_DIRS) $(OTHER_DIRS)
+
+#--------------------------------------------------------------------------
+#
+
+all:
+	BLD_ACTION="all" $(MM) recurse
+
+distclean::
+	BLD_ACTION="distclean" $(MM) recurse
+
+clean::
+	BLD_ACTION="clean" $(MM) recurse
+
+tidy::
+	BLD_ACTION="tidy" $(MM) recurse
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/analmodelpy/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = analmodelpy
+PACKAGE = analmodelpy
+
+#--------------------------------------------------------------------------
+#
+
+all: export
+
+
+#--------------------------------------------------------------------------
+#
+# export
+
+EXPORT_PYTHON_MODULES = \
+    __init__.py
+
+
+export:: export-python-modules
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/analmodelpy/__init__.py
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+def copyright():
+    return "analmodelpy pyre module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/analmodelpy/analmodelpymodule/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+PACKAGE = analmodelpymodule
+MODULE = analmodelpy
+
+include std-pythonmodule.def
+include local.def
+
+PROJ_CXX_SRCLIB = -lanalmodelpy
+
+PROJ_SRCS = \
+    bindings.cc \
+    exceptions.cc \
+    misc.cc
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/analmodelpymodule.cc
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/analmodelpymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/analmodelpymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+
+#include <Python.h>
+
+#include "exceptions.h"
+#include "bindings.h"
+
+
+char pyanalmodelpy_module__doc__[] = "";
+
+// Initialization function for the module (*must* be called initanalmodelpy)
+extern "C"
+void
+initanalmodelpy()
+{
+    // create the module and add the functions
+    PyObject * m = Py_InitModule4(
+        "analmodelpy", pyanalmodelpy_methods,
+        pyanalmodelpy_module__doc__, 0, PYTHON_API_VERSION);
+
+    // get its dictionary
+    PyObject * d = PyModule_GetDict(m);
+
+    // check for errors
+    if (PyErr_Occurred()) {
+        Py_FatalError("can't initialize module analmodelpy");
+    }
+
+    // install the module exceptions
+    pyanalmodelpy_runtimeError = PyErr_NewException("analmodelpy.runtime", 0, 0);
+    PyDict_SetItemString(d, "RuntimeException", pyanalmodelpy_runtimeError);
+
+    return;
+}
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/bindings.cc
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "bindings.h"
+
+#include "misc.h"          // miscellaneous methods
+
+// the method table
+
+struct PyMethodDef pyanalmodelpy_methods[] = {
+
+    // new analmodel
+    {pyanalmodelpy_new_analmodel__name__, pyanalmodelpy_new_analmodel,
+     METH_VARARGS, pyanalmodelpy_new_analmodel__doc__},
+
+    //analmodel method: CalculateIQ
+    {pyanalmodelpy_CalculateIQ__name__, pyanalmodelpy_CalculateIQ,
+     METH_VARARGS, pyanalmodelpy_CalculateIQ__doc__},
+
+    {pyanalmodelpy_copyright__name__, pyanalmodelpy_copyright,
+     METH_VARARGS, pyanalmodelpy_copyright__doc__},
+
+
+// Sentinel
+    {0, 0}
+};
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/bindings.h
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyanalmodelpy_bindings_h)
+#define pyanalmodelpy_bindings_h
+
+// the method table
+
+extern struct PyMethodDef pyanalmodelpy_methods[];
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.cc
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+PyObject *pyanalmodelpy_runtimeError = 0;
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.h
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyanalmodelpy_exceptions_h)
+#define pyanalmodelpy_exceptions_h
+
+// exceptions
+
+extern PyObject *pyanalmodelpy_runtimeError;
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/local.def
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,25 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+# C++
+
+    PROJ_CXX_INCLUDES = ../libanalmodelpy   \
+			../../iqPy/libiqPy  \
+			../../iqPy/libiqPy/tnt  \
+			../../geoshapespy/libgeoshapespy  \
+			../../pointsmodelpy/libpointsmodelpy
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/misc.cc
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "misc.h"
+#include "analytical_model.h"
+#include "geo_shape.h"
+#include "iq.h"
+
+// copyright
+
+char pyanalmodelpy_copyright__doc__[] = "";
+char pyanalmodelpy_copyright__name__[] = "copyright";
+
+static char pyanalmodelpy_copyright_note[] = 
+    "analmodelpy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+PyObject * pyanalmodelpy_copyright(PyObject *, PyObject *)
+{
+    return Py_BuildValue("s", pyanalmodelpy_copyright_note);
+}
+
+//extern char pyanalmodelpy_GetRadius__name__[] = "";
+//extern char pyanalmodelpy_GetRadius__doc__[] = "GetRadius";
+//PyObject * pyanalmodelpy_GetRadius(PyObject *, PyObject *args){
+//  double r = Sphere::GetRadius();
+//  
+//  return PyBuildValue("d", r);
+//}
+
+
+    
+// analytical_model class constructor  AnalyticalModel(Sphere &)
+
+char pyanalmodelpy_new_analmodel__doc__[] = "";
+char pyanalmodelpy_new_analmodel__name__[] = "new_analmodel";
+
+PyObject * pyanalmodelpy_new_analmodel(PyObject *, PyObject *args)
+{
+  PyObject *pyshape = 0;
+  int ok = PyArg_ParseTuple(args, "O", &pyshape);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyshape);
+
+  GeoShape *shape = static_cast<GeoShape *>(temp);
+
+  AnalyticalModel *newanal = new AnalyticalModel(*shape);
+
+  return PyCObject_FromVoidPtr(newanal, NULL);
+}
+
+//AnalyticalModel method: CalculateIQ(IQ *)
+char pyanalmodelpy_CalculateIQ__doc__[] = "";
+char pyanalmodelpy_CalculateIQ__name__[] = "CalculateIQ";
+
+PyObject * pyanalmodelpy_CalculateIQ(PyObject *, PyObject *args)
+{
+  PyObject *pyanal = 0, *pyiq = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pyanal, &pyiq);
+  if(!ok) return NULL;
+                                                                 
+  void *temp = PyCObject_AsVoidPtr(pyanal);
+  void *temp2 = PyCObject_AsVoidPtr(pyiq);
+                                         
+  AnalyticalModel * thisanal = static_cast<AnalyticalModel *>(temp);
+  IQ * thisiq = static_cast<IQ *>(temp2);
+
+  thisanal->CalculateIQ(thisiq);
+                        
+  return Py_BuildValue("i",0);
+
+}
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/analmodelpymodule/misc.h
===================================================================
--- realSpaceModeling/analmodelpy/analmodelpymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/analmodelpymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyanalmodelpy_misc_h)
+#define pyanalmodelpy_misc_h
+
+// copyright
+extern char pyanalmodelpy_copyright__name__[];
+extern char pyanalmodelpy_copyright__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_copyright(PyObject *, PyObject *);
+
+extern char pyanalmodelpy_GetRadius__name__[];
+extern char pyanalmodelpy_GetRadius__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_GetRadius(PyObject *, PyObject *);
+
+
+// Analytical Model constructor
+extern char pyanalmodelpy_new_analmodel__name__[];
+extern char pyanalmodelpy_new_analmodel__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_analmodel(PyObject *, PyObject *);
+
+// AnalyticalModel method: CalculateIQ(IQ *)
+extern char pyanalmodelpy_CalculateIQ__name__[];
+extern char pyanalmodelpy_CalculateIQ__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_CalculateIQ(PyObject *, PyObject *);
+
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/analmodelpy/examples/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = analmodelpy
+PACKAGE = examples
+
+#--------------------------------------------------------------------------
+#
+
+all: clean
+
+release: clean
+	cvs release .
+
+update: clean
+	cvs update .
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/libanalmodelpy/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/libanalmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/libanalmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,66 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+include local.def
+
+PROJECT = analmodelpy
+PACKAGE = libanalmodelpy
+
+PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
+PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
+PROJ_LIBRARIES = -lgeoshpespy -liqPy
+#PROJ_LIBRARIES = -L/home/jingz1/dv/tools/pythia-0.8/lib -lgeoshpespy -liqPy
+
+PROJ_SRCS = \
+    analytical_model.cc
+    
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# build the library
+
+all: $(PROJ_SAR) export
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
+	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries export-binaries
+
+else
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS) $(PROJ_LIBRARIES)
+
+# export
+export:: export-headers export-libraries
+
+endif
+
+EXPORT_HEADERS = \
+    analytical_model.h  \
+    sans_model.h
+
+EXPORT_LIBS = $(PROJ_SAR)
+EXPORT_BINS = $(PROJ_DLL)
+
+# version
+# $Id$
+
+#
+# End of file
Index: realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.cc
===================================================================
--- realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,29 @@
+/** \file analytical_model.cc  */
+
+#include "sphere.h"
+#include "hollow_sphere.h"
+#include "analytical_model.h"
+
+AnalyticalModel::AnalyticalModel(const GeoShape &geo_shape)
+{
+  switch (geo_shape.GetShapeType()){
+    case SPHERE:
+      shape_ = new Sphere(static_cast<const Sphere&>(geo_shape));
+      break;
+    case HOLLOWSPHERE:
+      shape_ = new HollowSphere(static_cast<const HollowSphere&>(geo_shape));
+      break;
+    case CYLINDER:
+      break;
+  }
+}
+
+AnalyticalModel::~AnalyticalModel() 
+{
+  if (shape_ != NULL) delete shape_;
+}
+
+void AnalyticalModel::CalculateIQ(IQ * iq)
+{
+  shape_->GetFormFactor(iq);
+}
Index: realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.h
===================================================================
--- realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/libanalmodelpy/analytical_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,23 @@
+/** \file analytical_model.h class AnalyticalModel:SANSModel */
+
+#ifndef ANALYTICALMODEL_H
+#define ANALYTICALMODEL_H
+
+#include "sans_model.h"
+#include "geo_shape.h"
+#include "iq.h"
+
+class AnalyticalModel : public SANSModel{
+
+ public:
+  AnalyticalModel(const GeoShape &);
+  ~AnalyticalModel();
+
+  void CalculateIQ(IQ *);
+
+ private:
+  AnalyticalModel();
+  GeoShape *shape_;
+};
+
+#endif
Index: realSpaceModeling/analmodelpy/libanalmodelpy/local.def
===================================================================
--- realSpaceModeling/analmodelpy/libanalmodelpy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/libanalmodelpy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+#
+# Local (project) definitions
+#
+
+# C++
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy/tnt   \
+		     ../../iqPy/libiqPy     \
+		     ../../geoshapespy/libgeoshapespy  \
+		     ../../pointsmodelpy/libpointsmodelpy 
+
+    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
+    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS)
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/libanalmodelpy/sans_model.h
===================================================================
--- realSpaceModeling/analmodelpy/libanalmodelpy/sans_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/libanalmodelpy/sans_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,15 @@
+/** \file sans_model.h    class SANSModel virtual base class */
+
+#ifndef SANSMODEL_H
+#define SANSMODEL_H
+
+#include "iq.h"
+
+class SANSModel{
+ public:
+
+  virtual void CalculateIQ(IQ *iq) = 0;
+
+};
+
+#endif
Index: realSpaceModeling/analmodelpy/tests/Make.mm
===================================================================
--- realSpaceModeling/analmodelpy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,52 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy    \
+		     ../../iqPy/libiqPy/tnt  \
+		     ../libanalmodelpy    \
+		     ../../geoshapespy/libgeoshapespy
+
+PROJECT = SANSsimulation
+PACKAGE = tests
+
+PROJ_CLEAN += $(PROJ_CPPTESTS)
+
+PROJ_PYTESTS = testanal_model.py
+PROJ_CPPTESTS = testanalytical_model
+PROJ_TESTS = $(PROJ_PYTESTS) $(PROJ_CPPTESTS)
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -lanalmodelpy -liqPy -lgeoshapespy
+
+
+#--------------------------------------------------------------------------
+#
+
+all: $(PROJ_TESTS)
+
+test:
+	for test in $(PROJ_TESTS) ; do $${test}; done
+
+release: tidy
+	cvs release .
+
+update: clean
+	cvs update .
+
+#--------------------------------------------------------------------------
+#
+
+testanalytical_model: testanalytical_model.cc $(BLD_LIBDIR)/libanalmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -o $@ testanalytical_model.cc $(PROJ_LIBRARIES) 
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/analmodelpy/tests/signon.py
===================================================================
--- realSpaceModeling/analmodelpy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    import analmodelpy
+    from analmodelpy import analmodelpy as analmodelpymodule
+
+    print "copyright information:"
+    print "   ", analmodelpy.copyright()
+    print "   ", analmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", analmodelpymodule.__file__
+    print "    doc:", analmodelpymodule.__doc__
+    print "    contents:", dir(analmodelpymodule)
+
+    print
+    print analmodelpymodule.hello()
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/analmodelpy/tests/testanal_model.py
===================================================================
--- realSpaceModeling/analmodelpy/tests/testanal_model.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/tests/testanal_model.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    from SANSsimulation import analmodelpy as analmodelpymodule
+    from SANSsimulation import iqPy
+    from SANSsimulation import geoshapespy
+
+    print "copyright information:"
+    print "   ", analmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", analmodelpymodule.__file__
+    print "    doc:", analmodelpymodule.__doc__
+    print "    contents:", dir(analmodelpymodule)
+
+    a = geoshapespy.new_sphere(1.0)
+    iq = iqPy.new_iq(10,0.001, 0.3)
+    anal = analmodelpymodule.new_analmodel(a)
+    analmodelpymodule.CalculateIQ(anal,iq)
+    iqPy.OutputIQ(iq,"out.iq")
+
+
+
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/analmodelpy/tests/testanalytical_model.cc
===================================================================
--- realSpaceModeling/analmodelpy/tests/testanalytical_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/analmodelpy/tests/testanalytical_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,22 @@
+#include <cassert>
+#include <iostream>
+#include "analytical_model.h"
+#include "sphere.h"
+
+using namespace std;
+
+void TestAnalyticalModel() {
+  Sphere sphere(1.0);
+  AnalyticalModel am(sphere);
+
+  IQ iq1(10,0.001, 0.3);
+  am.CalculateIQ(&iq1);
+
+  for (int i = 0; i < iq1.iq_data.dim1(); ++i)
+    cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;  
+}
+
+int main(){
+  TestAnalyticalModel();
+  printf("PASS.\n");
+}
Index: realSpaceModeling/geoshapespy/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,47 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = geoshapespy
+
+# directory structure
+
+BUILD_DIRS = \
+    libgeoshapespy \
+    geoshapespymodule \
+    geoshapespy \
+
+OTHER_DIRS = \
+    tests \
+    examples
+
+RECURSE_DIRS = $(BUILD_DIRS) $(OTHER_DIRS)
+
+#--------------------------------------------------------------------------
+#
+
+all:
+	BLD_ACTION="all" $(MM) recurse
+
+distclean::
+	BLD_ACTION="distclean" $(MM) recurse
+
+clean::
+	BLD_ACTION="clean" $(MM) recurse
+
+tidy::
+	BLD_ACTION="tidy" $(MM) recurse
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/examples/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = geoshapespy
+PACKAGE = examples
+
+#--------------------------------------------------------------------------
+#
+
+all: clean
+
+release: clean
+	cvs release .
+
+update: clean
+	cvs update .
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/geoshapespy/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = geoshapespy
+PACKAGE = geoshapespy
+
+#--------------------------------------------------------------------------
+#
+
+all: export
+
+
+#--------------------------------------------------------------------------
+#
+# export
+
+EXPORT_PYTHON_MODULES = \
+    __init__.py
+
+
+export:: export-python-modules
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/geoshapespy/__init__.py
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+def copyright():
+    return "geoshapespy pyre module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/geoshapespy/geoshapespymodule/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+PACKAGE = geoshapespymodule
+MODULE = geoshapespy
+
+include std-pythonmodule.def
+include local.def
+
+PROJ_CXX_SRCLIB = -lgeoshapespy
+
+PROJ_SRCS = \
+    bindings.cc \
+    exceptions.cc \
+    misc.cc
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/bindings.cc
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "bindings.h"
+
+#include "misc.h"          // miscellaneous methods
+
+// the method table
+
+struct PyMethodDef pygeoshapespy_methods[] = {
+
+   //geoshapes methods: set_orientation; set_center
+   {pygeoshapespy_set_orientation__name__, pygeoshapespy_set_orientation,
+    METH_VARARGS, pygeoshapespy_set_orientation__doc__},
+
+   {pygeoshapespy_set_center__name__, pygeoshapespy_set_center,
+    METH_VARARGS, pygeoshapespy_set_center__doc__},
+
+   // new sphere
+   {pyanalmodelpy_new_sphere__name__, pyanalmodelpy_new_sphere,
+    METH_VARARGS, pyanalmodelpy_new_sphere__doc__},
+
+   // new cylinder
+   {pyanalmodelpy_new_cylinder__name__, pyanalmodelpy_new_cylinder,
+    METH_VARARGS, pyanalmodelpy_new_cylinder__doc__},
+
+   // new ellipsoid
+   {pyanalmodelpy_new_ellipsoid__name__, pyanalmodelpy_new_ellipsoid,
+    METH_VARARGS, pyanalmodelpy_new_ellipsoid__doc__},
+
+   // new hollowsphere
+   {pyanalmodelpy_new_hollowsphere__name__, pyanalmodelpy_new_hollowsphere,
+    METH_VARARGS, pyanalmodelpy_new_hollowsphere__doc__},
+
+   // new singlehelix
+   {pyanalmodelpy_new_singlehelix__name__, pyanalmodelpy_new_singlehelix,
+    METH_VARARGS, pyanalmodelpy_new_singlehelix__doc__},
+
+   {pygeoshapespy_copyright__name__, pygeoshapespy_copyright,
+    METH_VARARGS, pygeoshapespy_copyright__doc__},
+
+
+// Sentinel
+    {0, 0}
+};
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/bindings.h
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pygeoshapespy_bindings_h)
+#define pygeoshapespy_bindings_h
+
+// the method table
+
+extern struct PyMethodDef pygeoshapespy_methods[];
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.cc
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+PyObject *pygeoshapespy_runtimeError = 0;
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.h
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pygeoshapespy_exceptions_h)
+#define pygeoshapespy_exceptions_h
+
+// exceptions
+
+extern PyObject *pygeoshapespy_runtimeError;
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/geoshapespymodule.cc
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/geoshapespymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/geoshapespymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+
+#include <Python.h>
+
+
+#include "exceptions.h"
+#include "bindings.h"
+#include "myutil.h"
+
+
+char pygeoshapespy_module__doc__[] = "";
+
+// Initialization function for the module (*must* be called initgeoshapespy)
+extern "C"
+void
+initgeoshapespy()
+{
+    // create the module and add the functions
+    PyObject * m = Py_InitModule4(
+        "geoshapespy", pygeoshapespy_methods,
+        pygeoshapespy_module__doc__, 0, PYTHON_API_VERSION);
+
+    // get its dictionary
+    PyObject * d = PyModule_GetDict(m);
+
+    // check for errors
+    if (PyErr_Occurred()) {
+        Py_FatalError("can't initialize module geoshapespy");
+    }
+
+    // install the module exceptions
+    pygeoshapespy_runtimeError = PyErr_NewException("geoshapespy.runtime", 0, 0);
+    PyDict_SetItemString(d, "RuntimeException", pygeoshapespy_runtimeError);
+
+	// Seed the random number generator
+	seed_rnd();
+
+    return;
+}
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/local.def
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,24 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+# C++
+
+    PROJ_CXX_INCLUDES = ../libgeoshapespy   \
+			../../iqPy/libiqPy  \
+			../../iqPy/libiqPy/tnt  \
+			../../pointsmodelpy/libpointsmodelpy
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/misc.cc
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,190 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "misc.h"
+#include "sphere.h"
+#include "cylinder.h"
+#include "ellipsoid.h"
+#include "hollow_sphere.h"
+#include "single_helix.h"
+
+// copyright
+
+char pygeoshapespy_copyright__doc__[] = "";
+char pygeoshapespy_copyright__name__[] = "copyright";
+
+static char pygeoshapespy_copyright_note[] = 
+    "geoshapespy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+PyObject * pygeoshapespy_copyright(PyObject *, PyObject *)
+{
+    return Py_BuildValue("s", pygeoshapespy_copyright_note);
+}
+
+//GeoShape methods
+char pygeoshapespy_set_orientation__name__[] = "set_orientation";
+char pygeoshapespy_set_orientation__doc__[] = "Set the rotation angles";
+
+PyObject * pygeoshapespy_set_orientation(PyObject *, PyObject *args){
+  PyObject *pyshape = 0;
+  double angX=0,angY=0,angZ=0;
+  
+  int ok = PyArg_ParseTuple(args, "Oddd", &pyshape,&angX,&angY,&angZ); 
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyshape);
+
+  GeoShape *shape = static_cast<GeoShape *>(temp);
+
+  shape->SetOrientation(angX,angY,angZ);
+
+  return Py_BuildValue("i", 0);
+}
+
+char pygeoshapespy_set_center__name__[] = "set_center";
+char pygeoshapespy_set_center__doc__[] = "new center for points translation";
+
+PyObject * pygeoshapespy_set_center(PyObject *, PyObject *args){
+
+  PyObject *pyshape = 0;
+  double tranX=0,tranY=0,tranZ=0;
+  
+  int ok = PyArg_ParseTuple(args, "Oddd", &pyshape,&tranX,&tranY,&tranZ); 
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyshape);
+
+  GeoShape *shape = static_cast<GeoShape *>(temp);
+
+  shape->SetCenter(tranX,tranY,tranZ);
+
+  return Py_BuildValue("i", 0);
+}
+
+//Sphere constructor
+char pyanalmodelpy_new_sphere__name__[] = "new_sphere";
+char pyanalmodelpy_new_sphere__doc__[] = "sphere constructor";
+
+PyObject * pyanalmodelpy_new_sphere(PyObject *, PyObject *args){
+  double r;
+  int ok = PyArg_ParseTuple(args,"d",&r);
+  if(!ok) return 0;
+
+  Sphere *newsph = new Sphere(r);
+
+  return PyCObject_FromVoidPtr(newsph, PyDelSphere);
+}
+
+static void PyDelSphere(void *ptr){
+  Sphere * oldsph = static_cast<Sphere *>(ptr);
+  delete oldsph;
+
+  return;
+}
+
+//Cylinder constructor
+char pyanalmodelpy_new_cylinder__name__[] = "new_cylinder";
+char pyanalmodelpy_new_cylinder__doc__[] = "cylinder constructor";
+
+PyObject * pyanalmodelpy_new_cylinder(PyObject *, PyObject *args){
+  double r,h;
+  int ok = PyArg_ParseTuple(args,"dd",&r,&h);
+  if(!ok) return 0;
+
+  Cylinder *newcyl = new Cylinder(r,h);
+
+  return PyCObject_FromVoidPtr(newcyl, PyDelCylinder);
+}
+
+static void PyDelCylinder(void *ptr){
+  Cylinder * oldcyl = static_cast<Cylinder *>(ptr);
+  delete oldcyl;
+
+  return;
+}
+
+//Ellipsoid constructor
+char pyanalmodelpy_new_ellipsoid__name__[] = "new_ellipsoid";
+char pyanalmodelpy_new_ellipsoid__doc__[] = "ellipsoid constructor";
+
+PyObject * pyanalmodelpy_new_ellipsoid(PyObject *, PyObject *args){
+  double rx,ry,rz;
+  int ok = PyArg_ParseTuple(args,"ddd",&rx,&ry,&rz);
+  if(!ok) return 0;
+
+  Ellipsoid *newelli = new Ellipsoid(rx,ry,rz);
+
+  return PyCObject_FromVoidPtr(newelli, PyDelEllipsoid);
+}
+
+static void PyDelEllipsoid(void *ptr){
+  Ellipsoid * oldelli = static_cast<Ellipsoid *>(ptr);
+  delete oldelli;
+
+  return;
+}
+
+//Hollow Sphere constructor & methods
+char pyanalmodelpy_new_hollowsphere__name__[] = "new_hollowsphere";
+char pyanalmodelpy_new_hollowsphere__doc__[] = "";
+
+PyObject * pyanalmodelpy_new_hollowsphere(PyObject *, PyObject *args)
+{
+  double r, th;
+  int ok = PyArg_ParseTuple(args,"dd",&r, &th);
+  if(!ok) return 0;
+
+  HollowSphere *newhosph = new HollowSphere(r,th);
+
+  return PyCObject_FromVoidPtr(newhosph, PyDelHollowSphere);
+
+}
+
+static void PyDelHollowSphere(void *ptr)
+{
+  HollowSphere * oldhosph = static_cast<HollowSphere *>(ptr);
+  delete oldhosph;
+  return;
+}
+
+//Single Helix constructor & methods
+char pyanalmodelpy_new_singlehelix__name__[] = "new_singlehelix";
+char pyanalmodelpy_new_singlehelix__doc__[] = "";
+
+PyObject * pyanalmodelpy_new_singlehelix(PyObject *, PyObject *args)
+{
+  double hr,tr,pitch,turns;
+  int ok = PyArg_ParseTuple(args,"dddd",&hr,&tr,&pitch,&turns);
+  if(!ok) return 0;
+
+  SingleHelix *newsinhel = new SingleHelix(hr,tr,pitch,turns);
+
+  return PyCObject_FromVoidPtr(newsinhel, PyDelSingleHelix);
+
+}
+
+static void PyDelSingleHelix(void *ptr)
+{
+  SingleHelix * oldsinhel = static_cast<SingleHelix *>(ptr);
+  delete oldsinhel;
+  return;
+}
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/geoshapespymodule/misc.h
===================================================================
--- realSpaceModeling/geoshapespy/geoshapespymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/geoshapespymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pygeoshapespy_misc_h)
+#define pygeoshapespy_misc_h
+
+// copyright
+extern char pygeoshapespy_copyright__name__[];
+extern char pygeoshapespy_copyright__doc__[];
+extern "C"
+PyObject * pygeoshapespy_copyright(PyObject *, PyObject *);
+
+//GeoShape methods
+extern char pygeoshapespy_set_orientation__name__[];
+extern char pygeoshapespy_set_orientation__doc__[];
+extern "C"
+PyObject * pygeoshapespy_set_orientation(PyObject *, PyObject *);
+
+extern char pygeoshapespy_set_center__name__[];
+extern char pygeoshapespy_set_center__doc__[];
+extern "C"
+PyObject * pygeoshapespy_set_center(PyObject *, PyObject *);
+
+//Sphere constructor & methods
+extern char pyanalmodelpy_new_sphere__name__[];
+extern char pyanalmodelpy_new_sphere__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_sphere(PyObject *, PyObject *);
+
+static void PyDelSphere(void *);
+
+//Cylinder constructor & methods
+extern char pyanalmodelpy_new_cylinder__name__[];
+extern char pyanalmodelpy_new_cylinder__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_cylinder(PyObject *, PyObject *);
+
+static void PyDelCylinder(void *);
+
+//Ellipsoid constructor & method
+extern char pyanalmodelpy_new_ellipsoid__name__[];
+extern char pyanalmodelpy_new_ellipsoid__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_ellipsoid(PyObject *, PyObject *);
+
+static void PyDelEllipsoid(void *);
+
+//Hollow Sphere constructor & methods
+extern char pyanalmodelpy_new_hollowsphere__name__[];
+extern char pyanalmodelpy_new_hollowsphere__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_hollowsphere(PyObject *, PyObject *);
+
+static void PyDelHollowSphere(void *);
+
+//Single Helix constructor & methods
+extern char pyanalmodelpy_new_singlehelix__name__[];
+extern char pyanalmodelpy_new_singlehelix__doc__[];
+extern "C"
+PyObject * pyanalmodelpy_new_singlehelix(PyObject *, PyObject *);
+
+static void PyDelSingleHelix(void *);
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/geoshapespy/libgeoshapespy/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,79 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+include local.def
+
+PROJECT = geoshapespy
+PACKAGE = libgeoshapespy
+
+PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
+PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
+
+PROJ_SRCS = \
+    geo_shape.cc \
+    sphere.cc \
+    hollow_sphere.cc \
+    cylinder.cc   \
+    ellipsoid.cc  \
+    single_helix.cc \
+    Point3D.cc  \
+    myutil.cc
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# build the library
+
+all: $(PROJ_SAR) export
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
+	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries export-binaries
+
+else
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries
+
+endif
+
+EXPORT_HEADERS = \
+    geo_shape.h   \
+    sphere.h      \
+    hollow_sphere.h \
+    cylinder.h \
+    ellipsoid.h \
+    single_helix.h \
+    Point3D.h  \
+    myutil.h
+
+
+EXPORT_LIBS = $(PROJ_SAR)
+EXPORT_BINS = $(PROJ_DLL)
+
+
+# version
+# $Id$
+
+#
+# End of file
Index: realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,220 @@
+//Point3D.cpp  
+
+#include <cmath>
+#include <cstdlib>
+#include <stdexcept>
+#include "Point3D.h"
+
+using namespace std;
+
+Point3D::Point3D(double a, double b, double c, double sld)
+{
+  x = a;
+  y = b;
+  z = c;
+  sld_ =  sld;
+}
+
+ostream& operator<< (ostream& os, const Point3D& p)
+{
+  os << "(" << p.getX() << ", " << p.getY() << ", " << p.getZ() << "," << p.getSLD() << ")";
+
+  return os;
+}
+
+double Point3D::distanceToPoint(const Point3D &p) const
+{
+	double dx=x-p.x;
+	double dy=y-p.y;
+	double dz=z-p.z;
+	return sqrt(dx*dx+dy*dy+dz*dz);
+}
+
+double Point3D::distanceToLine(const Point3D &p1, const Point3D &p2, bool * pIsOutside /* 0 */) const
+{
+	double u = ((x-p1.x)*(p2.x-p1.x) + (y-p1.y)*(p2.y-p1.y) + (z-p1.z)*(p2.z-p1.z))/(p1.distanceToPoint(p2)*p1.distanceToPoint(p2));
+	
+	if(pIsOutside != 0) {
+		if ( u < 0 || u > 1)
+			*pIsOutside=true;
+		else 
+			*pIsOutside=false;
+	}
+
+	double interX=p1.x+u*(p2.x-p1.x);
+	double interY=p1.y+u*(p2.y-p1.y);
+	double interZ=p1.z+u*(p2.z-p1.z);
+	
+	return sqrt((x-interX)*(x-interX)+(y-interY)*(y-interY)+(z-interZ)*(z-interZ));
+}
+
+// p1 and p2 determine a line, they are two end points
+Point3D Point3D::getInterPoint(const Point3D &p1, const Point3D &p2, bool * pIsOutside /* 0 */) const
+{
+	double u = ((x-p1.x)*(p2.x-p1.x) + (y-p1.y)*(p2.y-p1.y) + (z-p1.z)*(p2.z-p1.z))/(p1.distanceToPoint(p2)*p1.distanceToPoint(p2));
+	
+	if(pIsOutside != 0) {
+
+		if ( u < 0 || u > 1)
+			*pIsOutside=true;
+		else 
+			*pIsOutside=false;
+	}
+
+	return Point3D(p1.x+u*(p2.x-p1.x), p1.y+u*(p2.y-p1.y), p1.z+u*(p2.z-p1.z));
+}
+
+void Point3D::set(double x1, double y1, double z1)
+{
+	x = x1;
+	y = y1;
+	z = z1;
+}
+
+double Point3D::norm() const
+{
+	return sqrt(x * x + y * y + z * z);
+}
+
+double Point3D::normalize()
+{
+	double v = norm();
+	
+	if(v != 0) {
+		x /= v;
+		y /= v;
+		z /= v;
+	}
+	
+	return v;
+}
+
+Point3D Point3D::normVector() const
+{
+	Point3D p;	
+	double v = norm();
+	
+	if(v != 0) {
+		p.x = x / v;
+		p.y = y / v;
+		p.z = z / v;
+	}
+
+	return p;
+}
+
+double Point3D::dotProduct(const Point3D &p) const
+{
+	return x * p.x + y * p.y + z * p.z;
+}
+
+Point3D Point3D::minus(const Point3D &p) const
+{
+	return Point3D(x - p.x, y - p.y, z - p.z);
+}
+
+Point3D Point3D::plus(const Point3D &p) const
+{
+	return Point3D(x + p.x, y + p.y, z + p.z);
+}
+
+Point3D& Point3D::operator=(const Point3D &p)
+{
+	x = p.x;
+	y = p.y;
+	z = p.z;
+	sld_ = p.sld_;
+
+	return *this;
+}
+
+void Point3D::scale(double s)
+{
+	x *= s;
+	y *= s;
+	z *= s;
+}
+
+Point3D Point3D::multiplyProduct(const Point3D &p)
+{
+	return Point3D(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
+}
+
+void Point3D::Transform(const vector<double> &orien, const vector<double> &center){
+  if(orien[1]) RotateY(Degree2Radian(orien[1]));
+  if(orien[0]) RotateX(Degree2Radian(orien[0]));
+  if(orien[2]) RotateZ(Degree2Radian(orien[2]));
+
+  Translate(center[0],center[1],center[2]);
+}
+
+void Point3D::RotateX(const double ang_x)
+{
+  double sinA_ = sin(ang_x);
+  double cosA_ = cos(ang_x);
+
+  //x doesn't change;
+  double y_new= y*cosA_ - z*sinA_;
+  double z_new= y*sinA_ + z*cosA_;
+
+  y = y_new;
+  z = z_new;
+}
+
+void Point3D::RotateY(const double ang_y)
+{
+  double sinA_ = sin(ang_y);
+  double cosA_ = cos(ang_y);
+ 
+  double x_new = z*sinA_ + x*cosA_;
+  //y doesn't change
+  double z_new = z*cosA_ - x*sinA_;
+
+  x = x_new;
+  z = z_new;
+}
+
+void Point3D::RotateZ(const double ang_z)
+{
+  double sinA_ = sin(ang_z);
+  double cosA_ = cos(ang_z);
+
+  double x_new = x*cosA_ - y*sinA_;
+  double y_new = x*sinA_ + y*cosA_;
+  //z doesn't change
+
+  x = x_new;
+  y = y_new;
+}
+
+void Point3D::Translate(const double trans_x, const double trans_y, const double trans_z)
+{
+  double x_new = x + trans_x;
+  double y_new = y + trans_y;
+  double z_new = z + trans_z;
+
+  x = x_new;
+  y = y_new;
+  z = z_new;
+}
+
+double Point3D::Degree2Radian(const double degree)
+{
+  return degree/180*pi;
+}
+
+void Point3D::TransformMatrix(const vector<double> &rotmatrix, const vector<double> &center)
+{
+  if (rotmatrix.size() != 9 || center.size() != 3)
+    throw std::runtime_error("The size for rotation matrix vector has to be 9.");
+
+  double xold = x;
+  double yold = y;
+  double zold = z;
+
+  x = rotmatrix[0]*xold + rotmatrix[1]*yold + rotmatrix[2]*zold;
+  y = rotmatrix[3]*xold + rotmatrix[4]*yold + rotmatrix[5]*zold;
+  z = rotmatrix[6]*xold + rotmatrix[7]*yold + rotmatrix[8]*zold;
+
+  Translate(center[0],center[1],center[2]);
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/Point3D.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,87 @@
+//class point3D    1/29/2004 Jing
+//properties: copy point coordinates
+//	      calculate point to point distance 
+//	      shortest distance from a point to a line 
+
+
+#ifndef __POINT3D_
+#define __POINT3D_
+
+#include <iostream>
+#include <vector>
+
+using namespace std;
+
+const double pi = 3.1415926;
+
+class Point3D
+{
+  public:
+        Point3D() {}
+
+	//assign values with SLD to a point
+	Point3D(double a, double b, double c, double sld = 0);
+
+	// output
+	friend std::ostream& operator<<(std::ostream&, const Point3D&);
+
+	//distance to a point
+  	double distanceToPoint(const Point3D &p) const;
+  	
+  	//distance to a line
+  	double distanceToLine(const Point3D &p1, const Point3D &p2, bool *pv = 0) const; 
+
+	// get the point lying on the axis from a point
+	Point3D getInterPoint(const Point3D &p1, const Point3D &p2, bool *pv = 0) const;
+
+	// normalization
+	Point3D normVector() const;
+
+	// get length
+	double norm() const;
+	
+	double normalize();
+	
+	// assignment operator
+	Point3D& operator=(const Point3D &p);
+	
+	// scale this point with s
+	void scale(double s);
+	
+	// multiplication product of two vectors
+	Point3D multiplyProduct(const Point3D &p);
+
+	// p0 - p
+	Point3D minus(const Point3D &p) const;
+
+	// p0 + p
+	Point3D plus(const Point3D &p) const;
+
+	// dot product
+	double dotProduct(const Point3D &p) const;
+
+	//if you do not care if the point falls into the range of line,you can directly use distanceToLine(p1,p2)
+	void set(double x1, double y1, double z1);
+
+	double getX() const { return x; }
+	double getY() const { return y; }
+	double getZ() const { return z; }
+	double getSLD() const { return sld_; }
+
+        //Transformation
+        void Transform(const vector<double> &orien, const vector<double> &center);
+        void TransformMatrix(const vector<double> &rotmatrix, const vector<double> &center);
+  private:
+  	double x, y, z;
+	double sld_;
+
+        void RotateX(const double ang_x);
+        void RotateY(const double ang_y);
+        void RotateZ(const double ang_z);
+        void Translate(const double trans_x, const double trans_y, const double trans_z);
+        double Degree2Radian(const double degree);
+};
+
+typedef std::vector<Point3D> Point3DVector;
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,108 @@
+/** \file Cylinder.cc */
+#include <cmath>
+#include <cassert>
+#include "cylinder.h"
+#include "myutil.h"
+
+Cylinder::Cylinder()
+{
+  r_ = 0;
+}
+
+Cylinder::Cylinder(double radius,double length)
+{
+  r_ = radius;
+  l_ = length;
+  topcenter_ = Point3D(0,length/2,0);
+  botcenter_ = Point3D(0,-length/2,0);
+}
+
+Cylinder::~Cylinder()
+{
+}
+
+void Cylinder::SetRadius(double r)
+{
+  r_ = r;
+}
+
+void Cylinder::SetLength(double l)
+{
+  l_ = l;
+}
+
+double Cylinder::GetRadius()
+{
+  return r_;
+}
+
+double Cylinder::GetLength()
+{
+  return l_;
+}
+
+double Cylinder::GetMaxRadius()
+{
+  double maxr = sqrt(4*r_*r_ + l_*l_)/2;
+  return maxr;
+}
+
+ShapeType Cylinder::GetShapeType() const
+{
+  return CYLINDER;
+}
+
+double Cylinder::GetVolume()
+{
+  double V = pi * square(r_) * l_;
+  return V;
+}
+
+void Cylinder::GetFormFactor(IQ * iq)
+{
+  /** number of I for output, equal to the number of rows of array IQ*/
+  /** to be finished */
+}
+
+Point3D Cylinder::GetAPoint(double sld)
+{
+  /** cylinder long axis is along Y to match vtk actor */
+  static int max_try = 100;
+  for (int i = 0; i < max_try; ++i) {
+    double x = (ran1()-0.5) * 2 * r_;
+    double z = (ran1()-0.5) * 2 * r_;	
+    double y = (ran1()-0.5) * l_;
+
+    Point3D apoint(x,y,z,sld);
+    //check the cross section on xy plane within a sphere at (0,)
+    if (apoint.distanceToPoint(Point3D(0,y,0)) <= r_ ) 
+      return apoint;
+  }
+
+  std::cerr << "Max try "
+            << max_try
+            << " is reached while generating a point in cylinder" << std::endl;
+  return Point3D(0, 0, 0);
+}
+
+bool Cylinder::IsInside(const Point3D& point) const
+{
+  bool isOutside = false;
+  double distToLine = point.distanceToLine(GetTopCenter(),GetBotCenter(),&isOutside);
+
+  return (distToLine <= r_ && !isOutside);
+}
+
+Point3D Cylinder::GetTopCenter() const
+{
+  Point3D new_center(topcenter_);
+  new_center.Transform(GetOrientation(),GetCenter());
+  return new_center;
+}
+
+Point3D Cylinder::GetBotCenter() const
+{
+  Point3D new_center(botcenter_);
+  new_center.Transform(GetOrientation(),GetCenter());
+  return new_center;
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/cylinder.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,63 @@
+/** \file cylinder.h class Cylinder:GeoShape */
+
+#ifndef Cylinder_H
+#define Cylinder_H
+
+#include "geo_shape.h"
+
+/** class Cylinder, subclass of GeoShape */
+class Cylinder : public GeoShape {
+ public:
+
+  /** initialize */
+  Cylinder();
+
+  /** constructor with radius initialization */
+  Cylinder(double radius,double length);
+
+  ~Cylinder();
+
+  /** set parameter radius */
+  void SetRadius(double r);
+
+  /** set parameter length */
+  void SetLength(double l);
+
+  /** get the radius */
+  double GetRadius();
+  
+  /** get the length */
+  double GetLength();
+
+  /** get the radius of the sphere to cover this shape */
+  double GetMaxRadius();
+
+  /** get the volume */
+  double GetVolume();
+
+  /** calculate the cylinder form factor, no scale, no background*/
+  void GetFormFactor(IQ * iq);
+
+  /** using a equation to check whether a point with XYZ lies
+      within the cylinder with center (0,0,0)
+  */
+  Point3D GetAPoint(double sld);
+
+  /** check whether a point is inside the cylinder at any position 
+      in the 3D space
+  */
+  bool IsInside(const Point3D& point) const;
+
+  ShapeType GetShapeType() const;
+
+ protected:
+  Point3D GetTopCenter() const;
+  Point3D GetBotCenter() const;
+
+ private:
+  double r_, l_;
+  Point3D topcenter_,botcenter_;
+
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,165 @@
+/** \file Ellipsoid.cc */
+#include <cmath>
+#include <cassert>
+#include <algorithm>
+//MS library does not define min max in algorithm
+//#include "minmax.h"
+#include "ellipsoid.h"
+#include "myutil.h"
+
+using namespace std;
+
+Ellipsoid::Ellipsoid()
+{
+  rx_ = 0;
+  ry_ = 0;
+  rz_ = 0;
+}
+
+Ellipsoid::Ellipsoid(double rx, double ry, double rz)
+{
+  rx_ = rx;
+  ry_ = ry;
+  rz_ = rz;
+  xedge_plus_ = Point3D(rx,0,0);
+  xedge_minus_ = Point3D(-rx,0,0);
+  yedge_plus_ = Point3D(0,ry,0);
+  yedge_minus_ = Point3D(0,-ry,0);
+  zedge_plus_ = Point3D(0,0,rz);
+  zedge_minus_ = Point3D(0,0,-rz);
+}
+
+Ellipsoid::~Ellipsoid()
+{
+}
+
+void Ellipsoid::SetRadii(double rx, double ry, double rz)
+{
+  rx_ = rx;
+  ry_ = ry;
+  rz_ = rz;
+}
+
+double Ellipsoid::GetRadiusX()
+{
+  return rx_;
+}
+
+double Ellipsoid::GetRadiusY()
+{
+  return ry_;
+}
+
+double Ellipsoid::GetRadiusZ()
+{
+  return rz_;
+}
+
+double Ellipsoid::GetMaxRadius()
+{
+  double maxr = max(max(rx_,ry_),max(ry_,rz_));
+  return maxr;
+}
+
+ShapeType Ellipsoid::GetShapeType() const
+{
+  return ELLIPSOID;
+}
+
+double Ellipsoid::GetVolume()
+{
+  double V = (4./3.)*pi*rx_*ry_*rz_;
+  return V;
+}
+
+void Ellipsoid::GetFormFactor(IQ * iq)
+{
+  /** number of I for output, equal to the number of rows of array IQ*/
+  /** to be finished */
+}
+
+Point3D Ellipsoid::GetAPoint(double sld)
+{
+  static int max_try = 100;
+  for (int i = 0; i < max_try; ++i) {
+    double x = (ran1()-0.5) * 2 * rx_;
+    double y = (ran1()-0.5) * 2 * ry_;	
+    double z = (ran1()-0.5) * 2 * rz_;
+
+    if ((square(x/rx_) + square(y/ry_) + square(z/rz_)) <= 1){
+      Point3D apoint(x,y,z,sld);
+      return apoint;
+    }
+  }
+
+  std::cerr << "Max try "
+            << max_try
+            << " is reached while generating a point in ellipsoid" << std::endl;
+  return Point3D(0, 0, 0);
+}
+
+bool Ellipsoid::IsInside(const Point3D& point) const
+{
+  //x, y, z axis are internal axis
+  bool isOutsideX = false;
+  Point3D pointOnX = point.getInterPoint(GetXaxisPlusEdge(),GetXaxisMinusEdge(),&isOutsideX);
+  bool isOutsideY = false;
+  Point3D pointOnY = point.getInterPoint(GetYaxisPlusEdge(),GetYaxisMinusEdge(),&isOutsideY);
+  bool isOutsideZ = false;
+  Point3D pointOnZ = point.getInterPoint(GetZaxisPlusEdge(),GetZaxisMinusEdge(),&isOutsideZ);
+
+  if (isOutsideX || isOutsideY || isOutsideZ){
+    //one is outside axis is true -> the point is not inside
+    return false;    
+  }
+  else{
+    Point3D pcenter = GetCenterP();
+    double distX = pointOnX.distanceToPoint(pcenter);
+    double distY = pointOnY.distanceToPoint(pcenter);
+    double distZ = pointOnZ.distanceToPoint(pcenter);
+    return ((square(distX/rx_)+square(distY/ry_)+square(distZ/rz_)) <= 1);
+  }
+
+}
+
+Point3D Ellipsoid::GetXaxisPlusEdge() const
+{
+  Point3D new_edge(xedge_plus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
+
+Point3D Ellipsoid::GetXaxisMinusEdge() const
+{
+  Point3D new_edge(xedge_minus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
+
+Point3D Ellipsoid::GetYaxisPlusEdge() const
+{
+  Point3D new_edge(yedge_plus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
+
+Point3D Ellipsoid::GetYaxisMinusEdge() const
+{
+  Point3D new_edge(yedge_minus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
+
+Point3D Ellipsoid::GetZaxisPlusEdge() const
+{
+  Point3D new_edge(zedge_plus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
+
+Point3D Ellipsoid::GetZaxisMinusEdge() const
+{
+  Point3D new_edge(zedge_minus_);
+  new_edge.Transform(GetOrientation(),GetCenter());
+  return new_edge;
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/ellipsoid.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,65 @@
+/** \file cylinder.h class Cylinder:GeoShape */
+
+#ifndef Ellipsoid_H
+#define Ellipsoid_H
+
+#include "geo_shape.h"
+
+/** class Ellipsoid, subclass of GeoShape */
+class Ellipsoid : public GeoShape {
+ public:
+
+  /** initialize */
+  Ellipsoid();
+
+  /** constructor with radii initialization */
+  Ellipsoid(double rx,double ry, double rz);
+
+  ~Ellipsoid();
+
+  /** set parameter radii */
+  void SetRadii(double rx, double ry, double rz);
+
+  /** get the radii */
+  double GetRadiusX();
+  double GetRadiusY();
+  double GetRadiusZ();
+  
+  /** get the radius of the sphere to cover this shape */
+  double GetMaxRadius();
+
+  /** get the volume */
+  double GetVolume();
+
+  /** calculate the cylinder form factor, no scale, no background*/
+  void GetFormFactor(IQ * iq);
+
+  /** using a equation to check whether a point with XYZ lies
+      within the cylinder with center (0,0,0)
+  */
+  Point3D GetAPoint(double sld);
+
+  /** check whether a point is inside the cylinder at any position 
+      in the 3D space
+  */
+  bool IsInside(const Point3D& point) const;
+
+  ShapeType GetShapeType() const;
+
+ protected:
+  //get a point on three axis for function IsInside,using the edge point
+  Point3D GetXaxisPlusEdge() const;
+  Point3D GetXaxisMinusEdge() const;
+  Point3D GetYaxisPlusEdge() const;
+  Point3D GetYaxisMinusEdge() const;
+  Point3D GetZaxisPlusEdge() const;
+  Point3D GetZaxisMinusEdge() const;
+
+ private:
+  double rx_,ry_,rz_;
+  Point3D xedge_plus_,xedge_minus_;
+  Point3D yedge_plus_,yedge_minus_;
+  Point3D zedge_plus_,zedge_minus_;
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+#include "geo_shape.h"
+
+void GeoShape::SetOrientation(double angX,double angY, double angZ){
+  orientation_[0]=angX;
+  orientation_[1]=angY;
+  orientation_[2]=angZ;
+}
+
+void GeoShape::SetCenter(double cenX,double cenY,double cenZ){
+  center_[0]=cenX;
+  center_[1]=cenY;
+  center_[2]=cenZ;
+}
+
+vector<double> GeoShape::GetOrientation() const {
+  return orientation_;
+}
+
+vector<double> GeoShape::GetCenter() const {
+  return center_;
+}
+
+Point3D GeoShape::GetCenterP() const {
+  Point3D p(center_[0],center_[1],center_[2]);
+  return p;
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/geo_shape.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,66 @@
+/*! \file a abstract class GeoShape 
+*/
+#ifndef GEOSHAPE_H
+#define GEOSHAPE_H
+
+#include "iq.h"
+#include "Point3D.h"
+#include <vector>
+
+using namespace std;
+
+#define triple(x) ((x) * (x) * (x))
+#define square(x) ((x) * (x))
+
+enum ShapeType{ SPHERE, HOLLOWSPHERE, CYLINDER , ELLIPSOID,SINGLEHELIX};
+
+/**
+ *  class GeoShape, abstract class, parent class for Sphere, Cylinder ....
+ */
+
+class GeoShape{
+ public:
+
+  GeoShape(){
+    vector<double> init(3,0.0);
+    orientation_ = init;
+    center_ = init;
+  }
+  
+  virtual ~GeoShape() {}
+
+  /** calculate the form factor for a simple shape */
+  virtual void GetFormFactor(IQ * iq) = 0;
+
+  /** Get a point that is within the simple shape*/
+  virtual Point3D GetAPoint(double sld) = 0;
+
+  /** check whether a point is inside the shape*/
+  virtual bool IsInside(const Point3D& point) const = 0;
+
+  virtual double GetVolume() = 0;
+
+  virtual ShapeType GetShapeType() const = 0;
+
+  /** get the radius of the sphere to cover the shape*/
+  virtual double GetMaxRadius() = 0;
+
+  void SetOrientation(double angX, double angY, double angZ);
+
+  void SetCenter(double cenX, double cenY, double cenZ);
+
+  vector<double> GetOrientation() const;
+
+  vector<double> GetCenter() const;
+
+  Point3D GetCenterP() const;
+
+ private:
+  vector<double> orientation_;
+  
+ protected:
+  vector<double> center_;
+ 
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,83 @@
+/** \file hollowsphere.cc  */
+#include <cmath>
+#include <cassert>
+#include "hollow_sphere.h"
+
+HollowSphere::HollowSphere()
+{
+  ro_ = 0;
+  th_ = 0;
+}
+
+HollowSphere::HollowSphere(double radius, double thickness)
+{
+  ro_ = radius;
+  th_ = thickness;
+}
+
+double HollowSphere::GetMaxRadius()
+{
+  double maxr = ro_;
+  return maxr;
+}
+
+void HollowSphere::GetFormFactor(IQ * iq)
+{
+  /** number of I for output, equal to the number of rows of array IQ*/
+  int numI = iq->iq_data.dim1();
+  double qmin = iq->GetQmin();
+  double qmax = iq->GetQmax();
+
+  assert(numI > 0);
+  assert(qmin > 0);
+  assert(qmax > 0);
+  assert( qmax > qmin );
+
+  double logMin = log10(qmin);
+  double z = logMin;
+  double logMax = log10(qmax);
+  double delta = (logMax - logMin) / (numI-1);
+
+  //not finished yet, need to find the part which is equal to 1
+  for(int i = 0; i < numI; ++i) {
+
+    /** temp for Q*/
+    double q = pow(z,10);
+
+    double ri_ = ro_ - th_ ;
+
+    double bes1 = 3.0 * (sin(q*ri_) - q*ri_*cos(q*ri_)) / triple(q) / triple(ri_);
+    double bes2 = 3.0 * (sin(q*ro_) - q*ro_*cos(q*ro_)) / triple(q) / triple(ro_);
+    double bes = (triple(ro_)*bes1 - triple(ri_)*bes2)/(triple(ro_) - triple(ri_));
+    /** double f is the temp for I, should be equal to one when q is 0*/
+    double f = bes * bes;
+
+    /** IQ[i][0] is Q,Q starts from qmin (non zero),q=0 handle separately IQ[i][1] is I */
+    iq->iq_data[i][0]= q;
+    iq->iq_data[i][1]= f;
+
+    z += delta;
+  }
+
+}
+
+Point3D HollowSphere::GetAPoint(double sld)
+{
+  return Point3D(0,0,0);
+}
+
+double HollowSphere::GetVolume()
+{
+  return 0;
+}
+
+bool HollowSphere::IsInside(const Point3D& point) const
+{
+  return true;
+}
+
+ShapeType HollowSphere::GetShapeType() const
+{
+  return HOLLOWSPHERE;
+}
+
Index: realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/hollow_sphere.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,43 @@
+/** \file hollowsphere.h class HollowSphere:GeoShape */
+
+#ifndef HOLLOWSPHERE_H
+#define HOLLOWSPHERE_H
+
+#include "geo_shape.h"
+
+/** class Sphere, subclass of GeoShape */
+class HollowSphere : public GeoShape {
+ public:
+
+  /** initialize */
+  HollowSphere();
+
+  /** constructor with radius&length initialization */
+  HollowSphere(double radius, double thickness);
+
+  /** get the radius of the sphere to cover this shape */
+  double GetMaxRadius();
+
+  /** calculate the sphere form factor, no scale, no background*/
+  void GetFormFactor(IQ * iq);
+
+  /** using a equation to check whether a point with XYZ lies
+      within the sphere with center (0,0,0)
+  */
+  Point3D GetAPoint(double sld);
+
+  /** check whether point is inside hollow sphere*/
+  bool IsInside(const Point3D& point) const;
+
+  double GetVolume();
+
+  //get the shape type, return sphere 
+  ShapeType GetShapeType() const;
+
+ private:
+  //outer radius, and the thickness of the shell
+  double ro_, th_;
+
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/local.def
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,30 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+#
+# Local (project) definitions
+#
+
+# C++
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy   \
+		     ../../iqPy/libiqPy/tnt  \
+		     ../../pointsmodelpy/libpointsmodelpy 
+
+    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
+    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS) -liqPy
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/libgeoshapespy/minmax.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/minmax.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/minmax.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,23 @@
+#ifndef GUARD_minmax_H
+#define GUARD_minmax_H
+#ifdef _MSC_VER
+// needed to cope with bug in MS library:
+// it fails to define min/max
+
+template <class T> inline T max(const T& a, const T& b)
+{
+
+      return (a > b) ? a : b;
+
+}
+
+template <class T> inline T min(const T& a, const T& b)
+{
+
+      return (a < b) ? a : b;
+
+}
+
+#endif
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/myutil.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/myutil.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/myutil.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,16 @@
+/** \file myutil.cc */
+#include <cstdlib>
+#include <ctime> 
+#include "myutil.h"
+
+using namespace std;
+
+void seed_rnd() {
+	srand((unsigned)time(NULL)); 
+}
+
+double ran1()
+{
+	return (double)rand() / (double) RAND_MAX;
+}
+
Index: realSpaceModeling/geoshapespy/libgeoshapespy/myutil.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/myutil.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/myutil.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,9 @@
+/** \file myutil.h */
+#ifndef _MYUTIL_H
+#define _MYUTIL_H
+
+/** return a random float number between [0,1] */
+double ran1();
+void seed_rnd();
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,140 @@
+/** \file SingleHelix.cc */
+#include <cmath>
+#include <cassert>
+#include "single_helix.h"
+#include "myutil.h"
+
+SingleHelix::SingleHelix()
+{
+  hr_ = 0;
+  tr_ = 0;
+  pitch_ = 0;
+  turns_ = 0;
+}
+
+SingleHelix::SingleHelix(double helix_radius,double tube_radius,double pitch,double turns)
+{
+  hr_ = helix_radius;
+  tr_ = tube_radius;
+  pitch_ = pitch;
+  turns_ =  turns;
+}
+
+SingleHelix::~SingleHelix()
+{
+}
+
+void SingleHelix::SetHelixRadius(double hr)
+{
+  hr_ = hr;
+}
+
+void SingleHelix::SetTubeRadius(double tr)
+{
+  tr_ = tr;
+}
+
+void SingleHelix::SetPitch(double pitch)
+{
+  pitch_ = pitch;
+}
+
+void SingleHelix::SetTurns(double turns)
+{
+  turns_ = turns;
+}
+
+double SingleHelix::GetHelixRadius()
+{
+  return hr_;
+}
+
+double SingleHelix::GetTubeRadius()
+{
+  return tr_;
+}
+
+double SingleHelix::GetPitch()
+{
+  return pitch_;
+}
+
+double SingleHelix::GetTurns()
+{
+  return turns_;
+}
+
+double SingleHelix::GetMaxRadius()
+{
+  // put helix into a cylinder
+  double r_ = hr_ + tr_;
+  double l_ = pitch_*turns_ + 2*tr_;
+  double maxr = sqrt(4*r_*r_ + l_*l_)/2;
+  return maxr;
+}
+
+ShapeType SingleHelix::GetShapeType() const
+{
+  return SINGLEHELIX;
+}
+
+double SingleHelix::GetVolume()
+{
+  double V = pi*square(tr_)*sqrt(square(2*pi*hr_)+square(turns_*pitch_));
+  return V;
+}
+
+void SingleHelix::GetFormFactor(IQ * iq)
+{
+  /** number of I for output, equal to the number of rows of array IQ*/
+  /** to be finished */
+}
+
+Point3D SingleHelix::GetAPoint(double sld)
+{
+  int max_try = 100;
+  int i = 0;
+  double point1 = 0, point2 = 0, point3 = 0;
+ 
+  do{
+    i++;
+    if (i > max_try)
+	break;
+    zr_ = tr_*sqrt(1+square((pitch_/(2*pi*hr_))));
+    point1 = (ran1()-0.5)*2*tr_;
+    point2 = (ran1()-0.5)*2*zr_;
+    point3 = (ran1()-0.5)*4*pi*turns_;
+  } while (((square(point1/hr_)+square(point2/zr_))>1) || (point2+pitch_*point3/(2*pi)<0));
+
+  double x = (point1 + hr_)*cos(point3);
+  double y = (point1 + hr_)*sin(point3);
+  //"-pitch_*turns_/2" is just to corretly center the helix
+  double z = point2 + pitch_*point3/(2*pi)-pitch_*turns_/2;
+
+  Point3D apoint(x,y,z,sld);
+  return apoint;
+
+  
+  std::cerr << "Max try "
+            << max_try
+            << " is reached while generating a point in cylinder" << std::endl;
+  
+  return Point3D(0,0,0);
+}
+
+bool SingleHelix::IsInside(const Point3D& point) const
+{
+  double x = point.getX()-center_[0];
+  double y = point.getY()-center_[1];
+  double z = point.getZ()-center_[2];
+
+  double p3 = atan(y/x);
+  double p2 = z-(pitch_*p3)/(2*pi);
+  double p1 = x/cos(p3)-hr_;
+
+  if ((square(p1/tr_)+square(p2/zr_))>1 || p2+pitch_*p3/(2*pi))
+    return false;
+  else
+    return true;
+}
+
Index: realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/single_helix.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,75 @@
+/** \file cylinder.h class Cylinder:GeoShape */
+
+#ifndef SingleHelix_H
+#define SingleHelix_H
+
+#include "geo_shape.h"
+
+/** class SingleHelix, subclass of GeoShape */
+class SingleHelix : public GeoShape {
+ public:
+
+  /** initialize */
+  SingleHelix();
+
+  /** constructor with radius initialization */
+  SingleHelix(double helix_radius,double tube_radius,double pitch,double turns);
+
+  ~SingleHelix();
+
+  /** set parameter helix_radius */
+  void SetHelixRadius(double hr);
+
+  /** set parameter tube_radius */
+  void SetTubeRadius(double tr);
+
+  /** set parameter pitch */
+  void SetPitch(double pitch);
+
+  /** set parameter number of turns */
+  void SetTurns(double turns);
+
+  /** get the helix_radius */
+  double GetHelixRadius();
+
+  /** get the tube_radius */
+  double GetTubeRadius();
+  
+  /** get the pitch */
+  double GetPitch();
+
+  /** get the number of turns */
+  double GetTurns();
+
+  /** get the radius of the sphere to cover this shape */
+  double GetMaxRadius();
+
+  /** get the volume */
+  double GetVolume();
+
+  /** calculate the single helix form factor, no scale, no background*/
+  void GetFormFactor(IQ * iq);
+
+  /** using a equation to check whether a point with XYZ lies
+      within the cylinder with center (0,0,0)
+  */
+  Point3D GetAPoint(double sld);
+
+  /** check whether a point is inside the cylinder at any position 
+      in the 3D space
+  */
+  bool IsInside(const Point3D& point) const;
+
+  ShapeType GetShapeType() const;
+
+ protected:
+  //Point3D GetTopCenter() const;
+  //Point3D GetBotCenter() const;
+
+ private:
+  double hr_,tr_, pitch_, turns_,zr_;
+  Point3D topcenter_,botcenter_;
+
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/sphere.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/sphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/sphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,106 @@
+/** \file Sphere.cc */
+#include <cmath>
+#include <cassert>
+#include "sphere.h"
+#include "myutil.h"
+
+Sphere::Sphere()
+{
+  r_ = 0;
+}
+
+Sphere::Sphere(double radius)
+{
+  r_ = radius;
+}
+
+Sphere::~Sphere()
+{
+}
+
+void Sphere::SetRadius(double r)
+{
+  r_ = r;
+}
+
+double Sphere::GetRadius()
+{
+  return r_;
+}
+
+double Sphere::GetMaxRadius()
+{
+  double maxr = r_;
+  return maxr;
+}
+
+ShapeType Sphere::GetShapeType() const
+{
+  return SPHERE;
+}
+
+double Sphere::GetVolume()
+{
+  double V = 4 * pi / 3 * triple(r_);
+  return V;
+}
+
+void Sphere::GetFormFactor(IQ * iq)
+{
+  /** number of I for output, equal to the number of rows of array IQ*/
+  int numI = iq->iq_data.dim1();
+  double qmin = iq->GetQmin();
+  double qmax = iq->GetQmax();
+
+  assert(numI > 0);
+  assert(qmin > 0);
+  assert(qmax > 0);
+  assert( qmax > qmin );
+  
+  double logMin = log10(qmin);
+  double z = logMin;
+  double logMax = log10(qmax);
+  double delta = (logMax - logMin) / (numI-1);
+
+  for(int i = 0; i < numI; ++i) {
+
+    /** temp for Q*/
+    double q = pow(z, 10);
+ 
+    double bes = 3.0 * (sin(q*r_) - q*r_*cos(q*r_)) / triple(q) / triple(r_);
+
+    /** double f is the temp for I, should be equal to one when q is 0*/
+    double f = bes * bes;
+
+    /** IQ[i][0] is Q,Q starts from qmin (non zero),q=0 handle separately IQ[i][1] is IQ*/
+    iq->iq_data[i][0]= q;
+    iq->iq_data[i][1]= f;
+
+    z += delta;
+  }  
+}
+
+Point3D Sphere::GetAPoint(double sld)
+{
+  static int max_try = 100;
+  for (int i = 0; i < max_try; ++i) {
+    double x = (ran1()-0.5) * 2 * r_;
+    double y = (ran1()-0.5) * 2 * r_;	
+    double z = (ran1()-0.5) * 2 * r_;
+
+    Point3D apoint(x,y,z,sld);
+    if (apoint.distanceToPoint(Point3D(0,0,0)) <=r_ ) //dist to origin give sphere shape
+      return apoint;
+  }
+
+  std::cerr << "Max try "
+            << max_try
+            << " is reached while generating a point in sphere" << std::endl;
+  return Point3D(0, 0, 0);
+}
+
+bool Sphere::IsInside(const Point3D& point) const
+{
+  return point.distanceToPoint(Point3D(center_[0], center_[1], center_[2])) <= r_;
+  cout << "distance = " << point.distanceToPoint(Point3D(center_[0], center_[1], center_[2])) << endl;
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/sphere.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/sphere.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/sphere.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,52 @@
+/** \file sphere.h class Sphere:GeoShape */
+
+#ifndef SPHERE_H
+#define SPHERE_H
+
+#include "geo_shape.h"
+
+/** class Sphere, subclass of GeoShape */
+class Sphere : public GeoShape {
+ public:
+
+  /** initialize */
+  Sphere();
+
+  /** constructor with radius initialization */
+  Sphere(double radius);
+
+  ~Sphere();
+
+  /** set parameter radius */
+  void SetRadius(double r);
+
+  /** get the radius */
+  double GetRadius();
+
+  /** Get the radius of the sphere to cover this shape */
+  double GetMaxRadius();
+
+  /** get the volume */
+  double GetVolume();
+
+  /** calculate the sphere form factor, no scale, no background*/
+  void GetFormFactor(IQ * iq);
+
+  /** using a equation to check whether a point with XYZ lies
+      within the sphere with center (0,0,0)
+  */
+  Point3D GetAPoint(double sld);
+
+  /** check whether a point is inside the sphere at any position
+      in the 3D space
+  */
+  bool IsInside(const Point3D& point) const;
+
+  ShapeType GetShapeType() const;
+
+ private:
+  double r_;
+
+};
+
+#endif
Index: realSpaceModeling/geoshapespy/libgeoshapespy/transformation.cc
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/transformation.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/transformation.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,73 @@
+#include "transformation.h"
+#include <math.h>
+#include <stdexcept>
+
+void RotateX(const double ang_x,Point3D &a_point)
+{
+  double sinA_ = sin(ang_x);
+  double cosA_ = cos(ang_x);
+  double pointX_ = a_point.getX();
+  double pointY_ = a_point.getY();
+  double pointZ_ = a_point.getZ();
+
+  double x_new_ = pointX_;
+  double y_new_ = pointY_*cosA_ - pointZ_*sinA_;
+  double z_new_ = pointY_*sinA_ - pointZ_*cosA_;
+
+  a_point.set(x_new_, y_new_, z_new_);
+}
+
+void RotateY(const double ang_y,Point3D &a_point)
+{
+  double sinA_ = sin(ang_y);
+  double cosA_ = cos(ang_y);
+  double pointX_ = a_point.getX();
+  double pointY_ = a_point.getY();
+  double pointZ_ = a_point.getZ();
+
+  double x_new_ = pointX_*cosA_ + pointZ_*sinA_;
+  double y_new_ = pointY_;
+  double z_new_ = -pointX_*sinA_ + pointZ_*cosA_;
+
+  a_point.set(x_new_, y_new_, z_new_);
+}
+
+void RotateZ(const double ang_z,Point3D &a_point)
+{
+  double sinA_= sin(ang_z);
+  double cosA_ = cos(ang_z);
+  double pointX_ = a_point.getX();
+  double pointY_ = a_point.getY();
+  double pointZ_ = a_point.getZ();
+
+  double x_new_ = pointX_*cosA_ - pointY_*sinA_;
+  double y_new_ = pointX_*sinA_+ pointY_*cosA_;
+  double z_new_ = pointZ_;
+
+  a_point.set(x_new_, y_new_, z_new_);
+}
+
+void Translate(const double trans_x, const double trans_y, const double trans_z, Point3D &a_point)
+{
+  double x_new_ = a_point.getX() + trans_x;
+  double y_new_ = a_point.getY() + trans_y;
+  double z_new_ = a_point.getZ() + trans_z;
+
+  a_point.set(x_new_, y_new_, z_new_);
+}
+
+void RotateMatrix(const vector<double> &rotmatrix, Point3D &a_point)
+{
+  if (rotmatrix.size() != 9)
+    throw std::runtime_error("The size for rotation matrix vector has to be 9.");
+
+  double xold = a_point.getX();
+  double yold = a_point.getY();
+  double zold = a_point.getZ();
+
+  double x_new_ = rotmatrix[0]*xold + rotmatrix[1]*yold + rotmatrix[2]*zold;
+  double y_new_ = rotmatrix[3]*xold + rotmatrix[4]*yold + rotmatrix[5]*zold;
+  double z_new_ = rotmatrix[6]*xold + rotmatrix[7]*yold + rotmatrix[8]*zold;
+
+  a_point.set(x_new_, y_new_, z_new_);
+}
Index: realSpaceModeling/geoshapespy/libgeoshapespy/transformation.h
===================================================================
--- realSpaceModeling/geoshapespy/libgeoshapespy/transformation.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/libgeoshapespy/transformation.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+/** \file transformation.h: a few functions to do the transformation */
+
+#ifndef TRANSFORMATION_H
+//Transform operation on a Point3D
+//Not in use, similar transformation are implemented as Point3D class functions
+
+#define TRANSFORMATION_H
+
+#include <vector>
+#include "Point3D.h"
+
+void RotateX(const double ang_x,Point3D &);
+void RotateY(const double ang_y,Point3D &);
+void RotateZ(const double ang_z,Point3D &);
+void Translate(const double trans_x, const double trans_y, const double trans_z, Point3D &);
+
+//rotate a point by given a rotation 3X3 matrix
+//vec[0]=R00, vec[1]=R01.......vec[8]=R22
+void RotateMatrix(const vector<double> &, Point3D &);
+
+#endif
Index: realSpaceModeling/geoshapespy/tests/Make.mm
===================================================================
--- realSpaceModeling/geoshapespy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,59 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = geoshapespy
+PACKAGE = tests
+
+PROJ_CLEAN += $(PROJ_CPPTESTS)
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy   \
+                     ../../iqPy/libiqPy/tnt \
+                     ../libgeoshapespy   \
+		     ../../pointsmodelpy/libpointsmodelpy
+
+PROJ_PYTESTS = 
+PROJ_CPPTESTS = testpoint
+
+PROJ_TESTS = $(PROJ_PYTESTS) $(PROJ_CPPTESTS)
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -lgeoshapespy -liqPy -lpointsmodelpy
+
+
+#--------------------------------------------------------------------------
+#
+
+all: $(PROJ_TESTS)
+
+test:
+	for test in $(PROJ_TESTS) ; do $${test}; done
+
+release: tidy
+	cvs release .
+
+update: clean
+	cvs update .
+
+#--------------------------------------------------------------------------
+#
+
+testshapes: testshapes.cc $(BLD_LIBDIR)/libgeoshapespy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -o $@ testshapes.cc $(PROJ_LIBRARIES)
+
+testpoint: testPoint.cc $(BLD_LIBDIR)/libgeoshapespy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -o $@ testPoint.cc $(PROJ_LIBRARIES)
+
+testtransformation:  testtransformation.cc $(BLD_LIBDIR)/libgeoshapespy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -o $@ testtransformation.cc $(PROJ_LIBRARIES)
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/geoshapespy/tests/testPoint.cc
===================================================================
--- realSpaceModeling/geoshapespy/tests/testPoint.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/testPoint.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,40 @@
+#include <iostream>
+#include <vector>
+#include "Point3D.h"
+
+
+using namespace std;
+
+int main(){
+
+  cout << "test 1:initialize a point, set orientation, set center"
+       << " and perform transform" <<endl;
+  Point3D apoint(3,4,5);
+
+  vector<double> orient(3),center(3);
+  for (int i = 0; i!=3; ++i){
+    center[i] = 0;
+  }
+  orient[0]=10;
+  orient[1]=0;
+  orient[2]=30;
+
+  apoint.Transform(orient,center);
+
+  cout << apoint.getX() <<" "<<apoint.getY()<<" "<<apoint.getZ()<<endl;
+  cout << orient[0] <<" "<<orient[1]<<" "<<orient[2]<<endl;
+
+  cout << "test 2: initialize a point, and perform transformation \n"
+       << "through a rotation matrix and a translation" <<endl;
+
+  vector<double> rotmatrix(9,1);
+  for (size_t i = 0; i != rotmatrix.size(); ++i){
+    cout << rotmatrix[i] <<" ";
+  }
+
+  Point3D pp(1,1,1);
+  pp.TransformMatrix(rotmatrix, center);
+
+  cout << pp.getX() <<" "<<pp.getY()<<" "<<pp.getZ()<<endl;
+  return 0;
+}
Index: realSpaceModeling/geoshapespy/tests/testorientation.cc
===================================================================
--- realSpaceModeling/geoshapespy/tests/testorientation.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/testorientation.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,13 @@
+#include "sphere.h"
+#include <iostream>
+
+int main(){
+  Sphere sph1(10);
+  sph1.SetOrientation(10,20,30);
+  sph1.SetCenter(1,5,10);
+
+  vector<double> v1 = sph1.GetOrientation();
+  cout << v1[0] <<endl;
+
+  return 0;
+}
Index: realSpaceModeling/geoshapespy/tests/testshapes.cc
===================================================================
--- realSpaceModeling/geoshapespy/tests/testshapes.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/testshapes.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,171 @@
+#include <cassert>
+#include <iostream>
+#include <vector>
+#include "sphere.h"
+#include "cylinder.h"
+#include "hollow_sphere.h"
+#include "ellipsoid.h"
+#include "single_helix.h"
+#include "iq.h"
+
+using namespace std;
+
+void TestGetFormFactor_sphere() {
+  Sphere sphere(1.0);
+
+  IQ iq1(10,0.001, 0.3);
+  sphere.GetFormFactor(&iq1);
+
+  for (int i = 0; i< iq1.iq_data.dim1(); i++)
+    cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;
+}
+
+void TestGetShapeType_sphere() {
+  Sphere sphere;
+  //if (assert(sphere.GetShapeType() == SPHERE))
+  //  cout << " it is a sphere" << endl;
+  cout << sphere.GetShapeType() << endl;
+}
+
+void TestGetShapeType(GeoShape &gs){
+  cout <<gs.GetShapeType() << endl;
+}
+
+void TestGetVolume_sphere() {
+  Sphere s(1);
+  cout << "volume is " << s.GetVolume();
+}
+
+void TestGetAPoint_sphere(){
+  Sphere asphere(10);
+  cout << asphere.GetAPoint(1) << endl;
+}
+
+void TestGetFormFactor_HS(){
+
+  HollowSphere hs(10, 2);
+
+  IQ iq1(10, 0.001, 0.3);
+  hs.GetFormFactor(&iq1);
+
+  for (int i = 0; i< iq1.iq_data.dim1(); i++)
+    cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;
+
+
+}
+
+void TestGetShapeType_HS(){
+  HollowSphere hs1;
+  assert(hs1.GetShapeType() == HOLLOWSPHERE);
+}
+
+void TestIsInside_sphere(){
+  cout << "Testing IsInside(): ";
+  Sphere s1(10);
+  Point3D pp(20,30,30);
+  Point3D pp2(1,1,1);
+
+  cout << s1.IsInside(pp) <<" " << s1.IsInside(pp2) << " ";
+  cout << "Finished testing IsInside()" <<endl;
+}
+
+void TestCylinder(){
+  Cylinder c1(10,20);
+  Point3D p1 = c1.GetAPoint(1);
+  Point3D p4 = c1.GetAPoint(1);
+  cout << "Got two points inside the cylinder" << endl;
+  cout << "the distance is: " << p1.distanceToPoint(p4);
+  cout << p1 << endl;
+  cout << "is this point inside?:" << c1.IsInside(p1) << endl;
+  
+  Point3D p2(20,20,20);
+  cout << "this point should be outside:" << c1.IsInside(p2) <<endl;
+
+  c1.SetOrientation(10,10,10);
+  c1.SetCenter(20,20,20);
+
+  vector<double> ori;
+  ori.push_back(10);
+  ori.push_back(10);
+  ori.push_back(20);
+
+  vector<double> cen;
+  cen.push_back(20);
+  cen.push_back(20);
+  cen.push_back(20);
+
+  p1.Transform(ori,cen);
+  cout << "is the p1 still inside after orientation?" << c1.IsInside(p1) << endl;
+  cout << "p1 p2 distance: " <<p1.distanceToPoint(p4) << endl;
+
+  Point3D p3(0,0,0);
+  cout <<" this origin point should be outside after transformation:" << c1.IsInside(p3) <<endl;
+
+  Point3D pp1(6.8,-2.11,11);
+  cout <<"is pp1 inside? "<< c1.IsInside(pp1) << endl;
+
+}
+
+void TestEllipsoid(){
+  Ellipsoid e1(5,10,15);
+  cout << "generated an ellipsoid:"<<e1.GetRadiusX()<<" ";
+  cout <<e1.GetRadiusY()<<" " << e1.GetRadiusZ() << endl;
+  cout << "maximum radius is: " << e1.GetMaxRadius() << endl;
+  cout << "volume is : " << e1.GetVolume() << endl;
+  cout << "Get a point: " << e1.GetAPoint(1.0) << endl;
+
+  Point3D p1(1,2,3);
+  Point3D p2(6,11,16);
+  Point3D p3(100,100,100);
+  cout <<"is " << p1 << " inside? " << e1.IsInside(p1) << endl;
+  cout <<"is " << p2 << " inside? " << e1.IsInside(p2) << endl;
+
+  e1.SetCenter(10,10,10);
+  Point3D p4(11,12,13);
+  cout <<"is " << p2 << " inside after moved? " << e1.IsInside(p2) << endl;
+
+  e1.SetOrientation(90,90,90);
+  cout <<"is " << p3 << " inside after rotated? " << e1.IsInside(p3) << endl;
+
+}
+
+void TestSingleHelix(){
+
+  cout <<" Testing single helix" << endl;
+  SingleHelix sh(10,3,30,1);
+  cout << "Get a point" << sh.GetAPoint(1.0) << endl;  
+
+  Point3D p1(1,1,-50); //cannot be in sh(10,3,30,1)
+  cout <<"is " << p1 <<" inside?" << sh.IsInside(p1)<< endl;
+  Point3D p2(-3.15922, -11.6193, 20.5302); //should be inside
+  cout <<"is " << p2 <<" inside?" << sh.IsInside(p2)<< endl;
+
+}
+
+int main(){
+ 
+  //cout << "testing sphere :\n" ;
+  //TestGetAPoint_sphere();
+  //TestGetShapeType_sphere();
+  //testing getting shape type from parent
+  //Sphere ss(1);
+  //TestGetShapeType(ss);
+  //TestGetVolume_sphere();
+  //TestIsInside_sphere();
+
+  //cout << "testing hollowsphere: \n" ;	
+  //TestGetFormFactor_HS();
+  //TestGetShapeType_HS();
+  //  TestGetVolume();
+  
+  //cout << "testing cylinder:\n";
+  //TestCylinder();
+  
+  //cout << "testing ellipsoid :\n";
+  //TestEllipsoid();
+
+  TestSingleHelix();
+  printf("PASS.\n");
+
+  return 0;
+}
Index: realSpaceModeling/geoshapespy/tests/testshapes.py
===================================================================
--- realSpaceModeling/geoshapespy/tests/testshapes.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/testshapes.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    from SANSsimulation import geoshapespy
+
+    print
+    print "module information:"
+    print "    file:", geoshapespy.__file__
+    print "    doc:", geoshapespy.__doc__
+    print "    contents:", dir(geoshapespy)
+
+    sp = geoshapespy.new_sphere(10)
+#    geoshapespy.set_orientation(sp,10,20,10)
+    cy = geoshapespy.new_cylinder(2,6)
+
+    el = geoshapespy.new_ellipsoid(25,15,10)
+
+    hs = geoshapespy.new_hollowsphere(10,2)
+
+    sh = geoshapespy.new_singlehelix(10,2,30,2)
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/geoshapespy/tests/testsphere.cc
===================================================================
--- realSpaceModeling/geoshapespy/tests/testsphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/geoshapespy/tests/testsphere.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,36 @@
+#include <cassert>
+#include <iostream>
+#include "sphere.h"
+#include "iq.h"
+
+using namespace std;
+
+void TestGetAnalyticalIQ() {
+  Sphere sphere(1.0);
+
+  IQ iq1(10,0.001, 0.3);
+  sphere.GetFormFactor(&iq1);
+
+  for (int i = 0; i< iq1.iq_data.dim1(); i++)
+    cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;
+}
+
+void TestGetShapeType() {
+  Sphere sphere;
+  assert(sphere.GetShapeType() == SPHERE);
+}
+
+void TestGetVolume() {
+  Sphere s(1);
+  cout << "volume is " << s.GetVolume();
+}
+
+int main(){
+  TestGetAnalyticalIQ();
+  TestGetShapeType();
+  TestGetVolume();
+
+  printf("PASS.\n");
+
+  return 0;
+}
Index: realSpaceModeling/iqPy/Make.mm
===================================================================
--- realSpaceModeling/iqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,47 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+
+# directory structure
+
+BUILD_DIRS = \
+    libiqPy \
+    iqPymodule \
+    iqPy \
+
+OTHER_DIRS = \
+    tests \
+    examples
+
+RECURSE_DIRS = $(BUILD_DIRS) $(OTHER_DIRS)
+
+#--------------------------------------------------------------------------
+#
+
+all:
+	BLD_ACTION="all" $(MM) recurse
+
+distclean::
+	BLD_ACTION="distclean" $(MM) recurse
+
+clean::
+	BLD_ACTION="clean" $(MM) recurse
+
+tidy::
+	BLD_ACTION="tidy" $(MM) recurse
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/examples/Make.mm
===================================================================
--- realSpaceModeling/iqPy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+PACKAGE = examples
+
+#--------------------------------------------------------------------------
+#
+
+all: clean
+
+release: clean
+	cvs release .
+
+update: clean
+	cvs update .
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/iqPy/Make.mm
===================================================================
--- realSpaceModeling/iqPy/iqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = SANSsimulation
+PACKAGE = iqPy
+
+#--------------------------------------------------------------------------
+#
+
+all: export
+
+
+#--------------------------------------------------------------------------
+#
+# export
+
+EXPORT_PYTHON_MODULES = \
+    __init__.py
+
+
+export:: export-python-modules
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/iqPy/__init__.py
===================================================================
--- realSpaceModeling/iqPy/iqPy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+def copyright():
+    return "iqPy pyre module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/iqPy/iqPymodule/Make.mm
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+PACKAGE = iqPymodule
+MODULE = iqPy
+
+include std-pythonmodule.def
+include local.def
+
+PROJ_CXX_SRCLIB = -liqPy 
+PROJ_SRCS = \
+    bindings.cc \
+    exceptions.cc \
+    misc.cc
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/iqPymodule/bindings.cc
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "bindings.h"
+
+#include "misc.h"          // miscellaneous methods
+
+// the method table
+
+struct PyMethodDef pyiqPy_methods[] = {
+
+    // new_iq
+    {pyiqPy_new_iq__name__, pyiqPy_new_iq,
+     METH_VARARGS, "iq(int numI,double qmin, double qmax)->new IQ object"},
+
+    //OutputIQ
+    {pyiqPy_OutputIQ__name__, pyiqPy_OutputIQ,
+     METH_VARARGS, pyiqPy_OutputIQ__doc__},
+
+    {pyiqPy_copyright__name__, pyiqPy_copyright,
+     METH_VARARGS, pyiqPy_copyright__doc__},
+
+
+// Sentinel
+    {0, 0}
+};
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/bindings.h
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyiqPy_bindings_h)
+#define pyiqPy_bindings_h
+
+// the method table
+
+extern struct PyMethodDef pyiqPy_methods[];
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/exceptions.cc
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+PyObject *pyiqPy_runtimeError = 0;
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/exceptions.h
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyiqPy_exceptions_h)
+#define pyiqPy_exceptions_h
+
+// exceptions
+
+extern PyObject *pyiqPy_runtimeError;
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/iqPymodule.cc
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/iqPymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/iqPymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+
+#include <Python.h>
+
+#include "exceptions.h"
+#include "bindings.h"
+
+
+char pyiqPy_module__doc__[] = "";
+
+// Initialization function for the module (*must* be called initiqPy)
+extern "C"
+void
+initiqPy()
+{
+    // create the module and add the functions
+    PyObject * m = Py_InitModule4(
+        "iqPy", pyiqPy_methods,
+        pyiqPy_module__doc__, 0, PYTHON_API_VERSION);
+
+    // get its dictionary
+    PyObject * d = PyModule_GetDict(m);
+
+    // check for errors
+    if (PyErr_Occurred()) {
+        Py_FatalError("can't initialize module iqPy");
+    }
+
+    // install the module exceptions
+    pyiqPy_runtimeError = PyErr_NewException("iqPy.runtime", 0, 0);
+    PyDict_SetItemString(d, "RuntimeException", pyiqPy_runtimeError);
+
+    return;
+}
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/local.def
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+# C++
+
+    PROJ_CXX_INCLUDES = ../libiqPy/tnt \
+			../libiqPy
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/iqPymodule/misc.cc
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "misc.h"
+#include "iq.h"
+
+
+// copyright
+
+char pyiqPy_copyright__doc__[] = "";
+char pyiqPy_copyright__name__[] = "copyright";
+
+static char pyiqPy_copyright_note[] = 
+    "iqPy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+PyObject * pyiqPy_copyright(PyObject *, PyObject *)
+{
+    return Py_BuildValue("s", pyiqPy_copyright_note);
+}
+    
+// iq(int numI,double qmin,double qmax)
+char pyiqPy_new_iq__doc__[] = "wrap class iq in C++";
+char pyiqPy_new_iq__name__[] = "new_iq";
+
+PyObject * pyiqPy_new_iq(PyObject *, PyObject *args)
+{
+  int py_numI;
+  double py_qmin, py_qmax;
+  int ok = PyArg_ParseTuple(args,"idd",&py_numI, &py_qmin, &py_qmax);
+  if(!ok) return 0;
+
+  IQ *iq = new IQ(py_numI,py_qmin,py_qmax);
+  
+  return PyCObject_FromVoidPtr(iq, NULL);
+}
+
+//output iq to file
+extern char pyiqPy_OutputIQ__name__[] = "OutputIQ";
+extern char pyiqPy_OutputIQ__doc__[] = "";
+
+PyObject * pyiqPy_OutputIQ(PyObject *, PyObject *args){
+  PyObject *pyiq = 0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args,"Os", &pyiq, &outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyiq);
+
+  IQ * thisiq = static_cast<IQ *>(temp);
+
+  thisiq->OutputIQ(outfile);
+
+  return Py_BuildValue("i",0);
+}
+
+//release the iq object
+static void PyDeliq(void *ptr)
+{
+  std::cout<<"Called PyDeliq()\n"; //Good to see once
+  IQ * oldiq = static_cast<IQ *>(ptr);
+  delete oldiq;
+  return;
+}
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/iqPymodule/misc.h
===================================================================
--- realSpaceModeling/iqPy/iqPymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/iqPymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pyiqPy_misc_h)
+#define pyiqPy_misc_h
+
+// copyright
+extern char pyiqPy_copyright__name__[];
+extern char pyiqPy_copyright__doc__[];
+extern "C"
+PyObject * pyiqPy_copyright(PyObject *, PyObject *);
+
+// iq constructor, iq(int, double, double)
+extern char pyiqPy_new_iq__name__[];
+extern char pyiqPy_new_iq__doc__[];
+extern "C"
+PyObject * pyiqPy_new_iq(PyObject *, PyObject *);
+
+//output iq to file
+extern char pyiqPy_OutputIQ__name__[];
+extern char pyiqPy_OutputIQ__doc__[];
+extern "C"
+PyObject * pyiqPy_OutputIQ(PyObject *, PyObject *);
+
+//release the iq object
+static void PyDeliq(void *ptr);
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/iqPy/libiqPy/Make.mm
===================================================================
--- realSpaceModeling/iqPy/libiqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,64 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+include local.def
+
+PROJECT = iqPy
+PACKAGE = libiqPy
+
+PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
+PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
+
+PROJ_SRCS = \
+    iq.cc
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# build the library
+
+all: $(PROJ_SAR) export
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
+	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries export-binaries
+
+else
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries
+
+endif
+
+EXPORT_HEADERS = \
+    iq.h
+
+EXPORT_LIBS = $(PROJ_SAR)
+EXPORT_BINS = $(PROJ_DLL)
+
+
+# version
+# $Id$
+
+#
+# End of file
Index: realSpaceModeling/iqPy/libiqPy/iq.cc
===================================================================
--- realSpaceModeling/iqPy/libiqPy/iq.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/iq.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,80 @@
+/** \file iq.cc */
+
+#include "iq.h"
+#include <fstream>
+#include <iostream>
+
+using namespace std;
+
+IQ::IQ(int numI){
+
+  numI_ = numI;
+
+  Array2D<double> iq1(numI, 2, 0.0);
+
+  iq_data = iq1;
+}
+
+IQ::IQ(int numI,double qmin, double qmax){
+
+  numI_ = numI;
+  qmin_ = qmin;
+  qmax_ = qmax;
+
+  Array2D<double> iq1(numI, 2, 0.0);
+
+  iq_data = iq1;
+}
+
+void IQ::SetQmin(double qmin){
+  qmin_ = qmin;
+
+}
+
+void IQ::SetQmax(double qmax){
+  qmax_ = qmax;
+}
+
+void IQ::SetContrast(double delrho){
+  delrho_ = delrho;
+}
+
+void IQ::SetVolFrac(double vol_frac){
+  vol_frac_ = vol_frac;
+}
+
+double IQ::GetQmin(){
+  return qmin_;
+}
+
+double IQ::GetQmax(){
+  return qmax_;
+}
+
+double IQ::GetContrast(){
+  return delrho_;
+}
+
+double IQ::GetVolFrac(){
+  return vol_frac_;
+}
+
+int IQ::GetNumI(){
+  return numI_;
+}
+
+void IQ::OutputIQ(string fiq){
+  ofstream outfile(fiq.c_str());
+  if (!outfile) {
+    cerr << "error: unable to open output file: "
+	 << outfile << endl;
+    exit(1);
+  }
+  for (int i = 0;  i < iq_data.dim1(); ++i){
+    outfile << iq_data[i][0] << "       " << iq_data[i][1] << endl;
+  }
+    //    fprintf(fp,"%15lf%15lf%15lf\n", (j+1)*rstep, cor[j]/cormax, "0");
+
+
+
+}
Index: realSpaceModeling/iqPy/libiqPy/iq.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/iq.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/iq.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,45 @@
+/** \file iq.h   class IQ  */
+
+#ifndef IQ_H
+#define IQ_H
+
+#include <string>
+/**tnt: template numerical toolkit, http://math.nist.gov/tnt/ */
+#include "tnt/tnt.h"
+using namespace TNT;
+
+class IQ{
+  
+ public:
+  IQ(int numI);
+  IQ(int numI,double qmin, double qmax);
+
+  void SetQmin(double qmin);
+  void SetQmax(double qmax);
+  void SetContrast(double delrho);
+  void SetVolFrac(double vol_frac);
+  void SetIQArray(Array2D<double> iq_array);
+
+  double GetQmin();
+  double GetQmax();
+  double GetContrast();
+  double GetVolFrac();
+  int GetNumI();
+
+  void OutputIQ(std::string fiq);
+
+  Array2D<double> iq_data;
+
+ private:
+  IQ();
+  double qmin_;
+  double qmax_;
+  double delrho_;
+  int numI_;
+  double vol_frac_;
+
+
+};
+
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/local.def
===================================================================
--- realSpaceModeling/iqPy/libiqPy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,27 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+#
+# Local (project) definitions
+#
+
+# C++
+
+PROJ_CXX_INCLUDES += tnt
+    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
+    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS)
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,64 @@
+/*
+*
+* Template Numerical Toolkit (TNT): Linear Algebra Module
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_H
+#define TNT_H
+
+
+
+//---------------------------------------------------------------------
+// Define this macro if you want  TNT to track some of the out-of-bounds
+// indexing. This can encur a small run-time overhead, but is recommended 
+// while developing code.  It can be turned off for production runs.
+// 
+//       #define TNT_BOUNDS_CHECK
+//---------------------------------------------------------------------
+//
+
+//#define TNT_BOUNDS_CHECK
+
+
+
+#include "tnt_version.h"
+#include "tnt_math_utils.h"
+#include "tnt_array1d.h"
+#include "tnt_array2d.h"
+#include "tnt_array3d.h"
+#include "tnt_array1d_utils.h"
+#include "tnt_array2d_utils.h"
+#include "tnt_array3d_utils.h"
+
+#include "tnt_fortran_array1d.h"
+#include "tnt_fortran_array2d.h"
+#include "tnt_fortran_array3d.h"
+#include "tnt_fortran_array1d_utils.h"
+#include "tnt_fortran_array2d_utils.h"
+#include "tnt_fortran_array3d_utils.h"
+
+#include "tnt_sparse_matrix_csr.h"
+
+#include "tnt_stopwatch.h"
+#include "tnt_subscript.h"
+#include "tnt_vec.h"
+#include "tnt_cmat.h"
+
+
+#endif
+// TNT_H
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,278 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_ARRAY1D_H
+#define TNT_ARRAY1D_H
+
+//#include <cstdlib>
+#include <iostream>
+
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+
+#include "tnt_i_refvec.h"
+
+namespace TNT
+{
+
+template <class T>
+class Array1D 
+{
+
+  private:
+
+	  /* ... */
+    i_refvec<T> v_;
+    int n_;
+    T* data_;				/* this normally points to v_.begin(), but
+                             * could also point to a portion (subvector)
+							 * of v_.
+                            */
+
+    void copy_(T* p, const T*  q, int len) const;
+    void set_(T* begin,  T* end, const T& val);
+ 
+
+  public:
+
+    typedef         T   value_type;
+
+
+	         Array1D();
+	explicit Array1D(int n);
+	         Array1D(int n, const T &a);
+	         Array1D(int n,  T *a);
+    inline   Array1D(const Array1D &A);
+	inline   operator T*();
+	inline   operator const T*();
+	inline   Array1D & operator=(const T &a);
+	inline   Array1D & operator=(const Array1D &A);
+	inline   Array1D & ref(const Array1D &A);
+	         Array1D copy() const;
+		     Array1D & inject(const Array1D & A);
+	inline   T& operator[](int i);
+	inline   const T& operator[](int i) const;
+	inline 	 int dim1() const;
+	inline   int dim() const;
+              ~Array1D();
+
+
+	/* ... extended interface ... */
+
+	inline int ref_count() const;
+	inline Array1D<T> subarray(int i0, int i1);
+
+};
+
+
+
+
+template <class T>
+Array1D<T>::Array1D() : v_(), n_(0), data_(0) {}
+
+template <class T>
+Array1D<T>::Array1D(const Array1D<T> &A) : v_(A.v_),  n_(A.n_), 
+		data_(A.data_)
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Array1D(const Array1D<T> &A) \n";
+#endif
+
+}
+
+
+template <class T>
+Array1D<T>::Array1D(int n) : v_(n), n_(n), data_(v_.begin())
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Array1D(int n) \n";
+#endif
+}
+
+template <class T>
+Array1D<T>::Array1D(int n, const T &val) : v_(n), n_(n), data_(v_.begin()) 
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Array1D(int n, const T& val) \n";
+#endif
+	set_(data_, data_+ n, val);
+
+}
+
+template <class T>
+Array1D<T>::Array1D(int n, T *a) : v_(a), n_(n) , data_(v_.begin())
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Array1D(int n, T* a) \n";
+#endif
+}
+
+template <class T>
+inline Array1D<T>::operator T*()
+{
+	return &(v_[0]);
+}
+
+
+template <class T>
+inline Array1D<T>::operator const T*()
+{
+	return &(v_[0]);
+}
+
+
+
+template <class T>
+inline T& Array1D<T>::operator[](int i) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i>= 0);
+	assert(i < n_);
+#endif
+	return data_[i]; 
+}
+
+template <class T>
+inline const T& Array1D<T>::operator[](int i) const 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i>= 0);
+	assert(i < n_);
+#endif
+	return data_[i]; 
+}
+
+
+	
+
+template <class T>
+Array1D<T> & Array1D<T>::operator=(const T &a)
+{
+	set_(data_, data_+n_, a);
+	return *this;
+}
+
+template <class T>
+Array1D<T> Array1D<T>::copy() const
+{
+	Array1D A( n_);
+	copy_(A.data_, data_, n_);
+
+	return A;
+}
+
+
+template <class T>
+Array1D<T> & Array1D<T>::inject(const Array1D &A)
+{
+	if (A.n_ == n_)
+		copy_(data_, A.data_, n_);
+
+	return *this;
+}
+
+
+
+
+
+template <class T>
+Array1D<T> & Array1D<T>::ref(const Array1D<T> &A)
+{
+	if (this != &A)
+	{
+		v_ = A.v_;		/* operator= handles the reference counting. */
+		n_ = A.n_;
+		data_ = A.data_; 
+		
+	}
+	return *this;
+}
+
+template <class T>
+Array1D<T> & Array1D<T>::operator=(const Array1D<T> &A)
+{
+	return ref(A);
+}
+
+template <class T>
+inline int Array1D<T>::dim1() const { return n_; }
+
+template <class T>
+inline int Array1D<T>::dim() const { return n_; }
+
+template <class T>
+Array1D<T>::~Array1D() {}
+
+
+/* ............................ exented interface ......................*/
+
+template <class T>
+inline int Array1D<T>::ref_count() const
+{
+	return v_.ref_count();
+}
+
+template <class T>
+inline Array1D<T> Array1D<T>::subarray(int i0, int i1)
+{
+	if ((i0 > 0) && (i1 < n_) || (i0 <= i1))
+	{
+		Array1D<T> X(*this);  /* create a new instance of this array. */
+		X.n_ = i1-i0+1;
+		X.data_ += i0;
+
+		return X;
+	}
+	else
+	{
+		return Array1D<T>();
+	}
+}
+
+
+/* private internal functions */
+
+
+template <class T>
+void Array1D<T>::set_(T* begin, T* end, const T& a)
+{
+	for (T* p=begin; p<end; p++)
+		*p = a;
+
+}
+
+template <class T>
+void Array1D<T>::copy_(T* p, const T* q, int len) const
+{
+	T *end = p + len;
+	while (p<end )
+		*p++ = *q++;
+
+}
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_ARRAY1D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array1d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,230 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+#ifndef TNT_ARRAY1D_UTILS_H
+#define TNT_ARRAY1D_UTILS_H
+
+#include <cstdlib>
+#include <cassert>
+
+namespace TNT
+{
+
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Array1D<T> &A)
+{
+    int N=A.dim1();
+
+#ifdef TNT_DEBUG
+	s << "addr: " << (void *) &A[0] << "\n";
+#endif
+    s << N << "\n";
+    for (int j=0; j<N; j++)
+    {
+       s << A[j] << "\n";
+    }
+    s << "\n";
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Array1D<T> &A)
+{
+	int N;
+	s >> N;
+
+	Array1D<T> B(N);
+	for (int i=0; i<N; i++)
+		s >> B[i];
+	A = B;
+	return s;
+}
+
+
+
+template <class T>
+Array1D<T> operator+(const Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Array1D<T>();
+
+	else
+	{
+		Array1D<T> C(n);
+
+		for (int i=0; i<n; i++)
+		{
+			C[i] = A[i] + B[i];
+		}
+		return C;
+	}
+}
+
+
+
+template <class T>
+Array1D<T> operator-(const Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Array1D<T>();
+
+	else
+	{
+		Array1D<T> C(n);
+
+		for (int i=0; i<n; i++)
+		{
+			C[i] = A[i] - B[i];
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Array1D<T> operator*(const Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Array1D<T>();
+
+	else
+	{
+		Array1D<T> C(n);
+
+		for (int i=0; i<n; i++)
+		{
+			C[i] = A[i] * B[i];
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Array1D<T> operator/(const Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Array1D<T>();
+
+	else
+	{
+		Array1D<T> C(n);
+
+		for (int i=0; i<n; i++)
+		{
+			C[i] = A[i] / B[i];
+		}
+		return C;
+	}
+}
+
+
+
+
+
+
+
+
+
+template <class T>
+Array1D<T>&  operator+=(Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=0; i<n; i++)
+		{
+				A[i] += B[i];
+		}
+	}
+	return A;
+}
+
+
+
+
+template <class T>
+Array1D<T>&  operator-=(Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=0; i<n; i++)
+		{
+				A[i] -= B[i];
+		}
+	}
+	return A;
+}
+
+
+
+template <class T>
+Array1D<T>&  operator*=(Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=0; i<n; i++)
+		{
+				A[i] *= B[i];
+		}
+	}
+	return A;
+}
+
+
+
+
+template <class T>
+Array1D<T>&  operator/=(Array1D<T> &A, const Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=0; i<n; i++)
+		{
+				A[i] /= B[i];
+		}
+	}
+	return A;
+}
+
+
+
+
+
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,315 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_ARRAY2D_H
+#define TNT_ARRAY2D_H
+
+#include <cstdlib>
+#include <iostream>
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+#include "tnt_array1d.h"
+
+namespace TNT
+{
+
+template <class T>
+class Array2D 
+{
+
+
+  private:
+
+
+
+  	Array1D<T> data_;
+	Array1D<T*> v_;
+	int m_;
+    int n_;
+
+  public:
+
+    typedef         T   value_type;
+	       Array2D();
+	       Array2D(int m, int n);
+	       Array2D(int m, int n,  T *a);
+	       Array2D(int m, int n, const T &a);
+    inline Array2D(const Array2D &A);
+	inline operator T**();
+	inline operator const T**();
+	inline Array2D & operator=(const T &a);
+	inline Array2D & operator=(const Array2D &A);
+	inline Array2D & ref(const Array2D &A);
+	       Array2D copy() const;
+		   Array2D & inject(const Array2D & A);
+	inline T* operator[](int i);
+	inline const T* operator[](int i) const;
+	inline int dim1() const;
+	inline int dim2() const;
+     ~Array2D();
+
+	/* extended interface (not part of the standard) */
+
+
+	inline int ref_count();
+	inline int ref_count_data();
+	inline int ref_count_dim1();
+	Array2D subarray(int i0, int i1, int j0, int j1);
+
+};
+
+
+template <class T>
+Array2D<T>::Array2D() : data_(), v_(), m_(0), n_(0) {} 
+
+template <class T>
+Array2D<T>::Array2D(const Array2D<T> &A) : data_(A.data_), v_(A.v_), 
+	m_(A.m_), n_(A.n_) {}
+
+
+
+
+template <class T>
+Array2D<T>::Array2D(int m, int n) : data_(m*n), v_(m), m_(m), n_(n)
+{
+	if (m>0 && n>0)
+	{
+		T* p = &(data_[0]);
+		for (int i=0; i<m; i++)
+		{
+			v_[i] = p;
+			p += n;
+		}
+	}
+}
+
+
+
+template <class T>
+Array2D<T>::Array2D(int m, int n, const T &val) : data_(m*n), v_(m), 
+													m_(m), n_(n) 
+{
+  if (m>0 && n>0)
+  {
+	data_ = val;
+	T* p  = &(data_[0]);
+	for (int i=0; i<m; i++)
+	{
+			v_[i] = p;
+			p += n;
+	}
+  }
+}
+
+template <class T>
+Array2D<T>::Array2D(int m, int n, T *a) : data_(m*n, a), v_(m), m_(m), n_(n)
+{
+  if (m>0 && n>0)
+  {
+	T* p = &(data_[0]);
+	
+	for (int i=0; i<m; i++)
+	{
+			v_[i] = p;
+			p += n;
+	}
+  }
+}
+
+
+template <class T>
+inline T* Array2D<T>::operator[](int i) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 0);
+	assert(i < m_);
+#endif
+
+return v_[i]; 
+
+}
+
+
+template <class T>
+inline const T* Array2D<T>::operator[](int i) const
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 0);
+	assert(i < m_);
+#endif
+
+return v_[i]; 
+
+}
+
+template <class T>
+Array2D<T> & Array2D<T>::operator=(const T &a)
+{
+	/* non-optimzied, but will work with subarrays in future verions */
+
+	for (int i=0; i<m_; i++)
+		for (int j=0; j<n_; j++)
+		v_[i][j] = a;
+	return *this;
+}
+
+
+
+
+template <class T>
+Array2D<T> Array2D<T>::copy() const
+{
+	Array2D A(m_, n_);
+
+	for (int i=0; i<m_; i++)
+		for (int j=0; j<n_; j++)
+			A[i][j] = v_[i][j];
+
+
+	return A;
+}
+
+
+template <class T>
+Array2D<T> & Array2D<T>::inject(const Array2D &A)
+{
+	if (A.m_ == m_ &&  A.n_ == n_)
+	{
+		for (int i=0; i<m_; i++)
+			for (int j=0; j<n_; j++)
+				v_[i][j] = A[i][j];
+	}
+	return *this;
+}
+
+
+
+
+template <class T>
+Array2D<T> & Array2D<T>::ref(const Array2D<T> &A)
+{
+	if (this != &A)
+	{
+		v_ = A.v_;
+		data_ = A.data_;
+		m_ = A.m_;
+		n_ = A.n_;
+		
+	}
+	return *this;
+}
+
+
+
+template <class T>
+Array2D<T> & Array2D<T>::operator=(const Array2D<T> &A)
+{
+	return ref(A);
+}
+
+template <class T>
+inline int Array2D<T>::dim1() const { return m_; }
+
+template <class T>
+inline int Array2D<T>::dim2() const { return n_; }
+
+
+template <class T>
+Array2D<T>::~Array2D() {}
+
+
+
+
+template <class T>
+inline Array2D<T>::operator T**()
+{
+	return &(v_[0]);
+}
+template <class T>
+inline Array2D<T>::operator const T**()
+{
+	return &(v_[0]);
+}
+
+/* ............... extended interface ............... */
+/**
+	Create a new view to a subarray defined by the boundaries
+	[i0][i0] and [i1][j1].  The size of the subarray is
+	(i1-i0) by (j1-j0).  If either of these lengths are zero
+	or negative, the subarray view is null.
+
+*/
+template <class T>
+Array2D<T> Array2D<T>::subarray(int i0, int i1, int j0, int j1) 
+{
+	Array2D<T> A;
+	int m = i1-i0+1;
+	int n = j1-j0+1;
+
+	/* if either length is zero or negative, this is an invalide
+		subarray. return a null view.
+	*/
+	if (m<1 || n<1)
+		return A;
+
+	A.data_ = data_;
+	A.m_ = m;
+	A.n_ = n;
+	A.v_ = Array1D<T*>(m);
+	T* p = &(data_[0]) + i0 *  n_ + j0;
+	for (int i=0; i<m; i++)
+	{
+		A.v_[i] = p + i*n_;
+
+	}	
+	return A;
+}
+
+template <class T>
+inline int Array2D<T>::ref_count()
+{
+	return ref_count_data();
+}
+
+
+
+template <class T>
+inline int Array2D<T>::ref_count_data()
+{
+	return data_.ref_count();
+}
+
+template <class T>
+inline int Array2D<T>::ref_count_dim1()
+{
+	return v_.ref_count();
+}
+
+
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_ARRAY2D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array2d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,287 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_ARRAY2D_UTILS_H
+#define TNT_ARRAY2D_UTILS_H
+
+#include <cstdlib>
+#include <cassert>
+
+namespace TNT
+{
+
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Array2D<T> &A)
+{
+    int M=A.dim1();
+    int N=A.dim2();
+
+    s << M << " " << N << "\n";
+
+    for (int i=0; i<M; i++)
+    {
+        for (int j=0; j<N; j++)
+        {
+            s << A[i][j] << " ";
+        }
+        s << "\n";
+    }
+
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Array2D<T> &A)
+{
+
+    int M, N;
+
+    s >> M >> N;
+
+	Array2D<T> B(M,N);
+
+    for (int i=0; i<M; i++)
+        for (int j=0; j<N; j++)
+        {
+            s >>  B[i][j];
+        }
+
+	A = B;
+    return s;
+}
+
+
+template <class T>
+Array2D<T> operator+(const Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Array2D<T>();
+
+	else
+	{
+		Array2D<T> C(m,n);
+
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				C[i][j] = A[i][j] + B[i][j];
+		}
+		return C;
+	}
+}
+
+template <class T>
+Array2D<T> operator-(const Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Array2D<T>();
+
+	else
+	{
+		Array2D<T> C(m,n);
+
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				C[i][j] = A[i][j] - B[i][j];
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Array2D<T> operator*(const Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Array2D<T>();
+
+	else
+	{
+		Array2D<T> C(m,n);
+
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				C[i][j] = A[i][j] * B[i][j];
+		}
+		return C;
+	}
+}
+
+
+
+
+template <class T>
+Array2D<T> operator/(const Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Array2D<T>();
+
+	else
+	{
+		Array2D<T> C(m,n);
+
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				C[i][j] = A[i][j] / B[i][j];
+		}
+		return C;
+	}
+}
+
+
+
+
+
+template <class T>
+Array2D<T>&  operator+=(Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				A[i][j] += B[i][j];
+		}
+	}
+	return A;
+}
+
+
+
+template <class T>
+Array2D<T>&  operator-=(Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				A[i][j] -= B[i][j];
+		}
+	}
+	return A;
+}
+
+
+
+template <class T>
+Array2D<T>&  operator*=(Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				A[i][j] *= B[i][j];
+		}
+	}
+	return A;
+}
+
+
+
+
+
+template <class T>
+Array2D<T>&  operator/=(Array2D<T> &A, const Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=0; i<m; i++)
+		{
+			for (int j=0; j<n; j++)
+				A[i][j] /= B[i][j];
+		}
+	}
+	return A;
+}
+
+/**
+    Matrix Multiply:  compute C = A*B, where C[i][j]
+    is the dot-product of row i of A and column j of B.
+
+
+    @param A an (m x n) array
+    @param B an (n x k) array
+    @return the (m x k) array A*B, or a null array (0x0)
+        if the matrices are non-conformant (i.e. the number
+        of columns of A are different than the number of rows of B.)
+
+
+*/
+template <class T>
+Array2D<T> matmult(const Array2D<T> &A, const Array2D<T> &B)
+{
+    if (A.dim2() != B.dim1())
+        return Array2D<T>();
+
+    int M = A.dim1();
+    int N = A.dim2();
+    int K = B.dim2();
+
+    Array2D<T> C(M,K);
+
+    for (int i=0; i<M; i++)
+        for (int j=0; j<K; j++)
+        {
+            T sum = 0;
+
+            for (int k=0; k<N; k++)
+                sum += A[i][k] * B [k][j];
+
+            C[i][j] = sum;
+        }
+
+    return C;
+
+}
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,296 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_ARRAY3D_H
+#define TNT_ARRAY3D_H
+
+#include <cstdlib>
+#include <iostream>
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+#include "tnt_array1d.h"
+#include "tnt_array2d.h"
+
+namespace TNT
+{
+
+template <class T>
+class Array3D 
+{
+
+
+  private:
+  	Array1D<T> data_;
+	Array2D<T*> v_;
+	int m_;
+    int n_;
+	int g_;
+
+
+  public:
+
+    typedef         T   value_type;
+
+	       Array3D();
+	       Array3D(int m, int n, int g);
+	       Array3D(int m, int n, int g,  T val);
+	       Array3D(int m, int n, int g, T *a);
+
+	inline operator T***();
+	inline operator const T***();
+    inline Array3D(const Array3D &A);
+	inline Array3D & operator=(const T &a);
+	inline Array3D & operator=(const Array3D &A);
+	inline Array3D & ref(const Array3D &A);
+	       Array3D copy() const;
+		   Array3D & inject(const Array3D & A);
+
+	inline T** operator[](int i);
+	inline const T* const * operator[](int i) const;
+	inline int dim1() const;
+	inline int dim2() const;
+	inline int dim3() const;
+               ~Array3D();
+
+	/* extended interface */
+
+	inline int ref_count(){ return data_.ref_count(); }
+   Array3D subarray(int i0, int i1, int j0, int j1, 
+		   		int k0, int k1);
+};
+
+template <class T>
+Array3D<T>::Array3D() : data_(), v_(), m_(0), n_(0) {}
+
+template <class T>
+Array3D<T>::Array3D(const Array3D<T> &A) : data_(A.data_), 
+	v_(A.v_), m_(A.m_), n_(A.n_), g_(A.g_)
+{
+}
+
+
+
+template <class T>
+Array3D<T>::Array3D(int m, int n, int g) : data_(m*n*g), v_(m,n),
+	m_(m), n_(n), g_(g)
+{
+
+  if (m>0 && n>0 && g>0)
+  {
+	T* p = & (data_[0]);
+	int ng = n_*g_;
+
+	for (int i=0; i<m_; i++)
+	{	
+		T* ping = p+ i*ng;
+		for (int j=0; j<n; j++)
+			v_[i][j] = ping + j*g_;
+	}
+  }
+}
+
+
+
+template <class T>
+Array3D<T>::Array3D(int m, int n, int g, T val) : data_(m*n*g, val), 
+	v_(m,n), m_(m), n_(n), g_(g)
+{
+  if (m>0 && n>0 && g>0)
+  {
+
+	T* p = & (data_[0]);
+	int ng = n_*g_;
+
+	for (int i=0; i<m_; i++)
+	{	
+		T* ping = p+ i*ng;
+		for (int j=0; j<n; j++)
+			v_[i][j] = ping + j*g_;
+	}
+  }
+}
+
+
+
+template <class T>
+Array3D<T>::Array3D(int m, int n, int g, T* a) : 
+		data_(m*n*g, a), v_(m,n), m_(m), n_(n), g_(g)
+{
+
+  if (m>0 && n>0 && g>0)
+  {
+	T* p = & (data_[0]);
+	int ng = n_*g_;
+
+	for (int i=0; i<m_; i++)
+	{	
+		T* ping = p+ i*ng;
+		for (int j=0; j<n; j++)
+			v_[i][j] = ping + j*g_;
+	}
+  }
+}
+
+
+
+template <class T>
+inline T** Array3D<T>::operator[](int i) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 0);
+	assert(i < m_);
+#endif
+
+return v_[i]; 
+
+}
+
+template <class T>
+inline const T* const * Array3D<T>::operator[](int i) const 
+{ return v_[i]; }
+
+template <class T>
+Array3D<T> & Array3D<T>::operator=(const T &a)
+{
+	for (int i=0; i<m_; i++)
+		for (int j=0; j<n_; j++)
+			for (int k=0; k<g_; k++)
+				v_[i][j][k] = a;
+
+	return *this;
+}
+
+template <class T>
+Array3D<T> Array3D<T>::copy() const
+{
+	Array3D A(m_, n_, g_);
+	for (int i=0; i<m_; i++)
+		for (int j=0; j<n_; j++)
+			for (int k=0; k<g_; k++)
+				A.v_[i][j][k] = v_[i][j][k];
+
+	return A;
+}
+
+
+template <class T>
+Array3D<T> & Array3D<T>::inject(const Array3D &A)
+{
+	if (A.m_ == m_ &&  A.n_ == n_ && A.g_ == g_)
+
+	for (int i=0; i<m_; i++)
+		for (int j=0; j<n_; j++)
+			for (int k=0; k<g_; k++)
+				v_[i][j][k] = A.v_[i][j][k];
+
+	return *this;
+}
+
+
+
+template <class T>
+Array3D<T> & Array3D<T>::ref(const Array3D<T> &A)
+{
+	if (this != &A)
+	{
+		m_ = A.m_;
+		n_ = A.n_;
+		g_ = A.g_;
+		v_ = A.v_;
+		data_ = A.data_;
+	}
+	return *this;
+}
+
+template <class T>
+Array3D<T> & Array3D<T>::operator=(const Array3D<T> &A)
+{
+	return ref(A);
+}
+
+
+template <class T>
+inline int Array3D<T>::dim1() const { return m_; }
+
+template <class T>
+inline int Array3D<T>::dim2() const { return n_; }
+
+template <class T>
+inline int Array3D<T>::dim3() const { return g_; }
+
+
+
+template <class T>
+Array3D<T>::~Array3D() {}
+
+template <class T>
+inline Array3D<T>::operator T***()
+{
+	return v_;
+}
+
+
+template <class T>
+inline Array3D<T>::operator const T***()
+{
+	return v_;
+}
+
+/* extended interface */
+template <class T>
+Array3D<T> Array3D<T>::subarray(int i0, int i1, int j0,
+	int j1, int k0, int k1)
+{
+
+	/* check that ranges are valid. */
+	if (!( 0 <= i0 && i0 <= i1 && i1 < m_ &&
+	      0 <= j0 && j0 <= j1 && j1 < n_ &&
+	      0 <= k0 && k0 <= k1 && k1 < g_))
+		return Array3D<T>();  /* null array */
+
+
+	Array3D<T> A;
+	A.data_ = data_;
+	A.m_ = i1-i0+1;
+	A.n_ = j1-j0+1;
+	A.g_ = k1-k0+1;
+	A.v_ = Array2D<T*>(A.m_,A.n_);
+	T* p = &(data_[0]) + i0*n_*g_ + j0*g_ + k0; 
+
+	for (int i=0; i<A.m_; i++)
+	{
+		T* ping = p + i*n_*g_;
+		for (int j=0; j<A.n_; j++)
+			A.v_[i][j] = ping + j*g_ ;
+	}
+
+	return A;
+}
+	
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_ARRAY3D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_array3d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,236 @@
+
+
+#ifndef TNT_ARRAY3D_UTILS_H
+#define TNT_ARRAY3D_UTILS_H
+
+#include <cstdlib>
+#include <cassert>
+
+namespace TNT
+{
+
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Array3D<T> &A)
+{
+    int M=A.dim1();
+    int N=A.dim2();
+    int K=A.dim3();
+
+    s << M << " " << N << " " << K << "\n";
+
+    for (int i=0; i<M; i++)
+    {
+        for (int j=0; j<N; j++)
+        {
+			for (int k=0; k<K; k++)
+            	s << A[i][j][k] << " ";
+			s << "\n";
+        }
+        s << "\n";
+    }
+
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Array3D<T> &A)
+{
+
+    int M, N, K;
+
+    s >> M >> N >> K;
+
+	Array3D<T> B(M,N,K);
+
+    for (int i=0; i<M; i++)
+        for (int j=0; j<N; j++)
+			for (int k=0; k<K; k++)
+            	s >>  B[i][j][k];
+
+	A = B;
+    return s;
+}
+
+
+
+template <class T>
+Array3D<T> operator+(const Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Array3D<T>();
+
+	else
+	{
+		Array3D<T> C(m,n,p);
+
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+				C[i][j][k] = A[i][j][k] + B[i][j][k];
+
+		return C;
+	}
+}
+
+
+template <class T>
+Array3D<T> operator-(const Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Array3D<T>();
+
+	else
+	{
+		Array3D<T> C(m,n,p);
+
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+				C[i][j][k] = A[i][j][k] - B[i][j][k];
+
+		return C;
+	}
+}
+
+
+
+
+template <class T>
+Array3D<T> operator*(const Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Array3D<T>();
+
+	else
+	{
+		Array3D<T> C(m,n,p);
+
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+				C[i][j][k] = A[i][j][k] * B[i][j][k];
+
+		return C;
+	}
+}
+
+
+template <class T>
+Array3D<T> operator/(const Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Array3D<T>();
+
+	else
+	{
+		Array3D<T> C(m,n,p);
+
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+				C[i][j][k] = A[i][j][k] / B[i][j][k];
+
+		return C;
+	}
+}
+
+
+
+template <class T>
+Array3D<T>& operator+=(Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+					A[i][j][k] += B[i][j][k];
+	}
+
+	return A;
+}
+
+template <class T>
+Array3D<T>& operator-=(Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+					A[i][j][k] -= B[i][j][k];
+	}
+
+	return A;
+}
+
+template <class T>
+Array3D<T>& operator*=(Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+					A[i][j][k] *= B[i][j][k];
+	}
+
+	return A;
+}
+
+
+template <class T>
+Array3D<T>& operator/=(Array3D<T> &A, const Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=0; i<m; i++)
+			for (int j=0; j<n; j++)
+				for (int k=0; k<p; k++)
+					A[i][j][k] /= B[i][j][k];
+	}
+
+	return A;
+}
+
+
+
+
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_cmat.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_cmat.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_cmat.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,580 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+// C compatible matrix: row-oriented, 0-based [i][j] and 1-based (i,j) indexing
+//
+
+#ifndef TNT_CMAT_H
+#define TNT_CMAT_H
+
+#include "tnt_subscript.h"
+#include "tnt_vec.h"
+#include <cstdlib>
+#include <cassert>
+#include <iostream>
+#include <sstream>
+
+namespace TNT
+{
+
+
+template <class T>
+class Matrix 
+{
+
+
+  public:
+
+    typedef Subscript   size_type;
+    typedef         T   value_type;
+    typedef         T   element_type;
+    typedef         T*  pointer;
+    typedef         T*  iterator;
+    typedef         T&  reference;
+    typedef const   T*  const_iterator;
+    typedef const   T&  const_reference;
+
+    Subscript lbound() const { return 1;}
+ 
+  protected:
+    Subscript m_;
+    Subscript n_;
+    Subscript mn_;      // total size
+    T* v_;                  
+    T** row_;           
+    T* vm1_ ;       // these point to the same data, but are 1-based 
+    T** rowm1_;
+
+    // internal helper function to create the array
+    // of row pointers
+
+    void initialize(Subscript M, Subscript N)
+    {
+        mn_ = M*N;
+        m_ = M;
+        n_ = N;
+
+        v_ = new T[mn_]; 
+        row_ = new T*[M];
+        rowm1_ = new T*[M];
+
+        assert(v_  != NULL);
+        assert(row_  != NULL);
+        assert(rowm1_ != NULL);
+
+        T* p = v_;              
+        vm1_ = v_ - 1;
+        for (Subscript i=0; i<M; i++)
+        {
+            row_[i] = p;
+            rowm1_[i] = p-1;
+            p += N ;
+            
+        }
+
+        rowm1_ -- ;     // compensate for 1-based offset
+    }
+   
+    void copy(const T*  v)
+    {
+        Subscript N = m_ * n_;
+        Subscript i;
+
+#ifdef TNT_UNROLL_LOOPS
+        Subscript Nmod4 = N & 3;
+        Subscript N4 = N - Nmod4;
+
+        for (i=0; i<N4; i+=4)
+        {
+            v_[i] = v[i];
+            v_[i+1] = v[i+1];
+            v_[i+2] = v[i+2];
+            v_[i+3] = v[i+3];
+        }
+
+        for (i=N4; i< N; i++)
+            v_[i] = v[i];
+#else
+
+        for (i=0; i< N; i++)
+            v_[i] = v[i];
+#endif      
+    }
+
+    void set(const T& val)
+    {
+        Subscript N = m_ * n_;
+        Subscript i;
+
+#ifdef TNT_UNROLL_LOOPS
+        Subscript Nmod4 = N & 3;
+        Subscript N4 = N - Nmod4;
+
+        for (i=0; i<N4; i+=4)
+        {
+            v_[i] = val;
+            v_[i+1] = val;
+            v_[i+2] = val;
+            v_[i+3] = val; 
+        }
+
+        for (i=N4; i< N; i++)
+            v_[i] = val;
+#else
+
+        for (i=0; i< N; i++)
+            v_[i] = val;
+        
+#endif      
+    }
+    
+
+    
+    void destroy()
+    {     
+        /* do nothing, if no memory has been previously allocated */
+        if (v_ == NULL) return ;
+
+        /* if we are here, then matrix was previously allocated */
+        if (v_ != NULL) delete [] (v_);     
+        if (row_ != NULL) delete [] (row_);
+
+        /* return rowm1_ back to original value */
+        rowm1_ ++;
+        if (rowm1_ != NULL ) delete [] (rowm1_);
+    }
+
+
+  public:
+
+    operator T**(){ return  row_; }
+    operator T**() const { return row_; }
+
+
+    Subscript size() const { return mn_; }
+
+    // constructors
+
+    Matrix() : m_(0), n_(0), mn_(0), v_(0), row_(0), vm1_(0), rowm1_(0) {};
+
+    Matrix(const Matrix<T> &A)
+    {
+        initialize(A.m_, A.n_);
+        copy(A.v_);
+    }
+
+    Matrix(Subscript M, Subscript N, const T& value = T())
+    {
+        initialize(M,N);
+        set(value);
+    }
+
+    Matrix(Subscript M, Subscript N, const T* v)
+    {
+        initialize(M,N);
+        copy(v);
+    }
+
+    Matrix(Subscript M, Subscript N, const char *s)
+    {
+        initialize(M,N);
+        //std::istrstream ins(s);
+        std::istringstream ins(s);
+
+        Subscript i, j;
+
+        for (i=0; i<M; i++)
+            for (j=0; j<N; j++)
+                ins >> row_[i][j];
+    }
+
+    // destructor
+    //
+    ~Matrix()
+    {
+        destroy();
+    }
+
+
+    // reallocating
+    //
+    Matrix<T>& newsize(Subscript M, Subscript N)
+    {
+        if (num_rows() == M && num_cols() == N)
+            return *this;
+
+        destroy();
+        initialize(M,N);
+        
+        return *this;
+    }
+
+
+
+
+    // assignments
+    //
+    Matrix<T>& operator=(const Matrix<T> &A)
+    {
+        if (v_ == A.v_)
+            return *this;
+
+        if (m_ == A.m_  && n_ == A.n_)      // no need to re-alloc
+            copy(A.v_);
+
+        else
+        {
+            destroy();
+            initialize(A.m_, A.n_);
+            copy(A.v_);
+        }
+
+        return *this;
+    }
+        
+    Matrix<T>& operator=(const T& scalar)
+    { 
+        set(scalar); 
+        return *this;
+    }
+
+
+    Subscript dim(Subscript d) const 
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert( d >= 1);
+        assert( d <= 2);
+#endif
+        return (d==1) ? m_ : ((d==2) ? n_ : 0); 
+    }
+
+    Subscript num_rows() const { return m_; }
+    Subscript num_cols() const { return n_; }
+
+
+
+
+    inline T* operator[](Subscript i)
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert(0<=i);
+        assert(i < m_) ;
+#endif
+        return row_[i];
+    }
+
+    inline const T* operator[](Subscript i) const
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert(0<=i);
+        assert(i < m_) ;
+#endif
+        return row_[i];
+    }
+
+    inline reference operator()(Subscript i)
+    { 
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= mn_) ;
+#endif
+        return vm1_[i]; 
+    }
+
+    inline const_reference operator()(Subscript i) const
+    { 
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= mn_) ;
+#endif
+        return vm1_[i]; 
+    }
+
+
+
+    inline reference operator()(Subscript i, Subscript j)
+    { 
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= m_) ;
+        assert(1<=j);
+        assert(j <= n_);
+#endif
+        return  rowm1_[i][j]; 
+    }
+
+
+    
+    inline const_reference operator() (Subscript i, Subscript j) const
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= m_) ;
+        assert(1<=j);
+        assert(j <= n_);
+#endif
+        return rowm1_[i][j]; 
+    }
+
+
+
+
+};
+
+
+/* ***************************  I/O  ********************************/
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Matrix<T> &A)
+{
+    Subscript M=A.num_rows();
+    Subscript N=A.num_cols();
+
+    s << M << " " << N << "\n";
+
+    for (Subscript i=0; i<M; i++)
+    {
+        for (Subscript j=0; j<N; j++)
+        {
+            s << A[i][j] << " ";
+        }
+        s << "\n";
+    }
+
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Matrix<T> &A)
+{
+
+    Subscript M, N;
+
+    s >> M >> N;
+
+    if ( !(M == A.num_rows() && N == A.num_cols() ))
+    {
+        A.newsize(M,N);
+    }
+
+
+    for (Subscript i=0; i<M; i++)
+        for (Subscript j=0; j<N; j++)
+        {
+            s >>  A[i][j];
+        }
+
+
+    return s;
+}
+
+// *******************[ basic matrix algorithms ]***************************
+
+
+template <class T>
+Matrix<T> operator+(const Matrix<T> &A, 
+    const Matrix<T> &B)
+{
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+
+    assert(M==B.num_rows());
+    assert(N==B.num_cols());
+
+    Matrix<T> tmp(M,N);
+    Subscript i,j;
+
+    for (i=0; i<M; i++)
+        for (j=0; j<N; j++)
+            tmp[i][j] = A[i][j] + B[i][j];
+
+    return tmp;
+}
+
+template <class T>
+Matrix<T> operator-(const Matrix<T> &A, 
+    const Matrix<T> &B)
+{
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+
+    assert(M==B.num_rows());
+    assert(N==B.num_cols());
+
+    Matrix<T> tmp(M,N);
+    Subscript i,j;
+
+    for (i=0; i<M; i++)
+        for (j=0; j<N; j++)
+            tmp[i][j] = A[i][j] - B[i][j];
+
+    return tmp;
+}
+
+template <class T>
+Matrix<T> mult_element(const Matrix<T> &A, 
+    const Matrix<T> &B)
+{
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+
+    assert(M==B.num_rows());
+    assert(N==B.num_cols());
+
+    Matrix<T> tmp(M,N);
+    Subscript i,j;
+
+    for (i=0; i<M; i++)
+        for (j=0; j<N; j++)
+            tmp[i][j] = A[i][j] * B[i][j];
+
+    return tmp;
+}
+
+
+template <class T>
+Matrix<T> transpose(const Matrix<T> &A)
+{
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+
+    Matrix<T> S(N,M);
+    Subscript i, j;
+
+    for (i=0; i<M; i++)
+        for (j=0; j<N; j++)
+            S[j][i] = A[i][j];
+
+    return S;
+}
+
+
+    
+template <class T>
+inline Matrix<T> matmult(const Matrix<T>  &A, 
+    const Matrix<T> &B)
+{
+
+#ifdef TNT_BOUNDS_CHECK
+    assert(A.num_cols() == B.num_rows());
+#endif
+
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+    Subscript K = B.num_cols();
+
+    Matrix<T> tmp(M,K);
+    T sum;
+
+    for (Subscript i=0; i<M; i++)
+    for (Subscript k=0; k<K; k++)
+    {
+        sum = 0;
+        for (Subscript j=0; j<N; j++)
+            sum = sum +  A[i][j] * B[j][k];
+
+        tmp[i][k] = sum; 
+    }
+
+    return tmp;
+}
+
+template <class T>
+inline Matrix<T> operator*(const Matrix<T>  &A, 
+    const Matrix<T> &B)
+{
+    return matmult(A,B);
+}
+
+template <class T>
+inline int matmult(Matrix<T>& C, const Matrix<T>  &A, 
+    const Matrix<T> &B)
+{
+
+    assert(A.num_cols() == B.num_rows());
+
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+    Subscript K = B.num_cols();
+
+    C.newsize(M,K);
+
+    T sum;
+
+    const T* row_i;
+    const T* col_k;
+
+    for (Subscript i=0; i<M; i++)
+    for (Subscript k=0; k<K; k++)
+    {
+        row_i  = &(A[i][0]);
+        col_k  = &(B[0][k]);
+        sum = 0;
+        for (Subscript j=0; j<N; j++)
+        {
+            sum  += *row_i * *col_k;
+            row_i++;
+            col_k += K;
+        }
+        C[i][k] = sum; 
+    }
+
+    return 0;
+}
+
+
+template <class T>
+Vector<T> matmult(const Matrix<T>  &A, const Vector<T> &x)
+{
+
+#ifdef TNT_BOUNDS_CHECK
+    assert(A.num_cols() == x.dim());
+#endif
+
+    Subscript M = A.num_rows();
+    Subscript N = A.num_cols();
+
+    Vector<T> tmp(M);
+    T sum;
+
+    for (Subscript i=0; i<M; i++)
+    {
+        sum = 0;
+        const T* rowi = A[i];
+        for (Subscript j=0; j<N; j++)
+            sum = sum +  rowi[j] * x[j];
+
+        tmp[i] = sum; 
+    }
+
+    return tmp;
+}
+
+template <class T>
+inline Vector<T> operator*(const Matrix<T>  &A, const Vector<T> &x)
+{
+    return matmult(A,x);
+}
+
+} // namespace TNT
+
+#endif
+// CMAT_H
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,267 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_FORTRAN_ARRAY1D_H
+#define TNT_FORTRAN_ARRAY1D_H
+
+#include <cstdlib>
+#include <iostream>
+
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+
+#include "tnt_i_refvec.h"
+
+namespace TNT
+{
+
+template <class T>
+class Fortran_Array1D 
+{
+
+  private:
+
+    i_refvec<T> v_;
+    int n_;
+    T* data_;				/* this normally points to v_.begin(), but
+                             * could also point to a portion (subvector)
+							 * of v_.
+                            */
+
+    void initialize_(int n);
+    void copy_(T* p, const T*  q, int len) const;
+    void set_(T* begin,  T* end, const T& val);
+ 
+
+  public:
+
+    typedef         T   value_type;
+
+
+	         Fortran_Array1D();
+	explicit Fortran_Array1D(int n);
+	         Fortran_Array1D(int n, const T &a);
+	         Fortran_Array1D(int n,  T *a);
+    inline   Fortran_Array1D(const Fortran_Array1D &A);
+	inline   Fortran_Array1D & operator=(const T &a);
+	inline   Fortran_Array1D & operator=(const Fortran_Array1D &A);
+	inline   Fortran_Array1D & ref(const Fortran_Array1D &A);
+	         Fortran_Array1D copy() const;
+		     Fortran_Array1D & inject(const Fortran_Array1D & A);
+	inline   T& operator()(int i);
+	inline   const T& operator()(int i) const;
+	inline 	 int dim1() const;
+	inline   int dim() const;
+              ~Fortran_Array1D();
+
+
+	/* ... extended interface ... */
+
+	inline int ref_count() const;
+	inline Fortran_Array1D<T> subarray(int i0, int i1);
+
+};
+
+
+
+
+template <class T>
+Fortran_Array1D<T>::Fortran_Array1D() : v_(), n_(0), data_(0) {}
+
+template <class T>
+Fortran_Array1D<T>::Fortran_Array1D(const Fortran_Array1D<T> &A) : v_(A.v_),  n_(A.n_), 
+		data_(A.data_)
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Fortran_Array1D(const Fortran_Array1D<T> &A) \n";
+#endif
+
+}
+
+
+template <class T>
+Fortran_Array1D<T>::Fortran_Array1D(int n) : v_(n), n_(n), data_(v_.begin())
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Fortran_Array1D(int n) \n";
+#endif
+}
+
+template <class T>
+Fortran_Array1D<T>::Fortran_Array1D(int n, const T &val) : v_(n), n_(n), data_(v_.begin()) 
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Fortran_Array1D(int n, const T& val) \n";
+#endif
+	set_(data_, data_+ n, val);
+
+}
+
+template <class T>
+Fortran_Array1D<T>::Fortran_Array1D(int n, T *a) : v_(a), n_(n) , data_(v_.begin())
+{
+#ifdef TNT_DEBUG
+	std::cout << "Created Fortran_Array1D(int n, T* a) \n";
+#endif
+}
+
+template <class T>
+inline T& Fortran_Array1D<T>::operator()(int i) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i>= 1);
+	assert(i <= n_);
+#endif
+	return data_[i-1]; 
+}
+
+template <class T>
+inline const T& Fortran_Array1D<T>::operator()(int i) const 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i>= 1);
+	assert(i <= n_);
+#endif
+	return data_[i-1]; 
+}
+
+
+	
+
+template <class T>
+Fortran_Array1D<T> & Fortran_Array1D<T>::operator=(const T &a)
+{
+	set_(data_, data_+n_, a);
+	return *this;
+}
+
+template <class T>
+Fortran_Array1D<T> Fortran_Array1D<T>::copy() const
+{
+	Fortran_Array1D A( n_);
+	copy_(A.data_, data_, n_);
+
+	return A;
+}
+
+
+template <class T>
+Fortran_Array1D<T> & Fortran_Array1D<T>::inject(const Fortran_Array1D &A)
+{
+	if (A.n_ == n_)
+		copy_(data_, A.data_, n_);
+
+	return *this;
+}
+
+
+
+
+
+template <class T>
+Fortran_Array1D<T> & Fortran_Array1D<T>::ref(const Fortran_Array1D<T> &A)
+{
+	if (this != &A)
+	{
+		v_ = A.v_;		/* operator= handles the reference counting. */
+		n_ = A.n_;
+		data_ = A.data_; 
+		
+	}
+	return *this;
+}
+
+template <class T>
+Fortran_Array1D<T> & Fortran_Array1D<T>::operator=(const Fortran_Array1D<T> &A)
+{
+	return ref(A);
+}
+
+template <class T>
+inline int Fortran_Array1D<T>::dim1() const { return n_; }
+
+template <class T>
+inline int Fortran_Array1D<T>::dim() const { return n_; }
+
+template <class T>
+Fortran_Array1D<T>::~Fortran_Array1D() {}
+
+
+/* ............................ exented interface ......................*/
+
+template <class T>
+inline int Fortran_Array1D<T>::ref_count() const
+{
+	return v_.ref_count();
+}
+
+template <class T>
+inline Fortran_Array1D<T> Fortran_Array1D<T>::subarray(int i0, int i1)
+{
+#ifdef TNT_DEBUG
+		std::cout << "entered subarray. \n";
+#endif
+	if ((i0 > 0) && (i1 < n_) || (i0 <= i1))
+	{
+		Fortran_Array1D<T> X(*this);  /* create a new instance of this array. */
+		X.n_ = i1-i0+1;
+		X.data_ += i0;
+
+		return X;
+	}
+	else
+	{
+#ifdef TNT_DEBUG
+		std::cout << "subarray:  null return.\n";
+#endif
+		return Fortran_Array1D<T>();
+	}
+}
+
+
+/* private internal functions */
+
+
+template <class T>
+void Fortran_Array1D<T>::set_(T* begin, T* end, const T& a)
+{
+	for (T* p=begin; p<end; p++)
+		*p = a;
+
+}
+
+template <class T>
+void Fortran_Array1D<T>::copy_(T* p, const T* q, int len) const
+{
+	T *end = p + len;
+	while (p<end )
+		*p++ = *q++;
+
+}
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_FORTRAN_ARRAY1D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array1d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,242 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+#ifndef TNT_FORTRAN_ARRAY1D_UTILS_H
+#define TNT_FORTRAN_ARRAY1D_UTILS_H
+
+#include <iostream>
+
+namespace TNT
+{
+
+
+/**
+	Write an array to a character outstream.  Output format is one that can
+	be read back in via the in-stream operator: one integer
+	denoting the array dimension (n), followed by n elements,
+	one per line.  
+
+*/
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Fortran_Array1D<T> &A)
+{
+    int N=A.dim1();
+
+    s << N << "\n";
+    for (int j=1; j<=N; j++)
+    {
+       s << A(j) << "\n";
+    }
+    s << "\n";
+
+    return s;
+}
+
+/**
+	Read an array from a character stream.  Input format
+	is one integer, denoting the dimension (n), followed
+	by n whitespace-separated elments.  Newlines are ignored
+
+	<p>
+	Note: the array being read into references new memory
+	storage. If the intent is to fill an existing conformant
+	array, use <code> cin >> B;  A.inject(B) ); </code>
+	instead or read the elements in one-a-time by hand.
+
+	@param s the charater to read from (typically <code>std::in</code>)
+	@param A the array to read into.
+*/
+template <class T>
+std::istream& operator>>(std::istream &s, Fortran_Array1D<T> &A)
+{
+	int N;
+	s >> N;
+
+	Fortran_Array1D<T> B(N);
+	for (int i=1; i<=N; i++)
+		s >> B(i);
+	A = B;
+	return s;
+}
+
+
+template <class T>
+Fortran_Array1D<T> operator+(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Fortran_Array1D<T>();
+
+	else
+	{
+		Fortran_Array1D<T> C(n);
+
+		for (int i=1; i<=n; i++)
+		{
+			C(i) = A(i) + B(i);
+		}
+		return C;
+	}
+}
+
+
+
+template <class T>
+Fortran_Array1D<T> operator-(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Fortran_Array1D<T>();
+
+	else
+	{
+		Fortran_Array1D<T> C(n);
+
+		for (int i=1; i<=n; i++)
+		{
+			C(i) = A(i) - B(i);
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array1D<T> operator*(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Fortran_Array1D<T>();
+
+	else
+	{
+		Fortran_Array1D<T> C(n);
+
+		for (int i=1; i<=n; i++)
+		{
+			C(i) = A(i) * B(i);
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array1D<T> operator/(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() != n )
+		return Fortran_Array1D<T>();
+
+	else
+	{
+		Fortran_Array1D<T> C(n);
+
+		for (int i=1; i<=n; i++)
+		{
+			C(i) = A(i) / B(i);
+		}
+		return C;
+	}
+}
+
+
+
+
+
+
+
+
+
+template <class T>
+Fortran_Array1D<T>&  operator+=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=1; i<=n; i++)
+		{
+				A(i) += B(i);
+		}
+	}
+	return A;
+}
+
+
+
+
+template <class T>
+Fortran_Array1D<T>&  operator-=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=1; i<=n; i++)
+		{
+				A(i) -= B(i);
+		}
+	}
+	return A;
+}
+
+
+
+template <class T>
+Fortran_Array1D<T>&  operator*=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=1; i<=n; i++)
+		{
+				A(i) *= B(i);
+		}
+	}
+	return A;
+}
+
+
+
+
+template <class T>
+Fortran_Array1D<T>&  operator/=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B)
+{
+	int n = A.dim1();
+
+	if (B.dim1() == n)
+	{
+		for (int i=1; i<=n; i++)
+		{
+				A(i) /= B(i);
+		}
+	}
+	return A;
+}
+
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,225 @@
+/*
+*
+* Template Numerical Toolkit (TNT): Two-dimensional Fortran numerical array
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_FORTRAN_ARRAY2D_H
+#define TNT_FORTRAN_ARRAY2D_H
+
+#include <cstdlib>
+#include <iostream>
+
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+#include "tnt_i_refvec.h"
+
+namespace TNT
+{
+
+template <class T>
+class Fortran_Array2D 
+{
+
+
+  private: 
+  		i_refvec<T> v_;
+		int m_;
+		int n_;
+		T* data_;
+
+
+    	void initialize_(int n);
+    	void copy_(T* p, const T*  q, int len);
+    	void set_(T* begin,  T* end, const T& val);
+ 
+  public:
+
+    typedef         T   value_type;
+
+	       Fortran_Array2D();
+	       Fortran_Array2D(int m, int n);
+	       Fortran_Array2D(int m, int n,  T *a);
+	       Fortran_Array2D(int m, int n, const T &a);
+    inline Fortran_Array2D(const Fortran_Array2D &A);
+	inline Fortran_Array2D & operator=(const T &a);
+	inline Fortran_Array2D & operator=(const Fortran_Array2D &A);
+	inline Fortran_Array2D & ref(const Fortran_Array2D &A);
+	       Fortran_Array2D copy() const;
+		   Fortran_Array2D & inject(const Fortran_Array2D & A);
+	inline T& operator()(int i, int j);
+	inline const T& operator()(int i, int j) const ;
+	inline int dim1() const;
+	inline int dim2() const;
+               ~Fortran_Array2D();
+
+	/* extended interface */
+
+	inline int ref_count() const;
+
+};
+
+template <class T>
+Fortran_Array2D<T>::Fortran_Array2D() : v_(), m_(0), n_(0), data_(0) {}
+
+
+template <class T>
+Fortran_Array2D<T>::Fortran_Array2D(const Fortran_Array2D<T> &A) : v_(A.v_),
+		m_(A.m_), n_(A.n_), data_(A.data_) {}
+
+
+
+template <class T>
+Fortran_Array2D<T>::Fortran_Array2D(int m, int n) : v_(m*n), m_(m), n_(n),
+	data_(v_.begin()) {}
+
+template <class T>
+Fortran_Array2D<T>::Fortran_Array2D(int m, int n, const T &val) : 
+	v_(m*n), m_(m), n_(n), data_(v_.begin())
+{
+	set_(data_, data_+m*n, val);
+}
+
+
+template <class T>
+Fortran_Array2D<T>::Fortran_Array2D(int m, int n, T *a) : v_(a),
+	m_(m), n_(n), data_(v_.begin()) {}
+
+
+
+
+template <class T>
+inline T& Fortran_Array2D<T>::operator()(int i, int j) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 1);
+	assert(i <= m_);
+	assert(j >= 1);
+	assert(j <= n_);
+#endif
+
+	return v_[ (j-1)*m_ + (i-1) ];
+
+}
+
+template <class T>
+inline const T& Fortran_Array2D<T>::operator()(int i, int j) const
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 1);
+	assert(i <= m_);
+	assert(j >= 1);
+	assert(j <= n_);
+#endif
+
+	return v_[ (j-1)*m_ + (i-1) ];
+
+}
+
+
+template <class T>
+Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const T &a)
+{
+ 	set_(data_, data_+m_*n_, a);
+	return *this;
+}
+
+template <class T>
+Fortran_Array2D<T> Fortran_Array2D<T>::copy() const
+{
+
+	Fortran_Array2D B(m_,n_);
+	
+	B.inject(*this);
+	return B;
+}
+
+
+template <class T>
+Fortran_Array2D<T> & Fortran_Array2D<T>::inject(const Fortran_Array2D &A)
+{
+	if (m_ == A.m_ && n_ == A.n_)
+		copy_(data_, A.data_, m_*n_);
+
+	return *this;
+}
+
+
+
+template <class T>
+Fortran_Array2D<T> & Fortran_Array2D<T>::ref(const Fortran_Array2D<T> &A)
+{
+	if (this != &A)
+	{
+		v_ = A.v_;
+		m_ = A.m_;
+		n_ = A.n_;
+		data_ = A.data_;
+	}
+	return *this;
+}
+
+template <class T>
+Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const Fortran_Array2D<T> &A)
+{
+	return ref(A);
+}
+
+template <class T>
+inline int Fortran_Array2D<T>::dim1() const { return m_; }
+
+template <class T>
+inline int Fortran_Array2D<T>::dim2() const { return n_; }
+
+
+template <class T>
+Fortran_Array2D<T>::~Fortran_Array2D()
+{
+}
+
+template <class T>
+inline int Fortran_Array2D<T>::ref_count() const { return v_.ref_count(); }
+
+
+
+
+template <class T>
+void Fortran_Array2D<T>::set_(T* begin, T* end, const T& a)
+{
+	for (T* p=begin; p<end; p++)
+		*p = a;
+
+}
+
+template <class T>
+void Fortran_Array2D<T>::copy_(T* p, const T* q, int len) 
+{
+	T *end = p + len;
+	while (p<end )
+		*p++ = *q++;
+
+}
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_FORTRAN_ARRAY2D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array2d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,236 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_FORTRAN_ARRAY2D_UTILS_H
+#define TNT_FORTRAN_ARRAY2D_UTILS_H
+
+#include <iostream>
+
+namespace TNT
+{
+
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Fortran_Array2D<T> &A)
+{
+    int M=A.dim1();
+    int N=A.dim2();
+
+    s << M << " " << N << "\n";
+
+    for (int i=1; i<=M; i++)
+    {
+        for (int j=1; j<=N; j++)
+        {
+            s << A(i,j) << " ";
+        }
+        s << "\n";
+    }
+
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Fortran_Array2D<T> &A)
+{
+
+    int M, N;
+
+    s >> M >> N;
+
+	Fortran_Array2D<T> B(M,N);
+
+    for (int i=1; i<=M; i++)
+        for (int j=1; j<=N; j++)
+        {
+            s >>  B(i,j);
+        }
+
+	A = B;
+    return s;
+}
+
+
+
+
+template <class T>
+Fortran_Array2D<T> operator+(const Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Fortran_Array2D<T>();
+
+	else
+	{
+		Fortran_Array2D<T> C(m,n);
+
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				C(i,j) = A(i,j) + B(i,j);
+		}
+		return C;
+	}
+}
+
+template <class T>
+Fortran_Array2D<T> operator-(const Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Fortran_Array2D<T>();
+
+	else
+	{
+		Fortran_Array2D<T> C(m,n);
+
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				C(i,j) = A(i,j) - B(i,j);
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array2D<T> operator*(const Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Fortran_Array2D<T>();
+
+	else
+	{
+		Fortran_Array2D<T> C(m,n);
+
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				C(i,j) = A(i,j) * B(i,j);
+		}
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array2D<T> operator/(const Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() != m ||  B.dim2() != n )
+		return Fortran_Array2D<T>();
+
+	else
+	{
+		Fortran_Array2D<T> C(m,n);
+
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				C(i,j) = A(i,j) / B(i,j);
+		}
+		return C;
+	}
+}
+
+
+
+template <class T>
+Fortran_Array2D<T>&  operator+=(Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				A(i,j) += B(i,j);
+		}
+	}
+	return A;
+}
+
+template <class T>
+Fortran_Array2D<T>&  operator-=(Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				A(i,j) -= B(i,j);
+		}
+	}
+	return A;
+}
+
+template <class T>
+Fortran_Array2D<T>&  operator*=(Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				A(i,j) *= B(i,j);
+		}
+	}
+	return A;
+}
+
+template <class T>
+Fortran_Array2D<T>&  operator/=(Fortran_Array2D<T> &A, const Fortran_Array2D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+
+	if (B.dim1() == m ||  B.dim2() == n )
+	{
+		for (int i=1; i<=m; i++)
+		{
+			for (int j=1; j<=n; j++)
+				A(i,j) /= B(i,j);
+		}
+	}
+	return A;
+}
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,223 @@
+/*
+*
+* Template Numerical Toolkit (TNT): Three-dimensional Fortran numerical array
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_FORTRAN_ARRAY3D_H
+#define TNT_FORTRAN_ARRAY3D_H
+
+#include <cstdlib>
+#include <iostream>
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+#include "tnt_i_refvec.h"
+
+namespace TNT
+{
+
+template <class T>
+class Fortran_Array3D 
+{
+
+
+  private: 
+
+
+		i_refvec<T> v_;
+		int m_;
+		int n_;
+		int k_;
+		T* data_;
+
+  public:
+
+    typedef         T   value_type;
+
+	       Fortran_Array3D();
+	       Fortran_Array3D(int m, int n, int k);
+	       Fortran_Array3D(int m, int n, int k,  T *a);
+	       Fortran_Array3D(int m, int n, int k, const T &a);
+    inline Fortran_Array3D(const Fortran_Array3D &A);
+	inline Fortran_Array3D & operator=(const T &a);
+	inline Fortran_Array3D & operator=(const Fortran_Array3D &A);
+	inline Fortran_Array3D & ref(const Fortran_Array3D &A);
+	       Fortran_Array3D copy() const;
+		   Fortran_Array3D & inject(const Fortran_Array3D & A);
+	inline T& operator()(int i, int j, int k);
+	inline const T& operator()(int i, int j, int k) const ;
+	inline int dim1() const;
+	inline int dim2() const;
+	inline int dim3() const;
+	inline int ref_count() const;
+               ~Fortran_Array3D();
+
+
+};
+
+template <class T>
+Fortran_Array3D<T>::Fortran_Array3D() :  v_(), m_(0), n_(0), k_(0), data_(0) {}
+
+
+template <class T>
+Fortran_Array3D<T>::Fortran_Array3D(const Fortran_Array3D<T> &A) : 
+	v_(A.v_), m_(A.m_), n_(A.n_), k_(A.k_), data_(A.data_) {}
+
+
+
+template <class T>
+Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k) : 
+	v_(m*n*k), m_(m), n_(n), k_(k), data_(v_.begin()) {}
+
+
+
+template <class T>
+Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k, const T &val) : 
+	v_(m*n*k), m_(m), n_(n), k_(k), data_(v_.begin())
+{
+	for (T* p = data_; p < data_ + m*n*k; p++)
+		*p = val;
+}
+
+template <class T>
+Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k, T *a) : 
+	v_(a), m_(m), n_(n), k_(k), data_(v_.begin()) {}
+
+
+
+
+template <class T>
+inline T& Fortran_Array3D<T>::operator()(int i, int j, int k) 
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 1);
+	assert(i <= m_);
+	assert(j >= 1);
+	assert(j <= n_);
+	assert(k >= 1);
+	assert(k <= k_);
+#endif
+
+	return data_[(k-1)*m_*n_ + (j-1) * m_ + i-1];
+
+}
+
+template <class T>
+inline const T& Fortran_Array3D<T>::operator()(int i, int j, int k)  const
+{ 
+#ifdef TNT_BOUNDS_CHECK
+	assert(i >= 1);
+	assert(i <= m_);
+	assert(j >= 1);
+	assert(j <= n_);
+	assert(k >= 1);
+	assert(k <= k_);
+#endif
+
+	return data_[(k-1)*m_*n_ + (j-1) * m_ + i-1];
+}
+
+
+template <class T>
+Fortran_Array3D<T> & Fortran_Array3D<T>::operator=(const T &a)
+{
+
+	T *end = data_ + m_*n_*k_;
+
+	for (T *p=data_; p != end; *p++ = a);
+
+	return *this;
+}
+
+template <class T>
+Fortran_Array3D<T> Fortran_Array3D<T>::copy() const
+{
+
+	Fortran_Array3D B(m_, n_, k_);
+	B.inject(*this);
+	return B;
+	
+}
+
+
+template <class T>
+Fortran_Array3D<T> & Fortran_Array3D<T>::inject(const Fortran_Array3D &A)
+{
+
+	if (m_ == A.m_ && n_ == A.n_ && k_ == A.k_)
+	{
+		T *p = data_;
+		T *end = data_ + m_*n_*k_;
+		const T* q = A.data_;
+		for (; p < end; *p++ =  *q++);
+	}
+	return *this;
+}
+
+
+
+
+template <class T>
+Fortran_Array3D<T> & Fortran_Array3D<T>::ref(const Fortran_Array3D<T> &A)
+{
+
+	if (this != &A)
+	{
+		v_ = A.v_;
+		m_ = A.m_;
+		n_ = A.n_;
+		k_ = A.k_;
+		data_ = A.data_;
+	}
+	return *this;
+}
+
+template <class T>
+Fortran_Array3D<T> & Fortran_Array3D<T>::operator=(const Fortran_Array3D<T> &A)
+{
+	return ref(A);
+}
+
+template <class T>
+inline int Fortran_Array3D<T>::dim1() const { return m_; }
+
+template <class T>
+inline int Fortran_Array3D<T>::dim2() const { return n_; }
+
+template <class T>
+inline int Fortran_Array3D<T>::dim3() const { return k_; }
+
+
+template <class T>
+inline int Fortran_Array3D<T>::ref_count() const 
+{ 
+	return v_.ref_count(); 
+}
+
+template <class T>
+Fortran_Array3D<T>::~Fortran_Array3D()
+{
+}
+
+
+} /* namespace TNT */
+
+#endif
+/* TNT_FORTRAN_ARRAY3D_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_fortran_array3d_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,249 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_FORTRAN_ARRAY3D_UTILS_H
+#define TNT_FORTRAN_ARRAY3D_UTILS_H
+
+#include <cstdlib>
+#include <cassert>
+
+namespace TNT
+{
+
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Fortran_Array3D<T> &A)
+{
+    int M=A.dim1();
+    int N=A.dim2();
+    int K=A.dim3();
+
+    s << M << " " << N << " " << K << "\n";
+
+    for (int i=1; i<=M; i++)
+    {
+        for (int j=1; j<=N; j++)
+        {
+			for (int k=1; k<=K; k++)
+            	s << A(i,j,k) << " ";
+			s << "\n";
+        }
+        s << "\n";
+    }
+
+
+    return s;
+}
+
+template <class T>
+std::istream& operator>>(std::istream &s, Fortran_Array3D<T> &A)
+{
+
+    int M, N, K;
+
+    s >> M >> N >> K;
+
+	Fortran_Array3D<T> B(M,N,K);
+
+    for (int i=1; i<=M; i++)
+        for (int j=1; j<=N; j++)
+			for (int k=1; k<=K; k++)
+            	s >>  B(i,j,k);
+
+	A = B;
+    return s;
+}
+
+
+template <class T>
+Fortran_Array3D<T> operator+(const Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Fortran_Array3D<T>();
+
+	else
+	{
+		Fortran_Array3D<T> C(m,n,p);
+
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+				C(i,j,k) = A(i,j,k)+ B(i,j,k);
+
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array3D<T> operator-(const Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Fortran_Array3D<T>();
+
+	else
+	{
+		Fortran_Array3D<T> C(m,n,p);
+
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+				C(i,j,k) = A(i,j,k)- B(i,j,k);
+
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array3D<T> operator*(const Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Fortran_Array3D<T>();
+
+	else
+	{
+		Fortran_Array3D<T> C(m,n,p);
+
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+				C(i,j,k) = A(i,j,k)* B(i,j,k);
+
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array3D<T> operator/(const Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() != m ||  B.dim2() != n || B.dim3() != p )
+		return Fortran_Array3D<T>();
+
+	else
+	{
+		Fortran_Array3D<T> C(m,n,p);
+
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+				C(i,j,k) = A(i,j,k)/ B(i,j,k);
+
+		return C;
+	}
+}
+
+
+template <class T>
+Fortran_Array3D<T>& operator+=(Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+					A(i,j,k) += B(i,j,k);
+	}
+
+	return A;
+}
+
+
+template <class T>
+Fortran_Array3D<T>& operator-=(Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+					A(i,j,k) -= B(i,j,k);
+	}
+
+	return A;
+}
+
+
+template <class T>
+Fortran_Array3D<T>& operator*=(Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+					A(i,j,k) *= B(i,j,k);
+	}
+
+	return A;
+}
+
+
+template <class T>
+Fortran_Array3D<T>& operator/=(Fortran_Array3D<T> &A, const Fortran_Array3D<T> &B)
+{
+	int m = A.dim1();
+	int n = A.dim2();
+	int p = A.dim3();
+
+	if (B.dim1() == m &&  B.dim2() == n && B.dim3() == p )
+	{
+		for (int i=1; i<=m; i++)
+			for (int j=1; j<=n; j++)
+				for (int k=1; k<=p; k++)
+					A(i,j,k) /= B(i,j,k);
+	}
+
+	return A;
+}
+
+
+} // namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_i_refvec.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_i_refvec.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_i_refvec.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,243 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_I_REFVEC_H
+#define TNT_I_REFVEC_H
+
+#include <cstdlib>
+#include <iostream>
+
+#ifdef TNT_BOUNDS_CHECK
+#include <assert.h>
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+namespace TNT
+{
+/*
+	Internal representation of ref-counted array.  The TNT
+	arrays all use this building block.
+
+	<p>
+	If an array block is created by TNT, then every time 
+	an assignment is made, the left-hand-side reference 
+	is decreased by one, and the right-hand-side refernce
+	count is increased by one.  If the array block was
+	external to TNT, the refernce count is a NULL pointer
+	regardless of how many references are made, since the 
+	memory is not freed by TNT.
+
+
+	
+*/
+template <class T>
+class i_refvec
+{
+
+
+  private:
+    T* data_;                  
+    int *ref_count_;
+
+
+  public:
+
+			 i_refvec();
+	explicit i_refvec(int n);
+	inline	 i_refvec(T* data);
+	inline	 i_refvec(const i_refvec &v);
+	inline   T*		 begin();
+	inline const T* begin() const;
+	inline  T& operator[](int i);
+	inline const T& operator[](int i) const;
+	inline  i_refvec<T> & operator=(const i_refvec<T> &V);
+		    void copy_(T* p, const T* q, const T* e); 
+		    void set_(T* p, const T* b, const T* e); 
+	inline 	int	 ref_count() const;
+	inline  int is_null() const;
+	inline  void destroy();
+			 ~i_refvec();
+			
+};
+
+template <class T>
+void i_refvec<T>::copy_(T* p, const T* q, const T* e)
+{
+	for (T* t=p; q<e; t++, q++)
+		*t= *q;
+}
+
+template <class T>
+i_refvec<T>::i_refvec() : data_(NULL), ref_count_(NULL) {}
+
+/**
+	In case n is 0 or negative, it does NOT call new. 
+*/
+template <class T>
+i_refvec<T>::i_refvec(int n) : data_(NULL), ref_count_(NULL)
+{
+	if (n >= 1)
+	{
+#ifdef TNT_DEBUG
+		std::cout  << "new data storage.\n";
+#endif
+		data_ = new T[n];
+		ref_count_ = new int;
+		*ref_count_ = 1;
+	}
+}
+
+template <class T>
+inline	 i_refvec<T>::i_refvec(const i_refvec<T> &V): data_(V.data_),
+	ref_count_(V.ref_count_)
+{
+	if (V.ref_count_ != NULL)
+	    (*(V.ref_count_))++;
+}
+
+
+template <class T>
+i_refvec<T>::i_refvec(T* data) : data_(data), ref_count_(NULL) {}
+
+template <class T>
+inline T* i_refvec<T>::begin()
+{
+	return data_;
+}
+
+template <class T>
+inline const T& i_refvec<T>::operator[](int i) const
+{
+	return data_[i];
+}
+
+template <class T>
+inline T& i_refvec<T>::operator[](int i)
+{
+	return data_[i];
+}
+
+
+template <class T>
+inline const T* i_refvec<T>::begin() const
+{
+	return data_;
+}
+
+
+
+template <class T>
+i_refvec<T> & i_refvec<T>::operator=(const i_refvec<T> &V)
+{
+	if (this == &V)
+		return *this;
+
+
+	if (ref_count_ != NULL)
+	{
+		(*ref_count_) --;
+		if ((*ref_count_) == 0)
+			destroy();
+	}
+
+	data_ = V.data_;
+	ref_count_ = V.ref_count_;
+
+	if (V.ref_count_ != NULL)
+	    (*(V.ref_count_))++;
+
+	return *this;
+}
+
+template <class T>
+void i_refvec<T>::destroy()
+{
+	if (ref_count_ != NULL)
+	{
+#ifdef TNT_DEBUG
+		std::cout << "destorying data... \n";
+#endif
+		delete ref_count_;
+
+#ifdef TNT_DEBUG
+		std::cout << "deleted ref_count_ ...\n";
+#endif
+		if (data_ != NULL)
+			delete []data_;
+#ifdef TNT_DEBUG
+		std::cout << "deleted data_[] ...\n";
+#endif
+		data_ = NULL;
+	}
+}
+
+/*
+* return 1 is vector is empty, 0 otherwise
+*
+* if is_null() is false and ref_count() is 0, then
+* 
+*/
+template<class T>
+int i_refvec<T>::is_null() const
+{
+	return (data_ == NULL ? 1 : 0);
+}
+
+/*
+*  returns -1 if data is external, 
+*  returns 0 if a is NULL array,
+*  otherwise returns the positive number of vectors sharing
+*  		this data space.
+*/
+template <class T>
+int i_refvec<T>::ref_count() const
+{
+	if (data_ == NULL)
+		return 0;
+	else
+		return (ref_count_ != NULL ? *ref_count_ : -1) ; 
+}
+
+template <class T>
+i_refvec<T>::~i_refvec()
+{
+	if (ref_count_ != NULL)
+	{
+		(*ref_count_)--;
+
+		if (*ref_count_ == 0)
+		destroy();
+	}
+}
+
+
+} /* namespace TNT */
+
+
+
+
+
+#endif
+/* TNT_I_REFVEC_H */
+
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_math_utils.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_math_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_math_utils.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,34 @@
+#ifndef MATH_UTILS_H
+#define MATH_UTILS_H
+
+/* needed for fabs, sqrt() below */
+#include <cmath>
+
+
+
+namespace TNT
+{
+/**
+	@returns hypotenuse of real (non-complex) scalars a and b by 
+	avoiding underflow/overflow
+	using (a * sqrt( 1 + (b/a) * (b/a))), rather than
+	sqrt(a*a + b*b).
+*/
+template <class Real>
+Real hypot(const Real &a, const Real &b)
+{
+	
+	if (a== 0)
+		return abs(b);
+	else
+	{
+		Real c = b/a;
+		return fabs(a) * sqrt(1 + c*c);
+	}
+}
+} /* TNT namespace */
+
+
+
+#endif
+/* MATH_UTILS_H */
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_sparse_matrix_csr.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_sparse_matrix_csr.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_sparse_matrix_csr.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,103 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_SPARSE_MATRIX_CSR_H
+#define TNT_SPARSE_MATRIX_CSR_H
+
+#include "tnt_array1d.h"
+
+namespace TNT
+{
+
+
+/**
+	Read-only view of a sparse matrix in compressed-row storage
+	format.  Neither array elements (nonzeros) nor sparsity
+	structure can be modified.  If modifications are required,
+	create a new view.
+
+	<p>
+	Index values begin at 0.
+
+	<p>
+	<b>Storage requirements:</b> An (m x n) matrix with
+	nz nonzeros requires no more than  ((T+I)*nz + M*I)
+	bytes, where T is the size of data elements and
+	I is the size of integers.
+	
+
+*/
+template <class T>
+class Sparse_Matrix_CompRow {
+
+private:
+	Array1D<T>    val_;       // data values (nz_ elements)
+    Array1D<int>  rowptr_;    // row_ptr (dim_[0]+1 elements)
+    Array1D<int>  colind_;    // col_ind  (nz_ elements)
+
+    int dim1_;        // number of rows
+    int dim2_;        // number of cols
+  
+public:
+
+	Sparse_Matrix_CompRow(const Sparse_Matrix_CompRow &S);
+	Sparse_Matrix_CompRow(int M, int N, int nz, const T *val, 
+						const int *r, const int *c);
+    
+
+
+    inline   const T&      val(int i) const { return val_[i]; }
+    inline   const int&         row_ptr(int i) const { return rowptr_[i]; }
+    inline   const int&         col_ind(int i) const { return colind_[i];}
+
+    inline   int    dim1() const {return dim1_;}
+    inline   int    dim2() const {return dim2_;}
+       int          NumNonzeros() const {return val_.dim1();}
+
+
+    Sparse_Matrix_CompRow& operator=(
+					const Sparse_Matrix_CompRow &R);
+
+
+
+};
+
+/**
+	Construct a read-only view of existing sparse matrix in
+	compressed-row storage format.
+
+	@param M the number of rows of sparse matrix
+	@param N the  number of columns of sparse matrix
+	@param nz the number of nonzeros
+	@param val a contiguous list of nonzero values
+	@param r row-pointers: r[i] denotes the begining position of row i
+		(i.e. the ith row begins at val[row[i]]).
+	@param c column-indices: c[i] denotes the column location of val[i]
+*/
+template <class T>
+Sparse_Matrix_CompRow<T>::Sparse_Matrix_CompRow(int M, int N, int nz,
+	const T *val, const int *r, const int *c) : val_(nz,val), 
+		rowptr_(M, r), colind_(nz, c), dim1_(M), dim2_(N) {}
+
+
+}
+// namespace TNT
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_stopwatch.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_stopwatch.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_stopwatch.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,95 @@
+/*
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain.  NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef STOPWATCH_H
+#define STOPWATCH_H
+
+// for clock() and CLOCKS_PER_SEC
+#include <time.h>
+
+
+namespace TNT
+{
+
+inline static double seconds(void)
+{
+    const double secs_per_tick = 1.0 / CLOCKS_PER_SEC;
+    return ( (double) clock() ) * secs_per_tick;
+}
+
+class Stopwatch {
+    private:
+        int running_;
+        double start_time_;
+        double total_;
+
+    public:
+        inline Stopwatch();
+        inline void start();
+        inline double stop();
+		inline double read();
+		inline void resume();
+		inline int running();
+};
+
+inline Stopwatch::Stopwatch() : running_(0), start_time_(0.0), total_(0.0) {}
+
+void Stopwatch::start() 
+{
+	running_ = 1;
+	total_ = 0.0;
+	start_time_ = seconds();
+}
+
+double Stopwatch::stop()  
+{
+	if (running_) 
+	{
+         total_ += (seconds() - start_time_); 
+         running_ = 0;
+    }
+    return total_; 
+}
+
+inline void Stopwatch::resume()
+{
+	if (!running_)
+	{
+		start_time_ = seconds();
+		running_ = 1;
+	}
+}
+		
+
+inline double Stopwatch::read()   
+{
+	if (running_)
+	{
+		stop();
+		resume();
+	}
+	return total_;
+}
+
+
+} /* TNT namespace */
+#endif
+    
+
+            
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_subscript.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_subscript.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_subscript.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,54 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+#ifndef TNT_SUBSCRPT_H
+#define TNT_SUBSCRPT_H
+
+
+//---------------------------------------------------------------------
+// This definition describes the default TNT data type used for
+// indexing into TNT matrices and vectors.  The data type should
+// be wide enough to index into large arrays.  It defaults to an
+// "int", but can be overriden at compile time redefining TNT_SUBSCRIPT_TYPE,
+// e.g.
+// 
+//      c++ -DTNT_SUBSCRIPT_TYPE='unsigned int'  ...
+//
+//---------------------------------------------------------------------
+//
+
+#ifndef TNT_SUBSCRIPT_TYPE
+#define TNT_SUBSCRIPT_TYPE int
+#endif
+
+namespace TNT
+{
+    typedef TNT_SUBSCRIPT_TYPE Subscript;
+} /* namespace TNT */
+
+
+// () indexing in TNT means 1-offset, i.e. x(1) and A(1,1) are the
+// first elements.  This offset is left as a macro for future
+// purposes, but should not be changed in the current release.
+//
+//
+#define TNT_BASE_OFFSET (1)
+
+#endif
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_vec.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_vec.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_vec.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,404 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+
+
+#ifndef TNT_VEC_H
+#define TNT_VEC_H
+
+#include "tnt_subscript.h"
+#include <cstdlib>
+#include <cassert>
+#include <iostream>
+#include <sstream>
+
+namespace TNT
+{
+
+/**
+ <b>[Deprecatred]</b>  Value-based vector class from pre-1.0
+ 	TNT version.  Kept here for backward compatiblity, but should
+	use the newer TNT::Array1D classes instead.
+
+*/
+
+template <class T>
+class Vector 
+{
+
+
+  public:
+
+    typedef Subscript   size_type;
+    typedef         T   value_type;
+    typedef         T   element_type;
+    typedef         T*  pointer;
+    typedef         T*  iterator;
+    typedef         T&  reference;
+    typedef const   T*  const_iterator;
+    typedef const   T&  const_reference;
+
+    Subscript lbound() const { return 1;}
+ 
+  protected:
+    T* v_;                  
+    T* vm1_;        // pointer adjustment for optimzied 1-offset indexing
+    Subscript n_;
+
+    // internal helper function to create the array
+    // of row pointers
+
+    void initialize(Subscript N)
+    {
+        // adjust pointers so that they are 1-offset:
+        // v_[] is the internal contiguous array, it is still 0-offset
+        //
+        assert(v_ == NULL);
+        v_ = new T[N];
+        assert(v_  != NULL);
+        vm1_ = v_-1;
+        n_ = N;
+    }
+   
+    void copy(const T*  v)
+    {
+        Subscript N = n_;
+        Subscript i;
+
+#ifdef TNT_UNROLL_LOOPS
+        Subscript Nmod4 = N & 3;
+        Subscript N4 = N - Nmod4;
+
+        for (i=0; i<N4; i+=4)
+        {
+            v_[i] = v[i];
+            v_[i+1] = v[i+1];
+            v_[i+2] = v[i+2];
+            v_[i+3] = v[i+3];
+        }
+
+        for (i=N4; i< N; i++)
+            v_[i] = v[i];
+#else
+
+        for (i=0; i< N; i++)
+            v_[i] = v[i];
+#endif      
+    }
+
+    void set(const T& val)
+    {
+        Subscript N = n_;
+        Subscript i;
+
+#ifdef TNT_UNROLL_LOOPS
+        Subscript Nmod4 = N & 3;
+        Subscript N4 = N - Nmod4;
+
+        for (i=0; i<N4; i+=4)
+        {
+            v_[i] = val;
+            v_[i+1] = val;
+            v_[i+2] = val;
+            v_[i+3] = val; 
+        }
+
+        for (i=N4; i< N; i++)
+            v_[i] = val;
+#else
+
+        for (i=0; i< N; i++)
+            v_[i] = val;
+        
+#endif      
+    }
+    
+
+
+    void destroy()
+    {     
+        /* do nothing, if no memory has been previously allocated */
+        if (v_ == NULL) return ;
+
+        /* if we are here, then matrix was previously allocated */
+        delete [] (v_);     
+
+        v_ = NULL;
+        vm1_ = NULL;
+    }
+
+
+  public:
+
+    // access
+
+    iterator begin() { return v_;}
+    iterator end()   { return v_ + n_; }
+    const iterator begin() const { return v_;}
+    const iterator end() const  { return v_ + n_; }
+
+    // destructor
+
+    ~Vector() 
+    {
+        destroy();
+    }
+
+    // constructors
+
+    Vector() : v_(0), vm1_(0), n_(0)  {};
+
+    Vector(const Vector<T> &A) : v_(0), vm1_(0), n_(0)
+    {
+        initialize(A.n_);
+        copy(A.v_);
+    }
+
+    Vector(Subscript N, const T& value = T()) :  v_(0), vm1_(0), n_(0)
+    {
+        initialize(N);
+        set(value);
+    }
+
+    Vector(Subscript N, const T* v) :  v_(0), vm1_(0), n_(0)
+    {
+        initialize(N);
+        copy(v);
+    }
+
+    Vector(Subscript N, char *s) :  v_(0), vm1_(0), n_(0)
+    {
+        initialize(N);
+        std::istringstream ins(s);
+
+        Subscript i;
+
+        for (i=0; i<N; i++)
+                ins >> v_[i];
+    }
+
+
+    // methods
+    // 
+    Vector<T>& newsize(Subscript N)
+    {
+        if (n_ == N) return *this;
+
+        destroy();
+        initialize(N);
+
+        return *this;
+    }
+
+
+    // assignments
+    //
+    Vector<T>& operator=(const Vector<T> &A)
+    {
+        if (v_ == A.v_)
+            return *this;
+
+        if (n_ == A.n_)         // no need to re-alloc
+            copy(A.v_);
+
+        else
+        {
+            destroy();
+            initialize(A.n_);
+            copy(A.v_);
+        }
+
+        return *this;
+    }
+        
+    Vector<T>& operator=(const T& scalar)
+    { 
+        set(scalar);  
+        return *this;
+    }
+
+    inline Subscript dim() const 
+    {
+        return  n_; 
+    }
+
+    inline Subscript size() const 
+    {
+        return  n_; 
+    }
+
+
+    inline reference operator()(Subscript i)
+    { 
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= n_) ;
+#endif
+        return vm1_[i]; 
+    }
+
+    inline const_reference operator() (Subscript i) const
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert(1<=i);
+        assert(i <= n_) ;
+#endif
+        return vm1_[i]; 
+    }
+
+    inline reference operator[](Subscript i)
+    { 
+#ifdef TNT_BOUNDS_CHECK
+        assert(0<=i);
+        assert(i < n_) ;
+#endif
+        return v_[i]; 
+    }
+
+    inline const_reference operator[](Subscript i) const
+    {
+#ifdef TNT_BOUNDS_CHECK
+        assert(0<=i);
+
+
+
+
+
+
+        assert(i < n_) ;
+#endif
+        return v_[i]; 
+    }
+
+
+
+};
+
+
+/* ***************************  I/O  ********************************/
+
+template <class T>
+std::ostream& operator<<(std::ostream &s, const Vector<T> &A)
+{
+    Subscript N=A.dim();
+
+    s <<  N << "\n";
+
+    for (Subscript i=0; i<N; i++)
+        s   << A[i] << " " << "\n";
+    s << "\n";
+
+    return s;
+}
+
+template <class T>
+std::istream & operator>>(std::istream &s, Vector<T> &A)
+{
+
+    Subscript N;
+
+    s >> N;
+
+    if ( !(N == A.size() ))
+    {
+        A.newsize(N);
+    }
+
+
+    for (Subscript i=0; i<N; i++)
+            s >>  A[i];
+
+
+    return s;
+}
+
+// *******************[ basic matrix algorithms ]***************************
+
+
+template <class T>
+Vector<T> operator+(const Vector<T> &A, 
+    const Vector<T> &B)
+{
+    Subscript N = A.dim();
+
+    assert(N==B.dim());
+
+    Vector<T> tmp(N);
+    Subscript i;
+
+    for (i=0; i<N; i++)
+            tmp[i] = A[i] + B[i];
+
+    return tmp;
+}
+
+template <class T>
+Vector<T> operator-(const Vector<T> &A, 
+    const Vector<T> &B)
+{
+    Subscript N = A.dim();
+
+    assert(N==B.dim());
+
+    Vector<T> tmp(N);
+    Subscript i;
+
+    for (i=0; i<N; i++)
+            tmp[i] = A[i] - B[i];
+
+    return tmp;
+}
+
+template <class T>
+Vector<T> operator*(const Vector<T> &A, 
+    const Vector<T> &B)
+{
+    Subscript N = A.dim();
+
+    assert(N==B.dim());
+
+    Vector<T> tmp(N);
+    Subscript i;
+
+    for (i=0; i<N; i++)
+            tmp[i] = A[i] * B[i];
+
+    return tmp;
+}
+
+
+template <class T>
+T dot_prod(const Vector<T> &A, const Vector<T> &B)
+{
+    Subscript N = A.dim();
+    assert(N == B.dim());
+
+    Subscript i;
+    T sum = 0;
+
+    for (i=0; i<N; i++)
+        sum += A[i] * B[i];
+
+    return sum;
+}
+
+}   /* namespace TNT */
+
+#endif
+// TNT_VEC_H
Index: realSpaceModeling/iqPy/libiqPy/tnt/tnt_version.h
===================================================================
--- realSpaceModeling/iqPy/libiqPy/tnt/tnt_version.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/libiqPy/tnt/tnt_version.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,39 @@
+/*
+*
+* Template Numerical Toolkit (TNT)
+*
+* Mathematical and Computational Sciences Division
+* National Institute of Technology,
+* Gaithersburg, MD USA
+*
+*
+* This software was developed at the National Institute of Standards and
+* Technology (NIST) by employees of the Federal Government in the course
+* of their official duties. Pursuant to title 17 Section 105 of the
+* United States Code, this software is not subject to copyright protection
+* and is in the public domain. NIST assumes no responsibility whatsoever for
+* its use by other parties, and makes no guarantees, expressed or implied,
+* about its quality, reliability, or any other characteristic.
+*
+*/
+
+#ifndef TNT_VERSION_H
+#define TNT_VERSION_H
+
+
+//---------------------------------------------------------------------
+//  current version 
+//---------------------------------------------------------------------
+
+
+#define TNT_MAJOR_VERSION    '1'
+#define TNT_MINOR_VERSION    '2'
+#define TNT_SUBMINOR_VERSION '6'
+#define TNT_VERSION_STRING "1.2.6"
+
+
+
+
+
+#endif
+// TNT_VERSION_H
Index: realSpaceModeling/iqPy/tests/Make.mm
===================================================================
--- realSpaceModeling/iqPy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,48 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = iqPy
+PACKAGE = tests
+
+PROJ_CLEAN += $(PROJ_CPPTESTS)
+
+PROJ_PYTESTS = testiq.py
+PROJ_CPPTESTS = testiq
+PROJ_TESTS = $(PROJ_PYTESTS) $(PROJ_CPPTESTS)
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -liqPy
+PROJ_CXX_INCLUDES = ../libiqPy/tnt  \
+		    ../libiqPy
+
+#--------------------------------------------------------------------------
+#
+
+all: $(PROJ_TESTS)
+
+test:
+	for test in $(PROJ_TESTS) ; do $${test}; done
+
+release: tidy
+	cvs release .
+
+update: clean
+	cvs update .
+
+#--------------------------------------------------------------------------
+#
+
+testiq: testiq.cc $(BLD_LIBDIR)/libiqPy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -o $@ testiq.cc $(PROJ_LIBRARIES)
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/iqPy/tests/signon.py
===================================================================
--- realSpaceModeling/iqPy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    import iqPy
+    from iqPy import iqPy as iqPymodule
+
+    print "copyright information:"
+    print "   ", iqPy.copyright()
+    print "   ", iqPymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", iqPymodule.__file__
+    print "    doc:", iqPymodule.__doc__
+    print "    contents:", dir(iqPymodule)
+
+    print
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/iqPy/tests/testiq.cc
===================================================================
--- realSpaceModeling/iqPy/tests/testiq.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/tests/testiq.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,34 @@
+#include "iq.h"
+#include <iostream>
+
+using namespace std;
+
+int main(){
+
+  cout << " Generating a empty iq 2D array with size of 10"  << endl;
+	IQ iq1(10);
+
+	for (int i = 0; i< iq1.iq_data.dim1(); i++)
+		cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][0] <<endl;
+
+	int dim = iq1.iq_data.dim1();
+
+	cout << "dimension of the iq array is : " << dim << endl;
+
+	iq1.SetQmin(0.001);
+	iq1.SetQmax(0.4);
+	iq1.SetContrast(1.0);
+	iq1.SetVolFrac(1.0);
+
+	cout << iq1.GetQmin() << " " << iq1.GetQmax() << " " << iq1.GetContrast() << " " << iq1.GetVolFrac() << endl;
+
+	cout << "generating another empty iq object through constructor IQ(numI,qmin,qmax)" <<endl;
+	
+	IQ iq2(15,0.001,0.4);
+
+	iq2.OutputIQ("out.iq");
+
+	cout << "pass." << endl;
+
+	return 0;
+}
Index: realSpaceModeling/iqPy/tests/testiq.py
===================================================================
--- realSpaceModeling/iqPy/tests/testiq.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/iqPy/tests/testiq.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+	from SANSsimulation import iqPy
+	iqPy.new_iq(10,0.01,0.4)
+
+	print "pass."
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/pointsmodelpy/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,47 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = pointsmodelpy
+
+# directory structure
+
+BUILD_DIRS = \
+    libpointsmodelpy \
+    pointsmodelpymodule \
+    pointsmodelpy \
+
+OTHER_DIRS = \
+    tests \
+    examples
+
+RECURSE_DIRS = $(BUILD_DIRS) $(OTHER_DIRS)
+
+#--------------------------------------------------------------------------
+#
+
+all:
+	BLD_ACTION="all" $(MM) recurse
+
+distclean::
+	BLD_ACTION="distclean" $(MM) recurse
+
+clean::
+	BLD_ACTION="clean" $(MM) recurse
+
+tidy::
+	BLD_ACTION="tidy" $(MM) recurse
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/examples/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/examples/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = pointsmodelpy
+PACKAGE = examples
+
+#--------------------------------------------------------------------------
+#
+
+all: clean
+
+release: clean
+	cvs release .
+
+update: clean
+	cvs update .
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,69 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+include local.def
+
+PROJECT = pointsmodelpy
+PACKAGE = libpointsmodelpy
+
+PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
+PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
+
+PROJ_SRCS = \
+	lores_model.cc	\
+	points_model.cc	\
+        pdb_model.cc  \
+        complex_model.cc
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# build the library
+
+all: $(PROJ_SAR) export
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
+	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
+
+# export
+export:: export-headers export-libraries export-binaries
+
+else
+
+# build the shared object
+$(PROJ_SAR): product_dirs $(PROJ_OBJS)
+	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS) -L$(BLD_LIBDIR)
+
+# export
+export:: export-headers export-libraries
+
+endif
+
+EXPORT_HEADERS = \
+	lores_model.h	\
+	points_model.h	\
+        complex_model.h
+
+EXPORT_LIBS = $(PROJ_SAR)
+EXPORT_BINS = $(PROJ_DLL)
+
+
+# version
+# $Id$
+
+#
+# End of file
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,97 @@
+/** \file complex_model.cc */
+
+#include "complex_model.h"
+#include <algorithm>
+#include <stdexcept>
+
+using namespace std;
+
+ComplexModel::ComplexModel(){
+
+}
+
+void ComplexModel::Add(PointsModel *pm)
+{
+  models_.push_back(pm);
+}
+
+double ComplexModel::GetDimBound()
+{
+  //Get the vector of centers of pointsmodel instances
+  //and a vector of individual boundary
+  vector<PointsModel *>::iterator itr;
+  vector<Point3D> veccenter;
+  vector<double> bounds;
+
+  for(itr = models_.begin(); itr != models_.end(); ++itr){
+    if ((*itr)->GetDimBound() != 0){
+      Point3D pp((*itr)->GetCenter()[0],(*itr)->GetCenter()[1],(*itr)->GetCenter()[2]);
+      veccenter.push_back(pp);
+      bounds.push_back((*itr)->GetDimBound());
+    }
+  }
+
+  //max bound
+  double maxbound = *max_element(bounds.begin(),bounds.end());
+
+  //max distance
+  vector<double> vecdist;
+  size_t num = veccenter.size();
+
+  if (num > 1){
+    for (size_t i = 0; i != num; ++i){
+      for (size_t j= 1; j != num; ++j){
+        double dist = veccenter[i].distanceToPoint(veccenter[j]);
+        vecdist.push_back(dist);
+      }
+    }
+  }
+  else{
+    vecdist.push_back(maxbound);
+  }
+
+  double maxcenterdist = *max_element(vecdist.begin(),vecdist.end());
+
+  double finalbound = maxbound + maxcenterdist;
+
+  return finalbound;
+}
+
+vector<double> ComplexModel::GetCenter()
+{
+  double sumx = 0, sumy = 0, sumz = 0;
+  size_t num = 0;
+
+  vector<PointsModel *>::iterator itr;
+  for(itr = models_.begin(); itr != models_.end(); ++itr){
+    sumx += (*itr)->GetCenter()[0];
+    sumy += (*itr)->GetCenter()[1];
+    sumz += (*itr)->GetCenter()[2];
+    ++num;
+  }
+
+  vector<double> v(3);
+  v[0] = sumx/num;
+  v[1] = sumy/num;
+  v[2] = sumz/num;
+  center_ = v;
+  return center_;
+}
+
+int ComplexModel::GetPoints(Point3DVector &vp)
+{
+  if (vp.size() != 0){
+    throw runtime_error("GetPoints(Point3DVector &VP):VP has to be empty"); 
+  }
+
+  vector<PointsModel *>::iterator itr;
+
+  for(itr = models_.begin(); itr != models_.end(); ++itr){
+    vector<Point3D> temp;
+    (*itr)->GetPoints(temp);    	
+    if (temp.size() != 0){
+      vp.insert(vp.end(),temp.begin(),temp.end());
+    }
+  }
+  return vp.size();
+}
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.h
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/complex_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,36 @@
+/** \file complex_model.h child class of PointsModel */
+
+#ifndef COMPLEX_MODEL_H
+#define COMPLEX_MODEL_H
+
+#include "points_model.h"
+#include <string>
+#include <map>
+
+/**
+ *  Class ComplexModel : container class for LORESModel & PDBModel
+ *  The main functionality is to merge points from instances of 
+ *  LORESModel & PDBModel
+ */
+
+class ComplexModel : public PointsModel {
+ public:
+  ComplexModel();
+  
+  //add PointsModel instance
+  void Add(PointsModel *);
+
+  //Parse all coordinates from ATOM section 
+  //of the PDB file into vector of points
+  int GetPoints(Point3DVector &);
+
+  //Get distance boundary for the pointsmodel instances
+  double GetDimBound();
+
+  vector<double> GetCenter();
+
+ private:
+  vector<PointsModel *> models_;
+};
+
+#endif
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/local.def
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+#
+# Local (project) definitions
+#
+
+# C++
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy   \
+                     ../../iqPy/libiqPy/tnt \
+		     ../../geoshapespy/libgeoshapespy   \
+		     ../../analmodelpy/libanalmodelpy   \
+		     ./ 
+
+    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
+    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS) -liqPy -lgeoshapespy
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,237 @@
+/** \file lores_model.cc */
+
+#include <algorithm>
+#include <stdexcept>
+#include "lores_model.h"
+#include "sphere.h"
+#include "hollow_sphere.h"
+#include "cylinder.h"
+#include "ellipsoid.h"
+#include "single_helix.h"
+#include "Point3D.h"
+
+LORESModel::LORESModel(double density)
+{
+  density_ = density;
+}
+
+GeoShape* LORESModel::GetGeoShape(GeoShape& geo_shape)
+{
+  GeoShape* shape = NULL;
+
+  switch (geo_shape.GetShapeType()){
+    case SPHERE:
+      shape = new Sphere(static_cast<const Sphere&>(geo_shape));
+      break;
+    case HOLLOWSPHERE:
+      shape = new HollowSphere(static_cast<const HollowSphere&>(geo_shape));
+      break;
+    case CYLINDER:
+      shape = new Cylinder(static_cast<const Cylinder&>(geo_shape));
+      break;
+    case ELLIPSOID:
+      shape = new Ellipsoid(static_cast<const Ellipsoid&>(geo_shape));
+      break;
+    case SINGLEHELIX:
+      shape = new SingleHelix(static_cast<const SingleHelix&>(geo_shape));
+      break;
+  
+  }
+
+  return shape;
+}
+
+LORESModel::~LORESModel()
+{
+  for (RealSpaceShapeCollection::iterator it = shapes_.begin();
+       it != shapes_.end(); ++it) {
+    delete *it;
+  }
+}
+
+void LORESModel::SetDensity(double density)
+{
+  density_ = density;
+}
+
+double LORESModel::GetDensity()
+{
+  return density_;
+}
+
+// Add a shape into LORES Model
+void LORESModel::Add(GeoShape& geo_shape,
+                     double sld) {
+  GeoShape* shape = GetGeoShape(geo_shape);
+  assert(shape != NULL);
+
+  RealSpaceShape* real_shape = new RealSpaceShape(shape);
+  FillPoints(real_shape, sld);
+  shapes_.push_back(real_shape);
+}
+
+// Delete ith shape in shapes_ list
+// If we have 3 shapes in our model, the index starts
+// from 0, which means we need to call Delete(0) to delete
+// the first shape, and call Delete(1) to delete the second
+// shape, etc..
+void LORESModel::Delete(size_t i) {
+  if (i >= shapes_.size()) {
+    std::cerr << "Delete shapes out of scope" << std::endl;
+    return;
+  }
+
+  RealSpaceShape* real_shape = shapes_[i];
+  if (i + 1 < shapes_.size()) {
+    // if it is not the last shape, we have to distribute its points
+    // to the shapes after i-th shape.
+    const Point3DVector& points = real_shape->points;
+    for (Point3DVector::const_iterator pit = points.begin();
+         pit != points.end(); ++pit)
+      DistributePoint(*pit, i + 1);
+  }
+
+  shapes_.erase(shapes_.begin() + i);
+  delete real_shape;
+}
+
+// Get the points in the realspaceshapecollection
+int LORESModel::GetPoints(Point3DVector &pp)
+{
+  if (pp.size() != 0){
+    throw runtime_error("GetPoints(Point3DVector &VP):VP has to be empty"); 
+  }
+
+  if (shapes_.size() != 0){
+    for (size_t j = 0; j <shapes_.size(); ++j ){
+      pp.insert(pp.end(),shapes_[j]->points.begin(),shapes_[j]->points.end());
+    }
+  }
+  return pp.size();
+}
+
+//Write points to a file, mainly for testing right now
+void LORESModel::WritePoints2File(Point3DVector &vp){
+  ofstream outfile("test.coor");
+  for(size_t i=0; i<vp.size(); ++i){
+    outfile<<vp[i].getX()<<" "<<vp[i].getY()<<" "<<vp[i].getZ()<<" "<<vp[i].getSLD()<<endl;
+  }
+}
+
+double LORESModel::GetDimBound()
+{
+  if(shapes_.size() == 0)
+    return 0;
+
+  //find maximum distance between centers of shapes
+  //get the vector of centers
+  vector<Point3D> vec_center;
+  for (size_t m = 0; m < shapes_.size(); ++m){
+    assert(shapes_[m]->shape != NULL);
+    vector<double> center(3);
+    center = shapes_[m]->shape->GetCenter();
+    Point3D p_center;
+    p_center.set(center[0],center[1],center[2]);
+    vec_center.push_back(p_center);
+  }
+  size_t vecsize = vec_center.size();
+
+  //get the maximum distance among centers
+  double max_cen_dist;
+  if (vecsize == 1){
+    max_cen_dist = 0;
+  }
+  else{
+    vector<double> vecdist;
+    for (size_t m1=0; m1<vecsize -1; ++m1){
+      for (size_t m2 = m1+1; m2<vecsize; ++m2){
+	double dist = vec_center[m1].distanceToPoint(vec_center[m2]);
+	vecdist.push_back(dist);
+      }
+    }
+    max_cen_dist = *max_element(vecdist.begin(), vecdist.end());
+  }
+  //find the maximum radius for individual shape
+  vector<double> maxradii;
+  for (size_t n = 0; n < shapes_.size(); ++n){
+    assert(shapes_[n]->shape != NULL);
+    double maxradius = shapes_[n]->shape->GetMaxRadius();
+    maxradii.push_back(maxradius);
+  }
+  double max_maxradius = *max_element(maxradii.begin(),maxradii.end());
+  
+  return 2*(max_cen_dist/2 + max_maxradius);
+}
+
+
+// Distribute points of the shape we are going to delete
+void LORESModel::DistributePoint(const Point3D& point, size_t i)
+{
+  for (size_t k = i; k < shapes_.size(); ++k) {
+    assert(shapes_[k]->shape != NULL);
+    if (shapes_[k]->shape->IsInside(point)) {
+      shapes_[k]->points.push_back(point);
+      return;
+    }
+  }
+}
+
+void LORESModel::FillPoints(RealSpaceShape* real_shape, double sld)
+{
+  assert(real_shape != NULL);
+
+  GeoShape* shape = real_shape->shape;
+  assert(shape != NULL);
+
+  int npoints = static_cast<int>(density_ * shape->GetVolume());
+
+  for (int i = 0; i < npoints; ++i){
+    Point3D apoint = shape->GetAPoint(sld);
+    apoint.Transform(shape->GetOrientation(),shape->GetCenter());
+    if (!IsInside(apoint)){
+      real_shape->points.push_back(apoint);
+    }
+  }
+
+}
+
+bool LORESModel::IsInside(const Point3D& point)
+{
+  for (RealSpaceShapeCollection::const_iterator it = shapes_.begin();
+       it != shapes_.end(); ++it) {
+    const GeoShape* shape = (*it)->shape;
+    assert(shape != NULL);
+
+    if (shape->IsInside(point)) {
+       return true;
+    }
+  }
+
+  return false;
+}
+
+vector<double> LORESModel::GetCenter()
+{
+  //get the vector of centers from the list of shapes
+  size_t numshapes = 0;
+  double sumx = 0, sumy = 0, sumz = 0;
+  for (size_t m = 0; m < shapes_.size(); ++m){
+    assert(shapes_[m]->shape != NULL);
+    vector<double> center(3);
+    center = shapes_[m]->shape->GetCenter();
+
+    sumx += center[0];
+    sumy += center[1];
+    sumz += center[2];
+
+    ++numshapes;
+  }
+
+  vector<double> shapescenter(3);
+  shapescenter[0]= sumx/numshapes;
+  shapescenter[1]= sumy/numshapes;
+  shapescenter[2]= sumz/numshapes;
+
+  center_ = shapescenter;
+  return center_;
+}
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.h
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/lores_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,73 @@
+/** \file lores_model.h child class of PointsModel*/
+
+#ifndef LORESMODEL_H
+#define LORESMODEL_H
+
+#include <deque>
+#include "points_model.h"
+#include "geo_shape.h"
+//temporary
+#include <fstream>
+
+/**
+ *  Class LORESModel, low resolution models
+ */
+
+class LORESModel : public PointsModel {
+ private:
+  typedef vector<Point3D> PointsVector;
+
+  struct RealSpaceShape {
+    GeoShape* shape;
+    PointsVector points;
+
+    RealSpaceShape(GeoShape* s = NULL) : shape(s) {
+    }
+
+    ~RealSpaceShape() {
+      if (shape) delete shape;
+    }
+  };
+
+  typedef deque<RealSpaceShape*> RealSpaceShapeCollection;
+
+ public:
+  LORESModel(double density = 1.0);
+  ~LORESModel();
+
+  // Change density
+  void SetDensity(double density);
+  double GetDensity();
+
+  // Add new shape
+  void Add(GeoShape& geo_shape, double sld = 1);
+
+  // Delete ith shape at shapes_
+  void Delete(size_t i);
+
+  int GetPoints(Point3DVector &);
+  //Write points to a file, mainly for testing right now
+  void WritePoints2File(Point3DVector &);
+
+  //get the maximum possible dimension
+  double GetDimBound();
+
+  //will be used in determining the maximum distance for
+  //P(r) calculation for a complex model (merge several 
+  //pointsmodel instance together
+  vector<double> GetCenter();
+
+ protected:
+  GeoShape* GetGeoShape(GeoShape& geo_shape);
+  void FillPoints(RealSpaceShape* real_shape, double sld);
+  bool IsInside(const Point3D& point);
+  void DistributePoint(const Point3D& point, size_t i);
+
+ private:
+  RealSpaceShapeCollection shapes_;
+  int npoints_;
+  double density_;
+  
+};
+
+#endif
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,123 @@
+/** \file pdb_model.cc */
+
+#include "pdb_model.h"
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include <cmath>
+#include <stdexcept>
+
+using namespace std;
+
+typedef map<string,double>::const_iterator mymapitr;
+
+PDBModel::PDBModel(){
+  res_sld_["ALA"] = 1.645;  res_sld_["ARG"] = 3.466;
+  res_sld_["ASN"] = 3.456;  res_sld_["ASP"] = 3.845;
+  res_sld_["CYS"] = 1.930;  res_sld_["GLU"] = 3.762;
+  res_sld_["GLN"] = 3.373;  res_sld_["GLY"] = 1.728;
+  res_sld_["HIS"] = 4.959;  res_sld_["LLE"] = 1.396;
+  res_sld_["LEU"] = 1.396;  res_sld_["LYS"] = 1.586;
+  res_sld_["MET"] = 1.763;  res_sld_["PHE"] = 4.139;
+  res_sld_["PRO"] = 2.227;  res_sld_["SER"] = 2.225;
+  res_sld_["THR"] = 2.142;  res_sld_["TRP"] = 6.035;
+  res_sld_["TYR"] = 4.719;  res_sld_["VAL"] = 1.479;
+
+  x_max_ = -10000; x_min_ = 10000;
+  y_max_ = -10000; y_min_ = 10000;
+  z_max_ = -10000; z_min_ = 10000;
+}
+
+void PDBModel::AddPDB(const string &pdbfile)
+{
+  pdbnames_.push_back(pdbfile);
+}
+
+void PDBModel::AddPDB(const char* pdbfile)
+{
+  string sname(pdbfile);
+  pdbnames_.push_back(sname);
+}
+
+int PDBModel::GetPoints(Point3DVector &vp)
+{
+  if (vp.size() != 0){
+    throw runtime_error("PDBModel::GetPoints(Point3DVector &VP):VP has to be empty"); 
+  }
+  vector<string>::iterator itr;
+  for (itr = pdbnames_.begin(); itr!=pdbnames_.end(); ++itr){
+    ifstream infile(itr->c_str());
+    if (!infile){
+      cerr << "error: unable to open input file: " 
+	   << infile << endl;
+    }
+    string line;
+    while (getline(infile,line)){
+      size_t len = line.size();
+      string header;
+      
+      //for a line with size >=4, retrieve the header
+      //if the header == "ATOM""
+      //make sure the length of the line >=54, then
+      //retrieve the corresponding coordinates,convert str to double
+      //then assign them to a point3d,which will be append to vp with a SLD
+      if (len >= 4){
+	for (size_t i=0; i !=4; ++i) header += line[i];
+	if (header.compare("ATOM") == 0 && len >53){
+	  string strx,stry,strz;
+	  double x = 0, y = 0, z = 0;
+	  for (size_t j = 30; j!=38; ++j){
+	    strx += line[j];
+	    stry += line[j+8];
+	    strz += line[j+16];
+	  }
+	  x = atof(strx.c_str());
+	  y = atof(stry.c_str());
+	  z = atof(strz.c_str());
+	  
+	  //find residue type, and assign SLD
+	  string resname;
+	  for (size_t k = 17; k!=20; ++k) resname +=line[k];
+	  mymapitr itr = res_sld_.find("ALA");
+	  
+	  //apoint(x,y,z,sld)
+	  Point3D apoint(x,y,z,itr->second);
+	  vp.push_back(apoint);
+	  
+	  //save x y z' max & min to calculate the size boundary
+	  x_max_ = x > x_max_ ? x : x_max_;
+	  x_min_ = x < x_min_ ? x : x_min_;
+	  y_max_ = y > y_max_ ? y : y_max_;
+	  y_min_ = y < y_min_ ? y : y_min_;
+	  z_max_ = z > z_max_ ? z : z_max_;
+	  z_min_ = z < z_min_ ? z : z_min_;
+	}
+      }
+    }
+
+    infile.close();
+  }
+  return vp.size();
+}
+
+double PDBModel::GetDimBound()
+{
+  if (pdbnames_.size() == 0 )
+    return 0;
+
+  //cout <<x_max_<<" "<<x_min_<<" "<<y_max_<<" "<<y_min_<<" "<<z_max_<<" "<<z_min_<<endl;
+  double size = sqrt((x_max_-x_min_)*(x_max_-x_min_)+(y_max_-y_min_)*(y_max_-y_min_)+(z_max_-z_min_)*(z_max_-z_min_));
+  return size;
+}
+
+vector<double> PDBModel::GetCenter()
+{
+
+  vector<double> cen(3);
+  cen[0]= (x_max_+x_min_)/2;
+  cen[1]= (y_max_+y_min_)/2;
+  cen[2]= (z_max_+z_min_)/2;
+  center_ = cen;
+
+  return center_;
+}
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.h
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/pdb_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,43 @@
+/** \file pdb_model.h child class of PointsModel */
+
+#ifndef PDB_MODEL_H
+#define PDB_MODEL_H
+
+#include "points_model.h"
+#include <string>
+#include <map>
+
+/**
+ *  Class PDBModel, PDB models
+ */
+
+class PDBModel : public PointsModel {
+ public:
+  PDBModel();
+  
+  //add pdb file
+  void AddPDB(const string &);
+  void AddPDB(const char*);
+
+  //Parse all coordinates from ATOM section 
+  //of the PDB file into vector of points
+  int GetPoints(Point3DVector &);
+
+  //will be used in determining the maximum distance for
+  //P(r) calculation for a complex model (merge several 
+  //pointsmodel instance together
+  vector<double> GetCenter();
+
+  //get the maximum possible dimension= dist between XYZmax XYZmin
+  //May improve to directly get the dimension from unit cell
+  //if the technique is crystallography
+  double GetDimBound();
+
+ private:
+  vector<string> pdbnames_;
+  map<string,double> res_sld_;
+  double x_max_,x_min_,y_max_,y_min_,z_max_,z_min_;
+};
+
+#endif
+
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,376 @@
+/** \file points_model.cc */
+
+#include <vector>
+#include <algorithm>
+#include <fstream>
+#include <stdio.h>
+//#include <exception>
+#include <stdexcept>
+#include "points_model.h"
+#include "Point3D.h"
+
+PointsModel::PointsModel()
+{
+  r_grids_num_ = 2000;
+  rmax_ = 0;
+  cormax_ = 0;
+  rstep_ = 0;
+}
+
+void PointsModel::CalculateIQ(IQ *iq)
+{
+  //fourier transform of the returned Array2D<double> from ddFunction()
+  int nIpoints = iq->GetNumI();
+  double qstep = (iq->GetQmax()) / (nIpoints-1);
+  vector<double> fint(nIpoints, 0);
+
+  //I(0) is calculated seperately
+  int num_rstep = pr_.dim1();
+
+  for (int k = 1; k<nIpoints; k++){
+
+    double q = k * qstep;
+
+    double r =0;
+    double debeye = 0;
+    double fadd =0;
+
+
+    for (int i = 1; i < num_rstep; ++i){
+      r = i*rstep_;  //r should start from 1* rstep
+      double qr = q*r;
+      debeye = sin(qr)/qr;
+      fadd = pr_[i][1]*debeye;
+      fint[k] = fint[k] + fadd;
+    }
+  }
+
+  //I(0)
+  double Izero = 0;
+  for (int i = 0; i < num_rstep; ++i)
+    Izero += pr_[i][1];
+  fint[0] = Izero;
+
+  //assign I(Q) with normalization
+  for(int j = 0; j < nIpoints; ++j){
+    (*iq).iq_data[j][0] = j * qstep;
+    (*iq).iq_data[j][1] = fint[j];
+    // remove normalization Izero;
+  }
+}
+
+//return I with a single q value
+double PointsModel::CalculateIQ(double q)
+{
+  //fourier transform of the returned Array2D<double> from ddFunction()
+  int num_rstep = pr_.dim1();
+
+  double r =0;
+  double debeye = 0;
+  double fadd = 0;
+  double Irelative = 0;
+
+  //I(0) is calculated seperately
+  if (q == 0){
+    //I(0)
+    double Izero = 0;
+    for (int i = 0; i < num_rstep; ++i)
+      Izero += pr_[i][1];
+    Irelative = Izero;
+  }
+  else {
+    for (int i = 1; i < num_rstep; ++i){
+      r = i*rstep_;  //r should start from 1* rstep
+      double qr = q*r;
+      debeye = sin(qr)/qr;
+      fadd = pr_[i][1]*debeye;
+      Irelative = Irelative + fadd;
+    }
+  }
+  return Irelative;
+}
+
+double PointsModel::CalculateIQError(double q)
+{
+  //fourier transform of the returned Array2D<double> from ddFunction()
+  int num_rstep = pr_.dim1();
+
+  double r =0;
+  double debeye = 0;
+  double fadd = 0;
+  double Irelative = 0;
+
+  //I(0) is calculated seperately
+  for (int i = 1; i < num_rstep; ++i){
+	  r = i*rstep_;  //r should start from 1* rstep
+	  double qr = q*r;
+	  debeye = sin(qr)/qr;
+	  fadd = fabs(pr_[i][2])*debeye*debeye 
+	  	+ rstep_*rstep_/4.0/r/r*(cos(qr)*cos(qr) + debeye*debeye);
+	  Irelative = Irelative + fadd;
+  }
+  return sqrt(Irelative);
+}
+
+//pass in a vector of points, and calculate the P(r)
+double PointsModel::DistDistribution(const vector<Point3D> &vp)
+{
+  //get r axis:0,rstep,2rstep,3rstep......d_bound
+  int sizeofpr = r_grids_num_ + 1; //+1 just for overflow prevention
+
+  double d_bound = GetDimBound();
+  rstep_ = CalculateRstep(r_grids_num_,d_bound);
+
+  Array2D<double> pr(sizeofpr, 3); //third column is left for error for the future
+  pr = 0;
+
+  for (int i = 1; i != sizeofpr; ++i)
+    pr[i][0] = pr[i-1][0] + rstep_ ;  //column 1:  distance
+
+  int size = vp.size();
+
+  for (int i1 = 0; i1 < size - 1; ++i1) {
+    for (int i2 = i1 + 1; i2 < size; ++i2) {
+      //dist_.push_back(vp[i1].distanceToPoint(vp[i2]));
+      //product_sld_.push_back(vp[i1].getSLD() * vp[i2].getSLD());
+      double a_dist = vp[i1].distanceToPoint(vp[i2]);
+      double its_sld = vp[i1].getSLD() * vp[i2].getSLD();
+
+      //save maximum distance
+      if (a_dist>rmax_) {
+        rmax_ = a_dist;
+      }
+      //insert into pr array
+      int l = int(floor(a_dist/rstep_));
+
+      //cout << "i1,i2,l,a_dist"<<vp[i1]<<" "<<vp[i2]<<" "<<l<<" "<<a_dist<<endl;     
+      //overflow check
+      if (l >= sizeofpr) {
+        cerr << "one distance is out of range: " << l <<endl;
+        //throw "Out of range";
+      }
+      else {
+        pr[l][1] += its_sld;  //column 2 intermediate: sum of SLD of the points with specific distance     
+        // Estimate uncertainty (squared)
+        pr[l][2] += its_sld*its_sld; 
+        //keep maxium Pr absolute number, in order to normalize
+        //if (pr[l][1] > cormax_)	  cormax_ = pr[l][1];
+      }
+    }
+  }
+
+  //normalize Pr
+  for (int j = 0; j != sizeofpr; ++j){           //final column2 for P(r)
+    //pr[j][1] = pr[j][1]/cormax_;
+
+    // 'Size' is the number of space points, without double counting (excluding 
+    // overlapping regions between shapes). The volume of the combined shape
+    // is given by  V = size * (sum of all sub-volumes) / (Total number of points) 
+    //              V = size / (lores_density)
+    
+    // - To transform the integral to a sum, we need to give a weight
+    // to each entry equal to the average space volume of a point (w = V/N = 1/lores_density).
+    // The final output, I(q), should therefore be multiplied by V*V/N*N.
+    // Since we will be interested in P(r)/V, we only need to multiply by 1/N*(V/N) = 1/N/lores_density.
+    // We don't have access to lores_density from this class; we will therefore apply
+    // this correction externally.
+    //
+    // - Since the loop goes through half the points, multiply by 2.
+    // TODO: have access to lores_density from this class.
+    // 
+    pr[j][1] = 2.0*pr[j][1]/size;
+    pr[j][2] = 4.0*pr[j][2]/size/size;
+  }
+  pr_ = pr;
+
+  return rmax_;
+}
+
+Array2D<double> PointsModel::GetPr()
+{
+  return pr_;
+}
+
+
+double PointsModel::CalculateRstep(int num_grids, double rmax)
+{
+  assert(num_grids > 0);
+
+  double rstep;
+  rstep = rmax / num_grids;
+
+  return rstep;
+}
+
+void PointsModel::OutputPR(const string &fpr){
+  ofstream outfile(fpr.c_str());
+  if (!outfile) {
+    cerr << "error: unable to open output file: "
+	 << outfile << endl;
+    exit(1);
+  }
+  for (int i = 0;  i < pr_.dim1(); ++i){
+    outfile << pr_[i][0] << "       " << pr_[i][1] << endl;
+  }
+}
+
+void PointsModel::OutputPDB(const vector<Point3D> &vp,const char *fpr){
+  FILE *outfile=NULL;
+  outfile = fopen(fpr,"w+");
+  if (!outfile) {
+    cerr << "error: unable to open output file: "
+	 << outfile << endl;
+    exit(1);
+  }
+  int size = vp.size();
+  int index = 0;
+  for (int i = 0;  i < size; ++i){
+    ++index;
+    fprintf(outfile,"ATOM%7d  C%24.3lf%8.3lf%8.3lf%6.3lf\n", \
+           index,vp[i].getX(),vp[i].getY(),vp[i].getZ(),vp[i].getSLD());
+  }
+  fclose(outfile);
+}
+
+PointsModel::~PointsModel()
+{
+}
+
+void PointsModel::DistDistributionXY(const vector<Point3D> &vp)
+{
+  //the max box get from 3D should be more than enough for 2D,but doesn't hurt
+  double d_bound = GetDimBound();
+
+  //using 1A for rstep, so the total bins is the max distance for the object
+  int sizeofpr = ceil(d_bound) + 1; //+1 just for overflow prevention
+  rstep_ = 1;
+
+  Array2D<double> pr_xy(sizeofpr,sizeofpr); //2D histogram
+
+  //the max frequency in the correlation histogram
+  double cormax_xy_ = 0;
+
+  //initialization
+  pr_xy = 0;
+
+  for (int i = 1; i != sizeofpr; ++i){
+    pr_xy[i][0] = pr_xy[i-1][0] + rstep_ ;  //column 1:  distance
+  }
+
+  int size = vp.size();
+
+  for (int i1 = 0; i1 < size - 1; ++i1) {
+    for (int i2 = i1 + 1; i2 < size; ++i2) {
+      int jx = int(floor(fabs(vp[i1].getX()-vp[i2].getX())/rstep_));
+      int jy = int(floor(fabs(vp[i1].getY()-vp[i2].getY())/rstep_));
+      //the sld for the pair of points
+      double its_sld = vp[i1].getSLD()*vp[i2].getSLD();
+
+      //overflow check
+      if ((jx >= sizeofpr) || (jy >= sizeofpr))
+      {
+        cerr << "one distance is out of range: " <<endl;
+        //throw "Out of range";
+      }
+      else{
+	pr_xy[jx][jy] += its_sld;
+        if (pr_xy[jx][jy] > cormax_xy_ ) cormax_xy_ = pr_xy[jx][jy];
+      }
+    }
+  }
+
+  //normalize Pr_xy
+  for (int m = 0; m != sizeofpr; ++m){           //final column2 for P(r)
+    for (int n = 0; n != sizeofpr; ++n){
+      pr_xy[m][n] = pr_xy[m][n]/cormax_xy_;
+      //cout << "m n:"<<m<<" "<<n<<" "<<pr_xy[m][n]<<endl;
+    }
+  }
+
+  pr_xy_ = pr_xy;
+}
+
+void PointsModel::OutputPR_XY(const std::string &fpr)
+{
+  ofstream outfile(fpr.c_str());
+  if (!outfile) {
+    cerr << "error: unable to open output file: "
+	 << outfile << endl;
+    exit(1);
+  }
+  int size = pr_xy_.dim1();
+  //pr_xy_ is a N x N array
+  for (int i = 0;  i != size; ++i){
+    for (int j = 0; j != size; ++j)
+    {
+      outfile << i << "    " << j <<"    "<< pr_xy_[i][j] << endl;
+    }
+  }
+}
+
+void PointsModel::CalculateIQ_2D(IQ *iq,double phi)
+{
+  int nIpoints = iq->GetNumI();
+  double qstep = (iq->GetQmax()) / (nIpoints-1);
+  vector<double> fint(nIpoints, 0);
+  double Izero = 0;
+
+  //number of bins on x and y axis
+  int size_r = pr_xy_.dim1();
+  //rstep is set to one, otherwise should be cos(phi)*rstep
+  double cosphi = cos(phi);
+  double sinphi = sin(phi);
+
+  for(int k = 1; k != nIpoints; ++k){
+    double q = k * qstep;
+    double tmp = cos(q*(cosphi+sinphi));
+
+    for(int i=0; i!=size_r; ++i){
+      for(int j = 0; j!=size_r; ++j){
+        fint[k] += pr_xy_[i][j]*tmp;
+      }
+    }
+  }
+
+  for(int i=0; i!=size_r; ++i){
+    for(int j = 0; j!=size_r; ++j){
+      Izero += pr_xy_[i][j];
+    }
+  }
+  fint[0] = Izero;
+
+  //assign I(Q) with normalization
+  for(int j = 0; j < nIpoints; ++j){
+    (*iq).iq_data[j][0] = j * qstep;
+    (*iq).iq_data[j][1] = fint[j] / Izero;
+  }
+}
+
+vector<double> PointsModel::GetCenter()
+{
+  vector<double> vp(3,0);
+  return vp;
+}
+
+double PointsModel::CalculateIQ_2D(double qx, double qy)
+{
+  //for each (Qx,Qy) on 2D detector, calculate I
+  double q = sqrt(qx*qx+qy*qy);
+  double I = 0;
+
+  double cosphi = qx/q;
+  double sinphi = qy/q;
+  double tmp = cos(q*(cosphi+sinphi));
+
+  //loop through P(r) on xy plane
+  int size_r = pr_xy_.dim1();
+  for(int i=-size_r+1; i!=size_r; ++i){
+    for(int j = -size_r+1; j!=size_r; ++j){
+      //rstep is set to one, left out from calculation
+      I += pr_xy_[abs(i)][abs(j)]*cos(q*(cosphi*i+sinphi*j));
+    }
+  }
+
+  //return I, without normalization
+  return I;
+}
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,55 @@
+/** \file points_model.h child class of SANSmodel*/
+
+#ifndef POINTSMODEL_H
+#define POINTSMODEL_H
+
+#include <vector>
+#include "tnt/tnt.h"
+#include <string>
+#include "Point3D.h"
+#include "iq.h"
+#include "sans_model.h"
+
+using namespace std;
+
+class PointsModel : public SANSModel{
+ public:
+  PointsModel();
+  virtual ~PointsModel();
+
+  void CalculateIQ(IQ *iq);
+  double CalculateIQ(double q);
+  double CalculateIQError(double q);
+  void CalculateIQ_2D(IQ *iq,double phi);
+  double CalculateIQ_2D(double qx, double qy);
+  
+  //given a set of points, calculate distance correlation
+  //function, and return the max dist
+  double DistDistribution(const vector<Point3D>&);
+  void DistDistributionXY(const vector<Point3D>&);
+
+  Array2D<double> GetPr();
+  void OutputPR(const std::string &);
+  void OutputPR_XY(const std::string &);
+
+  virtual int GetPoints(Point3DVector &) = 0;
+  void OutputPDB(const vector<Point3D>&,const char*);
+
+  //will be used in calculating P(r), the maximum distance
+  virtual double GetDimBound() = 0;
+  //will be used to determin the maximum distance for
+  //several pointsmodel instances
+  virtual vector<double> GetCenter();
+
+ protected:
+  double CalculateRstep(int num_points, double rmax);
+  double rmax_, rstep_,cormax_,cormax_xy_;
+  int r_grids_num_;
+  vector<double> center_;
+
+ private:
+  Array2D<double> pr_,pr_xy_;
+  vector<double> product_sld_;
+};
+
+#endif
Index: realSpaceModeling/pointsmodelpy/pointsmodelpy/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpy/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = pointsmodelpy
+PACKAGE = pointsmodelpy
+
+#--------------------------------------------------------------------------
+#
+
+all: export
+
+
+#--------------------------------------------------------------------------
+#
+# export
+
+EXPORT_PYTHON_MODULES = \
+    __init__.py
+
+
+export:: export-python-modules
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpy/__init__.py
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpy/__init__.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+def copyright():
+    return "pointsmodelpy pyre module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
+
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+PROJECT = SANSsimulation
+PACKAGE = pointsmodelpymodule
+MODULE = pointsmodelpy
+
+include std-pythonmodule.def
+include local.def
+
+PROJ_CXX_SRCLIB = -lpointsmodelpy -lgeoshapespy -liqPy
+
+PROJ_SRCS = \
+    bindings.cc \
+    exceptions.cc \
+    misc.cc
+
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+// @copyright: University of Tennessee, for the DANSE project
+
+//#include <portinfo>
+#include <Python.h>
+
+#include "bindings.h"
+
+#include "misc.h"          // miscellaneous methods
+
+// the method table
+
+struct PyMethodDef pypointsmodelpy_methods[] = {
+
+    // new_loresmodel
+    {pypointsmodelpy_new_loresmodel__name__, pypointsmodelpy_new_loresmodel,
+     METH_VARARGS, pypointsmodelpy_new_loresmodel__doc__},
+
+    // LORESModel method:add(geoshape,sld)
+    {pypointsmodelpy_lores_add__name__, pypointsmodelpy_lores_add,
+     METH_VARARGS, pypointsmodelpy_lores_add__doc__},
+
+    // LORESModel method:GetPoints(vector<Point3D> &)
+    {pypointsmodelpy_get_lorespoints__name__, pypointsmodelpy_get_lorespoints,
+     METH_VARARGS, pypointsmodelpy_get_lorespoints__doc__},
+
+    // new_pdbmodel
+    {pypointsmodelpy_new_pdbmodel__name__, pypointsmodelpy_new_pdbmodel,
+     METH_VARARGS, pypointsmodelpy_new_pdbmodel__doc__},
+
+    // PDBModel method: AddPDB(const char*)
+    {pypointsmodelpy_pdbmodel_add__name__, pypointsmodelpy_pdbmodel_add,
+     METH_VARARGS, pypointsmodelpy_pdbmodel_add__doc__},
+
+    // PDBModel method: GetPoints(Point3DVector &)
+    {pypointsmodelpy_get_pdbpoints__name__, pypointsmodelpy_get_pdbpoints,
+     METH_VARARGS, pypointsmodelpy_get_pdbpoints__doc__},
+
+    // new_complexmodel
+    {pypointsmodelpy_new_complexmodel__name__, pypointsmodelpy_new_complexmodel,
+     METH_VARARGS, pypointsmodelpy_new_complexmodel__doc__},
+
+    // ComplexModel method: Add(PointsModel *)
+    {pypointsmodelpy_complexmodel_add__name__, pypointsmodelpy_complexmodel_add,
+     METH_VARARGS, pypointsmodelpy_complexmodel_add__doc__},
+
+    // ComplexModel method: GetPoints(Point3DVector &)
+    {pypointsmodelpy_get_complexpoints__name__, pypointsmodelpy_get_complexpoints,
+     METH_VARARGS, pypointsmodelpy_get_complexpoints__doc__},
+
+    //new_point3dvec
+    {pypointsmodelpy_new_point3dvec__name__, pypointsmodelpy_new_point3dvec,
+     METH_VARARGS, pypointsmodelpy_new_point3dvec__doc__},
+
+    //fillpoints
+    //{pypointsmodelpy_fillpoints__name__, pypointsmodelpy_fillpoints,
+    //METH_VARARGS, pypointsmodelpy_fillpoints__doc__},
+
+    //distdistribution calculation for LORES model
+    {pypointsmodelpy_get_lores_pr__name__, pypointsmodelpy_get_lores_pr,
+     METH_VARARGS, pypointsmodelpy_get_lores_pr__doc__},
+
+    //distdistribution 2D (on xy plane)
+    {pypointsmodelpy_distdistribution_xy__name__, pypointsmodelpy_distdistribution_xy,
+     METH_VARARGS, pypointsmodelpy_distdistribution_xy__doc__},
+
+    //distdistribution calculation for PDB model
+    {pypointsmodelpy_get_pdb_pr__name__, pypointsmodelpy_get_pdb_pr,
+     METH_VARARGS, pypointsmodelpy_get_pdb_pr__doc__},
+
+    //distdistribution calculation on XY plane for PDB model
+    {pypointsmodelpy_get_pdb_pr_xy__name__, pypointsmodelpy_get_pdb_pr_xy,
+     METH_VARARGS, pypointsmodelpy_get_pdb_pr_xy__doc__},
+
+    //distdistribution calculation for Complex model
+    {pypointsmodelpy_get_complex_pr__name__, pypointsmodelpy_get_complex_pr,
+     METH_VARARGS, pypointsmodelpy_get_complex_pr__doc__},
+
+    //calculateIQ
+    {pypointsmodelpy_get_lores_iq__name__, pypointsmodelpy_get_lores_iq,
+     METH_VARARGS, pypointsmodelpy_get_lores_iq__doc__},
+
+    //calculateI(single Q)
+    {pypointsmodelpy_get_lores_i__name__, pypointsmodelpy_get_lores_i,
+     METH_VARARGS, pypointsmodelpy_get_lores_i__doc__},
+
+    //calculateI(single Q)
+    {pypointsmodelpy_get_complex_i__name__, pypointsmodelpy_get_complex_i,
+     METH_VARARGS, pypointsmodelpy_get_complex_i__doc__},
+
+    //calculateI(single Q)
+    {pypointsmodelpy_get_complex_i_error__name__, pypointsmodelpy_get_complex_i_error,
+     METH_VARARGS, pypointsmodelpy_get_complex_i_error__doc__},
+
+    //calculateIQ 2D
+    {pypointsmodelpy_calculateIQ_2D__name__, pypointsmodelpy_calculateIQ_2D,
+     METH_VARARGS, pypointsmodelpy_calculateIQ_2D__doc__},
+
+    //calculateIQ 2D(Qx,Qy)
+    {pypointsmodelpy_calculateI_Qxy__name__, pypointsmodelpy_calculateI_Qxy,
+     METH_VARARGS, pypointsmodelpy_calculateI_Qxy__doc__},
+
+    //PDBModel calculateIQ
+    {pypointsmodelpy_get_pdb_iq__name__, pypointsmodelpy_get_pdb_iq,
+     METH_VARARGS, pypointsmodelpy_get_pdb_iq__doc__},
+
+    //PDBModel calculateIQ(Qx,Qy)
+    {pypointsmodelpy_get_pdb_Iqxy__name__, pypointsmodelpy_get_pdb_Iqxy,
+     METH_VARARGS, pypointsmodelpy_get_pdb_Iqxy__doc__},
+
+    //ComplexModel calculateIQ
+    {pypointsmodelpy_get_complex_iq__name__, pypointsmodelpy_get_complex_iq,
+     METH_VARARGS, pypointsmodelpy_get_complex_iq__doc__},
+
+    //outputPR
+    {pypointsmodelpy_outputPR__name__, pypointsmodelpy_outputPR,
+     METH_VARARGS, pypointsmodelpy_outputPR__doc__},
+
+    //outputPR_xy
+    {pypointsmodelpy_outputPR_xy__name__, pypointsmodelpy_outputPR_xy,
+     METH_VARARGS, pypointsmodelpy_outputPR_xy__doc__},
+
+    //PDBModel outputPR
+    {pypointsmodelpy_save_pdb_pr__name__, pypointsmodelpy_save_pdb_pr,
+     METH_VARARGS, pypointsmodelpy_save_pdb_pr__doc__},
+
+    //ComplexModel outputPR
+    {pypointsmodelpy_save_complex_pr__name__, pypointsmodelpy_save_complex_pr,
+     METH_VARARGS, pypointsmodelpy_save_complex_pr__doc__},
+
+    //outputPDB
+    {pypointsmodelpy_outputPDB__name__, pypointsmodelpy_outputPDB,
+     METH_VARARGS, pypointsmodelpy_outputPDB__doc__},
+
+    {pypointsmodelpy_copyright__name__, pypointsmodelpy_copyright,
+     METH_VARARGS, pypointsmodelpy_copyright__doc__},
+
+
+// Sentinel
+    {0, 0}
+};
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.h
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pypointsmodelpy_bindings_h)
+#define pypointsmodelpy_bindings_h
+
+// the method table
+
+extern struct PyMethodDef pypointsmodelpy_methods[];
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+#include <Python.h>
+
+PyObject *pypointsmodelpy_runtimeError = 0;
+    
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.h
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/exceptions.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+#if !defined(pypointsmodelpy_exceptions_h)
+#define pypointsmodelpy_exceptions_h
+
+// exceptions
+
+extern PyObject *pypointsmodelpy_runtimeError;
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/local.def
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/local.def	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,26 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+# C++
+
+    PROJ_CXX_INCLUDES = ..   \
+			../libpointsmodelpy   \
+			../../analmodelpy/libanalmodelpy  \
+			../../geoshapespy/libgeoshapespy  \
+			../../iqPy/libiqPy  \
+			../../iqPy/libiqPy/tnt  
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,639 @@
+// -*- C++ -*-
+#include <Python.h>
+
+#include <vector>
+#include <cstring>
+#include <stdexcept>
+#include "Point3D.h"
+#include "misc.h"
+#include "lores_model.h"
+#include "pdb_model.h"
+#include "complex_model.h"
+#include "geo_shape.h"
+#include "iq.h"
+
+// copyright
+
+char pypointsmodelpy_copyright__doc__[] = "";
+char pypointsmodelpy_copyright__name__[] = "copyright";
+
+static char pypointsmodelpy_copyright_note[] = 
+    "pointsmodelpy python module: Copyright (c) 2007 University of Tennessee";
+
+
+PyObject * pypointsmodelpy_copyright(PyObject *, PyObject *)
+{
+    return Py_BuildValue("s", pypointsmodelpy_copyright_note);
+}
+    
+// new_loresmodel 
+//wrapper for LORESModel constructor LORESModel(double density)
+
+char pypointsmodelpy_new_loresmodel__doc__[] = "Low-resolution shapes:real space geometric complex models";
+char pypointsmodelpy_new_loresmodel__name__[] = "new_loresmodel";
+
+PyObject * pypointsmodelpy_new_loresmodel(PyObject *, PyObject *args)
+{
+  double density = 0;
+
+  int ok = PyArg_ParseTuple(args, "d",&density);
+  if(!ok) return NULL;
+
+  LORESModel *newlores = new LORESModel(density);
+  return PyCObject_FromVoidPtr(newlores, PyDelLores);
+}
+    
+void PyDelLores(void *ptr){
+  LORESModel * oldlores = static_cast<LORESModel *>(ptr);
+  delete oldlores;
+  return;
+}
+
+//LORESModel methods add(GeoShape &, double sld)
+char pypointsmodelpy_lores_add__name__[] = "lores_add";
+char pypointsmodelpy_lores_add__doc__[] = "loresmodel method:add(Geoshape &,sld)";
+
+PyObject * pypointsmodelpy_lores_add(PyObject *, PyObject *args){
+  double sld = 1;
+  PyObject *pyloresmodel = 0, *pyshape = 0;
+  int ok = PyArg_ParseTuple(args, "OOd", &pyloresmodel, &pyshape, &sld);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
+  void *temp2 = PyCObject_AsVoidPtr(pyshape);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  GeoShape * thisshape = static_cast<GeoShape *>(temp2);
+
+  thislores->Add(*thisshape, sld);
+
+  return Py_BuildValue("i", 0);
+}
+
+//LORESModel methods GetPoints(vector<Point3D> &)
+char pypointsmodelpy_get_lorespoints__name__[] = "get_lorespoints";
+char pypointsmodelpy_get_lorespoints__doc__[] = "get the points from the lores model";
+
+PyObject * pypointsmodelpy_get_lorespoints(PyObject *, PyObject *args){
+  PyObject *pyloresmodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pyloresmodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  int npts = thislores->GetPoints(*thisvec);
+  //temporary
+  thislores->WritePoints2File(*thisvec);
+  return Py_BuildValue("i", npts);
+}
+
+// new_pdbmodel 
+//wrapper for PDBModel constructor PDBModel()
+
+char pypointsmodelpy_new_pdbmodel__doc__[] = "PDB model: contain atomic coordinate from PDB file & Scattering length density";
+char pypointsmodelpy_new_pdbmodel__name__[] = "new_pdbmodel";
+
+PyObject * pypointsmodelpy_new_pdbmodel(PyObject *, PyObject *args)
+{
+  PDBModel *newpdb = new PDBModel();
+  return PyCObject_FromVoidPtr(newpdb, PyDelPDB);
+}
+    
+void PyDelPDB(void *ptr){
+  PDBModel * oldpdb = static_cast<PDBModel *>(ptr);
+  delete oldpdb;
+  return;
+}
+
+//PDBModel methods AddPDB(char * pdbfile) 
+char pypointsmodelpy_pdbmodel_add__name__[] = "pdbmodel_add";
+char pypointsmodelpy_pdbmodel_add__doc__[] = "Add a structure from PDB";
+
+PyObject * pypointsmodelpy_pdbmodel_add(PyObject *, PyObject *args){
+  PyObject *pypdbmodel = 0;
+  char * pdbfile;
+
+  int ok = PyArg_ParseTuple(args, "Os", &pypdbmodel, &pdbfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pypdbmodel);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+
+  thispdb->AddPDB(pdbfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+//PDBModel methods GetPoints(Point3DVector &) 
+char pypointsmodelpy_get_pdbpoints__name__[] = "get_pdbpoints";
+char pypointsmodelpy_get_pdbpoints__doc__[] = "Get atomic points from pdb with SLD";
+
+PyObject * pypointsmodelpy_get_pdbpoints(PyObject *, PyObject *args){
+  PyObject *pypdbmodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pypdbmodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pypdbmodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  int npts = thispdb->GetPoints(*thisvec);
+
+  return Py_BuildValue("i", npts);
+}
+
+// new_complexmodel 
+//wrapper for ComplexModel constructor ComplexModel()
+
+char pypointsmodelpy_new_complexmodel__doc__[] = "COMPLEX model: contain LORES and PDB models";
+char pypointsmodelpy_new_complexmodel__name__[] = "new_complexmodel";
+
+PyObject * pypointsmodelpy_new_complexmodel(PyObject *, PyObject *args)
+{
+  ComplexModel *newcomplex = new ComplexModel();
+  return PyCObject_FromVoidPtr(newcomplex, PyDelComplex);
+}
+    
+void PyDelComplex(void *ptr){
+  ComplexModel * oldcomplex = static_cast<ComplexModel *>(ptr);
+  delete oldcomplex;
+  return;
+}
+
+//ComplexModel methods Add(PointsModel *) 
+char pypointsmodelpy_complexmodel_add__name__[] = "complexmodel_add";
+char pypointsmodelpy_complexmodel_add__doc__[] = "Add LORES model or PDB Model,type has to be specified (either PDB or LORES)";
+
+PyObject * pypointsmodelpy_complexmodel_add(PyObject *, PyObject *args){
+  PyObject *pycomplexmodel = 0, *pymodel = 0;
+  char * modeltype;
+
+  int ok = PyArg_ParseTuple(args, "OOs", &pycomplexmodel,&pymodel, &modeltype);
+  if(!ok) return NULL;
+
+  void *temp2 = PyCObject_AsVoidPtr(pycomplexmodel);
+  ComplexModel *thiscomplex = static_cast<ComplexModel *>(temp2);
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  if (strcmp(modeltype,"LORES") == 0){
+    LORESModel * thislores = static_cast<LORESModel *>(temp);
+    thiscomplex->Add(thislores);
+  }
+  else if (strcmp(modeltype,"PDB") == 0){
+    PDBModel * thispdb = static_cast<PDBModel *>(temp);
+    thiscomplex->Add(thispdb);
+  }
+  else{
+    throw runtime_error("The model type is either PDB or LORES");
+  }
+
+  return Py_BuildValue("i", 0);
+}
+
+//ComplexModel methods GetPoints(Point3DVector &) 
+char pypointsmodelpy_get_complexpoints__name__[] = "get_complexpoints";
+char pypointsmodelpy_get_complexpoints__doc__[] = "Get points from complex model (container for LORES & PDB model)";
+
+PyObject * pypointsmodelpy_get_complexpoints(PyObject *, PyObject *args){
+  PyObject *pycomplexmodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pycomplexmodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pycomplexmodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  int npts = thiscomplex->GetPoints(*thisvec);
+
+  return Py_BuildValue("i", npts);
+}
+
+//create a new vector that holds of class Point3D objects 
+char pypointsmodelpy_new_point3dvec__doc__[] = "";
+char pypointsmodelpy_new_point3dvec__name__[] = "new_point3dvec";
+
+PyObject * pypointsmodelpy_new_point3dvec(PyObject *, PyObject *args)
+{
+  PyObject *pyvec = 0;
+
+  vector<Point3D> *newvec = new vector<Point3D>();
+
+  return PyCObject_FromVoidPtr(newvec, PyDelPoint3DVec);
+}
+
+void PyDelPoint3DVec(void *ptr)
+{
+  vector<Point3D> * oldvec = static_cast<vector<Point3D> *>(ptr);
+  delete oldvec;
+  return;
+
+}
+
+//LORESModel method distribution(point3dvec)
+char pypointsmodelpy_get_lores_pr__name__[] = "get_lores_pr";
+char pypointsmodelpy_get_lores_pr__doc__[] = "calculate distance distribution function";
+
+PyObject * pypointsmodelpy_get_lores_pr(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  double rmax = thislores->DistDistribution(*thisvec);
+  
+  return Py_BuildValue("d", rmax);
+}
+
+//LORESModel method distribution_xy(point3dvec)
+char pypointsmodelpy_distdistribution_xy__name__[] = "distdistribution_xy";
+char pypointsmodelpy_distdistribution_xy__doc__[] = "calculate distance distribution function on XY plane";
+
+PyObject * pypointsmodelpy_distdistribution_xy(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+  thislores->DistDistributionXY(*thisvec);
+
+  return Py_BuildValue("i", 0);
+}
+
+//PDBModel method distribution_xy(point3dvec)
+char pypointsmodelpy_get_pdb_pr_xy__name__[] = "get_pdb_pr_xy";
+char pypointsmodelpy_get_pdb_pr_xy__doc__[] = "calculate distance distribution function on XY plane";
+
+PyObject * pypointsmodelpy_get_pdb_pr_xy(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+  thispdb->DistDistributionXY(*thisvec);
+
+  return Py_BuildValue("i", 0);
+}
+
+//PDBModel method distribution(point3dvec)
+char pypointsmodelpy_get_pdb_pr__name__[] = "get_pdb_pr";
+char pypointsmodelpy_get_pdb_pr__doc__[] = "calculate distance distribution function";
+
+PyObject * pypointsmodelpy_get_pdb_pr(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+  thispdb->DistDistribution(*thisvec);
+
+  return Py_BuildValue("i", 0);
+}
+
+//ComplexModel method distribution(point3dvec)
+char pypointsmodelpy_get_complex_pr__name__[] = "get_complex_pr";
+char pypointsmodelpy_get_complex_pr__doc__[] = "calculate distance distribution function";
+
+PyObject * pypointsmodelpy_get_complex_pr(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pypoint3dvec = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pypoint3dvec);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+  thiscomplex->DistDistribution(*thisvec);
+
+  return Py_BuildValue("i", 0);
+}
+
+//LORESModel method CalculateIQ(iq)
+char pypointsmodelpy_get_lores_iq__name__[] = "get_lores_iq";
+char pypointsmodelpy_get_lores_iq__doc__[] = "calculate scattering intensity";
+
+PyObject * pypointsmodelpy_get_lores_iq(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0, *pyiq = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pylores, &pyiq);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+  void *temp2 = PyCObject_AsVoidPtr(pyiq);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  IQ * thisiq = static_cast<IQ *>(temp2);
+
+  thislores->CalculateIQ(thisiq);
+
+  return Py_BuildValue("i",0);
+}
+
+//LORESModel method CalculateIQ(q)
+char pypointsmodelpy_get_lores_i__name__[] = "get_lores_i";
+char pypointsmodelpy_get_lores_i__doc__[] = "calculate averaged scattering intensity from a single q";
+
+PyObject * pypointsmodelpy_get_lores_i(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0;
+  double q = 0;
+  int ok = PyArg_ParseTuple(args, "Od", &pylores, &q);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  double I = thislores->CalculateIQ(q);
+
+  return Py_BuildValue("d",I);
+}
+
+// method calculateIQ_2D(iq)
+char pypointsmodelpy_calculateIQ_2D__name__[] = "calculateIQ_2D";
+char pypointsmodelpy_calculateIQ_2D__doc__[] = "calculate scattering intensity";
+
+PyObject * pypointsmodelpy_calculateIQ_2D(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0, *pyiq = 0;
+  double theta = 0;
+  int ok = PyArg_ParseTuple(args, "OOd", &pylores, &pyiq,&theta);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+  void *temp2 = PyCObject_AsVoidPtr(pyiq);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  IQ * thisiq = static_cast<IQ *>(temp2);
+
+  thislores->CalculateIQ_2D(thisiq,theta);
+
+  return Py_BuildValue("i",0);
+}
+
+// method calculateI_Qxy(Qx,Qy)
+char pypointsmodelpy_calculateI_Qxy__name__[] = "calculateI_Qxy";
+char pypointsmodelpy_calculateI_Qxy__doc__[] = "calculate scattering intensity on a 2D pixel";
+
+PyObject * pypointsmodelpy_calculateI_Qxy(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0;
+  double qx = 0, qy = 0;
+  double I = 0;
+
+  int ok = PyArg_ParseTuple(args, "Odd", &pylores, &qx,&qy);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  I = thislores->CalculateIQ_2D(qx,qy);
+
+  return Py_BuildValue("d",I);
+}
+
+// PDBModel method calculateIQ(iq)
+char pypointsmodelpy_get_pdb_iq__name__[] = "get_pdb_iq";
+char pypointsmodelpy_get_pdb_iq__doc__[] = "calculate scattering intensity for PDB model";
+
+PyObject * pypointsmodelpy_get_pdb_iq(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pyiq = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pyiq);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+  IQ * thisiq = static_cast<IQ *>(temp2);
+
+  thispdb->CalculateIQ(thisiq);
+
+  return Py_BuildValue("i",0);
+}
+
+// PDBModel method calculateIQ_2D(qx,qy)
+char pypointsmodelpy_get_pdb_Iqxy__name__[] = "get_pdb_Iqxy";
+char pypointsmodelpy_get_pdb_Iqxy__doc__[] = "calculate scattering intensity by a given (qx,qy) for PDB model";
+
+PyObject * pypointsmodelpy_get_pdb_Iqxy(PyObject *, PyObject *args)
+{
+  PyObject *pypdb = 0;
+  double qx = 0, qy = 0;
+  double I = 0;
+
+  int ok = PyArg_ParseTuple(args, "Odd", &pypdb, &qx,&qy);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pypdb);
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+
+  I = thispdb->CalculateIQ_2D(qx,qy);
+
+  return Py_BuildValue("d",I);
+}
+
+// ComplexModel method calculateIQ(iq)
+char pypointsmodelpy_get_complex_iq__name__[] = "get_complex_iq";
+char pypointsmodelpy_get_complex_iq__doc__[] = "calculate scattering intensity for COMPLEX model";
+
+PyObject * pypointsmodelpy_get_complex_iq(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0, *pyiq = 0;
+  int ok = PyArg_ParseTuple(args, "OO", &pymodel, &pyiq);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+  void *temp2 = PyCObject_AsVoidPtr(pyiq);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+  IQ * thisiq = static_cast<IQ *>(temp2);
+
+  thiscomplex->CalculateIQ(thisiq);
+
+  return Py_BuildValue("i",0);
+}
+
+//LORESModel method CalculateIQ(q) 
+char pypointsmodelpy_get_complex_i__name__[] = "get_complex_i";
+char pypointsmodelpy_get_complex_i__doc__[] = "calculate averaged scattering intensity from a single q";
+
+PyObject * pypointsmodelpy_get_complex_i(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0;
+  double q = 0;
+  int ok = PyArg_ParseTuple(args, "Od", &pylores, &q);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+
+  double I = thiscomplex->CalculateIQ(q);
+
+  return Py_BuildValue("d",I);
+}
+
+char pypointsmodelpy_get_complex_i_error__name__[] = "get_complex_i_error";
+char pypointsmodelpy_get_complex_i_error__doc__[] = "calculate error on averaged scattering intensity from a single q";
+
+PyObject * pypointsmodelpy_get_complex_i_error(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0;
+  double q = 0;
+  int ok = PyArg_ParseTuple(args, "Od", &pylores, &q);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+
+  double I = thiscomplex->CalculateIQError(q);
+
+  return Py_BuildValue("d",I);
+}
+
+
+
+
+//method outputPR(string filename)
+char pypointsmodelpy_outputPR__name__[] = "outputPR";
+char pypointsmodelpy_outputPR__doc__[] = "print out P(R) to a file";
+
+PyObject * pypointsmodelpy_outputPR(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  thislores->OutputPR(outfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+//method outputPR_xy(string filename)
+char pypointsmodelpy_outputPR_xy__name__[] = "outputPR_xy";
+char pypointsmodelpy_outputPR_xy__doc__[] = "print out P(R) to a file";
+
+PyObject * pypointsmodelpy_outputPR_xy(PyObject *, PyObject *args)
+{
+  PyObject *pyloresmodel = 0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args, "Os", &pyloresmodel, &outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  thislores->OutputPR_XY(outfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+//PDBModel method outputPR(string filename)
+char pypointsmodelpy_save_pdb_pr__name__[] = "save_pdb_pr";
+char pypointsmodelpy_save_pdb_pr__doc__[] = "print out P(R) to a file";
+
+PyObject * pypointsmodelpy_save_pdb_pr(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+
+  thispdb->OutputPR(outfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+//ComplexModel method outputPR(string filename)
+char pypointsmodelpy_save_complex_pr__name__[] = "save_complex_pr";
+char pypointsmodelpy_save_complex_pr__doc__[] = "print out P(R) to a file";
+
+PyObject * pypointsmodelpy_save_complex_pr(PyObject *, PyObject *args)
+{
+  PyObject *pymodel = 0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args, "Os", &pymodel, &outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pymodel);
+
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+
+  thiscomplex->OutputPR(outfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+
+//method outputPDB(string filename)
+char pypointsmodelpy_outputPDB__name__[] = "outputPDB";
+char pypointsmodelpy_outputPDB__doc__[] = "save the monte-carlo distributed points of the geomodel into a PDB format file.\
+                                           a .pdb extension will be automatically added";
+
+PyObject * pypointsmodelpy_outputPDB(PyObject *, PyObject *args)
+{
+  PyObject *pyloresmodel = 0, *pypoint3dvec=0;
+  char *outfile;
+  int ok = PyArg_ParseTuple(args, "OOs", &pyloresmodel, &pypoint3dvec,&outfile);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pyloresmodel);
+
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  thislores->OutputPDB(*thisvec,outfile);
+
+  return Py_BuildValue("i", 0);
+}
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,207 @@
+#if !defined(pypointsmodelpy_misc_h)
+#define pypointsmodelpy_misc_h
+
+// @copyright: University of Tennessee, for the DANSE project
+extern char pypointsmodelpy_copyright__name__[];
+extern char pypointsmodelpy_copyright__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_copyright(PyObject *, PyObject *);
+
+// LORESModel constructor LORESModel(double density)
+extern char pypointsmodelpy_new_loresmodel__name__[];
+extern char pypointsmodelpy_new_loresmodel__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_new_loresmodel(PyObject *, PyObject *);
+
+//Clean LORESModel constructor memory usage
+static void PyDelLores(void *);
+
+//LORESModel methods add(GeoShapes &, double sld)
+extern char pypointsmodelpy_lores_add__name__[];
+extern char pypointsmodelpy_lores_add__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_lores_add(PyObject *, PyObject *);
+
+//LORESModel methods GetPoints(vector<Point3D> &)
+extern char pypointsmodelpy_get_lorespoints__name__[];
+extern char pypointsmodelpy_get_lorespoints__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_lorespoints(PyObject *, PyObject *);
+
+//PDBModel constructor PDBModel()
+extern char pypointsmodelpy_new_pdbmodel__name__[];
+extern char pypointsmodelpy_new_pdbmodel__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_new_pdbmodel(PyObject *, PyObject *);
+
+//Clean PDBModel constructor memory usage
+static void PyDelPDB(void *);
+
+//PDBModel method AddPDB(string)
+extern char pypointsmodelpy_pdbmodel_add__name__[];
+extern char pypointsmodelpy_pdbmodel_add__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_pdbmodel_add(PyObject *, PyObject *);
+
+//PDBModel method GetPoints(Point3DVector &)
+extern char pypointsmodelpy_get_pdbpoints__name__[];
+extern char pypointsmodelpy_get_pdbpoints__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdbpoints(PyObject *, PyObject *);
+
+//ComplexModel constructor ComplexModel()
+extern char pypointsmodelpy_new_complexmodel__name__[];
+extern char pypointsmodelpy_new_complexmodel__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_new_complexmodel(PyObject *, PyObject *);
+
+//Clean Complexodel constructor memory usage
+static void PyDelComplex(void *);
+
+//ComplexModel method AddComplex(string)
+extern char pypointsmodelpy_complexmodel_add__name__[];
+extern char pypointsmodelpy_complexmodel_add__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_complexmodel_add(PyObject *, PyObject *);
+
+//ComplexModel method GetPoints(Point3DVector &)
+extern char pypointsmodelpy_get_complexpoints__name__[];
+extern char pypointsmodelpy_get_complexpoints__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complexpoints(PyObject *, PyObject *);
+
+//generate a new vector of points3d
+extern char pypointsmodelpy_new_point3dvec__name__[];
+extern char pypointsmodelpy_new_point3dvec__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_new_point3dvec(PyObject *, PyObject *);
+
+//clean new_point3dvec
+static void PyDelPoint3DVec(void *);
+
+// method FillPoints(loresmodel, point3dvec)
+//extern char pypointsmodelpy_fillpoints__name__[];
+//extern char pypointsmodelpy_fillpoints__doc__[];
+//extern "C"
+//PyObject * pypointsmodelpy_fillpoints(PyObject *, PyObject *);
+
+// LORESModel method distdistribution(point3dvec)
+extern char pypointsmodelpy_get_lores_pr__name__[];
+extern char pypointsmodelpy_get_lores_pr__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_lores_pr(PyObject *, PyObject *);
+
+// method distdistribution_xy(point3dvec)
+extern char pypointsmodelpy_distdistribution_xy__name__[];
+extern char pypointsmodelpy_distdistribution_xy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_distdistribution_xy(PyObject *, PyObject *);
+
+// PDBModel method distdistribution(point3dvec)
+extern char pypointsmodelpy_get_pdb_pr__name__[];
+extern char pypointsmodelpy_get_pdb_pr__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdb_pr(PyObject *, PyObject *);
+
+// PDBModel method distdistribution_xy(point3dvec)
+extern char pypointsmodelpy_get_pdb_pr_xy__name__[];
+extern char pypointsmodelpy_get_pdb_pr_xy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdb_pr_xy(PyObject *, PyObject *);
+
+// ComplexModel method distdistribution(point3dvec)
+extern char pypointsmodelpy_get_complex_pr__name__[];
+extern char pypointsmodelpy_get_complex_pr__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complex_pr(PyObject *, PyObject *);
+
+// LORESModel method calculateIQ(iq)
+extern char pypointsmodelpy_get_lores_iq__name__[];
+extern char pypointsmodelpy_get_lores_iq__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_lores_iq(PyObject *, PyObject *);
+
+// LORESModel method CalculateIQ(q)
+extern char pypointsmodelpy_get_lores_i__name__[];
+extern char pypointsmodelpy_get_lores_i__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_lores_i(PyObject *, PyObject *);
+
+// ComplexModel method CalculateIQ(q)
+extern char pypointsmodelpy_get_complex_i__name__[];
+extern char pypointsmodelpy_get_complex_i__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complex_i(PyObject *, PyObject *);
+
+// ComplexModel method CalculateIQError(q)
+extern char pypointsmodelpy_get_complex_i_error__name__[];
+extern char pypointsmodelpy_get_complex_i_error__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complex_i_error(PyObject *, PyObject *);
+
+// method calculateIQ_2D(iq,theta)
+extern char pypointsmodelpy_calculateIQ_2D__name__[];
+extern char pypointsmodelpy_calculateIQ_2D__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_calculateIQ_2D(PyObject *, PyObject *);
+
+// method calculateI_Qxy(Qx,Qy)
+extern char pypointsmodelpy_calculateI_Qxy__name__[];
+extern char pypointsmodelpy_calculateI_Qxy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_calculateI_Qxy(PyObject *, PyObject *);
+
+// PDBModel method calculateIQ(iq)
+extern char pypointsmodelpy_get_pdb_iq__name__[];
+extern char pypointsmodelpy_get_pdb_iq__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdb_iq(PyObject *, PyObject *);
+
+// PDBModel method calculateIQ_2D(qx,qy)
+extern char pypointsmodelpy_get_pdb_Iqxy__name__[];
+extern char pypointsmodelpy_get_pdb_Iqxy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdb_Iqxy(PyObject *, PyObject *);
+
+// ComplexModel method calculateIQ(iq)
+extern char pypointsmodelpy_get_complex_iq__name__[];
+extern char pypointsmodelpy_get_complex_iq__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complex_iq(PyObject *, PyObject *);
+
+// method outputPR
+extern char pypointsmodelpy_outputPR__name__[];
+extern char pypointsmodelpy_outputPR__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_outputPR(PyObject *, PyObject *);
+
+// method outputPR_xy
+extern char pypointsmodelpy_outputPR_xy__name__[];
+extern char pypointsmodelpy_outputPR_xy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_outputPR_xy(PyObject *, PyObject *);
+
+// PDBModel method outputPR
+extern char pypointsmodelpy_save_pdb_pr__name__[];
+extern char pypointsmodelpy_save_pdb_pr__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_save_pdb_pr(PyObject *, PyObject *);
+
+// ComplexModel method outputPR
+extern char pypointsmodelpy_save_complex_pr__name__[];
+extern char pypointsmodelpy_save_complex_pr__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_save_complex_pr(PyObject *, PyObject *);
+
+// method outputPDB
+extern char pypointsmodelpy_outputPDB__name__[];
+extern char pypointsmodelpy_outputPDB__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_outputPDB(PyObject *, PyObject *);
+
+#endif
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/pointsmodelpymodule.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/pointsmodelpymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/pointsmodelpymodule.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+//                               Michael A.G. Aivazis
+//                        California Institute of Technology
+//                        (C) 1998-2005  All Rights Reserved
+// 
+//  <LicenseText>
+// 
+//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// 
+
+//#include <portinfo>
+
+#include <Python.h>
+
+#include "exceptions.h"
+#include "bindings.h"
+
+
+char pypointsmodelpy_module__doc__[] = "";
+
+// Initialization function for the module (*must* be called initpointsmodelpy)
+extern "C"
+void
+initpointsmodelpy()
+{
+    // create the module and add the functions
+    PyObject * m = Py_InitModule4(
+        "pointsmodelpy", pypointsmodelpy_methods,
+        pypointsmodelpy_module__doc__, 0, PYTHON_API_VERSION);
+
+    // get its dictionary
+    PyObject * d = PyModule_GetDict(m);
+
+    // check for errors
+    if (PyErr_Occurred()) {
+        Py_FatalError("can't initialize module pointsmodelpy");
+    }
+
+    // install the module exceptions
+    pypointsmodelpy_runtimeError = PyErr_NewException("pointsmodelpy.runtime", 0, 0);
+    PyDict_SetItemString(d, "RuntimeException", pypointsmodelpy_runtimeError);
+
+    return;
+}
+
+// version
+// $Id$
+
+// End of file
Index: realSpaceModeling/pointsmodelpy/tests/Make.mm
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/Make.mm	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,61 @@
+# -*- Makefile -*-
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+#
+# <LicenseText>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+PROJECT = pointsmodelpy
+PACKAGE = tests
+
+PROJ_CLEAN += $(PROJ_CPPTESTS)
+
+PROJ_CXX_INCLUDES += ../../iqPy/libiqPy   \
+                     ../../iqPy/libiqPy/tnt \
+                     ../../geoshapespy/libgeoshapespy   \
+                     ../../analmodelpy/libanalmodelpy   \
+		     ../libpointsmodelpy
+
+PROJ_PYTESTS = signon.py
+PROJ_CPPTESTS = testlores \
+                testpdb  \
+                testcomplexmodel
+PROJ_TESTS = $(PROJ_PYTESTS) $(PROJ_CPPTESTS)
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -lpointsmodelpy -lgeoshapespy -liqPy
+
+
+#--------------------------------------------------------------------------
+#
+
+all: $(PROJ_TESTS)
+
+test:
+	for test in $(PROJ_TESTS) ; do $${test}; done
+
+release: tidy
+	cvs release .
+
+update: clean
+	cvs update .
+
+#--------------------------------------------------------------------------
+#
+
+testlores: testlores.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testlores.cc $(PROJ_LIBRARIES)
+
+testpdb: testpdb.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testpdb.cc $(PROJ_LIBRARIES)
+
+testcomplexmodel: testcomplexmodel.cc $(BLD_LIBDIR)/libpointsmodelpy.$(EXT_SAR)
+	$(CXX) $(CXXFLAGS) $(LCXXFLAGS) -g -o $@ testcomplexmodel.cc $(PROJ_LIBRARIES)
+
+# version
+# $Id$
+
+# End of file
Index: realSpaceModeling/pointsmodelpy/tests/signon.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/signon.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+#                               Michael A.G. Aivazis
+#                        California Institute of Technology
+#                        (C) 1998-2005  All Rights Reserved
+# 
+#  <LicenseText>
+# 
+#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# 
+
+if __name__ == "__main__":
+
+    import pointsmodelpy
+    from pointsmodelpy import pointsmodelpy as pointsmodelpymodule
+
+    print "copyright information:"
+    print "   ", pointsmodelpy.copyright()
+    print "   ", pointsmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", pointsmodelpymodule.__file__
+    print "    doc:", pointsmodelpymodule.__doc__
+    print "    contents:", dir(pointsmodelpymodule)
+
+    print
+    print pointsmodelpymodule.hello()
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/pointsmodelpy/tests/test.pdb
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/test.pdb	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/test.pdb	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,10 @@
+REMARK FILENAME="if0.pdb"
+REMARK  TOPH19.pep -MACRO for protein sequence
+REMARK DATE:17-Aug-02  11:05:39       created by user:
+ATOM      1  CB  SER     1      -1.115 -11.617 -11.368
+ATOM      2  OG  SER     1       0.202 -11.845 -10.894  1.00 54.67          
+ATOM      3  C   SER     1      -2.076 -12.837  -9.369  1.00 44.10          
+ATOM      4  O   SER     1      -3.108 -12.947  -8.704  1.00 43.77          
+ATOM      5  N   SER     1      -3.465 -12.399 -11.363  1.00 83.41          
+ATOM      6  CA  SER     1      -2.108 -12.709 -10.900  1.00 57.67          
+END
Index: realSpaceModeling/pointsmodelpy/tests/test2.pdb
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/test2.pdb	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/test2.pdb	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,7 @@
+ATOM      1  CB  SER     1      -1.115 -11.617 -11.368  1.00 52.49
+ATOM      2  OG  SER     1       0.202 -11.845 -10.894  1.00 54.67
+ATOM      3  C   SER     1      -2.076 -12.837  -9.369  1.00 44.10
+ATOM      4  O   SER     1      -3.108 -12.947  -8.704  1.00 43.77
+ATOM      5  N   SER     1      -3.465 -12.399 -11.363  1.00 83.41
+ATOM      6  CA  SER     1      -2.108 -12.709 -10.900  1.00 57.67
+END
Index: realSpaceModeling/pointsmodelpy/tests/test2dui.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/test2dui.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/test2dui.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+"""
+Demonstration of drawing a 2D image plot using the "hot" colormap
+"""
+
+#--------------------------------------------------------------------------------
+#  Imports:
+#--------------------------------------------------------------------------------
+
+import wx
+
+from enthought.traits import Any, Instance
+from enthought.enable.wx     import Window
+from enthought.pyface        import ApplicationWindow, GUI
+from enthought.util.numerix  import pi, concatenate, array, zeros, ones, \
+                                    arange, resize, ravel
+from enthought.util.numerix import Float as NumericFloat
+from math import sqrt, sin
+
+from enthought.chaco.plot_component import PlotComponent
+from enthought.chaco.plot_axis import PlotAxis
+from enthought.chaco.plot_canvas import PlotCanvas
+from enthought.chaco.plot_group import PlotGroup
+from enthought.chaco.image_plot_value import ImageData, CmapImagePlotValue
+from enthought.chaco.colormap import LinearColormap
+from enthought.chaco.colormap_legend import ColormapLegend
+from enthought.chaco.default_colormaps import hot, gray
+from enthought.chaco.demo.demo_base import PlotApplicationWindow
+
+
+class ImagePlotApplicationWindow( PlotApplicationWindow ):
+
+    ###########################################################################
+    # PlotApplicationWindow interface.
+    ###########################################################################
+    
+    def _create_plot( self ):
+        """ Create the plot to be displayed. """
+        
+        # Create the image data and the index values
+        #value_grid = zeros((100,100), NumericFloat)
+        from testlores2d import get2d_2        
+        value_grid = get2d_2()
+        #self._compute_function(value_grid)
+        index_vals = (arange(value_grid.shape[0]), arange(value_grid.shape[1]))
+
+        data = ImageData(value_grid, index_vals)
+        print value_grid, index_vals
+        
+        # Create the index axes
+        xaxis = PlotAxis(tick_visible=False, grid_visible=False)
+                        # bound_low = index_vals[0][0], bound_high = index_vals[0][-1])
+        yaxis = PlotAxis(tick_visible=False, grid_visible=False)
+                     #bound_low = index_vals[1][0], bound_high = index_vals[1][-1])
+        xaxis.visible = False
+        yaxis.visible = False
+        
+        # Create the value axis (i.e. colormap)
+        cmap = hot(0,1)
+                
+        # Create the Image PlotValue
+#        image = CmapImagePlotValue(data, cmap, axis_index = xaxis, axis = yaxis, type='image')
+        image = CmapImagePlotValue(data, cmap,type='image')
+        image.weight = 10
+        
+        cmap_legend = ColormapLegend(cmap, margin_width=31, margin_height=31)
+        cmap_legend.weight = 0.4
+        
+        group = PlotGroup(cmap_legend, image, orientation='horizontal')
+
+        return group
+
+    ###########################################################################
+    # Private interface.
+    ###########################################################################
+
+    def _compute_function(self, ary):
+        "Fills in ary with the sin(r)/r function"
+        
+        width, height = ary.shape
+        for i in range(width):
+            for j in range(height):
+                x = i - width / 2.0
+                x = x / (width/2.0) * 15
+                y = j - height / 2.0
+                y = y / (height/2.0) * 15
+                
+                radius = sqrt(x*x + y*y)
+                if radius == 0.0:
+                    ary[i,j] = 1
+                else:
+                    ary[i,j] = sin(radius) / radius
+
+        return
+    
+def main():
+
+    # Create the GUI (this does NOT start the GUI event loop).
+    gui = GUI()
+
+    # Screen size:
+    screen_width = gui.system_metrics.screen_width or 1024
+    screen_height = gui.system_metrics.screen_height or 768
+
+    # Create and open the main window.
+    window = ImagePlotApplicationWindow( title = "Plot" )
+    #window.plot_item = object
+    window.size = ( 2 * screen_width / 3, 2 * screen_height / 3 )
+    window.open()
+    
+    # Start the GUI event loop.
+    gui.start_event_loop()
+
+
+#=============================================================================== 
+#  Program start-up:
+#=============================================================================== 
+
+if __name__ == '__main__':
+    main()
Index: realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,41 @@
+#include "complex_model.h"
+#include "lores_model.h"
+#include "sphere.h"
+#include "pdb_model.h"
+#include <vector>
+#include "Point3D.h"
+#include <string>
+
+int main(){
+
+  //Get a few points from a lores model
+  vector<Point3D> vplores;
+  LORESModel lm(0.1);
+  Sphere s1(10);
+  lm.Add(s1,1);
+  lm.GetPoints(vplores);
+  
+  //get a few points from a pdb model
+  vector<Point3D> vppdb;
+  string pdbfile("ff0.pdb");
+  PDBModel p1;
+  p1.AddPDB(pdbfile);
+  p1.GetPoints(vppdb);
+  //should be error,argument vector has to be empty
+  //p1.GetPoints(vppdb);
+
+  //merge points
+  vector<Point3D> vptotal;
+  ComplexModel cm;
+  cm.Add(&lm);
+  cm.Add(&p1);
+  cout << "boundary"<< cm.GetDimBound() <<endl;
+
+  cm.GetPoints(vptotal);
+
+  cm.DistDistribution(vptotal);
+  cm.OutputPR("testcomplexcc.pr");
+  //pm.AddPoints(vptotal,vplores,vppdb);
+
+  return 0;
+}
Index: realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testcomplexmodel.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,101 @@
+from sansModeling.pointsmodelpy import pointsmodelpy
+from sansModeling.iqPy import iqPy
+from sansModeling.geoshapespy import geoshapespy
+
+#First testing: a normal case, a lores model holds a sphere
+#and a pdbmodel holds one pdb file. and merged into a complex
+#model, then perform calculation
+def test_complex():
+    p = pointsmodelpy.new_pdbmodel()
+    pointsmodelpy.pdbmodel_add(p,"ff0.pdb")
+
+    vp = pointsmodelpy.new_point3dvec()
+    pointsmodelpy.get_pdbpoints(p,vp);
+
+    pointsmodelpy.get_pdb_pr(p,vp)
+    pointsmodelpy.save_pdb_pr(p,"testcomplex.pr")
+
+    iq = iqPy.new_iq(100,0.001, 0.3)
+    pointsmodelpy.get_pdb_iq(p,iq)
+
+    iqPy.OutputIQ(iq,"testcomplex.iq")
+
+    a = geoshapespy.new_sphere(10)
+    lm = pointsmodelpy.new_loresmodel(0.1)
+    pointsmodelpy.lores_add(lm,a,1.0)
+
+    vpcomplex = pointsmodelpy.new_point3dvec();
+    complex = pointsmodelpy.new_complexmodel()
+    pointsmodelpy.complexmodel_add(complex,p,"PDB");
+    pointsmodelpy.complexmodel_add(complex,lm,"LORES");
+    
+    pointsmodelpy.get_complexpoints(complex,vpcomplex);
+    pointsmodelpy.get_complex_pr(complex,vpcomplex);
+    pointsmodelpy.save_complex_pr(complex,"testcomplex1.pr");
+
+    iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+    pointsmodelpy.get_complex_iq(complex,iqcomplex);
+
+    iqPy.OutputIQ(iq,"testcomplex1.iq")
+
+#testing 2, insert one pdbmodel and one empty loresmodel
+def test_complex2():
+  pdb = pointsmodelpy.new_pdbmodel()
+  pointsmodelpy.pdbmodel_add(pdb,"ff0.pdb")
+
+  lores = pointsmodelpy.new_loresmodel(0.1)
+
+  complex = pointsmodelpy.new_complexmodel()	
+  pointsmodelpy.complexmodel_add(complex,pdb,"PDB");
+  pointsmodelpy.complexmodel_add(complex,lores,"LORES")
+
+  points = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_complexpoints(complex,points)
+
+  pointsmodelpy.get_complex_pr(complex,points);
+  pointsmodelpy.save_complex_pr(complex,"testcomplex2.pr")
+
+  iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.get_complex_iq(complex,iqcomplex)
+
+  iqPy.OutputIQ(iqcomplex,"testcomplex2.iq")
+
+  print "p(r) is saved in testcomplex2.pr"
+  print "I(Q) is saved in testcomplex2.iq"
+  print "pass"
+
+#testing 3, insert one empty pdbmodel and one loresmodel
+def test_complex3():
+  pdb = pointsmodelpy.new_pdbmodel()
+
+  lores = pointsmodelpy.new_loresmodel(0.1)
+  sph = geoshapespy.new_sphere(10)
+  pointsmodelpy.lores_add(lores,sph,1.0)
+
+  complex = pointsmodelpy.new_complexmodel()	
+  pointsmodelpy.complexmodel_add(complex,pdb,"PDB");
+  pointsmodelpy.complexmodel_add(complex,lores,"LORES")
+
+  points = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_complexpoints(complex,points)
+
+  pointsmodelpy.get_complex_pr(complex,points);
+  pointsmodelpy.save_complex_pr(complex,"testcomplex3.pr")
+
+  iqcomplex = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.get_complex_iq(complex,iqcomplex)
+
+  iqPy.OutputIQ(iqcomplex,"testcomplex3.iq")
+
+  print "p(r) is saved in testcomplex3.pr"
+  print "I(Q) is saved in testcomplex3.iq"
+  print "pass"
+
+if __name__ == "__main__":
+    print "test 1, adding one nonempty loresmodel and one nonempty pdbmodel to complex model"
+    test_complex()
+    print "test 2, adding a nonempty pdbmodel, and adding an empty loresmodel"
+    test_complex2()
+    print "test 3, adding an empty pdbmodel, and adding a nonempty loresmodel"
+    test_complex3()
+    
Index: realSpaceModeling/pointsmodelpy/tests/testlores.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testlores.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testlores.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,209 @@
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include "lores_model.h"
+#include "sphere.h"
+#include "cylinder.h"
+#include "ellipsoid.h"
+#include "Point3D.h"
+
+using namespace std;
+
+void test_calculateIQ(LORESModel &lm);
+
+void WritePointsCoor(vector<Point3D> &vp){
+  ofstream outfile("testcc.coor");
+  for(size_t i=0; i<vp.size(); ++i){
+    outfile<<vp[i].getX()<<" "<<vp[i].getY()<<" "<<vp[i].getZ()<<" "<<1.0<<endl;
+  }
+}
+
+void test_lores(){
+
+  LORESModel lm(0.5);
+  cout << "density is:" << lm.GetDensity() << endl;
+   
+  Sphere s1(10);
+  s1.SetOrientation(10,10,20);
+  s1.SetCenter(10,10,10);
+  lm.Add(s1,1.0);
+   
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+  
+  /*
+  Cylinder c2(40,100);
+  c2.SetCenter(-30,-40,-35);
+  lm.Add(c2,1.0);
+  */
+  /*
+  Ellipsoid e1(20,15,10);
+  e1.SetCenter(0,0,0);
+  e1.SetOrientation(10,10,20);
+  lm.Add(e1,1.0);
+  */
+  /*test multiple spheres
+  int range = 20;
+  int r = 5;
+  for (int k = 0; k < 1000; ++k) {
+    Sphere s(r + rand() % r);
+    s.SetCenter(rand() % range, rand() % range, rand() % range);
+    lm.Add(s, 1.0);
+  }
+  */
+  /*
+  Sphere s1(10);
+  cout << "sphere information:" << s1.GetVolume() << " " << s1.GetRadius() <<endl;
+  s1.SetOrientation(10,20,10);
+  s1.SetCenter(1,5,2);
+  lm.Add(s1,1.0); 
+
+  Sphere s2(15);
+  s2.SetCenter(20,20,20);
+  lm.Add(s2,2.0);
+
+  Sphere s3(5);
+  s3.SetCenter(0,0,0);
+  lm.Add(s3,2.0);
+
+  Sphere s4(5);
+  s4.SetCenter(0,0,10);
+  lm.Add(s4,2.0);
+
+  Sphere s5(10);
+  s5.SetCenter(20,0,0);
+  lm.Add(s5,2.0);
+  */
+
+  test_calculateIQ(lm);
+}
+
+void test_calculateIQ(LORESModel &lm){
+
+  IQ iq1(10,0.001,0.3);
+  cout << "iq information:" << iq1.GetQmin() <<endl;
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+  WritePointsCoor(vp);
+  cout << "vp size:" <<vp.size()<<endl;
+  cout << "save into pdb file" << endl;
+  lm.OutputPDB(vp,"model.pdb");
+
+  //  for (vector<Point3D>::iterator iter = vp.begin(); 
+  //     iter != vp.end(); ++iter){
+  //  cout << *iter << endl;
+  //}
+
+  lm.DistDistribution(vp);
+  Array2D<double> pr(lm.GetPr());
+  //for(int i = 0; i< pr.dim1(); ++i)
+  //  cout << pr[i][0] << " " << pr[i][1] << " " << pr[i][2] << endl;
+  lm.OutputPR("test.pr");
+  cout << "pass ddfunction, and print out the pr file" <<endl;
+
+  lm.CalculateIQ(&iq1); 
+  cout <<"I(Q): \n" ;
+  //for (int i = 0; i< iq1.iq_data.dim1(); i++)
+  //  cout << iq1.iq_data[i][0]<< " " << iq1.iq_data[i][1] <<endl;
+}
+
+void test_lores2d(){
+
+  LORESModel lm(0.1);
+
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistributionXY(vp);
+  lm.OutputPR_XY("test2d.pr");
+
+  IQ iq(10,0.001,0.3);
+  lm.CalculateIQ_2D(&iq,10);
+
+  iq.OutputIQ("test2d.iq");
+}
+
+void test_lores2d_qxqy(){
+
+  LORESModel lm(0.1);
+
+  Cylinder c1(5,20);
+  c1.SetCenter(0,0,0);
+  c1.SetOrientation(10,20,30);
+  lm.Add(c1,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistributionXY(vp);  
+
+  double aI = lm.CalculateIQ_2D(0.1,0.2);
+
+  cout << " a single I is: "<<aI<<" at Qx,Qy = 0.1,0.2" <<endl;
+}
+
+void test_GetCenter()
+{
+  LORESModel lm(0.1);
+
+  Sphere s1(10);
+  s1.SetCenter(-1,-1,-1);
+  Sphere s2(20);
+  s2.SetCenter(1,1,1);
+
+  lm.Add(s1,1.0);
+  lm.Add(s2,1.0);
+
+  vector<double> center(3);
+  center = lm.GetCenter();
+
+  cout << "center should be (0,0,0) after adding two spheres:"<<endl;
+  cout << center[0] <<" "<< center[1] <<" "<< center[2]<<endl;
+
+}
+
+void test_CalSingleI(){
+  LORESModel lm(0.1);
+
+  Cylinder cyn(10,40);  
+
+  lm.Add(cyn,1.0);
+
+  vector<Point3D> vp;
+  lm.GetPoints(vp);
+
+  lm.DistDistribution(vp);
+
+  double result = lm.CalculateIQ(0.1);
+  cout << "The I(0.1) is: " << result << endl;      
+}
+
+int main(){
+
+  printf("this\n");
+  cout << "Start" << endl;
+  //test_lores();
+  cout <<"testing DistDistributionXY"<<endl;
+  test_lores2d();
+
+  cout <<"testing GetCenter (center of the list of shapes)"<<endl;
+  test_GetCenter();
+
+  cout <<"testing calculate_2d(Qx,Qy)"<<endl;
+  test_lores2d_qxqy();
+  cout << "Pass" << endl;
+
+  cout <<"testing CalculateIQ(q)"<<endl;
+  test_CalSingleI();
+
+  return 0;
+}
Index: realSpaceModeling/pointsmodelpy/tests/testlores.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testlores.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testlores.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,63 @@
+if __name__ == "__main__":
+
+    from sansModeling.iqPy import iqPy
+    #from sansModeling.analmodelpy import analmodelpy as analmodelpymodule
+    from sansModeling.geoshapespy import geoshapespy
+    from sansModeling.pointsmodelpy import pointsmodelpy
+
+#    print "copyright information:"
+#    print "   ", pointsmodelpy.copyright()
+#    print "   ", pointsmodelpymodule.copyright()
+
+    print
+    print "module information:"
+    print "    file:", pointsmodelpy.__file__
+    print "    doc:", pointsmodelpy.__doc__
+    print "    contents:", dir(pointsmodelpy)
+    print "    contents:", dir(geoshapespy)
+
+#    a = geoshapespy.new_singlehelix(10,2,30,2)
+    #a = geoshapespy.new_sphere(20)
+    
+    iq = iqPy.new_iq(100,0.001, 0.3)
+
+#    geoshapespy.set_orientation(a,20,40,60)
+#    geoshapespy.set_center(a,0,0,0)
+    lm = pointsmodelpy.new_loresmodel(0.1)
+#    pointsmodelpy.lores_add(lm,a,1.0)
+
+#    b = geoshapespy.new_sphere(15)
+#    geoshapespy.set_center(b,15,15,15)
+#    pointsmodelpy.lores_add(lm,b,2.0)
+
+    
+    c = geoshapespy.new_cylinder(10,40)
+    geoshapespy.set_center(c,1,1,1)
+    geoshapespy.set_orientation(c,0,0,0)
+    pointsmodelpy.lores_add(lm,c,3.0)
+    
+#    d = geoshapespy.new_ellipsoid(10,8,6)
+#    geoshapespy.set_center(d,3,3,3)
+#    geoshapespy.set_orientation(c,30,30,30)
+#    pointsmodelpy.lores_add(lm,d,1.0)
+
+    vp = pointsmodelpy.new_point3dvec()
+    pointsmodelpy.get_lorespoints(lm,vp)
+    pointsmodelpy.outputPDB(lm,vp,"modelpy.pseudo.pdb")
+
+    print "calculating distance distribution"
+    rmax = pointsmodelpy.get_lores_pr(lm,vp)
+    print "finish calculating get_lores_pr, and rmax is:", rmax
+    pointsmodelpy.outputPR(lm,"testlores.pr")
+    pointsmodelpy.get_lores_iq(lm,iq)
+
+    iqPy.OutputIQ(iq, "testlores.iq")
+
+    print "Testing get I from a single q"
+    result = pointsmodelpy.get_lores_i(lm,0.1)
+    print "The I(0.1) is: %s" % str(result) 
+
+# version
+__id__ = "$Id$"
+
+#  End of file 
Index: realSpaceModeling/pointsmodelpy/tests/testlores2d.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testlores2d.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testlores2d.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,115 @@
+def test_lores2d(phi):
+  from sansModeling.pointsmodelpy import pointsmodelpy 
+  from sansModeling.iqPy import iqPy
+  from sansModeling.geoshapespy import geoshapespy
+
+  #lores model is to hold several geometric objects
+  lm = pointsmodelpy.new_loresmodel(0.1)
+
+  #generate single geometry shape
+  c = geoshapespy.new_cylinder(10,40)
+  geoshapespy.set_center(c,1,1,1)
+  geoshapespy.set_orientation(c,0,0,0)
+
+  #add single geometry shape to lores model
+  pointsmodelpy.lores_add(lm,c,3.0)
+
+  #retrieve the points from lores model for sans calculation
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  #Calculate I(Q) and P(r) 2D
+  pointsmodelpy.distdistribution_xy(lm,vp)
+  pointsmodelpy.outputPR_xy(lm,"out_xy.pr")
+  iq = iqPy.new_iq(100,0.001, 0.3)
+  pointsmodelpy.calculateIQ_2D(lm,iq,phi)
+  iqPy.OutputIQ(iq, "out_xy.iq")
+
+def get2d():
+  from math import pi
+  from Numeric import arange,zeros
+  from enthought.util.numerix import Float,zeros
+  from sansModeling.file2array import readfile2array
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.geoshapespy import geoshapespy
+
+  lm = pointsmodelpy.new_loresmodel(0.1)
+  sph = geoshapespy.new_sphere(20)
+  pointsmodelpy.lores_add(lm,sph,1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.distdistribution_xy(lm,vp)
+
+  value_grid = zeros((100,100),Float)
+  width, height = value_grid.shape
+  print width,height
+
+  I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002)
+  print I
+
+  Imax = 0
+  for i in range(width):
+    for j in range(height):
+      qx = float(i-50)/200.0
+      qy = float(j-50)/200.0
+      value_grid[i,j] = pointsmodelpy.calculateI_Qxy(lm,qx,qy)
+      if value_grid[i][j] > Imax:
+        Imax = value_grid[i][j]
+
+  for i in range(width):
+    for j in range(height):
+      value_grid[i][j] = value_grid[i][j]/Imax
+
+  value_grid[50,50] = 1
+  return value_grid
+
+def get2d_2():
+  from math import pi
+  from Numeric import arange,zeros
+  from enthought.util.numerix import Float,zeros
+  from sansModeling.file2array import readfile2array
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.geoshapespy import geoshapespy
+
+  lm = pointsmodelpy.new_loresmodel(0.1)
+  cyn = geoshapespy.new_cylinder(5,20)
+  geoshapespy.set_orientation(cyn,0,0,90)
+  pointsmodelpy.lores_add(lm,cyn,1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.distdistribution_xy(lm,vp)
+
+  value_grid = zeros((100,100),Float)
+  width, height = value_grid.shape
+  print width,height
+
+  I = pointsmodelpy.calculateI_Qxy(lm,0.00001,0.000002)
+  print I
+
+  Imax = 0
+  for i in range(width):
+    for j in range(height):
+      qx = float(i-50)/200.0
+      qy = float(j-50)/200.0
+      value_grid[i,j] = pointsmodelpy.calculateI_Qxy(lm,qx,qy)
+      if value_grid[i][j] > Imax:
+        Imax = value_grid[i][j]
+
+  for i in range(width):
+    for j in range(height):
+      value_grid[i][j] = value_grid[i][j]/Imax
+
+  value_grid[50,50] = 1
+  return value_grid
+  
+if __name__ == "__main__":
+
+  print "start to test lores 2D"
+#  test_lores2d(10)
+  value_grid = get2d_2()
+  print value_grid
+  print "pass"
Index: realSpaceModeling/pointsmodelpy/tests/testnegativepr.py
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testnegativepr.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testnegativepr.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,16 @@
+if __name__ == "__main__":
+  from sansModeling.pointsmodelpy import pointsmodelpy
+  from sansModeling.iqPy import iqPy
+  from sansModeling.geoshapespy import geoshapespy
+
+  a = geoshapespy.new_sphere(10)
+  lm = pointsmodelpy.new_loresmodel(0.0005)
+  pointsmodelpy.lores_add(lm,a,1.0)
+  b = geoshapespy.new_sphere(20)
+  geoshapespy.set_center(b,20,20,20)
+  pointsmodelpy.lores_add(lm,b,-1.0)
+
+  vp = pointsmodelpy.new_point3dvec()
+  pointsmodelpy.get_lorespoints(lm,vp)
+
+  pointsmodelpy.get_lores_pr(lm,vp)
Index: realSpaceModeling/pointsmodelpy/tests/testpdb.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/tests/testpdb.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/tests/testpdb.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,42 @@
+#include "pdb_model.h"
+#include "Point3D.h"
+#include <vector>
+#include <string>
+#include "iq.h"
+
+typedef vector<Point3D> PointsVector;
+
+int main(){
+
+  //Test PDB with adding one normal pdb file
+  PointsVector vp;
+  IQ iq(100,0.001,0.3);
+
+  string name("test.pdb");
+
+  //initialize a PDBModel with a pdb file name
+  PDBModel mpdb;
+  mpdb.AddPDB(name);
+  //parse coordinates in pdb file into a vector
+  //of points
+  mpdb.GetPoints(vp);
+  //output the vector of points into a pseudo pdb
+  //file, for testing only
+  mpdb.OutputPDB(vp,"testpdb.pdb");
+  mpdb.DistDistribution(vp);
+  mpdb.OutputPR("test.pr");
+  mpdb.CalculateIQ(&iq);
+  iq.OutputIQ("test.iq");
+  cout << "check test.pr and test.iq files" <<endl;
+
+
+  //second test: add second pdb file
+  vector<Point3D> vp2;
+  string second("test2.pdb");
+  mpdb.AddPDB(second);
+  mpdb.GetPoints(vp2);
+  mpdb.OutputPDB(vp2,"testpdb2.pdb");
+  cout <<"check whether testpdb2.pdb has 12 points" <<endl;
+
+  return 0;
+}
Index: realSpaceModeling/setup_adpt.py
===================================================================
--- realSpaceModeling/setup_adpt.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/setup_adpt.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+
+
+def preparePackage( package, sourceRoot = "." ):
+
+    import os
+    isNT = os.name=='nt'
+    
+    package.changeRoot( sourceRoot )
+
+    #------------------------------------------------------------
+    #dependencies
+    #
+    #------------------------------------------------------------
+    from distutils_adpt.paths.Paths import Paths
+
+    #--------------------------------------------------------
+    # now add subdirs
+    #
+    #iqPy
+    package.addPurePython(
+        sourceDir = 'iqPy/iqPy',
+        destModuleName = 'sansModeling.iqPy' )
+
+    clibLibs = []
+
+    package.addCLib(
+        headerExportDir = '.',
+        libName = 'sansModeling_libiqPy',
+        libDir = 'iqPy/libiqPy',
+        libs = clibLibs,
+        libdirs = [],
+        include_dirs = ['libiqPy/tnt'],
+        macros = [('BLD_PROCEDURE',None)],
+        linkArgs = [] )
+
+    #module
+    modMacroList = [('BLD_PROCEDURE',None)]
+        
+    modLibs = clibLibs + ["sansModeling_libiqPy"]
+
+    package.addModule(
+        moduleDir = 'iqPy/iqPymodule',
+        libs = modLibs,
+        libdirs = [],
+        include_dirs = [],
+##         macros = [('BLD_PROCEDURE',None)],
+        macros = modMacroList,
+        dest = 'sansModeling.iqPy.iqPy' )
+
+    #--------------------------------------------------------
+    # now add subdirs
+    #
+    #geoshapepy
+    package.addPurePython(
+        sourceDir = 'geoshapespy/geoshapespy',
+        destModuleName = 'sansModeling.geoshapespy' )
+
+    clibLibs = ["sansModeling_libiqPy"]
+
+    package.addCLib(
+        headerExportDir = '.',
+        libName = 'libgeoshapespy',
+        libDir = 'geoshapespy/libgeoshapespy',
+        libs = clibLibs,
+        libdirs = [],
+        include_dirs = [''],
+        macros = [('BLD_PROCEDURE',None)],
+        linkArgs = [] )
+
+    #module
+    modMacroList = [('BLD_PROCEDURE',None)]
+        
+    modLibs = clibLibs + ["libgeoshapespy"]
+
+    package.addModule(
+        moduleDir = 'geoshapespy/geoshapespymodule',
+        libs = modLibs,
+        libdirs = [],
+##         macros = [('BLD_PROCEDURE',None)],
+        macros = modMacroList,
+        dest = 'sansModeling.geoshapespy.geoshapespy' )
+
+    #--------------------------------------------------------
+    # now add subdirs
+    #
+    #analmodel
+    package.addPurePython(
+        sourceDir = 'analmodelpy/analmodelpy',
+        destModuleName = 'sansModeling.analmodelpy' )
+
+    clibLibs = ["sansModeling_libiqPy", "libgeoshapespy"]
+
+    package.addCLib(
+        headerExportDir = '.',
+        libName = 'libanalmodelpy',
+        libDir = 'analmodelpy/libanalmodelpy',
+        libs = clibLibs,
+        libdirs = [],
+        include_dirs = [''],
+        macros = [('BLD_PROCEDURE',None)],
+        linkArgs = [] )
+
+    #module
+    modMacroList = [('BLD_PROCEDURE',None)]
+        
+    modLibs = clibLibs + ["libanalmodelpy"]
+
+    package.addModule(
+        moduleDir = 'analmodelpy/analmodelpymodule',
+        libs = modLibs,
+        libdirs = [],
+##         macros = [('BLD_PROCEDURE',None)],
+        macros = modMacroList,
+        dest = 'sansModeling.analmodelpy.analmodelpy' )
+
+
+    #--------------------------------------------------------
+    # now add subdirs
+    #
+    #pointsmodel
+    package.addPurePython(
+        sourceDir = 'pointsmodelpy/pointsmodelpy',
+        destModuleName = 'sansModeling.pointsmodelpy' )
+
+    clibLibs = ["sansModeling_libiqPy", "libgeoshapespy"]
+
+    package.addCLib(
+        headerExportDir = '.',
+        libName = 'libpointsmodelpy',
+        libDir = 'pointsmodelpy/libpointsmodelpy',
+        libs = clibLibs,
+        libdirs = [],
+        include_dirs = [''],
+        macros = [('BLD_PROCEDURE',None)],
+        linkArgs = [] )
+
+    #module
+    modMacroList = [('BLD_PROCEDURE',None)]
+        
+    modLibs = clibLibs + ["libpointsmodelpy"]
+
+    package.addModule(
+        moduleDir = 'pointsmodelpy/pointsmodelpymodule',
+        libs = modLibs,
+        libdirs = [],
+##         macros = [('BLD_PROCEDURE',None)],
+        macros = modMacroList,
+        dest = 'sansModeling.pointsmodelpy.pointsmodelpy' )
+
+
+    package.addPurePython('.', destModuleName='sansModeling', recursive=0 )
+
+
+
+if __name__ == "__main__":
+    #------------------------------------------------------------
+    #init the package
+    from distutils_adpt.Package import Package
+    package = Package('sansModeling_RealSpace', '0.1')
+
+    preparePackage( package )
+
+    package.setup()
+
Index: realSpaceModeling/setup_noadpt.py
===================================================================
--- realSpaceModeling/setup_noadpt.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/setup_noadpt.py	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
@@ -0,0 +1,105 @@
+"""
+ Installation script for SANS models
+
+  - To compile and install:
+      python setup.py install
+  - To create distribution:
+      python setup.py bdist_wininst
+
+"""
+import sys, os
+from distutils.core import setup, Extension
+from distutils import util
+from distutils import sysconfig
+
+def get_c_files(path):
+    """
+        Utility function to return all files 
+        to be compiled in a directory
+    """
+    clist = []
+    for file in os.listdir(path):
+        if file.endswith(".cc") or file.endswith(".c"):
+            clist.append("%s/%s" % (path, file))
+    return clist
+
+# The temp directory that the compiled files will be put in
+tempdir = "build/temp."+util.get_platform()+'-'+sysconfig.get_python_version()
+if os.name=='nt':
+    tempdir += "/Release"
+
+# List of sub modules
+mod_list = ["iqPy", "geoshapespy", "pointsmodelpy", "analmodelpy"]
+
+# Define package directors, will be extended below
+pck_dirs = {"sansModeling":"."}
+
+# List of modules to install, will be extende below
+pck_list = ["sansModeling"]
+
+# List of python extensions, will be extended below
+exts = []
+
+# List of include dirs, will be extended below
+incl_dirs = ["iqPy/libiqPy/tnt"]
+
+# List of files to compile, per module, will be extended below
+file_list = {}
+
+# List of dependencies
+deps = {}
+deps["iqPy"] = []
+deps["geoshapespy"] = ["iqPy"]
+deps["analmodelpy"] = ["iqPy", "geoshapespy"]
+deps["pointsmodelpy"] = ["iqPy", "geoshapespy"]
+
+# List of extra objects to link with, per module, will be extended below 
+libs = {}
+
+for module in mod_list:
+    pck_dirs["sansModeling.%s" % module] = "%s/%s" % (module, module)
+    pck_list.append("sansModeling.%s" % module)
+
+    src_m = "%s/%smodule" % (module, module)
+    src_l = "%s/lib%s" % (module, module)
+
+    files = get_c_files(src_m)
+    list_lib = get_c_files(src_l)
+
+    libs[module] = []    
+    for dep in deps[module]:
+        
+        for f in get_c_files("%s/lib%s" % (dep, dep)):
+            index = f.rindex('.')
+            if os.name=='nt':
+                fo = f[:index]+'.obj'
+            else:
+                fo = f[:index]+'.o'
+            libs[module].append("%s/%s" %(tempdir,fo))
+        
+    files.extend(list_lib)
+    file_list[module] = files
+    
+    incl_dirs.append(src_m)
+    incl_dirs.append(src_l)
+    
+for module in mod_list:
+    exts.append( Extension("sansModeling.%s.%s" % (module, module),
+        sources = file_list[module],
+        extra_objects=libs[module],
+        include_dirs=incl_dirs) )
+
+setup(
+    name="realspacesimulation",
+    version = "0.2",
+    description = "Python module for SANS simulation",
+    author = "University of Tennessee",
+    url = "http://danse.us/trac/sans",
+    
+    package_dir = pck_dirs,
+    packages    = pck_list,
+    
+    ext_modules = exts)
+
+
+        
