diff --git a/.gitattributes b/.gitattributes
index a6344aac8c09253b3b630fb776ae94478aa0275b..b95721c65f3037b3fbad4812b7e980e2d0483576 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,35 +1,32 @@
-*.7z filter=lfs diff=lfs merge=lfs -text
-*.arrow filter=lfs diff=lfs merge=lfs -text
-*.bin filter=lfs diff=lfs merge=lfs -text
-*.bz2 filter=lfs diff=lfs merge=lfs -text
-*.ckpt filter=lfs diff=lfs merge=lfs -text
-*.ftz filter=lfs diff=lfs merge=lfs -text
-*.gz filter=lfs diff=lfs merge=lfs -text
-*.h5 filter=lfs diff=lfs merge=lfs -text
-*.joblib filter=lfs diff=lfs merge=lfs -text
-*.lfs.* filter=lfs diff=lfs merge=lfs -text
-*.mlmodel filter=lfs diff=lfs merge=lfs -text
-*.model filter=lfs diff=lfs merge=lfs -text
-*.msgpack filter=lfs diff=lfs merge=lfs -text
-*.npy filter=lfs diff=lfs merge=lfs -text
-*.npz filter=lfs diff=lfs merge=lfs -text
-*.onnx filter=lfs diff=lfs merge=lfs -text
-*.ot filter=lfs diff=lfs merge=lfs -text
-*.parquet filter=lfs diff=lfs merge=lfs -text
-*.pb filter=lfs diff=lfs merge=lfs -text
-*.pickle filter=lfs diff=lfs merge=lfs -text
-*.pkl filter=lfs diff=lfs merge=lfs -text
+*.ipynb linguist-vendored=false
+*.ipynb linguist-detectable=false
+/jupyter_notebooks linguist-vendored=false
+jupyter_notebooks/** linguist-vendored
+jupyter_notebooks/** linguist-vendored=false
+jupyter_notebooks/* linguist-vendored
+jupyter_notebooks/* linguist-vendored=false
*.pt filter=lfs diff=lfs merge=lfs -text
-*.pth filter=lfs diff=lfs merge=lfs -text
-*.rar filter=lfs diff=lfs merge=lfs -text
-*.safetensors filter=lfs diff=lfs merge=lfs -text
-saved_model/**/* filter=lfs diff=lfs merge=lfs -text
-*.tar.* filter=lfs diff=lfs merge=lfs -text
-*.tar filter=lfs diff=lfs merge=lfs -text
-*.tflite filter=lfs diff=lfs merge=lfs -text
-*.tgz filter=lfs diff=lfs merge=lfs -text
-*.wasm filter=lfs diff=lfs merge=lfs -text
-*.xz filter=lfs diff=lfs merge=lfs -text
-*.zip filter=lfs diff=lfs merge=lfs -text
-*.zst filter=lfs diff=lfs merge=lfs -text
-*tfevents* filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlow filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/NanoShaper filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/apbs filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/msms filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/tabipb filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libGeometricFlowLib.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libTABIPBlib.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_fem.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_generic.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_geoflow_apbs.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_mg.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_pmgc.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libapbs_routines.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libcgcode.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libgamer.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libgmock.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libgmock_main.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libgtest.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libgtest_main.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libiapbs.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libmaloc.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libmc.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libsuperlu.a filter=lfs diff=lfs merge=lfs -text
+model/comp_surface/tools/transfer/APBS-3.4.1.Linux/lib/libvf2c.a filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..3b8d727f8993dfbc002c2a9011b0b7d124ff17b0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,186 @@
+homework
+inference_out_dir_not_specified
+.plotly_cache
+.DS_store
+renew.sh
+tmux_renew.sh
+images
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+# tools
+comp_surface/tools/transfer
+comp_surface/tools/transfer/*
+./comp_surface/tools/transfer
+./comp_surface/tools/transfer/*
+# log file
+./*/*.log
+./*/*.LOG
+./*/*.txt
+**/*.txt
+esm
+esm/*
+# C extensions
+*.so
+.so3_*
+best_models/
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+local_config_inference2.yml
+.vscode/
+
+
+*.zip
+
+.idea/
+
+
+#################### Project specific
+.p.npy
+.score.npy
+# this ignores everything in data except for the file
+# !/data
+# /data/*
+# !/data/splits
+# !/data/protein_ligand_example_csv.csv
+# !/data/testset_csv.csv
+# !/data/INDEX_general_PL_data.2020
+test_run
+
+cache
+wandb
+logs
+
+# temporary files
+.openbabel_cache
+temp/
+bsub*
+stderr*
+stdout*
+!/workdir
+/workdir/*
+!/workdir/paper_confidence_model
+!/workdir/paper_score_model
+runs2
+results
+# this excludes everything in the runs directory except for that specific run
+!/runs
+/runs/*
+!/runs/rigid_redocking
+!/runs/flexible_self_docking
+local_config.yml
+local_config_inference.yml
+local_config_confidence.yml
+temp1.py
+temp5.py
+temp3.py
+temp4.py
+temp5.py
+temp6.py
+temp7.py
+esm
+fixed_pdbs
+fixed_pdbs/*
+# nohup files
+./*/*.out
+bash_scripts/*/*/*.out
+
+*result*
+
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4a86ea88c2122de728a1784d5db0e44a888961ba
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 infinite recursion
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..a751f0193fba69b97421f39d0a11bb81de5a9f79
--- /dev/null
+++ b/README.md
@@ -0,0 +1,447 @@
+---
+license: mit
+language:
+- en
+tags:
+- OneScience
+- SCNet
+- DCU
+- protein-ligand-docking
+- virtual-screening
+- diffusion-model
+frameworks:
+- PyTorch
+---
+
+
+ SurfDock
+
+
+# Model Introduction
+
+SurfDock is a surface-informed diffusion generative model for protein–ligand complex prediction and structure-based virtual screening. The model incorporates protein surface geometry and chemical information into the diffusion-based docking process to generate and screen protein–small-molecule binding conformations.
+
+Paper:
+
+> **SurfDock is a surface-informed diffusion generative model for reliable and accurate protein–ligand complex prediction**
+> Duanhua Cao, Mingan Chen, Rui Zhang, et al.
+> *Nature Methods*, 2024
+> DOI: https://doi.org/10.1038/s41592-024-02516-y
+
+# Model Description
+
+SurfDock is a surface-informed diffusion generative model for protein–ligand complex prediction and structure-based virtual screening. The model first preprocesses the target protein structure and computes geometric and physicochemical information on the protein surface. In parallel, it uses ESM to extract protein sequence representations, providing both structural and sequence information for subsequent ligand conformation generation.
+
+During inference, SurfDock uses a diffusion generative model to sample candidate ligand conformations within the protein binding site, and then evaluates and ranks the generated poses using a pose confidence model. For virtual screening tasks, a screening score model can be further applied to rescore candidate protein–ligand conformations, producing results that are better suited for downstream ranking and screening.
+
+By integrating protein surface information, protein language model representations, and diffusion-based conformation generation, SurfDock can be used for protein–ligand docking, candidate binding pose generation, pose scoring, and structure-based virtual screening.
+
+# Use Cases
+
+| Use Case | Description |
+| --- | --- |
+| Protein–ligand docking | Predict the binding conformation of a ligand within a protein binding site |
+| Structure-based virtual screening | Perform batch docking and scoring for small-molecule libraries |
+| Ligand conformation generation | Sample candidate binding poses using a diffusion model |
+| Protein surface modeling | Use protein surface geometry and physicochemical information to assist docking |
+
+
+# Usage Instructions
+
+## 1. OneCode Usage
+
+You can use the OneCode online environment for intelligent one-click AI4S programming:
+
+[Try intelligent one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
+
+## 2. Manual Installation and Usage
+
+### Hardware Requirements
+
+- SurfDock involves computationally intensive diffusion sampling, ESM representation extraction, and graph neural network computation. GPU/DCU acceleration is recommended.
+
+### Environment Setup
+
+#### DCU Environment
+
+```bash
+# Activate DTK and CONDA first
+conda create -n onescience311 python=3.11 -y
+conda activate onescience311
+
+pip install onescience[bio] \
+ -i http://mirrors.onescience.ai:3141/pypi/simple/ \
+ --trusted-host mirrors.onescience.ai
+```
+
+### Environment Notes
+
+- During actual execution, if dependencies are missing or version incompatibilities occur, refer to the dependency versions declared in `environment.yaml` in the repository root and install or adjust the corresponding dependencies as needed.
+- SurfDock's protein surface processing pipeline depends on PyMesh. If the current Python version is not fully compatible with the upstream PyMesh package, compatibility adjustments should be made according to the actual call relationships.
+
+
+### Weights and Data Preparation
+
+#### SurfDock Model Weights
+
+The current repository already includes the main model weights required for inference:
+
+```text
+weight/
+├── docking/
+│ ├── best_ema_inference_epoch_model.pt
+│ └── model_parameters.yml
+├── posepredict/
+│ ├── best_model.pt
+│ └── model_parameters.yml
+└── screen/
+ ├── best_model.pt
+ └── model_parameters.yml
+```
+
+Therefore, after downloading the complete repository, you generally do not need to download the main SurfDock model weights separately.
+
+Check:
+
+```bash
+ls -lh weight/docking/
+ls -lh weight/posepredict/
+ls -lh weight/screen/
+```
+
+#### ESM Model
+
+SurfDock uses ESM to extract protein sequence representations.
+
+Official installation method:
+
+```bash
+git clone https://github.com/facebookresearch/esm model/esm
+cd model/esm
+pip install -e .
+cd ../..
+```
+
+The official inference script uses:
+
+```text
+esm2_t33_650M_UR50D
+```
+
+and runs:
+
+```bash
+python model/esm/scripts/extract.py \
+ "esm2_t33_650M_UR50D" \
+ input.fasta \
+ output_dir \
+ --repr_layers 33 \
+ --include "per_tok" \
+ --truncation_seq_length 4096
+```
+
+to extract protein residue-level embeddings.
+
+- If the current environment cannot access the internet, it is recommended to cache the corresponding ESM weights in advance. `esm2_t33_650M_UR50D` requires the following two files:
+
+```text
+https://dl.fbaipublicfiles.com/fair-esm/models/esm2_t33_650M_UR50D.pt
+https://dl.fbaipublicfiles.com/fair-esm/regression/esm2_t33_650M_UR50D-contact-regression.pt
+```
+
+After downloading, it is recommended to place them in the current user's Torch Hub checkpoints cache directory:
+
+```text
+~/.cache/torch/hub/checkpoints/
+```
+
+The final file paths should be:
+
+```text
+~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D.pt
+~/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D-contact-regression.pt
+```
+
+#### PDBBind Data
+
+If you need to retrain SurfDock, you must obtain PDBBind separately. According to the official instructions, the preprocessed data previously provided by EquiBind is no longer publicly distributed due to PDBBind licensing restrictions, so users need to obtain and process the data themselves through the official PDBBind channels.
+
+After processing, place the data in:
+
+```text
+model/data/PDBBind_processed/
+```
+`model/data/splits/` contains data split information and is not equivalent to the complete PDBBind dataset.
+
+## 3. Quick Start
+
+### Download the Model Package
+
+```bash
+hf download \
+ OneScience-Group/SurfDock \
+ --local-dir ./SurfDock
+
+cd SurfDock
+```
+- SurfDock uses ESM to extract protein sequence representations, so the ESM model must be downloaded separately. See the Weights and Data Preparation section for details.
+
+# Example Data
+
+The current repository already provides docking and screening examples:
+
+```text
+model/data/eval_sample_dirs/
+model/data/Screen_sample_dirs/
+```
+
+When using your own data, organize the protein and ligand inputs according to the example directory structure, and modify the following paths in the corresponding bash scripts:
+
+```text
+data_dir
+surface_out_dir
+out_csv_file
+Screen_lib_path
+docking_out_dir
+```
+
+as needed.
+
+# Inference Examples
+
+The following commands are assumed to be executed from the SurfDock repository root directory.
+
+## Protein–Ligand Docking Example
+
+Run:
+
+```bash
+cd scripts/bash_scripts/test_scripts
+bash eval_samples.sh
+```
+
+The script mainly performs the following steps automatically:
+
+```text
+1. Preprocess the protein structure
+2. Compute the protein surface
+3. Build the inference input CSV
+4. Extract ESM embeddings
+5. Run SurfDock diffusion sampling
+6. Save docking results
+```
+
+Before running, it is recommended to check:
+
+```bash
+vim scripts/bash_scripts/test_scripts/eval_samples.sh
+```
+
+Pay particular attention to:
+
+```text
+gpu_string
+data_dir
+surface_out_dir
+out_csv_file
+esmbedding_dir
+docking_out_dir
+```
+
+Users also need to adjust the `CUDA_VISIBLE_DEVICES` and `accelerate launch` settings in the script according to the actual adaptation method.
+
+## Virtual Screening Example
+
+Run:
+
+```bash
+cd scripts/bash_scripts/test_scripts
+bash screen_pipeline.sh
+```
+
+Before running, check:
+
+```bash
+vim scripts/bash_scripts/test_scripts/screen_pipeline.sh
+```
+
+Modify the following as needed:
+
+```text
+gpu_string
+data_dir
+surface_out_dir
+out_csv_file
+esmbedding_dir
+Screen_lib_path
+docking_out_dir
+```
+
+Here, `Screen_lib_path` specifies the small-molecule library to be screened, for example the official sample:
+
+```text
+model/data/Screen_sample_dirs/test_samples/1a0q/1a0q_ligand_for_Screen.sdf
+```
+
+The screening workflow is mainly:
+
+```text
+Protein preprocessing
+ ↓
+Protein surface computation
+ ↓
+ESM embedding
+ ↓
+SurfDock generates candidate conformations
+ ↓
+Screen model rescoring
+ ↓
+Output screening results
+```
+
+## Skip Completed Protein Preprocessing
+
+This parameter can be modified in the following two scripts:
+
+```text
+scripts/bash_scripts/test_scripts/eval_samples.sh
+scripts/bash_scripts/test_scripts/screen_pipeline.sh
+```
+
+The scripts use:
+
+```bash
+target_have_processed=true
+```
+
+to control whether target preprocessing is skipped. When set to `true`, the scripts skip target protein preprocessing steps such as OpenBabel/reduce and proceed directly to subsequent surface computation, CSV construction, ESM embedding, and inference.
+
+To reprocess the target protein:
+
+```bash
+target_have_processed=false
+```
+
+When set to `false`, the scripts rerun the target protein preprocessing steps.
+
+## Generate ESM Embeddings Separately
+
+First, build the FASTA file:
+
+```bash
+python model/datasets/esm_embedding_preparation.py \
+ --out_file ./protein.fasta \
+ --protein_ligand_csv ./input.csv
+```
+
+Extract ESM representations:
+
+```bash
+python model/esm/scripts/extract.py \
+ "esm2_t33_650M_UR50D" \
+ ./protein.fasta \
+ ./esm_embedding_output \
+ --repr_layers 33 \
+ --include "per_tok" \
+ --truncation_seq_length 4096
+```
+
+Extract pocket embeddings:
+
+```bash
+python model/datasets/get_pocket_embedding.py \
+ --protein_pocket_csv ./input.csv \
+ --embeddings_dir ./esm_embedding_output \
+ --pocket_emb_save_dir ./esm_embedding_pocket_output
+```
+
+Merge them into the `.pt` file required for SurfDock inference:
+
+```bash
+python model/datasets/esm_pocket_embeddings_to_pt.py \
+ --esm_embeddings_path ./esm_embedding_pocket_output \
+ --output_path ./esm2_pocket_embeddings.pt
+```
+
+# Training Instructions
+
+## Retraining SurfDock
+
+Retraining requires preparing the PDBBind data first and completing protein surface and ESM embedding preprocessing.
+
+The training-related scripts are located in:
+
+```text
+scripts/bash_scripts/train_SurfDock_docking_module/
+```
+
+First, prepare the ESM embedding files required for training by following the "Generate ESM Embeddings Separately" section. The training script in the current repository is located at:
+
+```text
+scripts/bash_scripts/train_SurfDock_docking_module/train_SurfDock.sh
+```
+
+After completing the ESM embeddings, check the data, model, and output paths in `train_SurfDock.sh`, then run:
+
+```bash
+cd scripts/bash_scripts/train_SurfDock_docking_module
+bash train_SurfDock.sh
+```
+
+## Retraining SurfScore
+
+The SurfScore training script is located at:
+
+```text
+scripts/bash_scripts/train_SurfScore/train_SurfScore.sh
+```
+
+Before running, check the PDBBind data, cache, ESM embedding, output directory, and GPU parameters in the script, then run:
+
+```bash
+cd scripts/bash_scripts/train_SurfScore
+bash train_SurfScore.sh
+```
+
+# Output Description
+
+## Docking Output
+
+The docking results from `eval_samples.sh` are saved in the directory specified by `docking_out_dir` in the script.
+
+The main outputs include:
+
+```text
+Generated protein–ligand conformations
+Confidence/scoring results
+Runtime logs
+Intermediate CSV
+ESM embeddings
+Protein surface files
+```
+
+## Screening Output
+
+`screen_pipeline.sh` generates the screening results in `docking_out_dir` and uses:
+
+```text
+weight/screen/best_model.pt
+```
+
+to rescore the docking poses.
+
+The final results can be used to rank and screen candidate small molecules.
+
+# OneScience Official Information
+
+| Platform | OneScience Main Repository | Skills Repository |
+| --- | --- | --- |
+| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
+| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
+
+
+# Citation and License
+
+- The official SurfDock source code repository is released under the **MIT License**, which permits use, modification, distribution, sublicensing, and commercial use. The original copyright notice and MIT License text should be retained when copying or distributing the software.
+- PDBBind data is governed by its own license and terms of use. SurfDock's MIT License does not automatically apply to PDBBind data.
+- This repository is a **DCU-adapted version** of SurfDock, with adjustments to parts of the runtime environment, dependency configuration, and execution workflow. The use of the repository code, model weights, and related data remains subject to the licenses and terms of use of their respective original projects.
diff --git a/conf/params_example/example.yml b/conf/params_example/example.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5cebb5859df6174cb638239b3d53af25a0187cab
--- /dev/null
+++ b/conf/params_example/example.yml
@@ -0,0 +1,146 @@
+# This file is used to explain the meaning of the SurfDock parameters.
+# If you want to learn more about the options available for these parameters, please refer ./utils/parsing.py file
+# If the user wants to retrain the model, they can pick the right parameters to optimize in their own way
+## General arguments
+# CUDA optimization parameter for faster training
+cudnn_benchmark: true
+# use pin_memory or not in linux system
+pin_memory: false
+# restart dir for training, which storge the model and optimizer
+restart_dir: ~/SurfDock/workdir/project_surface_V3_PDBBind_ema_model_pocket_8A
+# restart learning rate
+restart_lr: null
+
+## dataset
+# training data dir
+data_dir: ~/PDBBIND/PDBBind_pocket_8A/
+# cache path for training data, if you just use SurfDock, you can ignore this
+cache_path: ~/PDBBIND/cache_Surface_PDBBIND_pocket_8A
+# esm embedding path,if this is set then the LM embeddings at that path will be used for the receptor features
+esm_embeddings_path: ~/PDBBIND/esm_embedding/esm_embedding_pocket_for_train/esm2_3billion_embeddings.pt
+# dataset split file
+split_test: ~/data/splits/timesplit_test
+split_train: ~/data/splits/timesplit_no_lig_overlap_train
+split_val: ~/data/splits/timesplit_no_lig_overlap_val
+# use rmsd matching or not,use default value is fine
+matching: true
+# Differential evolution maxiter parameter in matching
+matching_maxiter: 20
+# the number of workers for dataloader
+num_dataloader_workers: 1
+# the number of complexes to inference in validation set
+num_inference_complexes: 500
+# the number of workers for training
+num_workers: 1
+
+## model
+# if you want to use dynamic max cross, you can set this to true. this parameter can set a different max cross distance for each timestep
+dynamic_max_cross: true
+# scale the noise by sigma or not
+scale_by_sigma: true
+# Maximum sigma for rotational component
+rot_sigma_max: 1.55
+# Minimum sigma for rotational component
+rot_sigma_min: 0.03
+# Maximum sigma for torsional component
+tor_sigma_max: 3.14
+# Minimum sigma for torsional component
+tor_sigma_min: 0.0314
+# Maximum sigma for translational component
+tr_sigma_max: 5.0
+# Minimum sigma for translational component
+tr_sigma_min: 0.1
+# the weight of torsional component loss
+tor_weight: 0.33
+# the weight of translational component loss
+tr_weight: 0.33
+# the weight of rotational component loss
+rot_weight: 0.33
+# diffusion model type , default value is surface_score_model,when train a scoring model, you can use mdn_model
+model_type: surface_score_model
+# diffusion model version, use default value is 3
+model_version: version3
+# training epochs
+n_epochs: 2000
+# number of gaussians which used to MDN module for socring module
+n_gaussians: 20
+# use no batch norm or not
+no_batch_norm: false
+# use torsion or not ,default value is false
+no_torsion: false
+# the layer number of the model
+num_conv_layers: 6
+# the dimension of the scalar embedding in e3nn
+ns: 48
+# the dimension of the vector embedding in e3nn
+nv: 10
+# use the second order representation or not
+use_second_order_repr: false
+# embedding type
+embedding_type: sinusoidal
+# max number of neighbors for each atom in ligand graph
+max_radius: 5.0
+batch_size: 12 # batch size
+# the radius of the receptor graph
+receptor_radius: 15.0
+# max number of neighbors for each C-alpha atom(residue graph)
+c_alpha_max_neighbors: 24
+# Maxximum inter-distance about different node types
+cross_max_distance: 80
+# cross distance embed dimension
+cross_distance_embed_dim: 32
+# intra-distance embed dimension
+distance_embed_dim: 32
+# Size of the embedding of the diffusion time
+sigma_embed_dim: 32
+# Parameter of the diffusion time embedding
+embedding_scale: 1000
+# dropout rate for dropout layer in diffusion module
+dropout: 0.1
+# the dropout rate for scoring module
+mdn_dropout: 0.1
+# use the ema model or not
+use_ema: false
+# exponential moving average rate
+ema_rate: 0.999
+# learning rate ,use default value is fine
+lr: 0.001
+# the learning rate scheduler
+scheduler: plateau
+# the weight decay factor, use default value is fine
+w_decay: 0.0
+# the patience of the learning rate scheduler
+scheduler_patience: 50
+# earlystop goal use max or min
+inference_earlystop_goal: max
+# inference earlystop metric
+inference_earlystop_metric: valinf_rmsds_lt2
+# denoise steps in inference stage
+inference_steps: 20
+# the early stop goal for training scoring module
+mdn_early_stop_patience: 30
+# remove hydrogen or not
+remove_hs: true
+# validation inference frequency,default is 20 epochs
+val_inference_freq: 20
+# top-N atoms with the smallest distances with surface node for mdn calculate in scoring model
+topN: 1
+# predict bond type or not in training scoring model stage
+bond_type_prediction: true
+# atom type prediction or not in training scoring model stage
+atom_type_prediction: true
+
+## wandb log
+# use wandb to log or not
+wandb: true
+# wandb dir
+wandb_dir: ~/wandb/SurfDock
+# the project name in wandb
+project: SurfDock_V3_PDBBind_ema_model_pocket_8A
+# the run name in wandb
+run_name: project_surface_V3_PDBBind_ema_model_pocket_8A
+# dir of log files
+log_dir: ~/wandb/SurfDock/workdir
+
+
+
diff --git a/config.json b/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..fcdffc4e97ee119afdf67ed89536f5371baca191
--- /dev/null
+++ b/config.json
@@ -0,0 +1,17 @@
+{
+ "directories": {
+ "conf": "Environment files and example parameter files",
+ "model": "SurfDock source modules, bundled data, surface tools, and assets",
+ "scripts": "Python entry points and shell workflows",
+ "weight": "Pretrained SurfDock, pose prediction, and screening weights"
+ },
+ "entrypoints": {
+ "inference": "scripts/inference_accelerate.py",
+ "evaluate": "scripts/evaluate_accelarate.py",
+ "score_in_place": "scripts/evaluate_score_in_place.py",
+ "train_docking": "scripts/train_accelarete.py",
+ "train_score": "scripts/train_mdn_accelarete.py"
+ },
+ "source": "model",
+ "weights": "weight"
+}
diff --git a/environment.yaml b/environment.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..90dbd744d241f931a8a662a8b35e96e9bd5ba488
--- /dev/null
+++ b/environment.yaml
@@ -0,0 +1,434 @@
+name: SurfDock
+channels:
+ - mx
+ - pyg
+ - pytorch
+ - nvidia
+ - defaults
+ - conda-forge
+dependencies:
+ - _libgcc_mutex=0.1=conda_forge
+ - _openmp_mutex=4.5=2_kmp_llvm
+ - aiohttp=3.9.3=py310h2372a71_1
+ - aiosignal=1.3.1=pyhd8ed1ab_0
+ - ambertools=22.5=py310hd182041_0
+ - annotated-types=0.6.0=pyhd8ed1ab_0
+ - anyio=4.3.0=pyhd8ed1ab_0
+ - archspec=0.2.3=pyhd8ed1ab_0
+ - argon2-cffi=23.1.0=pyhd8ed1ab_0
+ - argon2-cffi-bindings=21.2.0=py310h2372a71_4
+ - arpack=3.7.0=hdefa2d7_2
+ - arrow=1.3.0=pyhd8ed1ab_0
+ - asttokens=2.4.1=pyhd8ed1ab_0
+ - astunparse=1.6.3=pyhd8ed1ab_0
+ - async-lru=2.0.4=pyhd8ed1ab_0
+ - async-timeout=4.0.3=pyhd8ed1ab_0
+ - attrs=23.2.0=pyh71513ae_0
+ - babel=2.13.1=pyhd8ed1ab_0
+ - beautifulsoup4=4.12.3=pyha770c72_0
+ - biopandas=0.4.1=pyhd8ed1ab_1
+ - blas=2.116=mkl
+ - blas-devel=3.9.0=16_linux64_mkl
+ - bleach=6.1.0=pyhd8ed1ab_0
+ - blosc=1.21.5=hc2324a3_1
+ - boltons=24.0.0=pyhd8ed1ab_0
+ - boost=1.78.0=py310hcb52e73_5
+ - boost-cpp=1.78.0=h2c5509c_4
+ - brotli=1.1.0=hd590300_1
+ - brotli-bin=1.1.0=hd590300_1
+ - brotli-python=1.1.0=py310hc6cd4ac_1
+ - bson=0.5.9=py_0
+ - bzip2=1.0.8=hd590300_5
+ - c-ares=1.28.1=hd590300_0
+ - c-blosc2=2.14.4=hb4ffafa_1
+ - ca-certificates=2024.8.30=hbcca054_0
+ - cached-property=1.5.2=hd8ed1ab_1
+ - cached_property=1.5.2=pyha770c72_1
+ - cachetools=5.3.3=pyhd8ed1ab_0
+ - cairo=1.18.0=h3faef2a_0
+ - certifi=2024.8.30=pyhd8ed1ab_0
+ - cffi=1.16.0=py310h2fee648_0
+ - charset-normalizer=3.3.2=pyhd8ed1ab_0
+ - colorama=0.4.6=pyhd8ed1ab_0
+ - comm=0.2.2=pyhd8ed1ab_0
+ - conda=24.5.0=py310h06a4308_0
+ - conda-libmamba-solver=24.1.0=pyhd8ed1ab_0
+ - conda-package-handling=2.2.0=pyh38be061_0
+ - conda-package-streaming=0.9.0=pyhd8ed1ab_0
+ - contourpy=1.2.1=py310hd41b1e2_0
+ - cuda-cudart=12.1.105=0
+ - cuda-cupti=12.1.105=0
+ - cuda-libraries=12.1.0=0
+ - cuda-nvrtc=12.1.105=0
+ - cuda-nvtx=12.1.105=0
+ - cuda-opencl=12.4.127=0
+ - cuda-runtime=12.1.0=0
+ - cudatoolkit=11.8.0=h4ba93d1_13
+ - cycler=0.12.1=pyhd8ed1ab_0
+ - cython=3.0.10=py310hc6cd4ac_0
+ - debugpy=1.8.1=py310hc6cd4ac_0
+ - decorator=5.1.1=pyhd8ed1ab_0
+ - defusedxml=0.7.1=pyhd8ed1ab_0
+ - distro=1.9.0=pyhd8ed1ab_0
+ - entrypoints=0.4=pyhd8ed1ab_0
+ - exceptiongroup=1.2.0=pyhd8ed1ab_2
+ - executing=2.0.1=pyhd8ed1ab_0
+ - expat=2.6.2=h59595ed_0
+ - ffmpeg=4.3=hf484d3e_0
+ - fftw=3.3.10=nompi_hc118613_108
+ - filelock=3.13.4=pyhd8ed1ab_0
+ - fmt=10.2.1=h00ab1b0_0
+ - font-ttf-dejavu-sans-mono=2.37=hab24e00_0
+ - font-ttf-inconsolata=3.000=h77eed37_0
+ - font-ttf-source-code-pro=2.038=h77eed37_0
+ - font-ttf-ubuntu=0.83=h77eed37_1
+ - fontconfig=2.14.2=h14ed4e7_0
+ - fonts-conda-ecosystem=1=0
+ - fonts-conda-forge=1=0
+ - fonttools=4.51.0=py310h2372a71_0
+ - fqdn=1.5.1=pyhd8ed1ab_0
+ - freetype=2.12.1=h267a509_2
+ - frozendict=2.4.2=py310h5eee18b_0
+ - frozenlist=1.4.1=py310h2372a71_0
+ - fsspec=2024.3.1=pyhca7485f_0
+ - gmp=6.3.0=h59595ed_1
+ - gmpy2=2.1.2=py310h3ec546c_1
+ - gnutls=3.6.13=h85f3911_1
+ - greenlet=3.0.3=py310hc6cd4ac_0
+ - h11=0.14.0=pyhd8ed1ab_0
+ - h2=4.1.0=pyhd8ed1ab_0
+ - hdf4=4.2.15=h9772cbc_5
+ - hdf5=1.14.3=nompi_h4f84152_100
+ - hpack=4.0.0=pyh9f0ad1d_0
+ - httpcore=1.0.5=pyhd8ed1ab_0
+ - httpx=0.27.0=pyhd8ed1ab_0
+ - hyperframe=6.0.1=pyhd8ed1ab_0
+ - icu=73.2=h59595ed_0
+ - idna=3.6=pyhd8ed1ab_0
+ - importlib-metadata=7.1.0=pyha770c72_0
+ - importlib_metadata=7.1.0=hd8ed1ab_0
+ - importlib_resources=6.4.0=pyhd8ed1ab_0
+ - ipykernel=6.29.3=pyhd33586a_0
+ - ipython=8.22.2=pyh707e725_0
+ - ipywidgets=8.1.2=pyhd8ed1ab_0
+ - isoduration=20.11.0=pyhd8ed1ab_0
+ - jedi=0.19.1=pyhd8ed1ab_0
+ - jinja2=3.1.3=pyhd8ed1ab_0
+ - joblib=1.4.0=pyhd8ed1ab_0
+ - jpeg=9e=h166bdaf_2
+ - json5=0.9.24=pyhd8ed1ab_0
+ - jsonpatch=1.33=pyhd8ed1ab_0
+ - jsonpointer=2.4=py310hff52083_3
+ - jsonschema=4.21.1=pyhd8ed1ab_0
+ - jsonschema-specifications=2023.12.1=pyhd8ed1ab_0
+ - jsonschema-with-format-nongpl=4.21.1=pyhd8ed1ab_0
+ - jupyter-lsp=2.2.5=pyhd8ed1ab_0
+ - jupyter_client=8.6.1=pyhd8ed1ab_0
+ - jupyter_core=5.7.2=py310hff52083_0
+ - jupyter_events=0.10.0=pyhd8ed1ab_0
+ - jupyter_server=2.14.0=pyhd8ed1ab_0
+ - jupyter_server_terminals=0.5.3=pyhd8ed1ab_0
+ - jupyterlab=4.1.6=pyhd8ed1ab_0
+ - jupyterlab_pygments=0.3.0=pyhd8ed1ab_1
+ - jupyterlab_server=2.26.0=pyhd8ed1ab_0
+ - jupyterlab_widgets=3.0.10=pyhd8ed1ab_0
+ - keyutils=1.6.1=h166bdaf_0
+ - kiwisolver=1.4.5=py310hd41b1e2_1
+ - krb5=1.21.2=h659d440_0
+ - lame=3.100=h166bdaf_1003
+ - lcms2=2.12=hddcbb42_0
+ - ld_impl_linux-64=2.40=h41732ed_0
+ - lerc=3.0=h9c3ff4c_0
+ - libaec=1.1.3=h59595ed_0
+ - libarchive=3.7.2=h2aa1ff5_1
+ - libblas=3.9.0=16_linux64_mkl
+ - libbrotlicommon=1.1.0=hd590300_1
+ - libbrotlidec=1.1.0=hd590300_1
+ - libbrotlienc=1.1.0=hd590300_1
+ - libcblas=3.9.0=16_linux64_mkl
+ - libcublas=12.1.0.26=0
+ - libcufft=11.0.2.4=0
+ - libcufile=1.9.1.3=0
+ - libcurand=10.3.5.147=0
+ - libcurl=8.7.1=hca28451_0
+ - libcusolver=11.4.4.55=0
+ - libcusparse=12.0.2.55=0
+ - libdeflate=1.10=h7f98852_0
+ - libedit=3.1.20191231=he28a2e2_2
+ - libev=4.33=hd590300_2
+ - libexpat=2.6.2=h59595ed_0
+ - libffi=3.4.2=h7f98852_5
+ - libgcc=14.2.0=h77fa898_1
+ - libgcc-ng=14.2.0=h69a702a_1
+ - libgfortran-ng=13.2.0=h69a702a_5
+ - libgfortran5=13.2.0=ha4646dd_5
+ - libglib=2.80.0=hf2295e7_4
+ - libgomp=14.2.0=h77fa898_1
+ - libhwloc=2.9.3=default_h554bfaf_1009
+ - libiconv=1.17=hd590300_2
+ - libjpeg-turbo=2.0.0=h9bf148f_0
+ - liblapack=3.9.0=16_linux64_mkl
+ - liblapacke=3.9.0=16_linux64_mkl
+ - libmamba=1.5.8=had39da4_0
+ - libmambapy=1.5.8=py310h39ff949_0
+ - libnetcdf=4.9.2=nompi_h9612171_113
+ - libnghttp2=1.58.0=h47da74e_1
+ - libnpp=12.0.2.50=0
+ - libnsl=2.0.1=hd590300_0
+ - libnvjitlink=12.1.105=0
+ - libnvjpeg=12.1.1.14=0
+ - libpng=1.6.43=h2797004_0
+ - libsodium=1.0.18=h36c2ea0_1
+ - libsolv=0.7.28=hfc55251_2
+ - libsqlite=3.45.2=h2797004_0
+ - libssh2=1.11.0=h0841786_0
+ - libstdcxx-ng=13.2.0=h7e041cc_5
+ - libtiff=4.3.0=h0fcbabc_4
+ - libuuid=2.38.1=h0b41bf4_0
+ - libwebp-base=1.3.2=hd590300_1
+ - libxcb=1.15=h0b41bf4_0
+ - libxcrypt=4.4.36=hd590300_1
+ - libxml2=2.12.6=h232c23b_1
+ - libxslt=1.1.39=h76b75d6_0
+ - libzip=1.10.1=h2629f0a_3
+ - libzlib=1.2.13=hd590300_5
+ - lightning-utilities=0.11.2=pyhd8ed1ab_0
+ - llvm-openmp=15.0.7=h0cdce71_0
+ - loguru=0.7.2=py310hff52083_2
+ - lxml=5.1.0=py310hcfd0673_0
+ - lz4-c=1.9.4=hcb278e6_0
+ - lzo=2.10=h516909a_1000
+ - mamba=1.5.8=py310h51d5547_0
+ - markupsafe=2.1.5=py310h2372a71_0
+ - matplotlib-base=3.8.4=py310h62c0568_0
+ - matplotlib-inline=0.1.6=pyhd8ed1ab_0
+ - mda-xdrlib=0.2.0=pyhd8ed1ab_0
+ - mdtraj=1.9.9=py310h523e8d7_1
+ - menuinst=2.0.2=py310hff52083_0
+ - mistune=3.0.2=pyhd8ed1ab_0
+ - mkl=2022.1.0=h84fe81f_915
+ - mkl-devel=2022.1.0=ha770c72_916
+ - mkl-include=2022.1.0=h84fe81f_915
+ - mpc=1.3.1=hfe3b2da_0
+ - mpfr=4.2.1=h9458935_1
+ - mpmath=1.3.0=pyhd8ed1ab_0
+ - multidict=6.0.5=py310h2372a71_0
+ - munkres=1.1.4=pyh9f0ad1d_0
+ - nbclient=0.10.0=pyhd8ed1ab_0
+ - nbconvert-core=7.16.3=pyhd8ed1ab_1
+ - nbformat=5.10.4=pyhd8ed1ab_0
+ - ncurses=6.4.20240210=h59595ed_0
+ - nest-asyncio=1.6.0=pyhd8ed1ab_0
+ - netcdf-fortran=4.6.1=nompi_hacb5139_103
+ - nettle=3.6=he412f7d_0
+ - networkx=3.2=pyhd8ed1ab_0
+ - notebook=7.1.2=pyhd8ed1ab_0
+ - notebook-shim=0.2.4=pyhd8ed1ab_0
+ - ocl-icd=2.3.2=hd590300_1
+ - ocl-icd-system=1.0.0=1
+ - olefile=0.47=pyhd8ed1ab_0
+ - openbabel=3.1.1=py310hbff9852_9
+ - openff-amber-ff-ports=0.0.4=pyhca7485f_0
+ - openff-forcefields=2024.03.0=pyhca7485f_0
+ - openff-interchange=0.3.25=pyhd8ed1ab_1
+ - openff-interchange-base=0.3.25=pyhd8ed1ab_1
+ - openff-models=0.1.2=pyhca7485f_0
+ - openff-toolkit=0.15.2=pyhd8ed1ab_0
+ - openff-toolkit-base=0.15.2=pyhd8ed1ab_0
+ - openff-units=0.2.2=pyhca7485f_0
+ - openff-utilities=0.1.12=pyhd8ed1ab_0
+ - openh264=2.1.1=h780b84a_0
+ - openjpeg=2.5.0=h7d73246_0
+ - openmm=8.1.1=py310h43b6314_1
+ - openmmforcefields=0.12.0=pyhd8ed1ab_0
+ - openssl=3.4.0=hb9d3cd8_0
+ - overrides=7.7.0=pyhd8ed1ab_0
+ - packaging=24.0=pyhd8ed1ab_0
+ - packmol=20.010=h86c2bf4_0
+ - pandas=2.1.2=py310hcc13569_0
+ - pandocfilters=1.5.0=pyhd8ed1ab_0
+ - panedr=0.8.0=pyhd8ed1ab_0
+ - parmed=4.2.2=py310hc6cd4ac_1
+ - parso=0.8.4=pyhd8ed1ab_0
+ - pcre2=10.43=hcad00b1_0
+ - pdbfixer=1.9=pyh1a96a4e_0
+ - perl=5.32.1=7_hd590300_perl5
+ - pexpect=4.9.0=pyhd8ed1ab_0
+ - pickleshare=0.7.5=py_1003
+ - pillow=8.4.0=py310h07f4688_0
+ - pint=0.23=pyhd8ed1ab_0
+ - pip=24.0=pyhd8ed1ab_0
+ - pixman=0.43.2=h59595ed_0
+ - pkgutil-resolve-name=1.3.10=pyhd8ed1ab_1
+ - platformdirs=4.2.0=pyhd8ed1ab_0
+ - pluggy=1.4.0=pyhd8ed1ab_0
+ - plyfile=1.0.1=pyhd8ed1ab_0
+ - prody=2.4.0=py310heca2aa9_0
+ - prometheus_client=0.20.0=pyhd8ed1ab_0
+ - prompt-toolkit=3.0.42=pyha770c72_0
+ - psutil=5.9.8=py310h2372a71_0
+ - pthread-stubs=0.4=h36c2ea0_1001
+ - ptyprocess=0.7.0=pyhd3deb0d_0
+ - pure_eval=0.2.2=pyhd8ed1ab_0
+ - py-cpuinfo=9.0.0=pyhd8ed1ab_0
+ - pybind11-abi=4=hd8ed1ab_3
+ - pycairo=1.26.0=py310hda9f760_0
+ - pycosat=0.6.6=py310h2372a71_0
+ - pycparser=2.22=pyhd8ed1ab_0
+ - pydantic=2.7.0=pyhd8ed1ab_0
+ - pydantic-core=2.18.1=py310hcb5633a_0
+ - pyedr=0.8.0=pyhd8ed1ab_0
+ - pyg=2.5.2=py310_torch_2.2.0_cu121
+ - pygments=2.17.2=pyhd8ed1ab_0
+ - pyparsing=3.1.2=pyhd8ed1ab_0
+ - pysocks=1.7.1=pyha2e5f31_6
+ - pytables=3.9.2=py310hd76cd5d_2
+ - python=3.10.0=h543edf9_3_cpython
+ - python-constraint=1.4.0=py_0
+ - python-dateutil=2.9.0=pyhd8ed1ab_0
+ - python-fastjsonschema=2.19.1=pyhd8ed1ab_0
+ - python-json-logger=2.0.7=pyhd8ed1ab_0
+ - python-tzdata=2024.1=pyhd8ed1ab_0
+ - python_abi=3.10=4_cp310
+ - pytorch=2.2.2=py3.10_cuda12.1_cudnn8.9.2_0
+ - pytorch-cuda=12.1=ha16c6d3_5
+ - pytorch-mutex=1.0=cuda
+ - pytz=2024.1=pyhd8ed1ab_0
+ - pyyaml=6.0.1=py310h2372a71_1
+ - pyzmq=25.1.2=py310h795f18f_0
+ - readline=8.2=h8228510_1
+ - reduce=3.24=0
+ - referencing=0.34.0=pyhd8ed1ab_0
+ - reportlab=3.5.68=py310h94fcab3_1
+ - reproc=14.2.4.post0=hd590300_1
+ - reproc-cpp=14.2.4.post0=h59595ed_1
+ - requests=2.31.0=pyhd8ed1ab_0
+ - rfc3339-validator=0.1.4=pyhd8ed1ab_0
+ - rfc3986-validator=0.1.1=pyh9f0ad1d_0
+ - rpds-py=0.18.0=py310hcb5633a_0
+ - ruamel.yaml=0.18.6=py310h2372a71_0
+ - ruamel.yaml.clib=0.2.8=py310h2372a71_0
+ - scipy=1.8.1=py310hdfbd76f_2
+ - send2trash=1.8.3=pyh0d859eb_0
+ - setuptools=69.2.0=pyhd8ed1ab_0
+ - six=1.16.0=pyh6c4a22f_0
+ - smirnoff99frosst=1.1.0=pyh44b312d_0
+ - snappy=1.2.0=hdb0a2a9_1
+ - sniffio=1.3.1=pyhd8ed1ab_0
+ - soupsieve=2.5=pyhd8ed1ab_1
+ - sqlalchemy=2.0.29=py310h2372a71_0
+ - sqlite=3.45.2=h2c6b66d_0
+ - stack_data=0.6.2=pyhd8ed1ab_0
+ - sympy=1.12=pypyh9d50eac_103
+ - tbb=2021.11.0=h00ab1b0_1
+ - terminado=0.18.1=pyh0d859eb_0
+ - threadpoolctl=3.4.0=pyhc1e730c_0
+ - tinycss2=1.2.1=pyhd8ed1ab_0
+ - tinydb=4.8.0=pyhd8ed1ab_0
+ - tk=8.6.13=noxft_h4845f30_101
+ - tomli=2.0.1=pyhd8ed1ab_0
+ - torch-ema=0.3=pyhd8ed1ab_0
+ - torchaudio=2.2.2=py310_cu121
+ - torchmetrics=1.2.1=pyhd8ed1ab_0
+ - torchtriton=2.2.0=py310
+ - torchvision=0.17.2=py310_cu121
+ - tornado=6.4=py310h2372a71_0
+ - tqdm=4.66.2=pyhd8ed1ab_0
+ - traitlets=5.14.2=pyhd8ed1ab_0
+ - truststore=0.8.0=pyhd8ed1ab_0
+ - types-python-dateutil=2.9.0.20240316=pyhd8ed1ab_0
+ - typing-extensions=4.11.0=hd8ed1ab_0
+ - typing_extensions=4.11.0=pyha770c72_0
+ - typing_utils=0.1.0=pyhd8ed1ab_0
+ - tzdata=2024a=h0c530f3_0
+ - unicodedata2=15.1.0=py310h2372a71_0
+ - uri-template=1.3.0=pyhd8ed1ab_0
+ - urllib3=2.2.1=pyhd8ed1ab_0
+ - validators=0.28.0=pyhd8ed1ab_0
+ - wcwidth=0.2.13=pyhd8ed1ab_0
+ - webcolors=1.13=pyhd8ed1ab_0
+ - webencodings=0.5.1=pyhd8ed1ab_2
+ - websocket-client=1.7.0=pyhd8ed1ab_0
+ - wheel=0.43.0=pyhd8ed1ab_1
+ - widgetsnbextension=4.0.10=pyhd8ed1ab_0
+ - xmltodict=0.13.0=pyhd8ed1ab_0
+ - xorg-kbproto=1.0.7=h7f98852_1002
+ - xorg-libice=1.1.1=hd590300_0
+ - xorg-libsm=1.2.4=h7391055_0
+ - xorg-libx11=1.8.9=h8ee46fc_0
+ - xorg-libxau=1.0.11=hd590300_0
+ - xorg-libxdmcp=1.1.3=h7f98852_0
+ - xorg-libxext=1.3.4=h0b41bf4_2
+ - xorg-libxrender=0.9.11=hd590300_0
+ - xorg-libxt=1.3.0=hd590300_1
+ - xorg-renderproto=0.11.1=h7f98852_1002
+ - xorg-xextproto=7.3.0=h0b41bf4_1003
+ - xorg-xproto=7.0.31=h7f98852_1007
+ - xz=5.2.6=h166bdaf_0
+ - yaml=0.2.5=h7f98852_2
+ - yaml-cpp=0.8.0=h59595ed_0
+ - yarl=1.9.4=py310h2372a71_0
+ - zeromq=4.3.5=h59595ed_1
+ - zipp=3.17.0=pyhd8ed1ab_0
+ - zlib=1.2.13=hd590300_5
+ - zlib-ng=2.0.7=h0b41bf4_0
+ - zstandard=0.22.0=py310h1275a96_0
+ - zstd=1.5.5=hfc55251_0
+ - pip:
+ - accelerate==0.15.0
+ - amberlite==22.0
+ - amberutils==21.0
+ - appdirs==1.4.4
+ - biopython==1.79
+ - click==8.1.7
+ - dimorphite-dl==1.3.2
+ - docker-pycreds==0.4.0
+ - e3nn==0.5.1
+ - et-xmlfile==1.1.0
+ - fair-esm==2.0.1
+ - fasteners==0.19
+ - gitdb==4.0.11
+ - gitpython==3.1.43
+ - griddataformats==1.0.2
+ - gsd==3.2.1
+ - huggingface-hub==0.17.3
+ - jupyter==1.0.0
+ - jupyter-console==6.6.3
+ - mdanalysis==2.4.0
+ - mmpbsa-py==16.0
+ - mmtf-python==1.1.3
+ - mrcfile==1.5.0
+ - msgpack==1.0.8
+ - numexpr==2.10.0
+ - numpy==1.24.4
+ - openpyxl==3.1.3
+ - opt-einsum==3.3.0
+ - opt-einsum-fx==0.1.4
+ - packmol-memgen==1.2.3rc0
+ - pdb4amber==22.0
+ - posebusters==0.2.13
+ - prefetch-generator==1.0.3
+ - protobuf==4.25.3
+ - pyg-lib==0.4.0+pt22cu121
+ - pymesh==1.0.2
+ - pymesh2==0.3.1
+ - pympler==1.0.1
+ - pytraj==2.0.6
+ - qtconsole==5.5.2
+ - qtpy==2.4.1
+ - rdkit==2023.3.1
+ - rdkit-pypi==2022.9.5
+ - regex==2023.12.25
+ - sander==22.0
+ - scikit-learn==1.3.2
+ - sentry-sdk==1.45.0
+ - setproctitle==1.3.3
+ - smmap==5.0.1
+ - spyrmsd==0.7.0
+ - tokenizers==0.13.3
+ - torch-cluster==1.6.3+pt22cu121
+ - torch-scatter==2.1.2+pt22cu121
+ - torch-sparse==0.6.18+pt22cu121
+ - torch-spline-conv==1.2.2+pt22cu121
+ - transformers==4.29.2
+ - wandb==0.16.1
diff --git a/model/comp_surface/prepare_target/__init_.py b/model/comp_surface/prepare_target/__init_.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/model/comp_surface/prepare_target/computeAPBS.py b/model/comp_surface/prepare_target/computeAPBS.py
new file mode 100644
index 0000000000000000000000000000000000000000..6d41637000d1eb57794977034193c5421732fad8
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeAPBS.py
@@ -0,0 +1,116 @@
+import os
+import numpy
+from subprocess import Popen, PIPE
+import pymesh
+import tempfile
+
+from default_config.global_vars import apbs_bin, pdb2pqr_bin, multivalue_bin
+import random
+
+"""
+Modified from:
+computeAPBS.py: Wrapper function to compute the Poisson Boltzmann electrostatics for a surface using APBS.
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+def computeAPBS(vertices, pdb_file, tmp_file_base,clear=False):
+ """
+ Calls APBS, pdb2pqr, and multivalue and returns the charges per vertex
+ """
+ if not clear:
+ pdb2pqr = pdb2pqr_bin + " --ff=parse --whitespace --noopt --apbs-input %s %s"# + tempfile.mktemp()
+ # pdb2pqr = pdb2pqr_bin + " --clean --whitespace --noopt --apbs-input %s %s"# + tempfile.mktemp() # 上一行由于确实太多办法计算表面的时候再用这个
+ else:
+ pdb2pqr = pdb2pqr_bin + " --clean --whitespace --noopt --apbs-input %s %s"# + tempfile.mktemp() # 上一行由于确实太多办法计算表面的时候再用这个
+ make_pqr = pdb2pqr % (pdb_file, tmp_file_base)
+ os.system(make_pqr)
+ print('os.system(make_pqr)',os.system(make_pqr))
+
+ apbs = apbs_bin + " %s"
+ make_apbs = apbs % (tmp_file_base+".in")
+ # os.system(make_apbs)
+ print(make_apbs)
+ print('os.system(make_apbs)',os.system(make_apbs))
+
+ vertfile = open(tmp_file_base + ".csv", "w")
+ for vert in vertices:
+ vertfile.write("{},{},{}\n".format(vert[0], vert[1], vert[2]))
+ vertfile.close()
+
+ multivalue = multivalue_bin + " %s %s %s"
+ make_multivalue = multivalue % (tmp_file_base+".csv", tmp_file_base+".dx", tmp_file_base+"_out.csv")
+ # print(make_multivalue)
+ try:
+ os.system(make_multivalue)
+ except Exception as e:
+ print(e)
+
+
+ # Read the charge file
+ chargefile = open(tmp_file_base + "_out.csv")
+ charges = numpy.array([0.0] * len(vertices))
+ for ix, line in enumerate(chargefile.readlines()):
+ charges[ix] = float(line.split(",")[3])
+ # os.system("rm " + tmp_file_base + "*")
+ # os.system("rm io.mc")
+
+ return charges
+
+
+
+""" ORIGINAL FUNCTION
+'''
+computeAPBS.py: Wrapper function to compute the Poisson Boltzmann electrostatics for a surface using APBS.
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF.
+Released under an Apache License 2.0
+'''
+
+def computeAPBS(vertices, pdb_file, tmp_file_base = tempfile.mktemp()):
+
+ #Calls APBS, pdb2pqr, and multivalue and returns the charges per vertex
+
+ #fields = tmp_file_base.split("/")[0:-1]
+ #directory = "/".join(fields) + "/"
+ fields = tmp_file_base
+ directory = str(fields) + "/"
+ filename_base = tmp_file_base.split("/")[-1]
+ pdbname = pdb_file.split("/")[-1]
+ args = [
+ pdb2pqr_bin,
+ "--ff=parse",
+ "--whitespace",
+ "--noopt",
+ "--apbs-input",
+ pdbname,
+ filename_base,
+ ]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ args = [apbs_bin, filename_base + ".in"]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ vertfile = open(directory + "/" + filename_base + ".csv", "w")
+ for vert in vertices:
+ vertfile.write("{},{},{}\n".format(vert[0], vert[1], vert[2]))
+ vertfile.close()
+
+ args = [
+ multivalue_bin,
+ filename_base + ".csv",
+ filename_base + ".dx",
+ filename_base + "_out.csv",
+ ]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ # Read the charge file
+ chargefile = open(tmp_file_base + "_out.csv")
+ charges = numpy.array([0.0] * len(vertices))
+ for ix, line in enumerate(chargefile.readlines()):
+ charges[ix] = float(line.split(",")[3])
+
+ return charges
+"""
\ No newline at end of file
diff --git a/model/comp_surface/prepare_target/computeCharges.py b/model/comp_surface/prepare_target/computeCharges.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4799c944c60d1e12e57b67e6d53596a28328cdd
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeCharges.py
@@ -0,0 +1,219 @@
+from Bio.PDB import *
+import numpy as np
+from sklearn.neighbors import KDTree
+
+"""
+Modified from:
+computeCharges.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+"""
+computeCharges.py: Wrapper function to compute hydrogen bond potential (free electrons/protons) in the surface
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF.
+Released under an Apache License 2.0
+"""
+
+from default_config.chemistry import (
+ polarHydrogens,
+ radii,
+ acceptorAngleAtom,
+ acceptorPlaneAtom,
+ hbond_std_dev,
+ donorAtom,
+)
+
+# Compute vertex charges based on hydrogen bond potential.
+# pdb_filename: The filename of the protonated protein.
+# vertices: The surface vertices of the protonated protein
+# The name of each vertex in the format, example: B_125_x_ASN_ND2_Green
+# where B is chain, 125 res id, x the insertion, ASN aatype, ND2 the name of the
+# atom, and green is not used anymore.
+def computeCharges(pdb_filename, vertices, names):
+ parser = PDBParser(QUIET=True)
+ struct = parser.get_structure(pdb_filename, pdb_filename + ".pdb")
+ residues = {}
+ for res in struct.get_residues():
+ chain_id = res.get_parent().get_id()
+ if chain_id == "":
+ chain_id = " "
+ residues[(chain_id, res.get_id())] = res
+
+ #atoms = Selection.unfold_entities(struct, "A")
+ atoms = struct.get_atoms()
+ satisfied_CO, satisfied_HN = computeSatisfied_CO_HN(atoms)
+
+ charge = np.array([0.0] * len(vertices))
+ # Go over every vertex
+ for ix, name in enumerate(names):
+ fields = name.split("_")
+ chain_id = fields[0]
+ if chain_id == "":
+ chain_id = " "
+ if fields[2] == "x":
+ fields[2] = " "
+ res_id = (" ", int(fields[1]), fields[2])
+ aa = fields[3]
+ atom_name = fields[4]
+ # Ignore atom if it is BB and it is already satisfied.
+ if atom_name == "H" and res_id in satisfied_HN:
+ continue
+ if atom_name == "O" and res_id in satisfied_CO:
+ continue
+ # Compute the charge of the vertex
+ charge[ix] = computeChargeHelper(
+ atom_name, residues[(chain_id, res_id)], vertices[ix]
+ )
+
+ return charge
+
+
+# Compute the charge of a vertex in a residue.
+def computeChargeHelper(atom_name, res, v):
+ res_type = res.get_resname()
+ # Check if it is a polar hydrogen.
+ if isPolarHydrogen(atom_name, res):
+ donor_atom_name = donorAtom[atom_name]
+ a = res[donor_atom_name].get_coord() # N/O
+ b = res[atom_name].get_coord() # H
+ # Donor-H is always 180.0 degrees, = pi
+ angle_deviation = computeAngleDeviation(a, b, v, np.pi)
+ angle_penalty = computeAnglePenalty(angle_deviation)
+ return 1.0 * angle_penalty
+ # Check if it is an acceptor oxygen or nitrogen
+ elif isAcceptorAtom(atom_name, res):
+ acceptor_atom = res[atom_name]
+ b = acceptor_atom.get_coord()
+ a = res[acceptorAngleAtom[atom_name]].get_coord()
+ # 120 degress for acceptor
+ angle_deviation = computeAngleDeviation(a, b, v, 2 * np.pi / 3)
+ # TODO: This should not be 120 for all atoms, i.e. for HIS it should be
+ # ~125.0
+ angle_penalty = computeAnglePenalty(angle_deviation)
+ plane_penalty = 1.0
+ if atom_name in acceptorPlaneAtom:
+ try:
+ d = res[acceptorPlaneAtom[atom_name]].get_coord()
+ except:
+ return 0.0
+ plane_deviation = computePlaneDeviation(d, a, b, v)
+ plane_penalty = computeAnglePenalty(plane_deviation)
+ return -1.0 * angle_penalty * plane_penalty
+ # Compute the
+ return 0.0
+
+
+# Compute the absolute value of the deviation from theta
+def computeAngleDeviation(a, b, c, theta):
+ return abs(calc_angle(Vector(a), Vector(b), Vector(c)) - theta)
+
+
+# Compute the angle deviation from a plane
+def computePlaneDeviation(a, b, c, d):
+ dih = calc_dihedral(Vector(a), Vector(b), Vector(c), Vector(d))
+ dev1 = abs(dih)
+ dev2 = np.pi - abs(dih)
+ return min(dev1, dev2)
+
+
+# angle_deviation from ideal value. TODO: do a more data-based solution
+def computeAnglePenalty(angle_deviation):
+ # Standard deviation: hbond_std_dev
+ return max(0.0, 1.0 - (angle_deviation / (hbond_std_dev)) ** 2)
+
+
+def isPolarHydrogen(atom_name, res):
+ if atom_name in polarHydrogens[res.get_resname()]:
+ return True
+ else:
+ return False
+
+
+def isAcceptorAtom(atom_name, res):
+ if atom_name.startswith("O"):
+ return True
+ else:
+ if res.get_resname() == "HIS":
+ if atom_name == "ND1" and "HD1" not in res:
+ return True
+ if atom_name == "NE2" and "HE2" not in res:
+ return True
+ return False
+
+
+# Compute the list of backbone C=O:H-N that are satisfied. These will be ignored.
+def computeSatisfied_CO_HN(atoms):
+ ns = NeighborSearch(atoms)
+ satisfied_CO = set()
+ satisfied_HN = set()
+ for atom1 in atoms:
+ res1 = atom1.get_parent()
+ if atom1.get_id() == "O":
+ neigh_atoms = ns.search(atom1.get_coord(), 2.5, level="A")
+ for atom2 in neigh_atoms:
+ if atom2.get_id() == "H":
+ res2 = atom2.get_parent()
+ # Ensure they belong to different residues.
+ if res2.get_id() != res1.get_id():
+ # Compute the angle N-H:O, ideal value is 180 (but in
+ # helices it is typically 160) 180 +-30 = pi
+ angle_N_H_O_dev = computeAngleDeviation(
+ res2["N"].get_coord(),
+ atom2.get_coord(),
+ atom1.get_coord(),
+ np.pi,
+ )
+ # Compute angle H:O=C, ideal value is ~160 +- 20 = 8*pi/9
+ angle_H_O_C_dev = computeAngleDeviation(
+ atom2.get_coord(),
+ atom1.get_coord(),
+ res1["C"].get_coord(),
+ 8 * np.pi / 9,
+ )
+ ## Allowed deviations: 30 degrees (pi/6) and 20 degrees
+ # (pi/9)
+ if (
+ angle_N_H_O_dev - np.pi / 6 < 0
+ and angle_H_O_C_dev - np.pi / 9 < 0.0
+ ):
+ satisfied_CO.add(res1.get_id())
+ satisfied_HN.add(res2.get_id())
+ return satisfied_CO, satisfied_HN
+
+
+# Compute the charge of a new mesh, based on the charge of an old mesh.
+# Use the top vertex in distance, for now (later this should be smoothed over 3
+# or 4 vertices)
+def assignChargesToNewMesh(new_vertices, old_vertices, old_charges, seeder_opts):
+ dataset = old_vertices
+ testset = new_vertices
+ new_charges = np.zeros(len(new_vertices))
+ if seeder_opts["feature_interpolation"]:
+ num_inter = 4 # Number of interpolation features
+ # Assign k old vertices to each new vertex.
+ kdt = KDTree(dataset)
+ dists, result = kdt.query(testset, k=num_inter)
+ # Square the distances (as in the original pyflann)
+ dists = np.square(dists)
+ # The size of result is the same as new_vertices
+ for vi_new in range(len(result)):
+ vi_old = result[vi_new]
+ dist_old = dists[vi_new]
+ # If one vertex is right on top, ignore the rest.
+ if dist_old[0] == 0.0:
+ new_charges[vi_new] = old_charges[vi_old[0]]
+ continue
+
+ total_dist = np.sum(1 / dist_old)
+ for i in range(num_inter):
+ new_charges[vi_new] += (
+ old_charges[vi_old[i]] * (1 / dist_old[i]) / total_dist
+ )
+ else:
+ # Assign k old vertices to each new vertex.
+ kdt = KDTree(dataset)
+ dists, result = kdt.query(testset)
+ new_charges = old_charges[result]
+ return new_charges
+
diff --git a/model/comp_surface/prepare_target/computeHydrophobicity.py b/model/comp_surface/prepare_target/computeHydrophobicity.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc24c2237be151dfc895d9322c7a5f34678f961e
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeHydrophobicity.py
@@ -0,0 +1,39 @@
+import numpy as np
+
+"""
+Taken from:
+computeHydrophobicity.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+# Kyte Doolittle scale
+kd_scale = {}
+kd_scale["ILE"] = 4.5
+kd_scale["VAL"] = 4.2
+kd_scale["LEU"] = 3.8
+kd_scale["PHE"] = 2.8
+kd_scale["CYS"] = 2.5
+kd_scale["MET"] = 1.9
+kd_scale["ALA"] = 1.8
+kd_scale["GLY"] = -0.4
+kd_scale["THR"] = -0.7
+kd_scale["SER"] = -0.8
+kd_scale["TRP"] = -0.9
+kd_scale["TYR"] = -1.3
+kd_scale["PRO"] = -1.6
+kd_scale["HIS"] = -3.2
+kd_scale["GLU"] = -3.5
+kd_scale["GLN"] = -3.5
+kd_scale["ASP"] = -3.5
+kd_scale["ASN"] = -3.5
+kd_scale["LYS"] = -3.9
+kd_scale["ARG"] = -4.5
+
+# For each vertex in names, compute
+def computeHydrophobicity(names):
+ hp = np.zeros(len(names))
+ for ix, name in enumerate(names):
+ aa = name.split("_")[3]
+ hp[ix] = kd_scale[aa]
+ return hp
+
diff --git a/model/comp_surface/prepare_target/computeMSMS.py b/model/comp_surface/prepare_target/computeMSMS.py
new file mode 100644
index 0000000000000000000000000000000000000000..aa7d5ea0fad2cdb6fc95399baea3acbafd9f005d
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeMSMS.py
@@ -0,0 +1,53 @@
+import os
+from subprocess import Popen, PIPE
+
+from input_output.read_msms import read_msms
+from triangulation.xyzrn import output_pdb_as_xyzrn
+from default_config.global_vars import msms_bin
+from default_config.masif_opts import masif_opts
+import random
+
+"""
+Modified from:
+computeMSMS.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+# Pablo Gainza LPDI EPFL 2017-2019
+# Calls MSMS and returns the vertices.
+# Special atoms are atoms with a reduced radius.
+import time
+def computeMSMS(pdb_file, protonate=True, one_cavity=None):
+ randnum = random.randint(1,10000000) #+ time.time() + os.getpid()
+ file_base = masif_opts['tmp_dir']+"/msms_"+str(randnum)
+ out_xyzrn = file_base+".xyzrn"
+
+ if protonate:
+ output_pdb_as_xyzrn(pdb_file, out_xyzrn)
+ else:
+ print("Error - pdb2xyzrn is deprecated.")
+ sys.exit(1)
+ # Now run MSMS on xyzrn file
+ FNULL = open(os.devnull, 'w')
+ if one_cavity is not None:
+ args = [msms_bin, "-density", "3.0", "-hdensity", "3.0", "-probe", "1.5",\
+ "-one_cavity", str(1), str(one_cavity),\
+ "-if",out_xyzrn,"-of",file_base, "-af", file_base]
+ else:
+ args = [msms_bin, "-density", "3.0", "-hdensity", "3.0", "-probe",\
+ "1.5", "-all_components", "-if",out_xyzrn,"-of",file_base, "-af", file_base]
+ #print msms_bin+" "+`args`
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p2.communicate()
+ print(stdout, stderr)
+
+ vertices, faces, normals, names = read_msms(file_base)
+ areas = {}
+ ses_file = open(file_base+".area")
+ next(ses_file) # ignore header line
+ for line in ses_file:
+ fields = line.split()
+ areas[fields[3]] = fields[1]
+ # os.system("rm " + file_base + "*")
+ return vertices, faces, normals, names, areas
+
diff --git a/model/comp_surface/prepare_target/computeTargetMesh.py b/model/comp_surface/prepare_target/computeTargetMesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..e77eada58aba825f1ba5e1125bdfdf4b3f965d50
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeTargetMesh.py
@@ -0,0 +1,254 @@
+import os
+import sys
+import numpy as np
+import shutil
+import pymesh
+import Bio.PDB
+from Bio.PDB import *
+from rdkit import Chem
+import warnings
+warnings.filterwarnings("ignore")
+from IPython.utils import io
+from sklearn.neighbors import KDTree
+from scipy.spatial import distance
+
+sys.path.append('/home/caoduanhua/DeepDock')
+import deepdock
+sys.path.insert(0, deepdock.__path__[0]+'/masif/source')
+
+from default_config.masif_opts import masif_opts
+from deepdock.prepare_target.compute_normal import compute_normal
+from deepdock.prepare_target.computeAPBS import computeAPBS
+from deepdock.prepare_target.computeCharges import computeCharges, assignChargesToNewMesh
+from deepdock.prepare_target.computeHydrophobicity import computeHydrophobicity
+from deepdock.prepare_target.computeMSMS import computeMSMS
+from deepdock.prepare_target.fixmesh import fix_mesh
+from deepdock.prepare_target.save_ply import save_ply
+from deepdock.utils.mol2graph import *
+
+def compute_inp_surface(target_filename, ligand_filename,out_dir = None, dist_threshold=10):
+ # try:
+ sufix = '_'+str(dist_threshold+5)+'A.pdb'
+ # out_filename = os.path.splitext(target_filename)[0]
+ if out_dir is not None:
+ out_filename = os.path.join(out_dir,target_filename.split('/')[-2])
+ os.makedirs(out_filename,exist_ok=True)
+ sufix = '/' + os.path.splitext(target_filename)[0].split('/')[-1] + '_'+str(dist_threshold+5)+'A.pdb'
+ else:
+ out_filename = os.path.splitext(target_filename)[0]
+ if os.path.exists(out_filename+f"/{sufix.split('.')[0]}.ply"):
+ print('have done skip!')
+ return 0
+ input_filename = os.path.splitext(target_filename)[0]
+ # Get atom coordinates
+ # try:
+ if ligand_filename.endswith('.mol2'):
+ mol = Chem.MolFromMol2File(ligand_filename, sanitize=False, cleanupSubstructures=False)
+ if ligand_filename.endswith('.sdf'):
+ # print('mol2 faild try sdf')
+ mol = Chem.SDMolSupplier(ligand_filename, sanitize=False,removeHs = False)[0]
+ g = mol_to_nx(mol)
+ atomCoords = np.array([g.nodes[i]['pos'].tolist() for i in g.nodes])
+
+ # Read protein and select aminino acids in the binding pocket
+ parser = Bio.PDB.PDBParser(QUIET=True) # QUIET=True avoids comments on errors in the pdb.
+
+ structures = parser.get_structure('target', input_filename+'.pdb')
+ structure = structures[0] # 'structures' may contain several proteins in this case only one.
+
+ atoms = Bio.PDB.Selection.unfold_entities(structure, 'A')
+ ns = Bio.PDB.NeighborSearch(atoms)
+
+ close_residues= []
+ for a in atomCoords:
+ close_residues.extend(ns.search(a, dist_threshold+5, level='R'))
+ close_residues = Bio.PDB.Selection.uniqueify(close_residues)
+
+ class SelectNeighbors(Select):
+ def accept_residue(self, residue):
+ if residue in close_residues:
+ if all(a in [i.get_name() for i in residue.get_unpacked_list()] for a in ['N', 'CA', 'C', 'O']) or residue.resname=='HOH':
+ return True
+ else:
+ return False
+ else:
+ return False
+
+ pdbio = PDBIO()
+ pdbio.set_structure(structure)
+ pdbio.save(out_filename+sufix, SelectNeighbors())
+
+ # Identify closes atom to the ligand
+ structures = parser.get_structure('target', out_filename+sufix)
+ structure = structures[0] # 'structures' may contain several proteins in this case only one.
+ atoms = Bio.PDB.Selection.unfold_entities(structure, 'A')
+
+ #dist = [distance.euclidean(atomCoords.mean(axis=0), a.get_coord()) for a in atoms]
+ #atom_idx = np.argmin(dist)
+ #dist = [[distance.euclidean(ac, a.get_coord()) for ac in atomCoords] for a in atoms]
+ #atom_idx = np.argsort(np.min(dist, axis=1))[0]
+ # Compute MSMS of surface w/hydrogens,
+ try:
+ dist = [distance.euclidean(atomCoords.mean(axis=0), a.get_coord()) for a in atoms]
+ atom_idx = np.argmin(dist)
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=atom_idx)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ except:
+ try:
+ dist = [[distance.euclidean(ac, a.get_coord()) for ac in atomCoords] for a in atoms]
+ atom_idx = np.argsort(np.min(dist, axis=1))[0]
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=atom_idx)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ except:
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=None)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ # Compute the normals
+ vertex_normal = compute_normal(regular_mesh.vertices, regular_mesh.faces)
+ # Assign charges on new vertices based on charges of old vertices (nearest
+ # neighbor)
+
+ if masif_opts['use_hbond']:
+ vertex_hbond = assignChargesToNewMesh(regular_mesh.vertices, vertices1,\
+ vertex_hbond, masif_opts)
+
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = assignChargesToNewMesh(regular_mesh.vertices, vertices1,\
+ vertex_hphobicity, masif_opts)
+
+ if masif_opts['use_apbs']:
+ vertex_charges = computeAPBS(regular_mesh.vertices, out_filename+sufix, out_filename+"_temp")
+
+ # Compute the principal curvature components for the shape index.
+ regular_mesh.add_attribute("vertex_mean_curvature")
+ H = regular_mesh.get_attribute("vertex_mean_curvature")
+ regular_mesh.add_attribute("vertex_gaussian_curvature")
+ K = regular_mesh.get_attribute("vertex_gaussian_curvature")
+ elem = np.square(H) - K
+ # In some cases this equation is less than zero, likely due to the method that computes the mean and gaussian curvature.
+ # set to an epsilon.
+ elem[elem<0] = 1e-8
+ k1 = H + np.sqrt(elem)
+ k2 = H - np.sqrt(elem)
+ # Compute the shape index
+ si = (k1+k2)/(k1-k2)
+ si = np.arctan(si)*(2/np.pi)
+
+ # Convert to ply and save.
+ save_ply(out_filename+f"/{sufix.split('.')[0]}.ply", regular_mesh.vertices,\
+ regular_mesh.faces, normals=vertex_normal, charges=vertex_charges,\
+ normalize_charges=True, hbond=vertex_hbond, hphob=vertex_hphobicity,\
+ si=si)
+ os.system("rm " + f"{out_dir}/{target_filename.split('/')[-2]}*")
+ return 0
+ # except:
+ # return target_filename
+
+
+if __name__ == "__main__":
+ from joblib import delayed,Parallel
+
+
+ surface_dist = 10
+ data_dir = '~/dockingModelTestDataset/'
+
+ out_dir = ' '
+ # 在out_dir 文件夹下执行
+ sys.path.append(out_dir)
+ from tqdm import tqdm
+ import glob
+ args_list = []
+ for protein in tqdm(os.listdir(data_dir)):
+ if os.path.isdir(os.path.join(data_dir,protein)):
+
+ if protein in ['3TGG']:
+
+ target_filename = os.path.join(data_dir,protein,f'{protein}_PRO.pdb')
+ if os.path.exists(os.path.join(data_dir,protein,f'{protein}_LIG_raw.sdf')):
+ ligand_filename = os.path.join(data_dir,protein,f'{protein}_LIG_raw.sdf')
+ else:
+ print(glob.glob(os.path.join(data_dir,protein,f'*_LIG.sdf')))
+ print(protein)
+ ligand_filename = glob.glob(os.path.join(data_dir,protein,'*_LIG.sdf'))[0]
+ args_list.append((target_filename,ligand_filename))
+
+ results = Parallel(n_jobs = 30)(delayed(compute_inp_surface)(target_filename, ligand_filename,out_dir, dist_threshold=surface_dist-5) for (target_filename, ligand_filename) in tqdm(args_list))
+
+ print('sucess num : ',len([i for i in results if i == 0]),'all num : ',len(results))
\ No newline at end of file
diff --git a/model/comp_surface/prepare_target/computeTargetMesh_test_samples.py b/model/comp_surface/prepare_target/computeTargetMesh_test_samples.py
new file mode 100644
index 0000000000000000000000000000000000000000..60a4c2dd577cb72c1750f7396894b67bec010bb9
--- /dev/null
+++ b/model/comp_surface/prepare_target/computeTargetMesh_test_samples.py
@@ -0,0 +1,262 @@
+import os
+import sys
+import numpy as np
+import shutil
+import glob
+import pymesh
+import Bio.PDB
+from Bio.PDB import *
+from rdkit import Chem
+import warnings
+warnings.filterwarnings("ignore")
+from IPython.utils import io
+from sklearn.neighbors import KDTree
+from scipy.spatial import distance
+
+from default_config.masif_opts import masif_opts
+from compute_normal import compute_normal
+from computeAPBS import computeAPBS
+from computeCharges import computeCharges, assignChargesToNewMesh
+from computeHydrophobicity import computeHydrophobicity
+from computeMSMS import computeMSMS
+from fixmesh import fix_mesh
+from save_ply import save_ply
+from mol2graph import *
+
+
+def compute_inp_surface(target_filename, ligand_filename,out_dir = None, dist_threshold=10):
+ try:
+
+ sufix = '_'+str(dist_threshold)+'A.pdb'
+ # out_filename = os.path.splitext(target_filename)[0]
+ if out_dir is not None:
+ out_filename = os.path.join(out_dir,ligand_filename.split('/')[-2])
+ os.makedirs(out_filename,exist_ok=True)
+ sufix = '/' + os.path.splitext(target_filename)[0].split('/')[-1] + '_'+str(dist_threshold)+'A.pdb'
+ else:
+ out_filename = os.path.splitext(ligand_filename)[0]
+ if os.path.exists(out_filename+f"/{sufix.split('.pdb')[0]}.ply"):
+ print('have done skip!')
+ return 0
+ input_filename = os.path.splitext(target_filename)[0]
+ # Get atom coordinates
+ # try:
+ # mol = Chem.MolFromMol2File(ligand_filename, sanitize=False, cleanupSubstructures=False)
+ # except:
+ # print('mol2 faild try sdf')
+ if ligand_filename.endswith('.sdf'):
+ mol = Chem.SDMolSupplier(ligand_filename, sanitize=False)[0]
+ elif ligand_filename.endswith('.pdb'):
+ mol = Chem.MolFromPDBFile(ligand_filename, sanitize=False)
+ g = mol_to_nx(mol)
+ atomCoords = np.array([g.nodes[i]['pos'].tolist() for i in g.nodes])
+
+ # Read protein and select aminino acids in the binding pocket
+ parser = Bio.PDB.PDBParser(QUIET=True) # QUIET=True avoids comments on errors in the pdb.
+
+ structures = parser.get_structure('target', input_filename+'.pdb')
+ structure = structures[0] # 'structures' may contain several proteins in this case only one.
+
+ atoms = Bio.PDB.Selection.unfold_entities(structure, 'A')
+ ns = Bio.PDB.NeighborSearch(atoms)
+
+ close_residues= []
+ for a in atomCoords:
+ close_residues.extend(ns.search(a, dist_threshold, level='R'))
+ close_residues = Bio.PDB.Selection.uniqueify(close_residues)
+
+ class SelectNeighbors(Select):
+ def accept_residue(self, residue):
+ if residue in close_residues:
+ if all(a in [i.get_name() for i in residue.get_unpacked_list()] for a in ['N', 'CA', 'C', 'O']) or residue.resname=='HOH':
+ return True
+ else:
+ return False
+ else:
+ return False
+
+ pdbio = PDBIO()
+ pdbio.set_structure(structure)
+ pdbio.save(out_filename+sufix, SelectNeighbors())
+
+ # Identify closes atom to the ligand
+ structures = parser.get_structure('target', out_filename+sufix)
+ structure = structures[0] # 'structures' may contain several proteins in this case only one.
+ atoms = Bio.PDB.Selection.unfold_entities(structure, 'A')
+
+ #dist = [distance.euclidean(atomCoords.mean(axis=0), a.get_coord()) for a in atoms]
+ #atom_idx = np.argmin(dist)
+ #dist = [[distance.euclidean(ac, a.get_coord()) for ac in atomCoords] for a in atoms]
+ #atom_idx = np.argsort(np.min(dist, axis=1))[0]
+
+ # Compute MSMS of surface w/hydrogens,
+ try:
+ dist = [distance.euclidean(atomCoords.mean(axis=0), a.get_coord()) for a in atoms]
+ atom_idx = np.argmin(dist)
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=atom_idx)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold-5)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ except:
+ try:
+ dist = [[distance.euclidean(ac, a.get_coord()) for ac in atomCoords] for a in atoms]
+ atom_idx = np.argsort(np.min(dist, axis=1))[0]
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=atom_idx)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold-5)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ except:
+ vertices1, faces1, normals1, names1, areas1 = computeMSMS(out_filename+sufix,\
+ protonate=True, one_cavity=None)
+
+ # Find the distance between every vertex in binding site surface and each atom in the ligand.
+ kdt = KDTree(atomCoords)
+ d, r = kdt.query(vertices1)
+ assert(len(d) == len(vertices1))
+ iface_v = np.where(d <= dist_threshold-5)[0]
+ faces_to_keep = [idx for idx, face in enumerate(faces1) if all(v in iface_v for v in face)]
+
+ # Compute "charged" vertices
+ if masif_opts['use_hbond']:
+ vertex_hbond = computeCharges(input_filename, vertices1, names1)
+
+ # For each surface residue, assign the hydrophobicity of its amino acid.
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = computeHydrophobicity(names1)
+
+ # If protonate = false, recompute MSMS of surface, but without hydrogens (set radius of hydrogens to 0).
+ vertices2 = vertices1
+ faces2 = faces1
+
+ # Fix the mesh.
+ mesh = pymesh.form_mesh(vertices2, faces2)
+ mesh = pymesh.submesh(mesh, faces_to_keep, 0)
+ with io.capture_output() as captured:
+ regular_mesh = fix_mesh(mesh, masif_opts['mesh_res'])
+
+ # Compute the normals
+ vertex_normal = compute_normal(regular_mesh.vertices, regular_mesh.faces)
+ # Assign charges on new vertices based on charges of old vertices (nearest
+ # neighbor)
+
+ if masif_opts['use_hbond']:
+ vertex_hbond = assignChargesToNewMesh(regular_mesh.vertices, vertices1,\
+ vertex_hbond, masif_opts)
+
+ if masif_opts['use_hphob']:
+ vertex_hphobicity = assignChargesToNewMesh(regular_mesh.vertices, vertices1,\
+ vertex_hphobicity, masif_opts)
+
+ if masif_opts['use_apbs']:
+ vertex_charges = computeAPBS(regular_mesh.vertices, out_filename+sufix, out_filename+"_temp")
+
+ # Compute the principal curvature components for the shape index.
+ regular_mesh.add_attribute("vertex_mean_curvature")
+ H = regular_mesh.get_attribute("vertex_mean_curvature")
+ regular_mesh.add_attribute("vertex_gaussian_curvature")
+ K = regular_mesh.get_attribute("vertex_gaussian_curvature")
+ elem = np.square(H) - K
+ # In some cases this equation is less than zero, likely due to the method that computes the mean and gaussian curvature.
+ # set to an epsilon.
+ elem[elem<0] = 1e-8
+ k1 = H + np.sqrt(elem)
+ k2 = H - np.sqrt(elem)
+ # Compute the shape index
+ si = (k1+k2)/(k1-k2)
+ si = np.arctan(si)*(2/np.pi)
+
+ # Convert to ply and save.
+ save_ply(out_filename+f"/{sufix.split('.pdb')[0]}.ply", regular_mesh.vertices,\
+ regular_mesh.faces, normals=vertex_normal, charges=vertex_charges,\
+ normalize_charges=True, hbond=vertex_hbond, hphob=vertex_hphobicity,\
+ si=si)
+
+ return 0
+ except:
+ return target_filename
+
+
+if __name__ == "__main__":
+ from joblib import delayed,Parallel
+ # arguments
+ from argparse import ArgumentParser, Namespace, FileType
+ parser = ArgumentParser()
+ parser.add_argument('--data_dir', type=str, default='~/SurfDock/model/data/test_samples', help='')
+ parser.add_argument('--out_dir', type=str, default='~/SurfDock/model/data/test_samples_8A_surface', help='')
+ parser.add_argument('--n_jobs',type=int, default=1, help='Number of parallel jobs (-1 for all CPUs)')
+ args = parser.parse_args()
+ os.makedirs(args.out_dir,exist_ok=True)
+
+ sys.path.append(args.out_dir)
+ from tqdm import tqdm
+ args_list = []
+ for protein in tqdm(os.listdir(args.data_dir)):
+ if os.path.exists(os.path.join(args.out_dir,protein,f'{protein}_protein_processed_obabel_reduce_obabel.pdb')):
+ target_filename = os.path.join(args.out_dir,protein,f'{protein}_protein_processed_obabel_reduce_obabel.pdb')
+ elif os.path.exists(os.path.join(args.data_dir,protein,f'{protein}_protein_processed.pdb')):
+ target_filename = os.path.join(args.data_dir,protein,f'{protein}_protein_processed.pdb')
+ print(f'{protein} use {target_filename}; Please check this protein file was processed by openbabel reduce! in protein_process')
+ else:
+ print(f'{protein} not exists , Please check file name or path')
+ continue
+ ligand_filename = os.path.join(args.data_dir,protein,f'{protein}_ligand.sdf')
+ if not os.path.exists(ligand_filename):
+ ligand_filename = os.path.join(args.data_dir,protein,f'{protein}_ligand.mol2')
+ args_list.append((target_filename,ligand_filename))
+ print(f'number {len(args_list)} need to processed.....')
+ results = Parallel(n_jobs = args.n_jobs,backend = 'multiprocessing')(delayed(compute_inp_surface)(target_filename, ligand_filename,args.out_dir, dist_threshold=8) for (target_filename, ligand_filename) in tqdm(args_list))
+ # print(results)
+ # Find all files in args.out_dir that end with _temp
+
+ files = glob.glob(os.path.join(args.out_dir, '*_temp*')) + glob.glob(os.path.join(args.out_dir, '*msms*'))
+ # Delete all found files
+ for f in files:
+ os.remove(f)
diff --git a/model/comp_surface/prepare_target/compute_normal.py b/model/comp_surface/prepare_target/compute_normal.py
new file mode 100644
index 0000000000000000000000000000000000000000..002a6d2814f6b0bc1e5688a844abe653e115aebe
--- /dev/null
+++ b/model/comp_surface/prepare_target/compute_normal.py
@@ -0,0 +1,78 @@
+import numpy as np
+from numpy.matlib import repmat
+"""
+compute_normal.py: Compute the normals of a closed shape.
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF, based on previous matlab code by Gabriel Peyre, converted to Python by Pablo Gainza
+"""
+
+###
+from default_config.global_vars import epsilon as eps
+
+"""
+Taken from:
+compute_normal.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+
+def compute_normal(vertex, face):
+
+ """
+ compute_normal - compute the normal of a triangulation
+ vertex: 3xn matrix of vertices
+ face: 3xm matrix of face indices.
+
+ normal,normalf = compute_normal(vertex,face)
+
+ normal(i,:) is the normal at vertex i.
+ normalf(j,:) is the normal at face j.
+
+ Copyright (c) 2004 Gabriel Peyr
+ Converted to Python by Pablo Gainza LPDI EPFL 2017
+ """
+
+ vertex = vertex.T
+ face = face.T
+ nface = np.size(face, 1)
+ nvert = np.size(vertex, 1)
+ normal = np.zeros((3, nvert))
+ # unit normals to the faces
+ normalf = crossp(
+ vertex[:, face[1, :]] - vertex[:, face[0, :]],
+ vertex[:, face[2, :]] - vertex[:, face[0, :]],
+ )
+ sum_squares = np.sum(normalf ** 2, 0)
+ d = np.sqrt(sum_squares)
+ d[d < eps] = 1
+ normalf = normalf / repmat(d, 3, 1)
+ # unit normal to the vertex
+ normal = np.zeros((3, nvert))
+ for i in np.arange(0, nface):
+ f = face[:, i]
+ for j in np.arange(3):
+ normal[:, f[j]] = normal[:, f[j]] + normalf[:, i]
+
+ # normalize
+ d = np.sqrt(np.sum(normal ** 2, 0))
+ d[d < eps] = 1
+ normal = normal / repmat(d, 3, 1)
+ # enforce that the normal are outward
+ vertex_means = np.mean(vertex, 0)
+ v = vertex - repmat(vertex_means, 3, 1)
+ s = np.sum(np.multiply(v, normal), 1)
+ if np.sum(s > 0) < np.sum(s < 0):
+ # flip
+ normal = -normal
+ normalf = -normalf
+ return normal.T
+
+
+def crossp(x, y):
+
+ # x and y are (m,3) dimensional
+ z = np.zeros((x.shape))
+ z[0, :] = np.multiply(x[1, :], y[2, :]) - np.multiply(x[2, :], y[1, :])
+ z[1, :] = np.multiply(x[2, :], y[0, :]) - np.multiply(x[0, :], y[2, :])
+ z[2, :] = np.multiply(x[0, :], y[1, :]) - np.multiply(x[1, :], y[0, :])
+ return z
diff --git a/model/comp_surface/prepare_target/default_config/README.md b/model/comp_surface/prepare_target/default_config/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..925ce6bbadbbcf0df01b9a6bb95980e30313be4c
--- /dev/null
+++ b/model/comp_surface/prepare_target/default_config/README.md
@@ -0,0 +1,3 @@
+### source/default_config/
+Contains MaSIF's default configuration options, and other parameters such as atom radiuses, the definition of polar hydrogens,
+and the name of environment variables with external programs used by MaSIF.
diff --git a/model/comp_surface/prepare_target/default_config/__init__.py b/model/comp_surface/prepare_target/default_config/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/model/comp_surface/prepare_target/default_config/chemistry.py b/model/comp_surface/prepare_target/default_config/chemistry.py
new file mode 100644
index 0000000000000000000000000000000000000000..3e1b2c9abbfdd03c2b8ac58e159160616340f4e9
--- /dev/null
+++ b/model/comp_surface/prepare_target/default_config/chemistry.py
@@ -0,0 +1,152 @@
+# chemistry.py: Chemical parameters for MaSIF.
+# Pablo Gainza - LPDI STI EPFL 2018-2019
+# Released under an Apache License 2.0
+
+import numpy as np
+
+# radii for atoms in explicit case.
+radii = {}
+radii["N"] = "1.540000"
+radii["N"] = "1.540000"
+radii["O"] = "1.400000"
+radii["C"] = "1.740000"
+radii["H"] = "1.200000"
+radii["S"] = "1.800000"
+radii["P"] = "1.800000"
+radii["Z"] = "1.39"
+radii["X"] = "0.770000" ## Radii of CB or CA in disembodied case.
+# This polar hydrogen's names correspond to that of the program Reduce.
+polarHydrogens = {}
+polarHydrogens["ALA"] = ["H"]
+polarHydrogens["GLY"] = ["H"]
+polarHydrogens["SER"] = ["H", "HG"]
+polarHydrogens["THR"] = ["H", "HG1"]
+polarHydrogens["LEU"] = ["H"]
+polarHydrogens["ILE"] = ["H"]
+polarHydrogens["VAL"] = ["H"]
+polarHydrogens["ASN"] = ["H", "HD21", "HD22"]
+polarHydrogens["GLN"] = ["H", "HE21", "HE22"]
+polarHydrogens["ARG"] = ["H", "HH11", "HH12", "HH21", "HH22", "HE"]
+polarHydrogens["HIS"] = ["H", "HD1", "HE2"]
+polarHydrogens["TRP"] = ["H", "HE1"]
+polarHydrogens["PHE"] = ["H"]
+polarHydrogens["TYR"] = ["H", "HH"]
+polarHydrogens["GLU"] = ["H"]
+polarHydrogens["ASP"] = ["H"]
+polarHydrogens["LYS"] = ["H", "HZ1", "HZ2", "HZ3"]
+polarHydrogens["PRO"] = []
+polarHydrogens["CYS"] = ["H"]
+polarHydrogens["MET"] = ["H"]
+
+hbond_std_dev = np.pi / 3
+
+# Dictionary from an acceptor atom to its directly bonded atom on which to
+# compute the angle.
+acceptorAngleAtom = {}
+acceptorAngleAtom["O"] = "C"
+acceptorAngleAtom["O1"] = "C"
+acceptorAngleAtom["O2"] = "C"
+acceptorAngleAtom["OXT"] = "C"
+acceptorAngleAtom["OT1"] = "C"
+acceptorAngleAtom["OT2"] = "C"
+# Dictionary from acceptor atom to a third atom on which to compute the plane.
+acceptorPlaneAtom = {}
+acceptorPlaneAtom["O"] = "CA"
+# Dictionary from an H atom to its donor atom.
+donorAtom = {}
+donorAtom["H"] = "N"
+# Hydrogen bond information.
+# ARG
+# ARG NHX
+# Angle: NH1, HH1X, point and NH2, HH2X, point 180 degrees.
+# radii from HH: radii[H]
+# ARG NE
+# Angle: ~ 120 NE, HE, point, 180 degrees
+donorAtom["HH11"] = "NH1"
+donorAtom["HH12"] = "NH1"
+donorAtom["HH21"] = "NH2"
+donorAtom["HH22"] = "NH2"
+donorAtom["HE"] = "NE"
+
+# ASN
+# Angle ND2,HD2X: 180
+# Plane: CG,ND2,OD1
+# Angle CG-OD1-X: 120
+donorAtom["HD21"] = "ND2"
+donorAtom["HD22"] = "ND2"
+# ASN Acceptor
+acceptorAngleAtom["OD1"] = "CG"
+acceptorPlaneAtom["OD1"] = "CB"
+
+# ASP
+# Plane: CB-CG-OD1
+# Angle CG-ODX-point: 120
+acceptorAngleAtom["OD2"] = "CG"
+acceptorPlaneAtom["OD2"] = "CB"
+
+# GLU
+# PLANE: CD-OE1-OE2
+# ANGLE: CD-OEX: 120
+# GLN
+# PLANE: CD-OE1-NE2
+# Angle NE2,HE2X: 180
+# ANGLE: CD-OE1: 120
+donorAtom["HE21"] = "NE2"
+donorAtom["HE22"] = "NE2"
+acceptorAngleAtom["OE1"] = "CD"
+acceptorAngleAtom["OE2"] = "CD"
+acceptorPlaneAtom["OE1"] = "CG"
+acceptorPlaneAtom["OE2"] = "CG"
+
+# HIS Acceptors: ND1, NE2
+# Plane ND1-CE1-NE2
+# Angle: ND1-CE1 : 125.5
+# Angle: NE2-CE1 : 125.5
+acceptorAngleAtom["ND1"] = "CE1"
+acceptorAngleAtom["NE2"] = "CE1"
+acceptorPlaneAtom["ND1"] = "NE2"
+acceptorPlaneAtom["NE2"] = "ND1"
+
+# HIS Donors: ND1, NE2
+# Angle ND1-HD1 : 180
+# Angle NE2-HE2 : 180
+donorAtom["HD1"] = "ND1"
+donorAtom["HE2"] = "NE2"
+
+# TRP Donor: NE1-HE1
+# Angle NE1-HE1 : 180
+donorAtom["HE1"] = "NE1"
+
+# LYS Donor NZ-HZX
+# Angle NZ-HZX : 180
+donorAtom["HZ1"] = "NZ"
+donorAtom["HZ2"] = "NZ"
+donorAtom["HZ3"] = "NZ"
+
+# TYR acceptor OH
+# Plane: CE1-CZ-OH
+# Angle: CZ-OH 120
+acceptorAngleAtom["OH"] = "CZ"
+acceptorPlaneAtom["OH"] = "CE1"
+
+# TYR donor: OH-HH
+# Angle: OH-HH 180
+donorAtom["HH"] = "OH"
+acceptorPlaneAtom["OH"] = "CE1"
+
+# SER acceptor:
+# Angle CB-OG-X: 120
+acceptorAngleAtom["OG"] = "CB"
+
+# SER donor:
+# Angle: OG-HG-X: 180
+donorAtom["HG"] = "OG"
+
+# THR acceptor:
+# Angle: CB-OG1-X: 120
+acceptorAngleAtom["OG1"] = "CB"
+
+# THR donor:
+# Angle: OG1-HG1-X: 180
+donorAtom["HG1"] = "OG1"
+
diff --git a/model/comp_surface/prepare_target/default_config/global_vars.py b/model/comp_surface/prepare_target/default_config/global_vars.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb0617af92897135be4bde1d20bdcbaa57677ca2
--- /dev/null
+++ b/model/comp_surface/prepare_target/default_config/global_vars.py
@@ -0,0 +1,32 @@
+import os
+from pathlib import Path
+import sys
+
+epsilon = 1.0e-6
+
+PROJECT_ROOT = Path(__file__).resolve().parents[4]
+TOOLS_ROOT = PROJECT_ROOT / "model" / "comp_surface" / "tools"
+if (TOOLS_ROOT / "transfer").exists():
+ TOOLS_ROOT = TOOLS_ROOT / "transfer"
+
+msms_bin = str(TOOLS_ROOT / "APBS-3.4.1.Linux" / "bin" / "msms")
+pdb2pqr_bin = str(TOOLS_ROOT / "pdb2pqr-linux-bin64-2.1.1" / "pdb2pqr")
+apbs_bin = str(TOOLS_ROOT / "APBS-3.4.1.Linux" / "bin" / "apbs")
+multivalue_bin = str(TOOLS_ROOT / "APBS-3.4.1.Linux" / "share" / "apbs" / "tools" / "bin" / "multivalue")
+
+os.environ["MSMS_BIN"] = msms_bin
+os.environ["PDB2PQR_BIN"] = pdb2pqr_bin
+os.environ["APBS_BIN"] = apbs_bin
+os.environ["MULTIVALUE_BIN"] = multivalue_bin
+
+for name, path in {
+ "MSMS_BIN": msms_bin,
+ "PDB2PQR_BIN": pdb2pqr_bin,
+ "APBS_BIN": apbs_bin,
+ "MULTIVALUE_BIN": multivalue_bin,
+}.items():
+ if not os.path.exists(path):
+ print(f"ERROR: {name} does not exist: {path}", file=sys.stderr)
+
+class NoSolutionError(Exception):
+ pass
diff --git a/model/comp_surface/prepare_target/default_config/masif_opts.py b/model/comp_surface/prepare_target/default_config/masif_opts.py
new file mode 100644
index 0000000000000000000000000000000000000000..06509e6789111b15ff5f0f0b488f24e2fd81f0e2
--- /dev/null
+++ b/model/comp_surface/prepare_target/default_config/masif_opts.py
@@ -0,0 +1,83 @@
+import tempfile
+
+masif_opts = {}
+# Default directories
+masif_opts["raw_pdb_dir"] = "data_preparation/00-raw_pdbs/"
+masif_opts["pdb_chain_dir"] = "data_preparation/01-benchmark_pdbs/"
+masif_opts["ply_chain_dir"] = "data_preparation/01-benchmark_surfaces/"
+masif_opts["tmp_dir"] = tempfile.gettempdir()
+masif_opts["ply_file_template"] = masif_opts["ply_chain_dir"] + "/{}_{}.ply"
+
+# Surface features
+masif_opts["use_hbond"] = True
+masif_opts["use_hphob"] = True
+masif_opts["use_apbs"] = True
+masif_opts["compute_iface"] = True
+# Mesh resolution. Everything gets very slow if it is lower than 1.0
+masif_opts["mesh_res"] = 1.0
+masif_opts["feature_interpolation"] = True
+
+
+# Coords params
+masif_opts["radius"] = 12.0
+
+# Neural network patch application specific parameters.
+masif_opts["ppi_search"] = {}
+masif_opts["ppi_search"]["training_list"] = "lists/training.txt"
+masif_opts["ppi_search"]["testing_list"] = "lists/testing.txt"
+masif_opts["ppi_search"]["max_shape_size"] = 200
+masif_opts["ppi_search"]["max_distance"] = 12.0 # Radius for the neural network.
+masif_opts["ppi_search"][
+ "masif_precomputation_dir"
+] = "data_preparation/04b-precomputation_12A/precomputation/"
+masif_opts["ppi_search"]["feat_mask"] = [1.0] * 5
+masif_opts["ppi_search"]["max_sc_filt"] = 1.0
+masif_opts["ppi_search"]["min_sc_filt"] = 0.5
+masif_opts["ppi_search"]["pos_surf_accept_probability"] = 1.0
+masif_opts["ppi_search"]["pos_interface_cutoff"] = 1.0
+masif_opts["ppi_search"]["range_val_samples"] = 0.9 # 0.9 to 1.0
+masif_opts["ppi_search"]["cache_dir"] = "nn_models/sc05/cache/"
+masif_opts["ppi_search"]["model_dir"] = "nn_models/sc05/all_feat/model_data/"
+masif_opts["ppi_search"]["desc_dir"] = "descriptors/sc05/all_feat/"
+masif_opts["ppi_search"]["gif_descriptors_out"] = "gif_descriptors/"
+# Parameters for shape complementarity calculations.
+masif_opts["ppi_search"]["sc_radius"] = 12.0
+masif_opts["ppi_search"]["sc_interaction_cutoff"] = 1.5
+masif_opts["ppi_search"]["sc_w"] = 0.25
+
+# Neural network patch application specific parameters.
+masif_opts["site"] = {}
+masif_opts["site"]["training_list"] = "lists/training.txt"
+masif_opts["site"]["testing_list"] = "lists/testing.txt"
+masif_opts["site"]["max_shape_size"] = 100
+masif_opts["site"]["n_conv_layers"] = 3
+masif_opts["site"]["max_distance"] = 9.0 # Radius for the neural network.
+masif_opts["site"][
+ "masif_precomputation_dir"
+] = "data_preparation/04a-precomputation_9A/precomputation/"
+masif_opts["site"]["range_val_samples"] = 0.9 # 0.9 to 1.0
+masif_opts["site"]["model_dir"] = "nn_models/all_feat_3l/model_data/"
+masif_opts["site"]["out_pred_dir"] = "output/all_feat_3l/pred_data/"
+masif_opts["site"]["out_surf_dir"] = "output/all_feat_3l/pred_surfaces/"
+masif_opts["site"]["feat_mask"] = [1.0] * 5
+
+# Neural network ligand application specific parameters.
+masif_opts["ligand"] = {}
+masif_opts["ligand"]["assembly_dir"] = "data_preparation/00b-pdbs_assembly"
+masif_opts["ligand"]["ligand_coords_dir"] = "data_preparation/00c-ligand_coords"
+masif_opts["ligand"][
+ "masif_precomputation_dir"
+] = "data_preparation/04a-precomputation_12A/precomputation/"
+masif_opts["ligand"]["max_shape_size"] = 200
+masif_opts["ligand"]["feat_mask"] = [1.0] * 5
+masif_opts["ligand"]["train_fract"] = 0.9 * 0.8
+masif_opts["ligand"]["val_fract"] = 0.1 * 0.8
+masif_opts["ligand"]["test_fract"] = 0.2
+masif_opts["ligand"]["tfrecords_dir"] = "data_preparation/tfrecords"
+masif_opts["ligand"]["max_distance"] = 12.0
+masif_opts["ligand"]["n_classes"] = 7
+masif_opts["ligand"]["feat_mask"] = [1.0, 1.0, 1.0, 1.0, 1.0]
+masif_opts["ligand"]["costfun"] = "dprime"
+masif_opts["ligand"]["model_dir"] = "nn_models/all_feat/"
+masif_opts["ligand"]["test_set_out_dir"] = "test_set_predictions/"
+
diff --git a/model/comp_surface/prepare_target/fix_pdb.py b/model/comp_surface/prepare_target/fix_pdb.py
new file mode 100644
index 0000000000000000000000000000000000000000..01e30af9dd5d739960389d955bdcabff15283084
--- /dev/null
+++ b/model/comp_surface/prepare_target/fix_pdb.py
@@ -0,0 +1,22 @@
+from pdbfixer import PDBFixer
+from openmm.app import PDBFile
+
+
+
+# Load the PDB file
+
+fixer = PDBFixer(filename='your_file.pdb')
+
+# Find missing residues
+fixer.findMissingResidues()
+
+# Replace nonstandard residues
+fixer.findNonstandardResidues()
+fixer.replaceNonstandardResidues()
+
+# Find missing atoms and add them
+fixer.findMissingAtoms()
+fixer.addMissingAtoms()
+
+# Write the fixed PDB file
+PDBFile.writeFile(fixer.topology, fixer.positions, open('fixed_pdb.pdb', 'w'))
\ No newline at end of file
diff --git a/model/comp_surface/prepare_target/fixmesh.py b/model/comp_surface/prepare_target/fixmesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..1d7065fe0d4d1aaa76bc739bb31a7a43c79116a5
--- /dev/null
+++ b/model/comp_surface/prepare_target/fixmesh.py
@@ -0,0 +1,71 @@
+import numpy as np
+from numpy.linalg import norm
+import pymesh
+
+"""
+Modified from:
+fixmesh.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+"""
+fixmesh.py: Regularize a protein surface mesh.
+- based on code from the PyMESH documentation.
+"""
+
+def fix_mesh(mesh, resolution, detail="normal"):
+ bbox_min, bbox_max = mesh.bbox;
+ diag_len = norm(bbox_max - bbox_min);
+ if detail == "normal":
+ target_len = diag_len * 5e-3;
+ elif detail == "high":
+ target_len = diag_len * 2.5e-3;
+ elif detail == "low":
+ target_len = diag_len * 1e-2;
+
+ target_len = resolution
+ #print("Target resolution: {} mm".format(target_len));
+ # PGC 2017: Remove duplicated vertices first
+ mesh, _ = pymesh.remove_duplicated_vertices(mesh, 0.001)
+
+
+ count = 0;
+ print("Removing degenerated triangles")
+ mesh, __ = pymesh.remove_degenerated_triangles(mesh, 100);
+ mesh, __ = pymesh.split_long_edges(mesh, target_len);
+ num_vertices = mesh.num_vertices;
+ while True:
+ mesh, __ = pymesh.collapse_short_edges(mesh, 1e-6);
+ mesh, __ = pymesh.collapse_short_edges(mesh, target_len,
+ preserve_feature=True);
+ mesh, __ = pymesh.remove_obtuse_triangles(mesh, 150.0, 100);
+ if mesh.num_vertices == num_vertices:
+ break;
+
+ num_vertices = mesh.num_vertices;
+ #print("#v: {}".format(num_vertices));
+ count += 1;
+ if count > 10: break;
+
+ mesh = pymesh.resolve_self_intersection(mesh);
+ mesh, __ = pymesh.remove_duplicated_faces(mesh);
+ #mesh = pymesh.compute_outer_hull(mesh);
+
+ ############ Added by Oscar Mendez Lucio ##############
+ mesh = pymesh.compute_outer_hull(mesh, all_layers=True);
+ num_nodes = [i.num_nodes for i in mesh]
+ mesh = mesh[np.argmax(num_nodes)]
+ ############################################################
+
+ mesh, __ = pymesh.remove_duplicated_faces(mesh);
+ mesh, __ = pymesh.remove_obtuse_triangles(mesh, 179.0, 5);
+ mesh, __ = pymesh.remove_isolated_vertices(mesh);
+ mesh, _ = pymesh.remove_duplicated_vertices(mesh, 0.001)
+
+ ############ Added by Oscar Mendez Lucio ##############
+ mesh = pymesh.separate_mesh(mesh)
+ num_nodes = [i.num_nodes for i in mesh]
+ mesh = mesh[np.argmax(num_nodes)]
+ ############################################################
+
+ return mesh
diff --git a/model/comp_surface/prepare_target/input_output/README.md b/model/comp_surface/prepare_target/input_output/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..96c958dc3ca4d6020c277c60b5c1de4c16136222
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/README.md
@@ -0,0 +1,2 @@
+### source/input_output/
+Contains functions to read/write surface files, protonate PDBs and extract PDB chains.
diff --git a/model/comp_surface/prepare_target/input_output/__init__.py b/model/comp_surface/prepare_target/input_output/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/model/comp_surface/prepare_target/input_output/extractHelix.py b/model/comp_surface/prepare_target/input_output/extractHelix.py
new file mode 100644
index 0000000000000000000000000000000000000000..81d7bd7d84de4b0c0b366bef3da2b6d37b65e779
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/extractHelix.py
@@ -0,0 +1,32 @@
+from Bio.PDB import *
+
+# Exclude disordered atoms.
+class NotDisordered(Select):
+ def accept_atom(self, atom):
+ return not atom.is_disordered() or atom.get_altloc() == 'A'
+
+def extractHelix(helix, infilename, outfilename, chain_ids=None, includeWaters=False,\
+ invert=False):
+ parser = PDBParser(QUIET=True)
+ struct = parser.get_structure(infilename, infilename)
+ model = Selection.unfold_entities(struct, 'M')[0]
+ chains = Selection.unfold_entities(struct, 'C')
+ # Select residues to extract and build new structure
+ structBuild = StructureBuilder.StructureBuilder()
+ structBuild.init_structure("output")
+ structBuild.init_seg(" ")
+ structBuild.init_model(0)
+ outputStruct = structBuild.get_structure()
+ for chain in model:
+ if chain.get_id() in chain_ids:
+ structBuild.init_chain(chain.get_id())
+ for residue in chain:
+ het = residue.get_id()
+ if het[0] == ' ' and het in helix:
+ outputStruct[0][chain.get_id()].add(residue)
+
+ # Output the selected residues
+ pdbio = PDBIO()
+ pdbio.set_structure(outputStruct)
+ pdbio.save(outfilename, select=NotDisordered())
+
diff --git a/model/comp_surface/prepare_target/input_output/extractPDB.py b/model/comp_surface/prepare_target/input_output/extractPDB.py
new file mode 100644
index 0000000000000000000000000000000000000000..82ecc3a562cbc0704d7f348a77c5725c7fcae1f0
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/extractPDB.py
@@ -0,0 +1,69 @@
+"""
+extractPDB.py: Extract selected chains from a PDB and save the extracted chains to an output file.
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+from Bio.PDB import *
+
+from Bio.SeqUtils import IUPACData
+PROTEIN_LETTERS = [x.upper() for x in IUPACData.protein_letters_3to1.keys()]
+
+# Exclude disordered atoms.
+class NotDisordered(Select):
+ def accept_atom(self, atom):
+ return not atom.is_disordered() or atom.get_altloc() == "A" or atom.get_altloc() == "1"
+
+
+def find_modified_amino_acids(path):
+ """
+ Contributed by github user jomimc - find modified amino acids in the PDB (e.g. MSE)
+ """
+ res_set = set()
+ for line in open(path, 'r'):
+ if line[:6] == 'SEQRES':
+ for res in line.split()[4:]:
+ res_set.add(res)
+ for res in list(res_set):
+ if res in PROTEIN_LETTERS:
+ res_set.remove(res)
+ return res_set
+
+
+def extractPDB(
+ infilename, outfilename, chain_ids=None
+):
+ # extract the chain_ids from infilename and save in outfilename.
+ parser = PDBParser(QUIET=True)
+ struct = parser.get_structure(infilename, infilename)
+ model = Selection.unfold_entities(struct, "M")[0]
+ chains = Selection.unfold_entities(struct, "C")
+ # Select residues to extract and build new structure
+ structBuild = StructureBuilder.StructureBuilder()
+ structBuild.init_structure("output")
+ structBuild.init_seg(" ")
+ structBuild.init_model(0)
+ outputStruct = structBuild.get_structure()
+
+ # Load a list of non-standard amino acid names -- these are
+ # typically listed under HETATM, so they would be typically
+ # ignored by the orginal algorithm
+ modified_amino_acids = find_modified_amino_acids(infilename)
+
+ for chain in model:
+ if (
+ chain_ids == None
+ or chain.get_id() in chain_ids
+ ):
+ structBuild.init_chain(chain.get_id())
+ for residue in chain:
+ het = residue.get_id()
+ if het[0] == " ":
+ outputStruct[0][chain.get_id()].add(residue)
+ elif het[0][-3:] in modified_amino_acids:
+ outputStruct[0][chain.get_id()].add(residue)
+
+ # Output the selected residues
+ pdbio = PDBIO()
+ pdbio.set_structure(outputStruct)
+ pdbio.save(outfilename, select=NotDisordered())
+
diff --git a/model/comp_surface/prepare_target/input_output/protonate.py b/model/comp_surface/prepare_target/input_output/protonate.py
new file mode 100644
index 0000000000000000000000000000000000000000..e674d7bfc1ac8923b26428f57b42911b1f707788
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/protonate.py
@@ -0,0 +1,32 @@
+"""
+protonate.py: Wrapper method for the reduce program: protonate (i.e., add hydrogens) a pdb using reduce
+ and save to an output file.
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+
+from subprocess import Popen, PIPE
+from IPython.core.debugger import set_trace
+import os
+
+
+def protonate(in_pdb_file, out_pdb_file):
+ # protonate (i.e., add hydrogens) a pdb using reduce and save to an output file.
+ # in_pdb_file: file to protonate.
+ # out_pdb_file: output file where to save the protonated pdb file.
+
+ # Remove protons first, in case the structure is already protonated
+ args = ["reduce", "-Trim", in_pdb_file]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p2.communicate()
+ outfile = open(out_pdb_file, "w")
+ outfile.write(stdout.decode('utf-8').rstrip())
+ outfile.close()
+ # Now add them again.
+ args = ["reduce", "-HIS", out_pdb_file]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p2.communicate()
+ outfile = open(out_pdb_file, "w")
+ outfile.write(stdout.decode('utf-8'))
+ outfile.close()
+
diff --git a/model/comp_surface/prepare_target/input_output/read_msms.py b/model/comp_surface/prepare_target/input_output/read_msms.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ab24f774e980f1b3331cafe33fcf361b980a3db
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/read_msms.py
@@ -0,0 +1,60 @@
+import numpy as np
+"""
+read_msms.py: Read an msms output file that was output by MSMS (MSMS is the program we use to build a surface)
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+
+def read_msms(file_root):
+ # read the surface from the msms output. MSMS outputs two files: {file_root}.vert and {file_root}.face
+
+ vertfile = open(file_root + ".vert")
+ meshdata = (vertfile.read().rstrip()).split("\n")
+ vertfile.close()
+
+ # Read number of vertices.
+ count = {}
+ header = meshdata[2].split()
+ count["vertices"] = int(header[0])
+ ## Data Structures
+ vertices = np.zeros((count["vertices"], 3))
+ normalv = np.zeros((count["vertices"], 3))
+ atom_id = [""] * count["vertices"]
+ res_id = [""] * count["vertices"]
+ for i in range(3, len(meshdata)):
+ fields = meshdata[i].split()
+ vi = i - 3
+ vertices[vi][0] = float(fields[0])
+ vertices[vi][1] = float(fields[1])
+ vertices[vi][2] = float(fields[2])
+ normalv[vi][0] = float(fields[3])
+ normalv[vi][1] = float(fields[4])
+ normalv[vi][2] = float(fields[5])
+ atom_id[vi] = fields[7]
+ res_id[vi] = fields[9]
+ count["vertices"] -= 1
+
+ # Read faces.
+ facefile = open(file_root + ".face")
+ meshdata = (facefile.read().rstrip()).split("\n")
+ facefile.close()
+
+ # Read number of vertices.
+ header = meshdata[2].split()
+ count["faces"] = int(header[0])
+ faces = np.zeros((count["faces"], 3), dtype=int)
+ normalf = np.zeros((count["faces"], 3))
+
+ for i in range(3, len(meshdata)):
+ fi = i - 3
+ fields = meshdata[i].split()
+ faces[fi][0] = int(fields[0]) - 1
+ faces[fi][1] = int(fields[1]) - 1
+ faces[fi][2] = int(fields[2]) - 1
+ count["faces"] -= 1
+
+ assert count["vertices"] == 0
+ assert count["faces"] == 0
+
+ return vertices, faces, normalv, res_id
+
diff --git a/model/comp_surface/prepare_target/input_output/read_ply.py b/model/comp_surface/prepare_target/input_output/read_ply.py
new file mode 100644
index 0000000000000000000000000000000000000000..7811b4463677c230b0d7a12fc5b7e2e877abb058
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/read_ply.py
@@ -0,0 +1,53 @@
+import pymesh
+import numpy
+"""
+read_ply.py: Read a ply file from disk using pymesh and load the attributes used by MaSIF.
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+
+def read_ply(filename):
+ # Read a ply file from disk using pymesh and load the attributes used by MaSIF.
+ # filename: the input ply file.
+ # returns data as tuple.
+ mesh = pymesh.load_mesh(filename)
+
+ attributes = mesh.get_attribute_names()
+ if "vertex_nx" in attributes:
+ nx = mesh.get_attribute("vertex_nx")
+ ny = mesh.get_attribute("vertex_ny")
+ nz = mesh.get_attribute("vertex_nz")
+
+ normals = numpy.column_stack((nx, ny, nz))
+ else:
+ normals = None
+ if "vertex_charge" in attributes:
+ charge = mesh.get_attribute("vertex_charge")
+ else:
+ charge = numpy.array([0.0] * len(mesh.vertices))
+
+ if "vertex_cb" in attributes:
+ vertex_cb = mesh.get_attribute("vertex_cb")
+ else:
+ vertex_cb = numpy.array([0.0] * len(mesh.vertices))
+
+ if "vertex_hbond" in attributes:
+ vertex_hbond = mesh.get_attribute("vertex_hbond")
+ else:
+ vertex_hbond = numpy.array([0.0] * len(mesh.vertices))
+
+ if "vertex_hphob" in attributes:
+ vertex_hphob = mesh.get_attribute("vertex_hphob")
+ else:
+ vertex_hphob = numpy.array([0.0] * len(mesh.vertices))
+
+ return (
+ mesh.vertices,
+ mesh.faces,
+ normals,
+ charge,
+ vertex_cb,
+ vertex_hbond,
+ vertex_hphob,
+ )
+
diff --git a/model/comp_surface/prepare_target/input_output/save_ply.py b/model/comp_surface/prepare_target/input_output/save_ply.py
new file mode 100644
index 0000000000000000000000000000000000000000..de24ae35f33b8195159bd1751c0687e043d8c4f7
--- /dev/null
+++ b/model/comp_surface/prepare_target/input_output/save_ply.py
@@ -0,0 +1,58 @@
+import pymesh
+import numpy
+"""
+read_ply.py: Save a ply file to disk using pymesh and load the attributes used by MaSIF.
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+
+
+def save_ply(
+ filename,
+ vertices,
+ faces=[],
+ normals=None,
+ charges=None,
+ vertex_cb=None,
+ hbond=None,
+ hphob=None,
+ iface=None,
+ normalize_charges=False,
+):
+ """ Save vertices, mesh in ply format.
+ vertices: coordinates of vertices
+ faces: mesh
+ """
+ mesh = pymesh.form_mesh(vertices, faces)
+ if normals is not None:
+ n1 = normals[:, 0]
+ n2 = normals[:, 1]
+ n3 = normals[:, 2]
+ mesh.add_attribute("vertex_nx")
+ mesh.set_attribute("vertex_nx", n1)
+ mesh.add_attribute("vertex_ny")
+ mesh.set_attribute("vertex_ny", n2)
+ mesh.add_attribute("vertex_nz")
+ mesh.set_attribute("vertex_nz", n3)
+ if charges is not None:
+ mesh.add_attribute("charge")
+ if normalize_charges:
+ charges = charges / 10
+ mesh.set_attribute("charge", charges)
+ if hbond is not None:
+ mesh.add_attribute("hbond")
+ mesh.set_attribute("hbond", hbond)
+ if vertex_cb is not None:
+ mesh.add_attribute("vertex_cb")
+ mesh.set_attribute("vertex_cb", vertex_cb)
+ if hphob is not None:
+ mesh.add_attribute("vertex_hphob")
+ mesh.set_attribute("vertex_hphob", hphob)
+ if iface is not None:
+ mesh.add_attribute("vertex_iface")
+ mesh.set_attribute("vertex_iface", iface)
+
+ pymesh.save_mesh(
+ filename, mesh, *mesh.get_attribute_names(), use_float=True, ascii=True
+ )
+
diff --git a/model/comp_surface/prepare_target/mol2graph.py b/model/comp_surface/prepare_target/mol2graph.py
new file mode 100644
index 0000000000000000000000000000000000000000..4049f8206dd5f0963fb0b9908c556590a6eeef5a
--- /dev/null
+++ b/model/comp_surface/prepare_target/mol2graph.py
@@ -0,0 +1,153 @@
+import numpy as np
+from rdkit.Chem import AllChem, Draw, Descriptors, rdMolTransforms
+import rdkit.Chem as Chem
+import rdkit.Chem.rdMolDescriptors as rdMolDescriptors
+import rdkit.Chem.EState as EState
+import rdkit.Chem.rdPartialCharges as rdPartialCharges
+import rdkit.Chem.rdChemReactions as rdRxns
+import copy
+att_dtype = np.float32
+
+import networkx as nx
+
+
+def oneHotVector(val, lst):
+ '''Converts a value to a one-hot vector based on options in lst'''
+ if val not in lst:
+ val = lst[-1]
+ return map(lambda x: x == val, lst)
+
+def mol_to_nx(mol):
+ G = nx. Graph()
+
+ # Globals.
+ G.graph["features"] = np.array([None], dtype = np.float32)
+ atomCoords = mol.GetConformer().GetPositions()
+
+ for i, atom in enumerate(mol.GetAtoms()):
+ if atom.GetAtomicNum() == 1: continue
+ G.add_node(atom.GetIdx(),
+ pos = atomCoords[i],
+ x=np.array(list(oneHotVector(atom.GetAtomicNum(),
+ [4, 5, 6, 7, 8, 9, 12, 14, 15, 16, 17, 23, 26, 27, 29, 30, 33, 34, 35, 44, 45, 51, 53, 75, 76, 77, 78, 80])),
+ dtype = np.float32))
+
+ for bond in mol.GetBonds():
+ if mol.GetAtomWithIdx(bond.GetBeginAtomIdx()).GetAtomicNum() == 1: continue
+ if mol.GetAtomWithIdx(bond.GetEndAtomIdx()).GetAtomicNum() == 1: continue
+ isConjugated = 1 if bond.GetIsConjugated() and not bond.GetIsAromatic() else 0
+ G.add_edge(bond.GetBeginAtomIdx(),
+ bond.GetEndAtomIdx(),
+ edge_attr=np.array(list(oneHotVector(bond.GetBondTypeAsDouble(),
+ [1.0, 1.5, 2.0, 3.0, 99.0]))+[isConjugated],
+ dtype = np.float32))
+ '''
+ try:
+ conf = mol.GetConformer()
+ for i in range(0, mol.GetNumAtoms()-1):
+ for j in range(i+1,mol.GetNumAtoms()):
+ if mol.GetBondBetweenAtoms(i,j)==None:
+ ShortestPath = Chem.rdmolops.GetShortestPath(mol, i,j)
+ dist=Chem.rdMolTransforms.GetBondLength(conf,i,j)
+ if (dist <= 10. and len(ShortestPath) > 4):
+ G.add_edge(i, j, bond_type=None, features=np.array([0.,0.,0.,0.,0.,dist], dtype = np.float32))
+ except:pass
+ '''
+ return G
+
+
+def get_bonds(mol_list, bidirectional=True):
+ atom_counter=0
+ bonds = []
+ dist = []
+ for m in mol_list:
+ for x in m.GetBonds():
+ conf = m.GetConformer()
+ bonds.extend([(x.GetBeginAtomIdx()+atom_counter, x.GetEndAtomIdx()+atom_counter)])
+ dist.extend([rdMolTransforms.GetBondLength(conf,x.GetBeginAtomIdx(), x.GetEndAtomIdx())])
+ if bidirectional:
+ bonds.extend([(x.GetEndAtomIdx()+atom_counter, x.GetBeginAtomIdx()+atom_counter)])
+ dist.extend([rdMolTransforms.GetBondLength(conf,x.GetEndAtomIdx(), x.GetBeginAtomIdx())])
+ atom_counter += m.GetNumAtoms()
+ return bonds, dist
+
+
+def get_angles(mol_list, bidirectional=True):
+ atom_counter = 0
+ bendList = []
+ angleList = []
+ for m in mol_list:
+ bendSmarts = '*~*~*'
+ bendQuery = Chem.MolFromSmarts(bendSmarts)
+ matches = m.GetSubstructMatches(bendQuery)
+ conf = m.GetConformer()
+ for match in matches:
+ idx0 = match[0]
+ idx1 = match[1]
+ idx2 = match[2]
+ bendList.append((idx0+atom_counter, idx1+atom_counter, idx2+atom_counter))
+ angleList.append(rdMolTransforms.GetAngleRad(conf, idx0, idx1, idx2))
+ if bidirectional:
+ bendList.append((idx2+atom_counter, idx1+atom_counter, idx0+atom_counter))
+ angleList.append(rdMolTransforms.GetAngleRad(conf, idx2, idx1, idx0))
+ atom_counter += m.GetNumAtoms()
+ return bendList, angleList
+
+
+def get_torsions(mol_list, bidirectional=True):
+ atom_counter=0
+ torsionList = []
+ dihedralList = []
+ for m in mol_list:
+ torsionSmarts = '[!$(*#*)&!D1]~[!$(*#*)&!D1]'
+ torsionQuery = Chem.MolFromSmarts(torsionSmarts)
+ matches = m.GetSubstructMatches(torsionQuery)
+ conf = m.GetConformer()
+ for match in matches:
+ idx2 = match[0]
+ idx3 = match[1]
+ bond = m.GetBondBetweenAtoms(idx2, idx3)
+ jAtom = m.GetAtomWithIdx(idx2)
+ kAtom = m.GetAtomWithIdx(idx3)
+ if (((jAtom.GetHybridization() != Chem.HybridizationType.SP2)
+ and (jAtom.GetHybridization() != Chem.HybridizationType.SP3))
+ or ((kAtom.GetHybridization() != Chem.HybridizationType.SP2)
+ and (kAtom.GetHybridization() != Chem.HybridizationType.SP3))):
+ continue
+ for b1 in jAtom.GetBonds():
+ if (b1.GetIdx() == bond.GetIdx()):
+ continue
+ idx1 = b1.GetOtherAtomIdx(idx2)
+ for b2 in kAtom.GetBonds():
+ if ((b2.GetIdx() == bond.GetIdx())
+ or (b2.GetIdx() == b1.GetIdx())):
+ continue
+ idx4 = b2.GetOtherAtomIdx(idx3)
+ # skip 3-membered rings
+ if (idx4 == idx1):
+ continue
+ torsionList.append((idx1+atom_counter, idx2+atom_counter, idx3+atom_counter, idx4+atom_counter))
+ dihedralList.append(rdMolTransforms.GetDihedralRad(conf, idx1, idx2, idx3, idx4))
+ if bidirectional:
+ torsionList.append((idx4+atom_counter, idx3+atom_counter, idx2+atom_counter, idx1+atom_counter))
+ dihedralList.append(rdMolTransforms.GetDihedralRad(conf, idx4, idx3, idx2, idx1))
+ atom_counter += m.GetNumAtoms()
+ return torsionList, dihedralList
+
+
+def mol_with_atom_index( mol ):
+ atoms = mol.GetNumAtoms()
+ for idx in range( atoms ):
+ mol.GetAtomWithIdx( idx ).SetProp( 'molAtomMapNumber', str( mol.GetAtomWithIdx( idx ).GetIdx() ) )
+ return mol
+
+def atomenvironments(mol, radius=3):
+ envs = []
+ for a in mol.GetAtoms():
+ idx = a.GetIdx()
+ env = Chem.FindAtomEnvironmentOfRadiusN(mol, radius, idx)
+ amap = {}
+ submol=Chem.PathToSubmol(mol, env, atomMap=amap)
+ if amap.get(idx) is not None:
+ envs.append(Chem.MolToSmarts(submol))
+ return envs
diff --git a/model/comp_surface/prepare_target/save_ply.py b/model/comp_surface/prepare_target/save_ply.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab479b8e7dfc5981c5e1cdfe4c798e76c6d65dd7
--- /dev/null
+++ b/model/comp_surface/prepare_target/save_ply.py
@@ -0,0 +1,68 @@
+import pymesh
+import numpy
+"""
+Modified from:
+save_ply.py - MaSIF
+Pablo Gainza - LPDI STI EPFL 2019
+"""
+
+"""
+read_ply.py: Save a ply file to disk using pymesh and load the attributes used by MaSIF.
+Pablo Gainza - LPDI STI EPFL 2019
+Released under an Apache License 2.0
+"""
+
+
+def save_ply(
+ filename,
+ vertices,
+ faces=[],
+ normals=None,
+ charges=None,
+ vertex_cb=None,
+ hbond=None,
+ hphob=None,
+ iface=None,
+ si=None,
+ normalize_charges=False,
+):
+ """ Save vertices, mesh in ply format.
+ vertices: coordinates of vertices
+ faces: mesh
+ """
+ mesh = pymesh.form_mesh(vertices, faces)
+ if normals is not None:
+ n1 = normals[:, 0]
+ n2 = normals[:, 1]
+ n3 = normals[:, 2]
+ mesh.add_attribute("vertex_nx")
+ mesh.set_attribute("vertex_nx", n1)
+ mesh.add_attribute("vertex_ny")
+ mesh.set_attribute("vertex_ny", n2)
+ mesh.add_attribute("vertex_nz")
+ mesh.set_attribute("vertex_nz", n3)
+ if charges is not None:
+ mesh.add_attribute("charge")
+ if normalize_charges:
+ charges = charges / 10
+ mesh.set_attribute("charge", charges)
+ if hbond is not None:
+ mesh.add_attribute("hbond")
+ mesh.set_attribute("hbond", hbond)
+ if vertex_cb is not None:
+ mesh.add_attribute("vertex_cb")
+ mesh.set_attribute("vertex_cb", vertex_cb)
+ if hphob is not None:
+ mesh.add_attribute("vertex_hphob")
+ mesh.set_attribute("vertex_hphob", hphob)
+ if iface is not None:
+ mesh.add_attribute("vertex_iface")
+ mesh.set_attribute("vertex_iface", iface)
+ if si is not None:
+ mesh.add_attribute("vertex_si")
+ mesh.set_attribute("vertex_si", si)
+
+ pymesh.save_mesh(
+ filename, mesh, *mesh.get_attribute_names(), use_float=True, ascii=True
+ )
+
diff --git a/model/comp_surface/prepare_target/triangulation/README.md b/model/comp_surface/prepare_target/triangulation/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5c9b1a24902e754acdce8d2b9b215ea05225ca5
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/README.md
@@ -0,0 +1,12 @@
+### source/triangulation
+Functions used by MaSIF to triangulate proteins (through MSMS), regularize these meshes, and compute chemical charges.
+
++ *computeAPBS.py*: Wrapper function to compute the Poisson Boltzmann electrostatics for a surface using APBS.
++ *computeCharges.py*: Compute the free electrons/protons in the surface.
++ *computeHydrophobicity.py*: Compute the hydrophobicity of each vertex.
++ *computeMSMS.py*: Compute the MSMS surface of a protein.
++ *compute_normal.py*: Compute the normals of the surface.
++ *fixmesh.py*: Regularize an MSMS mesh
++ *xyzrn.py*: Output a PDB in the input format used by MSMS
+
+
diff --git a/model/comp_surface/prepare_target/triangulation/__init__.py b/model/comp_surface/prepare_target/triangulation/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/model/comp_surface/prepare_target/triangulation/computeAPBS.py b/model/comp_surface/prepare_target/triangulation/computeAPBS.py
new file mode 100644
index 0000000000000000000000000000000000000000..b37c41950eb8e6403949f560df88fada826f2e07
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/computeAPBS.py
@@ -0,0 +1,68 @@
+import os
+import numpy
+from subprocess import Popen, PIPE
+import pymesh
+
+from default_config.global_vars import apbs_bin, pdb2pqr_bin, multivalue_bin
+import random
+
+"""
+computeAPBS.py: Wrapper function to compute the Poisson Boltzmann electrostatics for a surface using APBS.
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF.
+Released under an Apache License 2.0
+"""
+
+def computeAPBS(vertices, pdb_file, tmp_file_base):
+ """
+ Calls APBS, pdb2pqr, and multivalue and returns the charges per vertex
+ """
+ fields = tmp_file_base.split("/")[0:-1]
+ directory = "/".join(fields) + "/"
+ filename_base = tmp_file_base.split("/")[-1]
+ pdbname = pdb_file.split("/")[-1]
+ args = [
+ pdb2pqr_bin,
+ "--ff=parse",
+ "--whitespace",
+ "--noopt",
+ "--apbs-input",
+ pdbname,
+ filename_base,
+ ]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ args = [apbs_bin, filename_base + ".in"]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ vertfile = open(directory + "/" + filename_base + ".csv", "w")
+ for vert in vertices:
+ vertfile.write("{},{},{}\n".format(vert[0], vert[1], vert[2]))
+ vertfile.close()
+
+ args = [
+ multivalue_bin,
+ filename_base + ".csv",
+ filename_base + ".dx",
+ filename_base + "_out.csv",
+ ]
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE, cwd=directory)
+ stdout, stderr = p2.communicate()
+
+ # Read the charge file
+ chargefile = open(tmp_file_base + "_out.csv")
+ charges = numpy.array([0.0] * len(vertices))
+ for ix, line in enumerate(chargefile.readlines()):
+ charges[ix] = float(line.split(",")[3])
+
+ remove_fn = os.path.join(directory, filename_base)
+ os.remove(remove_fn)
+ os.remove(remove_fn+'.csv')
+ os.remove(remove_fn+'.dx')
+ os.remove(remove_fn+'.in')
+ os.remove(remove_fn+'-input.p')
+ os.remove(remove_fn+'_out.csv')
+
+ return charges
diff --git a/model/comp_surface/prepare_target/triangulation/computeCharges.py b/model/comp_surface/prepare_target/triangulation/computeCharges.py
new file mode 100644
index 0000000000000000000000000000000000000000..43dd3cd3af14d6eaf8c1e456924ab720f93a6a2c
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/computeCharges.py
@@ -0,0 +1,215 @@
+from Bio.PDB import *
+import numpy as np
+from sklearn.neighbors import KDTree
+
+"""
+computeCharges.py: Wrapper function to compute hydrogen bond potential (free electrons/protons) in the surface
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF.
+Released under an Apache License 2.0
+"""
+
+from default_config.chemistry import (
+ polarHydrogens,
+ radii,
+ acceptorAngleAtom,
+ acceptorPlaneAtom,
+ hbond_std_dev,
+ donorAtom,
+)
+
+# Compute vertex charges based on hydrogen bond potential.
+# pdb_filename: The filename of the protonated protein.
+# vertices: The surface vertices of the protonated protein
+# The name of each vertex in the format, example: B_125_x_ASN_ND2_Green
+# where B is chain, 125 res id, x the insertion, ASN aatype, ND2 the name of the
+# atom, and green is not used anymore.
+def computeCharges(pdb_filename, vertices, names):
+ parser = PDBParser(QUIET=True)
+ struct = parser.get_structure(pdb_filename, pdb_filename + ".pdb")
+ residues = {}
+ for res in struct.get_residues():
+ chain_id = res.get_parent().get_id()
+ if chain_id == "":
+ chain_id = " "
+ residues[(chain_id, res.get_id())] = res
+
+ atoms = Selection.unfold_entities(struct, "A")
+ satisfied_CO, satisfied_HN = computeSatisfied_CO_HN(atoms)
+
+ charge = np.array([0.0] * len(vertices))
+ # Go over every vertex
+ for ix, name in enumerate(names):
+ fields = name.split("_")
+ chain_id = fields[0]
+ if chain_id == "":
+ chain_id = " "
+ if fields[2] == "x":
+ fields[2] = " "
+ res_id = (" ", int(fields[1]), fields[2])
+ aa = fields[3]
+ atom_name = fields[4]
+ # Ignore atom if it is BB and it is already satisfied.
+ if atom_name == "H" and res_id in satisfied_HN:
+ continue
+ if atom_name == "O" and res_id in satisfied_CO:
+ continue
+ # Compute the charge of the vertex
+ charge[ix] = computeChargeHelper(
+ atom_name, residues[(chain_id, res_id)], vertices[ix]
+ )
+
+ return charge
+
+
+# Compute the charge of a vertex in a residue.
+def computeChargeHelper(atom_name, res, v):
+ res_type = res.get_resname()
+ # Check if it is a polar hydrogen.
+ if isPolarHydrogen(atom_name, res):
+ donor_atom_name = donorAtom[atom_name]
+ a = res[donor_atom_name].get_coord() # N/O
+ b = res[atom_name].get_coord() # H
+ # Donor-H is always 180.0 degrees, = pi
+ angle_deviation = computeAngleDeviation(a, b, v, np.pi)
+ angle_penalty = computeAnglePenalty(angle_deviation)
+ return 1.0 * angle_penalty
+ # Check if it is an acceptor oxygen or nitrogen
+ elif isAcceptorAtom(atom_name, res):
+ acceptor_atom = res[atom_name]
+ b = acceptor_atom.get_coord()
+ try:
+ a = res[acceptorAngleAtom[atom_name]].get_coord()
+ except:
+ return 0.0
+ # 120 degress for acceptor
+ angle_deviation = computeAngleDeviation(a, b, v, 2 * np.pi / 3)
+ # TODO: This should not be 120 for all atoms, i.e. for HIS it should be
+ # ~125.0
+ angle_penalty = computeAnglePenalty(angle_deviation)
+ plane_penalty = 1.0
+ if atom_name in acceptorPlaneAtom:
+ try:
+ d = res[acceptorPlaneAtom[atom_name]].get_coord()
+ except:
+ return 0.0
+ plane_deviation = computePlaneDeviation(d, a, b, v)
+ plane_penalty = computeAnglePenalty(plane_deviation)
+ return -1.0 * angle_penalty * plane_penalty
+ # Compute the
+ return 0.0
+
+
+# Compute the absolute value of the deviation from theta
+def computeAngleDeviation(a, b, c, theta):
+ return abs(calc_angle(Vector(a), Vector(b), Vector(c)) - theta)
+
+
+# Compute the angle deviation from a plane
+def computePlaneDeviation(a, b, c, d):
+ dih = calc_dihedral(Vector(a), Vector(b), Vector(c), Vector(d))
+ dev1 = abs(dih)
+ dev2 = np.pi - abs(dih)
+ return min(dev1, dev2)
+
+
+# angle_deviation from ideal value. TODO: do a more data-based solution
+def computeAnglePenalty(angle_deviation):
+ # Standard deviation: hbond_std_dev
+ return max(0.0, 1.0 - (angle_deviation / (hbond_std_dev)) ** 2)
+
+
+def isPolarHydrogen(atom_name, res):
+ if atom_name in polarHydrogens[res.get_resname()]:
+ return True
+ else:
+ return False
+
+
+def isAcceptorAtom(atom_name, res):
+ if atom_name.startswith("O"):
+ return True
+ else:
+ if res.get_resname() == "HIS":
+ if atom_name == "ND1" and "HD1" not in res:
+ return True
+ if atom_name == "NE2" and "HE2" not in res:
+ return True
+ return False
+
+
+# Compute the list of backbone C=O:H-N that are satisfied. These will be ignored.
+def computeSatisfied_CO_HN(atoms):
+ ns = NeighborSearch(atoms)
+ satisfied_CO = set()
+ satisfied_HN = set()
+ for atom1 in atoms:
+ res1 = atom1.get_parent()
+ if atom1.get_id() == "O":
+ neigh_atoms = ns.search(atom1.get_coord(), 2.5, level="A")
+ for atom2 in neigh_atoms:
+ if atom2.get_id() == "H":
+ res2 = atom2.get_parent()
+ # Ensure they belong to different residues.
+ if res2.get_id() != res1.get_id():
+ # Compute the angle N-H:O, ideal value is 180 (but in
+ # helices it is typically 160) 180 +-30 = pi
+ angle_N_H_O_dev = computeAngleDeviation(
+ res2["N"].get_coord(),
+ atom2.get_coord(),
+ atom1.get_coord(),
+ np.pi,
+ )
+ # Compute angle H:O=C, ideal value is ~160 +- 20 = 8*pi/9
+ angle_H_O_C_dev = computeAngleDeviation(
+ atom2.get_coord(),
+ atom1.get_coord(),
+ res1["C"].get_coord(),
+ 8 * np.pi / 9,
+ )
+ ## Allowed deviations: 30 degrees (pi/6) and 20 degrees
+ # (pi/9)
+ if (
+ angle_N_H_O_dev - np.pi / 6 < 0
+ and angle_H_O_C_dev - np.pi / 9 < 0.0
+ ):
+ satisfied_CO.add(res1.get_id())
+ satisfied_HN.add(res2.get_id())
+ return satisfied_CO, satisfied_HN
+
+
+# Compute the charge of a new mesh, based on the charge of an old mesh.
+# Use the top vertex in distance, for now (later this should be smoothed over 3
+# or 4 vertices)
+def assignChargesToNewMesh(new_vertices, old_vertices, old_charges, seeder_opts):
+ dataset = old_vertices
+ testset = new_vertices
+ new_charges = np.zeros(len(new_vertices))
+ if seeder_opts["feature_interpolation"]:
+ num_inter = 4 # Number of interpolation features
+ # Assign k old vertices to each new vertex.
+ kdt = KDTree(dataset)
+ dists, result = kdt.query(testset, k=num_inter)
+ # Square the distances (as in the original pyflann)
+ dists = np.square(dists)
+ # The size of result is the same as new_vertices
+ for vi_new in range(len(result)):
+ vi_old = result[vi_new]
+ dist_old = dists[vi_new]
+ # If one vertex is right on top, ignore the rest.
+ if dist_old[0] == 0.0:
+ new_charges[vi_new] = old_charges[vi_old[0]]
+ continue
+
+ total_dist = np.sum(1 / dist_old)
+ for i in range(num_inter):
+ new_charges[vi_new] += (
+ old_charges[vi_old[i]] * (1 / dist_old[i]) / total_dist
+ )
+ else:
+ # Assign k old vertices to each new vertex.
+ kdt = KDTree(dataset)
+ dists, result = kdt.query(testset)
+ new_charges = old_charges[result]
+ return new_charges
+
diff --git a/model/comp_surface/prepare_target/triangulation/computeHydrophobicity.py b/model/comp_surface/prepare_target/triangulation/computeHydrophobicity.py
new file mode 100644
index 0000000000000000000000000000000000000000..c0948096e4ba3d0074fb032d6fd134bf31f26cac
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/computeHydrophobicity.py
@@ -0,0 +1,33 @@
+import numpy as np
+
+# Kyte Doolittle scale
+kd_scale = {}
+kd_scale["ILE"] = 4.5
+kd_scale["VAL"] = 4.2
+kd_scale["LEU"] = 3.8
+kd_scale["PHE"] = 2.8
+kd_scale["CYS"] = 2.5
+kd_scale["MET"] = 1.9
+kd_scale["ALA"] = 1.8
+kd_scale["GLY"] = -0.4
+kd_scale["THR"] = -0.7
+kd_scale["SER"] = -0.8
+kd_scale["TRP"] = -0.9
+kd_scale["TYR"] = -1.3
+kd_scale["PRO"] = -1.6
+kd_scale["HIS"] = -3.2
+kd_scale["GLU"] = -3.5
+kd_scale["GLN"] = -3.5
+kd_scale["ASP"] = -3.5
+kd_scale["ASN"] = -3.5
+kd_scale["LYS"] = -3.9
+kd_scale["ARG"] = -4.5
+
+# For each vertex in names, compute
+def computeHydrophobicity(names):
+ hp = np.zeros(len(names))
+ for ix, name in enumerate(names):
+ aa = name.split("_")[3]
+ hp[ix] = kd_scale[aa]
+ return hp
+
diff --git a/model/comp_surface/prepare_target/triangulation/computeMSMS.py b/model/comp_surface/prepare_target/triangulation/computeMSMS.py
new file mode 100644
index 0000000000000000000000000000000000000000..b7a345e13a99e17ab72ab9780804a2638d07e0d0
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/computeMSMS.py
@@ -0,0 +1,46 @@
+import os
+from subprocess import Popen, PIPE
+
+from input_output.read_msms import read_msms
+from triangulation.xyzrn import output_pdb_as_xyzrn
+from default_config.global_vars import msms_bin
+from default_config.masif_opts import masif_opts
+import random
+
+# Pablo Gainza LPDI EPFL 2017-2019
+# Calls MSMS and returns the vertices.
+# Special atoms are atoms with a reduced radius.
+def computeMSMS(pdb_file, protonate=True):
+ randnum = random.randint(1,10000000)
+ file_base = masif_opts['tmp_dir']+"/msms_"+str(randnum)
+ out_xyzrn = file_base+".xyzrn"
+
+ if protonate:
+ output_pdb_as_xyzrn(pdb_file, out_xyzrn)
+ else:
+ print("Error - pdb2xyzrn is deprecated.")
+ sys.exit(1)
+ # Now run MSMS on xyzrn file
+ FNULL = open(os.devnull, 'w')
+ args = [msms_bin, "-density", "3.0", "-hdensity", "3.0", "-probe",\
+ "1.5", "-if",out_xyzrn,"-of",file_base, "-af", file_base]
+ #print msms_bin+" "+`args`
+ p2 = Popen(args, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p2.communicate()
+
+ vertices, faces, normals, names = read_msms(file_base)
+ areas = {}
+ ses_file = open(file_base+".area")
+ next(ses_file) # ignore header line
+ for line in ses_file:
+ fields = line.split()
+ areas[fields[3]] = fields[1]
+
+
+ # Remove temporary files.
+ os.remove(file_base+'.area')
+ os.remove(file_base+'.xyzrn')
+ os.remove(file_base+'.vert')
+ os.remove(file_base+'.face')
+ return vertices, faces, normals, names, areas
+
diff --git a/model/comp_surface/prepare_target/triangulation/compute_normal.py b/model/comp_surface/prepare_target/triangulation/compute_normal.py
new file mode 100644
index 0000000000000000000000000000000000000000..a1cd899a52ec67a7cca14a9360b55d6f42a35f16
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/compute_normal.py
@@ -0,0 +1,72 @@
+import numpy as np
+from numpy.matlib import repmat
+"""
+compute_normal.py: Compute the normals of a closed shape.
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF, based on previous matlab code by Gabriel Peyre, converted to Python by Pablo Gainza
+"""
+
+###
+from default_config.global_vars import epsilon as eps
+
+
+def compute_normal(vertex, face):
+
+ """
+ compute_normal - compute the normal of a triangulation
+ vertex: 3xn matrix of vertices
+ face: 3xm matrix of face indices.
+
+ normal,normalf = compute_normal(vertex,face)
+
+ normal(i,:) is the normal at vertex i.
+ normalf(j,:) is the normal at face j.
+
+ Copyright (c) 2004 Gabriel Peyr
+ Converted to Python by Pablo Gainza LPDI EPFL 2017
+ """
+
+ vertex = vertex.T
+ face = face.T
+ nface = np.size(face, 1)
+ nvert = np.size(vertex, 1)
+ normal = np.zeros((3, nvert))
+ # unit normals to the faces
+ normalf = crossp(
+ vertex[:, face[1, :]] - vertex[:, face[0, :]],
+ vertex[:, face[2, :]] - vertex[:, face[0, :]],
+ )
+ sum_squares = np.sum(normalf ** 2, 0)
+ d = np.sqrt(sum_squares)
+ d[d < eps] = 1
+ normalf = normalf / repmat(d, 3, 1)
+ # unit normal to the vertex
+ normal = np.zeros((3, nvert))
+ for i in np.arange(0, nface):
+ f = face[:, i]
+ for j in np.arange(3):
+ normal[:, f[j]] = normal[:, f[j]] + normalf[:, i]
+
+ # normalize
+ d = np.sqrt(np.sum(normal ** 2, 0))
+ d[d < eps] = 1
+ normal = normal / repmat(d, 3, 1)
+ # enforce that the normal are outward
+ vertex_means = np.mean(vertex, 0)
+ v = vertex - repmat(vertex_means, 3, 1)
+ s = np.sum(np.multiply(v, normal), 1)
+ if np.sum(s > 0) < np.sum(s < 0):
+ # flip
+ normal = -normal
+ normalf = -normalf
+ return normal.T
+
+
+def crossp(x, y):
+
+ # x and y are (m,3) dimensional
+ z = np.zeros((x.shape))
+ z[0, :] = np.multiply(x[1, :], y[2, :]) - np.multiply(x[2, :], y[1, :])
+ z[1, :] = np.multiply(x[2, :], y[0, :]) - np.multiply(x[0, :], y[2, :])
+ z[2, :] = np.multiply(x[0, :], y[1, :]) - np.multiply(x[1, :], y[0, :])
+ return z
diff --git a/model/comp_surface/prepare_target/triangulation/fixmesh.py b/model/comp_surface/prepare_target/triangulation/fixmesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d584824a49f7a13e8dbf02c5350c1abc307b09e
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/fixmesh.py
@@ -0,0 +1,53 @@
+import numpy as np
+from numpy.linalg import norm
+import pymesh
+
+"""
+fixmesh.py: Regularize a protein surface mesh.
+- based on code from the PyMESH documentation.
+"""
+
+
+def fix_mesh(mesh, resolution, detail="normal"):
+ bbox_min, bbox_max = mesh.bbox;
+ diag_len = norm(bbox_max - bbox_min);
+ if detail == "normal":
+ target_len = diag_len * 5e-3;
+ elif detail == "high":
+ target_len = diag_len * 2.5e-3;
+ elif detail == "low":
+ target_len = diag_len * 1e-2;
+
+ target_len = resolution
+ #print("Target resolution: {} mm".format(target_len));
+ # PGC 2017: Remove duplicated vertices first
+ mesh, _ = pymesh.remove_duplicated_vertices(mesh, 0.001)
+
+
+ count = 0;
+ print("Removing degenerated triangles")
+ mesh, __ = pymesh.remove_degenerated_triangles(mesh, 100);
+ mesh, __ = pymesh.split_long_edges(mesh, target_len);
+ num_vertices = mesh.num_vertices;
+ while True:
+ mesh, __ = pymesh.collapse_short_edges(mesh, 1e-6);
+ mesh, __ = pymesh.collapse_short_edges(mesh, target_len,
+ preserve_feature=True);
+ mesh, __ = pymesh.remove_obtuse_triangles(mesh, 150.0, 100);
+ if mesh.num_vertices == num_vertices:
+ break;
+
+ num_vertices = mesh.num_vertices;
+ #print("#v: {}".format(num_vertices));
+ count += 1;
+ if count > 10: break;
+
+ mesh = pymesh.resolve_self_intersection(mesh);
+ mesh, __ = pymesh.remove_duplicated_faces(mesh);
+ mesh = pymesh.compute_outer_hull(mesh);
+ mesh, __ = pymesh.remove_duplicated_faces(mesh);
+ mesh, __ = pymesh.remove_obtuse_triangles(mesh, 179.0, 5);
+ mesh, __ = pymesh.remove_isolated_vertices(mesh);
+ mesh, _ = pymesh.remove_duplicated_vertices(mesh, 0.001)
+
+ return mesh
diff --git a/model/comp_surface/prepare_target/triangulation/xyzrn.py b/model/comp_surface/prepare_target/triangulation/xyzrn.py
new file mode 100644
index 0000000000000000000000000000000000000000..b6d6660a1b6acecab195f03aa5f6e3606764d9db
--- /dev/null
+++ b/model/comp_surface/prepare_target/triangulation/xyzrn.py
@@ -0,0 +1,51 @@
+from Bio.PDB import *
+from default_config.chemistry import radii, polarHydrogens
+
+"""
+xyzrn.py: Read a pdb file and output it is in xyzrn for use in MSMS
+Pablo Gainza - LPDI STI EPFL 2019
+This file is part of MaSIF.
+Released under an Apache License 2.0
+"""
+
+def output_pdb_as_xyzrn(pdbfilename, xyzrnfilename):
+ """
+ pdbfilename: input pdb filename
+ xyzrnfilename: output in xyzrn format.
+ """
+ parser = PDBParser()
+ struct = parser.get_structure(pdbfilename, pdbfilename)
+ outfile = open(xyzrnfilename, "w")
+ for atom in struct.get_atoms():
+ name = atom.get_name()
+ residue = atom.get_parent()
+ # Ignore hetatms.
+ if residue.get_id()[0] != " ":
+ continue
+ resname = residue.get_resname()
+ reskey = residue.get_id()[1]
+ chain = residue.get_parent().get_id()
+ atomtype = name[0]
+
+ color = "Green"
+ coords = None
+ if atomtype in radii and resname in polarHydrogens:
+ if atomtype == "O":
+ color = "Red"
+ if atomtype == "N":
+ color = "Blue"
+ if atomtype == "H":
+ if name in polarHydrogens[resname]:
+ color = "Blue" # Polar hydrogens
+ coords = "{:.06f} {:.06f} {:.06f}".format(
+ atom.get_coord()[0], atom.get_coord()[1], atom.get_coord()[2]
+ )
+ insertion = "x"
+ if residue.get_id()[2] != " ":
+ insertion = residue.get_id()[2]
+ full_id = "{}_{:d}_{}_{}_{}_{}".format(
+ chain, residue.get_id()[1], insertion, resname, name, color
+ )
+ if coords is not None:
+ outfile.write(coords + " " + radii[atomtype] + " 1 " + full_id + "\n")
+
diff --git a/model/comp_surface/protein_process/openbabel_reduce_openbabel.py b/model/comp_surface/protein_process/openbabel_reduce_openbabel.py
new file mode 100644
index 0000000000000000000000000000000000000000..c5d9019efd6bf95c2f512414133c9be17f780083
--- /dev/null
+++ b/model/comp_surface/protein_process/openbabel_reduce_openbabel.py
@@ -0,0 +1,68 @@
+import os
+import subprocess
+import time
+from tqdm import tqdm
+from openbabel import openbabel
+from joblib import Parallel, delayed
+
+def process_protein(name, data_path, save_path):
+ mol = openbabel.OBMol()
+ conv = openbabel.OBConversion()
+ conv.SetInAndOutFormats("pdb", "pdb")
+
+ os.makedirs(os.path.join(save_path, name), exist_ok=True)
+ result_path = os.path.join(save_path, name, f'{name}_protein_processed_obabel_reduce_obabel.pdb')
+ if os.path.exists(result_path):
+ return name
+
+ # step 1 openbabel
+ rec_path = os.path.join(data_path, name, f'{name}_protein_processed.pdb')
+ conv.ReadFile(mol, rec_path)
+
+ out_path = os.path.join(save_path, name, f'{name}_protein_processed_obabel.pdb')
+ conv.WriteFile(mol, out_path)
+
+ # step 2 reduce
+ rec_path = os.path.join(save_path, name, f'{name}_protein_processed_obabel.pdb')
+ subprocess.run(
+ f"reduce -Trim {rec_path} > {os.path.join(save_path, name, f'{name}_protein_processed_obabel_tmp.pdb')}", shell=True)
+
+ subprocess.run(
+ f"reduce -HIS {os.path.join(save_path, name, f'{name}_protein_processed_obabel_tmp.pdb')} > {os.path.join(save_path, name, f'{name}_protein_processed_obabel_reduce.pdb')}", shell=True)
+
+ subprocess.run(
+ f"rm {os.path.join(save_path, name, f'{name}_protein_processed_obabel_tmp.pdb')}",
+ shell=True)
+
+ # step 3 openbabel
+ rec_path = os.path.join(save_path, name, f'{name}_protein_processed_obabel_reduce.pdb')
+ conv.ReadFile(mol, rec_path)
+
+ out_path = os.path.join(save_path, name, f'{name}_protein_processed_obabel_reduce_obabel.pdb')
+ conv.WriteFile(mol, out_path)
+
+ return name
+
+def main(data_path, save_path, n_jobs):
+ start_time = time.time()
+ names = sorted(os.listdir(data_path))
+ os.makedirs(save_path, exist_ok=True)
+
+ sucessed_names = Parallel(n_jobs=n_jobs)(
+ delayed(process_protein)(name, data_path, save_path) for name in tqdm(names)
+ )
+
+ print("--- %s seconds ---" % (time.time() - start_time))
+ print(f"sucessed_names: {list(filter(None, sucessed_names))}")
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--data_path', type=str, default='', help='Path to the data directory')
+ parser.add_argument('--save_path', type=str, default='', help='Path to the save directory')
+ parser.add_argument('--n_jobs', type=int, default=1, help='Number of parallel jobs (-1 for all CPUs)')
+ args = parser.parse_args()
+
+ if not os.path.exists(args.data_path):
+ raise ValueError(f"Data path {args.data_path} does not exist.")
+ main(args.data_path, args.save_path, args.n_jobs)
\ No newline at end of file
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlow b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlow
new file mode 100644
index 0000000000000000000000000000000000000000..591e7b744107a86aa2a2392a0334d38fcb06e1ac
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlow
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4aba4866ec410705f81cdb68fe5474c046b0c237757a50c6aeba012ad1fe3fc7
+size 166208
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlowWrap b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlowWrap
new file mode 100644
index 0000000000000000000000000000000000000000..a1c8a2b0c9c1246f307ce12373118318635c9b3d
Binary files /dev/null and b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/GeometricFlowWrap differ
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/NanoShaper b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/NanoShaper
new file mode 100644
index 0000000000000000000000000000000000000000..d7083346b835767ed623c2b8e590a5706e874059
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/NanoShaper
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6d41b6f0ddd400aa5713d08b3a178884bfff4c7ae826530ab73549aa93584baf
+size 3383549
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/apbs b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/apbs
new file mode 100644
index 0000000000000000000000000000000000000000..0061ef7ee850a94ab9c5d51a9f0ef310c659a75b
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/apbs
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6ebdacce26e31aa01cd221a534147218088de9d55ff111a1c8bbea56a60a32bd
+size 29850192
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/msms b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/msms
new file mode 100644
index 0000000000000000000000000000000000000000..7ca1eb5b2bdc83707c53b81064f48da4a5973559
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/msms
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:739b88d8195b89ee5a9c00ef7b986f6bb9d32f7d3b200f457781c98b95958088
+size 943144
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/tabipb b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/tabipb
new file mode 100644
index 0000000000000000000000000000000000000000..10bc902b8d5d6056d486c74c3ef42a5ef1b60c46
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/bin/tabipb
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2e3b2ef3016982438401896ad0817fda5095b3042dc23a601e4e9e96406e0a9b
+size 149728
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbs.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbs.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ed0836022e37a7c5f2d5ac463b2506356192c29
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbs.h
@@ -0,0 +1,100 @@
+/**
+ * @defgroup Header dependencies
+ */
+
+/**
+ * @file apbs.h
+ * @author Nathan Baker
+ * @brief Header file for header dependencies
+ * @ingroup Frontend
+ * @version $Id$
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _APBSHEADERS_H_
+#define _APBSHEADERS_H_
+
+#include "apbscfg.h"
+
+/* MALOC headers */
+#include "maloc/maloc.h"
+
+/* Generic headers */
+#include "generic/nosh.h"
+#include "generic/mgparm.h"
+#include "generic/pbeparm.h"
+#include "generic/femparm.h"
+#include "generic/bemparm.h"
+#include "generic/geoflowparm.h"
+#include "generic/vacc.h"
+#include "generic/valist.h"
+#include "generic/vatom.h"
+#include "generic/vcap.h"
+#include "generic/vhal.h"
+#include "generic/vpbe.h"
+#include "generic/vstring.h"
+#include "generic/vunit.h"
+#include "generic/vparam.h"
+#include "generic/vgreen.h"
+
+//#include "geoflow/cpbconcz2.h"
+
+/* MG headers */
+#include "mg/vgrid.h"
+#include "mg/vmgrid.h"
+#include "mg/vopot.h"
+#include "mg/vpmg.h"
+#include "mg/vpmgp.h"
+
+/* FEM headers */
+#include "fem/vfetk.h"
+#include "fem/vpee.h"
+
+#endif /* _APBSHEADERS_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbscfg.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbscfg.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ab2c464132bdb44801eba27fbe52d4fa843c7d3
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/apbscfg.h
@@ -0,0 +1,132 @@
+// apbs configuration header generated by CMake
+
+// apbs version string
+#define PACKAGE_STRING "APBS 3.4.1"
+
+// apbs fast mode
+/* #undef APBS_FAST */
+
+// apbs debugging mode
+/* #undef DEBUG */
+
+// prints verbose debugging information
+#define VERBOSE_DEBUG
+
+// apbs quiet mode
+/* #undef VAPBSQUIET */
+
+// time function available
+#define HAVE_TIME_FUNC
+
+// rand function available
+#define HAVE_RAND_FUNC
+
+// srand function available
+#define HAVE_SRAND_FUNC
+
+// readline library is available
+/* #undef HAVE_LIBREADLINE */
+
+// do not inline functions
+#define APBS_NOINLINE
+
+
+
+// Is macro embedding availble?
+/* #undef HAVE_EMBED */
+
+// zlib compression is available
+/* #undef HAVE_ZLIB */
+
+
+
+// have FEtk component PUNC
+#define HAVE_PUNC
+
+// have FEtk component MCX
+/* #undef HAVE_MCX */
+
+// have FEtk component MC
+#define HAVE_MC
+
+// have fetk component GAMER
+#define HAVE_GAMER
+
+/* #undef HAVE_MPI_H */
+
+// The floating point epsilon for the current machine
+#define FLOAT_EPSILON 2.220446e-16
+
+// The double precision epsilon for the current machine
+#define DOUBLE_EPSILON 2.220446e-16
+
+
+
+
+// Remain for use be determined.
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_MEMORY_H
+
+/* have the MPI library */
+//#undef HAVE_MPI_H
+/* Define to 1 if you have the header file. */
+//#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_STDLIB_H
+
+/* have machine-supplied strcasecmp */
+//#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_STRING_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the header file. */
+//#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+//#undef LT_OBJDIR
+
+/* Name of package */
+//#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+//#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+//#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+//#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+//#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+//#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+//#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+//#undef STDC_HEADERS
+
+/* use hierarchical basis method */
+//#undef USE_HB
+
+/* Version number of package */
+//#undef VERSION
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vcsm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vcsm.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8105ef45682453f00f793a9ae5d61e0af54d850
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vcsm.h
@@ -0,0 +1,297 @@
+/** @defgroup Vcsm Vcsm class
+ * @brief A charge-simplex map for evaluating integrals of delta functions
+ * in a finite element setting
+ */
+
+/**
+ * @file vcsm.h
+ * @brief Contains declarations for the Vcsm class
+ * @ingroup Vcsm
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VCSM_H_
+#define _VCSM_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#include "mc/mc.h"
+
+#include "generic/vhal.h"
+#include "generic/valist.h"
+
+/** @brief External function for FEtk Gem class to use during mesh refinement
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ */
+VEXTERNC void Gem_setExternalUpdateFunction(
+ Gem *thee, /**< The FEtk geometry manager */
+ void (*externalUpdate)(SS **simps, int num) /**< Function pointer for
+ call during mesh
+ refinement */
+ );
+
+/** @brief Charge-simplex map class
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ */
+struct sVcsm {
+
+ Valist *alist; /**< Atom (charge) list */
+ int natom; /**< Size of thee->alist; redundant, but useful for
+ * convenience */
+ Gem *gm; /**< Grid manager (container class for master vertex
+ * and simplex lists as well as prolongation
+ * operator for updating after refinement ) */
+ int **sqm; /**< The map which gives the list charges associated with
+ * each simplex in gm->simplices. The indices of
+ * the first dimension are associated with the
+ * simplex ID's in Vgm. Each charge list (second
+ * dimension) contains entries corresponding to
+ * indicies in thee->alist with lengths given in
+ * thee->nsqm */
+ int *nsqm; /**< The length of the charge lists in thee->sqm */
+ int nsimp; /**< The _currently used) length of sqm, nsqm -- may not
+ * always be up-to-date with Gem */
+ int msimp; /**< The maximum number of entries that can be
+ * accomodated by sqm or nsqm -- saves on realloc's */
+ int **qsm; /**< The inverse of sqm; the list of simplices
+ * associated with a given charge */
+ int *nqsm; /**< The length of the simplex lists in thee->qsm */
+ int initFlag; /**< Indicates whether the maps have been initialized
+ * yet */
+ Vmem *vmem; /**< Memory management object */
+
+};
+
+/**
+ * @ingroup Vcsm
+ * @brief Declaration of the Vcsm class as the Vcsm structure
+ */
+typedef struct sVcsm Vcsm;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vcsm: Inlineable methods (vcsm.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+#if !defined(VINLINE_VCSM)
+
+ /** @brief Get atom list
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Pointer to Valist atom list
+ */
+ VEXTERNC Valist* Vcsm_getValist(
+ Vcsm *thee /**< The Vcsm object */
+ );
+
+ /** @brief Get number of atoms associated with a simplex
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Number of atoms associated with a simplex
+ */
+ VEXTERNC int Vcsm_getNumberAtoms(
+ Vcsm *thee, /**< The Vcsm object */
+ int isimp /**< Simplex ID */
+ );
+
+ /** @brief Get particular atom associated with a simplex
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Array of atoms associated with a simplex
+ */
+ VEXTERNC Vatom* Vcsm_getAtom(
+ Vcsm *thee, /**< The Vcsm object */
+ int iatom, /**< Index of atom in Vcsm list ofr this simplex */
+ int isimp /**< Simplex ID */
+ );
+
+ /** @brief Get ID of particular atom in a simplex
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Index of atom in Valist object
+ */
+ VEXTERNC int Vcsm_getAtomIndex(
+ Vcsm *thee, /**< The Vcsm object */
+ int iatom, /**< Index of atom in Vcsm list for this simplex */
+ int isimp /**< Simplex ID */
+ );
+
+ /** @brief Get number of simplices associated with an atom
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Number of simplices associated with an atom
+ */
+ VEXTERNC int Vcsm_getNumberSimplices(
+ Vcsm *thee, /**< The Vcsm object */
+ int iatom /**< The Valist atom index */
+ );
+
+ /** @brief Get particular simplex associated with an atom
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Pointer to simplex object
+ */
+ VEXTERNC SS* Vcsm_getSimplex(
+ Vcsm *thee, /**< The Vcsm object */
+ int isimp, /**< Index of simplex in Vcsm list */
+ int iatom /**< Valist atom index */
+ );
+
+ /** @brief Get index particular simplex associated with an atom
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return Gem index of specified simplex
+ */
+ VEXTERNC int Vcsm_getSimplexIndex(
+ Vcsm *thee, /**< The Vcsm object */
+ int isimp, /**< Index of simplex in Vcsm list */
+ int iatom /**< Index of atom in Valist */
+ );
+
+ /** @brief Return the memory used by this structure (and its contents)
+ * in bytes
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return The memory used by this structure and its contents in bytes
+ */
+ VEXTERNC unsigned long int Vcsm_memChk(
+ Vcsm *thee /**< The Vcsm object */
+ );
+
+#else /* if defined(VINLINE_VCSM) */
+# define Vcsm_getValist(thee) ((thee)->alist)
+# define Vcsm_getNumberAtoms(thee, isimp) ((thee)->nsqm[isimp])
+# define Vcsm_getAtom(thee, iatom, isimp) (Valist_getAtom((thee)->alist, ((thee)->sqm)[isimp][iatom]))
+# define Vcsm_getAtomIndex(thee, iatom, isimp) (((thee)->sqm)[isimp][iatom])
+# define Vcsm_getNumberSimplices(thee, iatom) (((thee)->nqsm)[iatom])
+# define Vcsm_getSimplex(thee, isimp, iatom) (Gem_SS((thee)->gm, ((thee)->qsm)[iatom][isimp]))
+# define Vcsm_getSimplexIndex(thee, isimp, iatom) (((thee)->qsm)[iatom][isimp])
+# define Vcsm_memChk(thee) (Vmem_bytes((thee)->vmem))
+#endif /* if !defined(VINLINE_VCSM) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vcsm: Non-Inlineable methods (vcsm.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct Vcsm object
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @note \li The initial mesh must be sufficiently coarse for the assignment
+ * procedures to be efficient
+ * \li The map is not built until Vcsm_init is called
+ * @return Pointer to newly allocated Vcsm object
+ */
+VEXTERNC Vcsm* Vcsm_ctor(
+ Valist *alist, /**< List of atoms */
+ Gem *gm /**< FEtk geometry manager defining the mesh */
+ );
+
+/** @brief FORTRAN stub to construct Vcsm object
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @note \li The initial mesh must be sufficiently coarse for the assignment
+ * procedures to be efficient
+ * \li The map is not built until Vcsm_init is called
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vcsm_ctor2(
+ Vcsm *thee, /**< The Vcsm object */
+ Valist *alist, /**< The list of atoms */
+ Gem *gm /**< The FEtk geometry manager defining the mesh */
+ );
+
+/** @brief Destroy Vcsm object
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ */
+VEXTERNC void Vcsm_dtor(
+ Vcsm **thee /**< Pointer to memory location for Vcsm object */
+ );
+
+/** @brief FORTRAN stub to destroy Vcsm object
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ */
+VEXTERNC void Vcsm_dtor2(
+ Vcsm *thee /**< Pointer to Vcsm object */
+ );
+
+/** @brief Initialize charge-simplex map with mesh and atom data
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @note The initial mesh must be sufficiently coarse for the assignment
+ * procedures to be efficient
+ */
+VEXTERNC void Vcsm_init(
+ Vcsm *thee /**< The Vcsm object */
+ );
+
+/** @brief Update the charge-simplex and simplex-charge maps after
+ * refinement
+ * @ingroup Vcsm
+ * @author Nathan Baker
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vcsm_update(
+ Vcsm *thee, /**< The Vcsm object */
+ SS **simps, /**< List of pointer to newly created (by refinement)
+ simplex objects. The first simplex is expected to be
+ derived from the parent simplex and therefore have the
+ same ID. The remaining simplices are the children and
+ should represent new entries in the charge-simplex map. */
+ int num /**< Number of simplices in simps list */
+ );
+
+#endif /* ifndef _VCSM_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vfetk.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vfetk.h
new file mode 100644
index 0000000000000000000000000000000000000000..e98b0243c0b333222996ac7076fb02739a94b549
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vfetk.h
@@ -0,0 +1,1011 @@
+/** @defgroup Vfetk Vfetk class
+ * @brief FEtk master class (interface between FEtk and APBS)
+ */
+
+/**
+ * @file vfetk.h
+ * @ingroup Vfetk
+ * @brief Contains declarations for class Vfetk
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VFETK_H_
+#define _VFETK_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#include "mc/mc.h"
+
+#include "generic/vhal.h"
+#include "generic/vatom.h"
+// #include "generic/valist.h"
+#include "generic/vpbe.h"
+#include "generic/vunit.h"
+#include "generic/vgreen.h"
+#include "generic/vcap.h"
+#include "generic/pbeparm.h"
+#include "generic/femparm.h"
+#include "fem/vcsm.h"
+
+/**
+ * @brief Linear solver type
+ * @ingroup Vfetk
+ * @note Do not change these values; they correspond to settings in FEtk
+ */
+enum eVfetk_LsolvType {
+ VLT_SLU=0, /**< SuperLU direct solve */
+ VLT_MG=1, /**< Multigrid */
+ VLT_CG=2, /**< Conjugate gradient */
+ VLT_BCG=3 /**< BiCGStab */
+};
+
+/**
+ * @brief Declare FEMparm_LsolvType type
+ * @ingroup Vfetk
+ */
+typedef enum eVfetk_LsolvType Vfetk_LsolvType;
+
+
+/**
+ * @brief Mesh loading operation
+ * @ingroup Vfetk
+ */
+enum eVfetk_MeshLoad {
+ VML_DIRICUBE, /**< Dirichlet cube */
+ VML_NEUMCUBE, /**< Neumann cube */
+ VML_EXTERNAL /**< External mesh (from socket) */
+};
+
+/**
+ * @brief Declare FEMparm_GuessType type
+ * @ingroup Vfetk
+ */
+typedef enum eVfetk_MeshLoad Vfetk_MeshLoad;
+
+/**
+ * @brief Non-linear solver type
+ * @ingroup Vfetk
+ * @note Do not change these values; they correspond to settings in FEtk
+ */
+enum eVfetk_NsolvType {
+ VNT_NEW=0, /**< Newton solver */
+ VNT_INC=1, /**< Incremental */
+ VNT_ARC=2 /**< Psuedo-arclength */
+};
+
+/**
+ * @brief Declare FEMparm_NsolvType type
+ * @ingroup Vfetk
+ */
+typedef enum eVfetk_NsolvType Vfetk_NsolvType;
+
+/**
+ * @brief Initial guess type
+ * @ingroup Vfetk
+ * @note Do not change these values; they correspond to settings in FEtk
+ */
+enum eVfetk_GuessType {
+ VGT_ZERO=0, /**< Zero initial guess */
+ VGT_DIRI=1, /**< Dirichlet boundary condition initial guess */
+ VGT_PREV=2 /**< Previous level initial guess */
+};
+
+/**
+ * @brief Declare FEMparm_GuessType type
+ * @ingroup Vfetk
+ */
+typedef enum eVfetk_GuessType Vfetk_GuessType;
+
+/**
+ * @brief Preconditioner type
+ * @ingroup Vfetk
+ * @note Do not change these values; they correspond to settings in FEtk
+ */
+enum eVfetk_PrecType {
+ VPT_IDEN=0, /**< Identity matrix */
+ VPT_DIAG=1, /**< Diagonal scaling */
+ VPT_MG=2 /**< Multigrid */
+};
+
+/**
+ * @brief Declare FEMparm_GuessType type
+ * @ingroup Vfetk
+ */
+typedef enum eVfetk_PrecType Vfetk_PrecType;
+
+/**
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @brief Contains public data members for Vfetk class/module
+ *
+ * Many of the routines and macros are borrowed from the main.c driver
+ * (written by Mike Holst) provided with the PMG code.
+ *
+ */
+struct sVfetk {
+
+ Vmem *vmem; /**< Memory management object */
+ Gem *gm; /**< Grid manager (container class for master vertex
+ * and simplex lists as well as prolongation operator for updating
+ * after refinement). */
+ AM *am; /**< Multilevel algebra manager. */
+ Aprx *aprx; /**< Approximation manager. */
+ PDE *pde; /**< FEtk PDE object */
+ Vpbe *pbe; /**< Poisson-Boltzmann object */
+ Vcsm *csm; /**< Charge-simplex map */
+ Vfetk_LsolvType lkey; /**< Linear solver method */
+ int lmax; /**< Maximum number of linear solver iterations */
+ double ltol; /**< Residual tolerance for linear solver */
+ Vfetk_NsolvType nkey; /**< Nonlinear solver method */
+ int nmax; /**< Maximum number of nonlinear solver iterations */
+ double ntol; /**< Residual tolerance for nonlinear solver */
+ Vfetk_GuessType gues; /**< Initial guess method */
+ Vfetk_PrecType lprec; /**< Linear preconditioner */
+ int pjac; /**< Flag to print the jacobians (usually set this to -1,
+ * please) */
+ PBEparm *pbeparm; /**< Generic PB parameters */
+ FEMparm *feparm; /**< FEM-specific parameters */
+ Vhal_PBEType type; /**< Version of PBE to solve */
+ int level; /**< Refinement level (starts at 0) */
+
+};
+
+/** @typedef Vfetk
+ * @ingroup Vfetk
+ * @brief Declaration of the Vfetk class as the Vfetk structure */
+typedef struct sVfetk Vfetk;
+
+/**
+ * @brief Vfetk LocalVar subclass
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @brief Contains variables used when solving the PDE with FEtk
+ */
+struct sVfetk_LocalVar {
+ double nvec[VAPBS_DIM]; /**< Normal vector for a simplex face */
+ double vx[4][VAPBS_DIM]; /**< Vertex coordinates */
+ double xq[VAPBS_DIM]; /**< Quadrature pt */
+ double U[MAXV]; /**< Solution value */
+ double dU[MAXV][VAPBS_DIM]; /**< Solution gradient */
+ double W; /**< Coulomb regularization term scalar value */
+ double dW[VAPBS_DIM]; /**< Coulomb regularization term gradient */
+ double d2W; /**< Coulomb regularization term Laplacia */
+ int sType; /**< Simplex type */
+ int fType; /**< Face type */
+ double diel; /**< Dielectric value */
+ double ionacc; /**< Ion accessibility value */
+ double A; /**< Second-order differential term */
+ double F; /**< RHS characteristic function value */
+ double B; /**< Entire ionic strength term */
+ double DB; /**< Entire ionic strength term derivative */
+ double jumpDiel; /**< Dielectric value on one side of a simplex face */
+ Vfetk *fetk; /**< Pointer to the VFETK object */
+ Vgreen *green; /**< Pointer to a Green's function object */
+ int initGreen; /**< Boolean to designate whether Green's function
+ * has been initialized */
+ SS *simp; /**< Pointer to the latest simplex object; set in initElement()
+ * and delta() */
+ VV *verts[4]; /**< Pointer to the latest vertices; set in initElement */
+ int nverts; /**< number of vertices in the simplex */
+ double ionConc[MAXION]; /**< Counterion species' concentrations */
+ double ionQ[MAXION]; /**< Counterion species' valencies */
+ double ionRadii[MAXION]; /**< Counterion species' radii */
+ double zkappa2; /**< Ionic strength parameters */
+ double zks2; /**< Ionic strength parameters */
+ double ionstr; /**< Ionic strength parameters (M) */
+ int nion; /**< Number of ion species */
+ double Fu_v; /**< Store Fu_v value */
+ double DFu_wv; /**< Store DFu_wv value */
+ double delta; /**< Store delta value */
+ double u_D; /**< Store Dirichlet value */
+ double u_T; /**< Store true value */
+};
+
+/**
+ * @ingroup Vfetk
+ * @brief Declaration of the Vfetk_LocalVar subclass as the Vfetk_LocalVar
+ * structure */
+typedef struct sVfetk_LocalVar Vfetk_LocalVar;
+
+#if !defined(VINLINE_VFETK)
+
+ /** @brief Get a pointer to the Gem (grid manager) object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Pointer to the Gem (grid manager) object
+ */
+ VEXTERNC Gem* Vfetk_getGem(
+ Vfetk *thee /**< Vfetk object */
+ );
+
+ /** @brief Get a pointer to the AM (algebra manager) object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Pointer to the AM (algebra manager) object
+ */
+ VEXTERNC AM* Vfetk_getAM(
+ Vfetk *thee /**< The Vfetk object */
+ );
+
+ /** @brief Get a pointer to the Vpbe (PBE manager) object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Pointer to the Vpbe (PBE manager) object
+ */
+ VEXTERNC Vpbe* Vfetk_getVpbe(
+ Vfetk *thee /**< The Vfetk object */
+ );
+
+ /** @brief Get a pointer to the Vcsm (charge-simplex map) object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Pointer to the Vcsm (charge-simplex map) object
+ */
+ VEXTERNC Vcsm* Vfetk_getVcsm(
+ Vfetk *thee /**< The Vfetk object */
+ );
+
+ /** @brief Get the partition information for a particular atom
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note Friend function of Vatom
+ * @returns Partition ID
+ */
+ VEXTERNC int Vfetk_getAtomColor(
+ Vfetk *thee, /**< The Vfetk object */
+ int iatom /**< Valist atom index */
+ );
+
+#else /* if defined(VINLINE_VFETK) */
+# define Vfetk_getGem(thee) ((thee)->gm)
+# define Vfetk_getAM(thee) ((thee)->am)
+# define Vfetk_getVpbe(thee) ((thee)->pbe)
+# define Vfetk_getVcsm(thee) ((thee)->csm)
+# define Vfetk_getAtomColor(thee, iatom) (Vatom_getPartID(Valist_getAtom(Vpbe_getValist(thee->pbe), iatom)))
+#endif /* if !defined(VINLINE_VFETK) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vfetk: Non-Inlineable methods (vfetk.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/**
+ * @brief Constructor for Vfetk object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Pointer to newly allocated Vfetk object
+ * @note This sets up the Gem, AM, and Aprx FEtk objects but does not create
+ * a mesh. The easiest way to create a mesh is to then call
+ * Vfetk_genCube
+ */
+VEXTERNC Vfetk* Vfetk_ctor(
+ Vpbe *pbe, /**< Vpbe (PBE manager object) */
+ Vhal_PBEType type /**< Version of PBE to solve */
+ );
+
+/**
+ * @brief FORTRAN stub constructor for Vfetk object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return 1 if successful, 0 otherwise
+ * @note This sets up the Gem, AM, and Aprx FEtk objects but does not create
+ * a mesh. The easiest way to create a mesh is to then call
+ * Vfetk_genCube
+ */
+VEXTERNC int Vfetk_ctor2(
+ Vfetk *thee, /**< Vfetk object memory */
+ Vpbe *pbe, /**< PBE manager object */
+ Vhal_PBEType type /**< Version of PBE to solve */
+ );
+
+/**
+ * @brief Object destructor
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC void Vfetk_dtor(
+ Vfetk **thee /**< Pointer to memory location of Vfetk object */
+ );
+
+/**
+ * @brief FORTRAN stub object destructor
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC void Vfetk_dtor2(
+ Vfetk *thee /**< Pointer to Vfetk object to be destroyed */
+ );
+
+/**
+ * @brief Create an array containing the solution (electrostatic potential
+ * in units of \f$k_B T/e\f$) at the finest mesh level.
+ * @ingroup Vfetk
+ * @author Nathan Baker and Michael Holst
+ * @note The user is responsible for destroying the newly created array
+ * @return Newly created array of length "length" (see above); the user is
+ * responsible for destruction
+ */
+VEXTERNC double* Vfetk_getSolution(
+ Vfetk *thee, /**< Vfetk object with solution */
+ int *length /**< Ste to length of the newly created solution array */
+ );
+
+/**
+ * @brief Set the parameter objects
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC void Vfetk_setParameters(
+ Vfetk *thee, /**< The Vfetk object */
+ PBEparm *pbeparm, /**< Parameters for solution of the PBE */
+ FEMparm *feparm /**< FEM-speecific solution parameters */
+ );
+
+/**
+ * @brief Return the total electrostatic energy
+ *
+ * Using the solution at the finest mesh level, get the electrostatic energy
+ * using the free energy functional for the Poisson-Boltzmann equation
+ * without removing any self-interaction terms (i.e., removing the reference
+ * state of isolated charges present in an infinite dielectric continuum with
+ * the same relative permittivity as the interior of the protein) and return
+ * the result in units of \f$k_B T\f$. The argument color allows the user to
+ * control the partition on which this energy is calculated; if (color == -1)
+ * no restrictions are used. The solution is obtained from the finest level
+ * of the passed AM object, but atomic data from the Vfetk object is used to
+ * calculate the energy.
+ *
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Total electrostatic energy in units of \f$k_B T\f$.
+ */
+VEXTERNC double Vfetk_energy(
+ Vfetk *thee, /**< THe Vfetk object */
+ int color, /**< Partition restriction for energy calculation; if
+ non-negative, energy calculation is restricted to the
+ specified partition (indexed by simplex and atom colors
+ */
+ int nonlin /**< If 1, the NPBE energy functional is used; otherwise,
+ the LPBE energy functional is used. If -2, SMPBE is used. */
+ );
+
+/**
+ * @brief Get the "mobile charge" and "polarization" contributions to the
+ * electrostatic energy.
+ *
+ * Using the solution at the finest mesh level, get the
+ * electrostatic energy due to the interaction of the mobile charges
+ * with the potential and polarization of the dielectric medium:
+ * \f[ G = \frac{1}{4 I_s} \sum_i c_i q_i^2 \int
+ * \overline{\kappa}^2(x) e^{-q_i u(x)} dx + \frac{1}{2} \int
+ * \epsilon ( \nabla u )^2 dx \f]
+ * for the NPBE and
+ * \f[ G = \frac{1}{2} \int \overline{\kappa}^2(x) u^2(x) dx +
+ * \frac{1}{2} \int \epsilon ( \nabla u )^2 dx \f]
+ * for the LPBE. Here \f$i\f$ denotes the counterion species,
+ * \f$I_s\f$ is the bulk ionic strength, \f$\overline{\kappa}^2(x)\f$
+ * is the modified Debye-Huckel parameter, \f$c_i\f$ is the
+ * concentration of species \f$i\f$, \f$q_i\f$ is the charge of
+ * species \f$i\f$, \f$\epsilon\f$ is the dielectric function, and
+ * \f$u(x)\f$ is the dimensionless electrostatic potential. The
+ * energy is scaled to units of \f$k_b T\f$.
+ *
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @param thee Vfetk object
+ * @param color Partition restriction for energy evaluation, only used if
+ * non-negative
+ * @return The "mobile charge" and "polarization" contributions to the
+ * electrostatic energy in units of \f$k_B T\f$.
+ */
+VEXTERNC double Vfetk_dqmEnergy(
+ Vfetk *thee, /**< The Vfetk object */
+ int color /**< Partition restriction for energy calculation; if
+ non-negative, energy calculation is restricted to the
+ specified partition (indexed by simplex and atom colors
+ */
+ );
+
+/**
+ * @brief Get the "fixed charge" contribution to the electrostatic energy
+ *
+ * Using the solution at the finest mesh level, get the
+ * electrostatic energy due to the interaction of the fixed charges
+ * with the potential: \f[ G = \sum_i q_i u(r_i) \f]
+ * and return the result in units of \f$k_B T\f$. Clearly, no
+ * self-interaction terms are removed. A factor a 1/2 has to be
+ * included to convert this to a real energy.
+ *
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @param thee Vfetk object
+ * @param color Partition restriction for energy evaluation, only used if
+ * non-negative
+ * @returns The fixed charge electrostatic energy in units of \f$k_B T\f$.
+ */
+VEXTERNC double Vfetk_qfEnergy(
+ Vfetk *thee, /**< The Vfetk object */
+ int color /**< Partition restriction for energy evaluation, only used
+ if non-negative */
+ );
+
+/**
+ * @brief Return the memory used by this structure (and its contents)
+ * in bytes
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return The memory used by this structure and its contents in bytes
+ */
+VEXTERNC unsigned long int Vfetk_memChk(
+ Vfetk *thee /**< THe Vfetk object */
+ );
+
+/**
+ * @brief Transfer color (partition ID) information frmo a partitioned mesh
+ * to the atoms.
+ *
+ * Transfer color information from partitioned mesh to the atoms.
+ * In the case that a charge is shared between two partitions, the
+ * partition color of the first simplex is selected. Due to the
+ * arbitrary nature of this selection, THIS METHOD SHOULD ONLY BE
+ * USED IMMEDIATELY AFTER PARTITIONING!!!
+ * @warning This function should only be used immediately after mesh
+ * partitioning
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note This is a friend function of Vcsm
+ */
+VEXTERNC void Vfetk_setAtomColors(
+ Vfetk *thee /**< THe Vfetk object */
+ );
+
+/**
+ * @brief Writes a Bmat to disk in Harwell-Boeing sparse matrix format.
+ *
+ * @ingroup Vfetk
+ * @author Stephen Bond
+ * @note This is a friend function of Bmat
+ * @bug Hardwired to only handle the single block symmetric case.
+ */
+VEXTERNC void Bmat_printHB(
+ Bmat *thee, /**< The matrix to write */
+ char *fname /**< Filename for output */
+ );
+
+/**
+ * @brief Construct a rectangular mesh (in the current Vfetk object)
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC Vrc_Codes Vfetk_genCube(
+ Vfetk *thee, /**< Vfetk object */
+ double center[3], /**< Center for mesh */
+ double length[3], /**< Mesh lengths */
+ Vfetk_MeshLoad meshType /**< Mesh boundary conditions */
+ );
+
+/**
+ * @brief Loads a mesh into the Vfetk (and associated) object(s).
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC Vrc_Codes Vfetk_loadMesh(
+ Vfetk *thee, /**< Vfetk object to load into */
+ double center[3], /**< Center for mesh (if constructed) */
+ double length[3], /**< Mesh lengths (if constructed) */
+ Vfetk_MeshLoad meshType, /**< Type of mesh to load */
+ Vio *sock /**< Socket for external mesh data (NULL otherwise) */
+ );
+
+/**
+ * @brief Constructs the FEtk PDE object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return Newly-allocated PDE object
+ * @bug Not thread-safe */
+VEXTERNC PDE* Vfetk_PDE_ctor(
+ Vfetk *fetk /**< The Vfetk object */
+ );
+
+/**
+ * @brief Intializes the FEtk PDE object
+ * @ingroup Vfetk
+ * @author Nathan Baker (with code by Mike Holst)
+ * @return 1 if successful, 0 otherwise
+ * @bug Not thread-safe */
+VEXTERNC int Vfetk_PDE_ctor2(
+ PDE *thee, /**< The newly-allocated PDE object */
+ Vfetk *fetk /**< The parent Vfetk object */
+ );
+
+/**
+ * @brief Destroys FEtk PDE object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note Thread-safe
+ */
+VEXTERNC void Vfetk_PDE_dtor(
+ PDE **thee /**< Pointer to PDE object memory */
+ );
+
+/**
+ * @brief FORTRAN stub: destroys FEtk PDE object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note Thread-safe
+ */
+VEXTERNC void Vfetk_PDE_dtor2(
+ PDE *thee /**< PDE object memory */
+ );
+
+/**
+ * @brief Do once-per-assembly initialization
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @note Thread-safe */
+VEXTERNC void Vfetk_PDE_initAssemble(
+ PDE *thee, /**< PDE object */
+ int ip[], /**< Integer parameter array (not used) */
+ double rp[] /**< Double parameter array (not used) */
+ );
+
+/**
+ * @brief Do once-per-element initialization
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @todo Jump term is not implemented
+ * @bug This function is not thread-safe */
+VEXTERNC void Vfetk_PDE_initElement(
+ PDE *thee, /**< PDE object */
+ int elementType, /**< Material type (not used) */
+ int chart, /**< Chart in which the vertex coordinates are provided,
+ used here as a bitfield to store molecular accessibility
+ */
+ double tvx[][VAPBS_DIM], /**< Vertex coordinates */
+ void *data /**< Simplex pointer (hack) */
+ );
+
+/**
+ * @brief Do once-per-face initialization
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @bug This function is not thread-safe */
+VEXTERNC void Vfetk_PDE_initFace(
+ PDE *thee, /**< THe PDE object */
+ int faceType, /**< Simplex face type (interior or various boundary
+ types) */
+ int chart, /**< Chart in which the vertex coordinates are provided,
+ used here as a bitfield for molecular accessibility */
+ double tnvec[] /**< Coordinates of outward normal vector for face */
+ );
+
+/**
+ * @brief Do once-per-point initialization
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is not thread-safe
+ * @bug This function uses pre-defined boudnary definitions for the molecular
+ * surface. */
+VEXTERNC void Vfetk_PDE_initPoint(
+ PDE *thee, /**< The PDE object */
+ int pointType, /**< The type of point -- interior or various faces */
+ int chart, /**< The chart in which the point coordinates are provided,
+ used here as bitfield for molecular accessibility */
+ double txq[], /**< Point coordinates */
+ double tU[], /**< Solution value at point */
+ double tdU[][VAPBS_DIM] /**< Solution derivative at point */
+ );
+
+/**
+ * @brief Evaluate strong form of PBE. For interior points, this is:
+ * \f[ -\nabla \cdot \epsilon \nabla u + b(u) - f \f]
+ * where \f$b(u)\f$ is the (possibly nonlinear) mobile ion term and \f$f\f$ is
+ * the source charge distribution term (for PBE) or the induced surface charge
+ * distribution (for RPBE). For an interior-boundary (simplex face) point,
+ * this is:
+ * \f[ [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^+} - [\epsilon(x) \nabla u(x)
+ * \cdot n(x)]_{x=0^-} \f]
+ * where \f$n(x)\f$ is the normal to the simplex face and the term represents
+ * the jump in dielectric displacement across the face. There is no
+ * outer-boundary contribution for this problem.
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is not thread-safe
+ * @bug This function is not implemented (sets error to zero)
+ */
+VEXTERNC void Vfetk_PDE_Fu(
+ PDE *thee, /**< The PDE object */
+ int key, /**< Type of point (0 = interior, 1 = boundary, 2 = interior
+ boundary */
+ double F[] /**< Set to value of residual */
+ );
+
+/**
+ * @brief This is the weak form of the PBE; i.e. the strong form integrated
+ * with a test function to give:
+ * \f[ \int_\Omega \left[ \epsilon \nabla u \cdot \nabla v + b(u) v - f v
+ * \right] dx \f]
+ * where \f$b(u)\f$ denotes the mobile ion term.
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @return Integrand value
+ * @bug This function is not thread-safe */
+VEXTERNC double Vfetk_PDE_Fu_v(
+ PDE *thee, /**< The PDE object */
+ int key, /**< Integrand to evaluate (0 = interior weak form, 1 =
+ boundary weak form */
+ double V[], /**< Test function at current point */
+ double dV[][VAPBS_DIM] /**< Test function derivative at current point */
+ );
+
+/**
+ * @brief This is the linearization of the weak form of the PBE; e.g., for use
+ * in a Newton iteration. This is the functional linearization of the strong
+ * form integrated with a test function to give:
+ * \f[ \int_\Omega \left[ \epsilon \nabla w \cdot \nabla v + b'(u) w v - f v
+ * \right] dx \f]
+ * where \f$b'(u)\f$ denotes the functional derivation of the mobile ion term.
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @return Integrand value
+ * @bug This function is not thread-safe */
+VEXTERNC double Vfetk_PDE_DFu_wv(
+ PDE *thee, /**< The PDE object */
+ int key, /**< Integrand to evaluate (0 = interior weak form, 1 =
+ boundary weak form) */
+ double W[], /**< Trial function value at current point */
+ double dW[][VAPBS_DIM], /**< Trial function gradient at current point */
+ double V[], /**< Test function value at current point */
+ double dV[][VAPBS_DIM] /**< Test function gradient */
+ );
+
+/**
+ * @brief Evaluate a (discretized) delta function source term at the given
+ * point
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is not thread-safe */
+VEXTERNC void Vfetk_PDE_delta(
+ PDE *thee, /**< PDE object */
+ int type, /**< Vertex type */
+ int chart, /**< Chart for point coordinates */
+ double txq[], /**< Point coordinates */
+ void *user, /**< Vertex object pointer */
+ double F[] /**< Set to delta function value */
+ );
+
+/**
+ * @brief Evaluate the Dirichlet boundary condition at the given point
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is hard-coded to call only multiple-sphere
+ * Debye-Hü functions.
+ * @bug This function is not thread-safe. */
+VEXTERNC void Vfetk_PDE_u_D(
+ PDE *thee, /**< PDE object */
+ int type, /**< Vertex boundary type */
+ int chart, /**< Chart for point coordinates */
+ double txq[], /**< Point coordinates */
+ double F[] /**< Set to boundary values */
+ );
+
+/**
+ * @brief Evaluate the "true solution" at the given point for comparison with
+ * the numerical solution
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note This function only returns zero.
+ * @bug This function is not thread-safe. */
+VEXTERNC void Vfetk_PDE_u_T(
+ PDE *thee, /**< PDE object */
+ int type, /**< Point type */
+ int chart, /**< Chart for point coordinates */
+ double txq[], /**< Point coordinates */
+ double F[] /**< Set to value at point */
+ );
+
+/**
+ * @brief Define the way manifold edges are bisected
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @note This function is thread-safe. */
+VEXTERNC void Vfetk_PDE_bisectEdge(
+ int dim, /**< Intrinsic dimension of manifold */
+ int dimII, /**< Embedding dimension of manifold */
+ int edgeType, /**< Type of edge being refined */
+ int chart[], /**< Chart for edge vertices, used here as accessibility
+ bitfields */
+ double vx[][VAPBS_DIM] /**< Edge vertex coordindates */
+ );
+
+/**
+ * @brief Map a boundary point to some pre-defined shape
+ * @ingroup Vfetk
+ * @author Nathan Baker and Mike Holst
+ * @note This function is thread-safe and is a no-op */
+VEXTERNC void Vfetk_PDE_mapBoundary(
+ int dim, /**< Intrinsic dimension of manifold */
+ int dimII, /**< Embedding dimension of manifold */
+ int vertexType, /**< Type of vertex */
+ int chart, /**< Chart for vertex coordinates */
+ double vx[VAPBS_DIM] /**< Vertex coordinates */
+ );
+
+/**
+ * @brief User-defined error estimator -- in our case, a geometry-based
+ * refinement method; forcing simplex refinement at the dielectric boundary and
+ * (for non-regularized PBE) the charges.
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @return 1 if mark simplex for refinement, 0 otherwise
+ * @bug This function is not thread-safe */
+VEXTERNC int Vfetk_PDE_markSimplex(
+ int dim, /**< Intrinsic manifold dimension */
+ int dimII, /**< Embedding manifold dimension */
+ int simplexType, /**< Type of simplex being refined */
+ int faceType[VAPBS_NVS], /**< Types of faces in simplex */
+ int vertexType[VAPBS_NVS], /**< Types of vertices in simplex */
+ int chart[], /**< Charts for vertex coordinates */
+ double vx[][VAPBS_DIM], /**< Vertex coordinates */
+ void *simplex /**< Simplex pointer */
+ );
+
+/**
+ * @brief Unify the chart for different coordinate systems -- a no-op for us.
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note Thread-safe; a no-op */
+VEXTERNC void Vfetk_PDE_oneChart(
+ int dim, /**< Intrinsic manifold dimension */
+ int dimII, /**< Embedding manifold dimension */
+ int objType, /**< ??? */
+ int chart[], /**< Charts of vertices' coordinates */
+ double vx[][VAPBS_DIM], /**< Vertices' coordinates */
+ int dimV /**< Number of vertices */
+ );
+
+/**
+ * @brief Energy functional. This returns the energy (less delta function
+ * terms) in the form:
+ * \f[ c^{-1}/2 \int (\epsilon (\nabla u)^2 + \kappa^2 (cosh u - 1)) dx \f]
+ * for a 1:1 electrolyte where \f$c\f$ is the output from Vpbe_getZmagic.
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @returns Energy value (in kT)
+ * @bug This function is not thread-safe. */
+VEXTERNC double Vfetk_PDE_Ju(
+ PDE *thee, /**< The PDE object */
+ int key /**< What to evluate: interior (0) or boundary (1)? */
+ );
+
+/**
+ * @brief External hook to simplex subdivision routines in Gem. Called each
+ * time a simplex is subdivided (we use it to update the charge-simplex map)
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is not thread-safe.
+ */
+VEXTERNC void Vfetk_externalUpdateFunction(
+ SS **simps, /**< List of parent (simps[0]) and children (remainder)
+ simplices */
+ int num /**< Number of simplices in list */
+ );
+
+
+/**
+ * @brief Initialize the bases for the trial or the test space, for a
+ * particular component of the system, at all quadrature points on the master
+ * simplex element.
+ * @ingroup Vfetk
+ * @author Mike Holst
+ * @note
+ * @verbatim
+ * The basis ordering is important. For a fixed quadrature
+ * point iq, you must follow the following ordering in p[iq][],
+ * based on how you specify the degrees of freedom in dof[]:
+ *
+ * , , ...,
+ * , , ...,
+ * ...
+ * , , ...,
+ *
+ * , , ...,
+ * , , ...,
+ * ...
+ * , , ...,
+ *
+ * , , ...,
+ * , , ...,
+ * ...
+ * , , ...,
+ *
+ * , , ...,
+ * , , ...,
+ * ...
+ * , , ...,
+ *
+ * For example, linear elements in R^3, with one degree of freedom at each *
+ * vertex, would use the following ordering:
+ *
+ * , , ,
+ *
+ * Quadratic elements in R^2, with one degree of freedom at each vertex and
+ * edge, would use the following ordering:
+ *
+ * , ,
+ * , ,
+ *
+ * You can use different trial and test spaces for each component of the
+ * elliptic system, thereby allowing for the use of Petrov-Galerkin methods.
+ * You MUST then tag the bilinear form symmetry entries as nonsymmetric in
+ * your PDE constructor to reflect that DF(u)(w,v) will be different from
+ * DF(u)(v,w), even if your form acts symmetrically when the same basis is
+ * used for w and v.
+ *
+ * You can also use different trial spaces for each component of the elliptic
+ * system, and different test spaces for each component of the elliptic
+ * system. This allows you to e.g. use a basis which is vertex-based for
+ * one component, and a basis which is edge-based for another. This is
+ * useful in fluid mechanics, eletromagnetics, or simply to play around with
+ * different elements.
+ *
+ * This function is called by MC to build new master elements whenever it
+ * reads in a new mesh. Therefore, this function does not have to be all
+ * that fast, and e.g. could involve symbolic computation.
+ * @endverbatim
+ */
+VEXTERNC int Vfetk_PDE_simplexBasisInit(
+ int key, /**< Basis type to evaluate (0 = trial, 1 = test, 2 = trialB,
+ 3 = testB) */
+ int dim, /**< Spatial dimension */
+ int comp, /**< Which component of elliptic system to produce basis
+ for? */
+ int *ndof, /**< Set to the number of degrees of freedom */
+ int dof[] /**< Set to degree of freedom per v/e/f/s */
+ );
+
+/**
+ * @brief Evaluate the bases for the trial or test space, for a particular
+ * component of the system, at all quadrature points on the master simplex
+ * element.
+ * @ingroup Vfetk
+ * @author Mike Holst
+ */
+VEXTERNC void Vfetk_PDE_simplexBasisForm(
+ int key, /**< Basis type to evaluate (0 = trial, 1 = test, 2 = trialB,
+ 3 = testB) */
+ int dim, /**< Spatial dimension */
+ int comp /**< Which component of elliptic system to produce basis for */,
+ int pdkey, /**< Basis partial differential equation evaluation key:
+ \li 0 = evaluate basis(x,y,z)
+ \li 1 = evaluate basis_x(x,y,z)
+ \li 2 = evaluate basis_y(x,y,z)
+ \li 3 = evaluate basis_z(x,y,z)
+ \li 4 = evaluate basis_xx(x,y,z)
+ \li 5 = evaluate basis_yy(x,y,z)
+ \li 6 = evaluate basis_zz(x,y,z)
+ \li 7 = etc... */
+ double xq[], /**< Set to quad pt coordinate */
+ double basis[] /**< Set to all basis functions evaluated at all
+ quadrature pts */
+ );
+
+/**
+ * @brief Read in mesh and initialize associated internal structures
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note @see Vfetk_genCube */
+VEXTERNC void Vfetk_readMesh(
+ Vfetk *thee, /**< THe Vfetk object */
+ int skey, /**< The sock format key (0 = MCSF simplex format) */
+ Vio *sock /**< Socket object ready for reading */
+ );
+
+/**
+ * @brief Debugging routine to print out local variables used by PDE object
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @bug This function is not thread-safe */
+VEXTERNC void Vfetk_dumpLocalVar();
+
+/**
+ * @brief Fill an array with the specified data
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @note This function is thread-safe
+ * @bug Several values of type are not implemented
+ * @return 1 if successful, 0 otherwise */
+VEXTERNC int Vfetk_fillArray(
+ Vfetk *thee, /**< The Vfetk object with the data */
+ Bvec *vec, /**< The vector to hold the data */
+ Vdata_Type type /**< THe type of data to write */
+ );
+
+/**
+ * @brief Write out data
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ * @param thee Vfetk object
+ * @param vec FEtk Bvec vector to use
+ * @param format Format for data
+ * @param iodev Output device type (FILE/BUFF/UNIX/INET)
+ * @param iofmt Output device format (ASCII/XDR)
+ * @param thost Output hostname (for sockets)
+ * @param fname Output FILE/BUFF/UNIX/INET name
+ * @note This function is thread-safe
+ * @bug Some values of format are not implemented
+ * @return 1 if successful, 0 otherwise */
+VEXTERNC int Vfetk_write(
+ Vfetk *thee, /**< The Vfetk object */
+ const char *iodev, /**< Output device type (FILE = file, BUFF = buffer,
+ UNIX = unix pipe, INET = network socket) */
+ const char *iofmt, /**< Output device format (ASCII = ascii/plaintext,
+ XDR = xdr) */
+ const char *thost, /**< Output hostname for sockets */
+ const char *fname, /**< Output filename for other */
+ Bvec *vec, /**< Data vector */
+ Vdata_Format format /**< Data format */
+ );
+
+/**
+ * @brief Load a Gem geometry manager object into Vfetk
+ * @ingroup Vfetk
+ * @author Nathan Baker
+ */
+VEXTERNC Vrc_Codes Vfetk_loadGem(
+ Vfetk *thee, /**< Destination */
+ Gem *gm /**< Geometry manager source */
+ );
+
+
+#endif /* ifndef _VFETK_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vpee.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vpee.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab7982a7590ad98b3bd48a91d0624e4731ff066c
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/fem/vpee.h
@@ -0,0 +1,235 @@
+/** @defgroup Vpee Vpee class
+ * @brief This class provides some functionality for error esimation
+ * in parallel.
+ *
+ * This class provides some functionality for error esimation in parallel.
+ * The purpose is to modulate the error returned by some external error
+ * estimator according to the partitioning of the mesh. For example, the
+ * Bank/Holst parallel refinement routine essentially reduces the error
+ * outside the ``local" partition to zero. However, this leads to the need
+ * for a few final overlapping Schwarz solves to smooth out the errors near
+ * partition boundaries. Supposedly, if the region in which we allow
+ * error-based refinement includes the ``local" partition and an external
+ * buffer zone approximately equal in size to the local region, then the
+ * solution will asymptotically approach the solution obtained via more
+ * typical methods. This is essentially a more flexible parallel
+ * implementation of MC's AM_markRefine.
+ */
+
+/**
+ * @file vpee.h
+ * @ingroup Vpee
+ * @brief Contains declarations for class Vpee
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VPEE_H
+#define _VPEE_H
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#include "mc/mc.h"
+
+/**
+ * @ingroup Vpee
+ * @author Nathan Baker
+ * @brief Contains public data members for Vpee class/module
+ */
+struct sVpee {
+
+ Gem *gm; /**< Grid manager */
+ int localPartID; /**< The local partition ID: i.e. the partition
+ * whose boundary simplices we're keeping
+ * track of */
+ double localPartCenter[3]; /**< The coordinates of the center of the local
+ * partition */
+ double localPartRadius; /**< The radius of the circle/sphere which
+ * circumscribes the local partition */
+ int killFlag; /**< A flag indicating the method we're using to
+ * artificially decrease the error esimate
+ * outside the local partition */
+ double killParam; /**< A parameter for the error estimate
+ * attenuation method */
+ Vmem *mem; /**< Memory manager */
+
+};
+
+/**
+ * @ingroup Vpee
+ * @brief Declaration of the Vpee class as the Vpee structure
+ */
+typedef struct sVpee Vpee;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vpee Inlineable methods
+/////////////////////////////////////////////////////////////////////////// */
+
+#if !defined(VINLINE_VPEE)
+#else /* if defined(VINLINE_VPEE) */
+#endif /* if !defined(VINLINE_VPEE) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vpee: Non-Inlineable methods (vpee.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/**
+ * @brief Construct the Vpee object
+ * @ingroup Vpee
+ * @author Nathan Baker
+ * @return Newly constructed Vpee object
+ */
+VEXTERNC Vpee* Vpee_ctor(
+ Gem *gm, /**< FEtk geometry manager object */
+ int localPartID, /**< ID of the local partition (focus of refinement) */
+ int killFlag, /**< A flag to indicate how error estimates are to be
+ attenuated outside the local partition:
+ \li 0: no attenuation
+ \li 1: all error outside the local partition set to
+ zero
+ \li 2: all error is set to zero outside a sphere of
+ radius (killParam*partRadius), where
+ partRadius is the radius of the sphere
+ circumscribing the local partition
+ \li 3: all error is set to zero except for the local
+ partition and its immediate neighbors */
+ double killParam /**< @see killFlag for usage */
+ );
+
+/**
+ * @brief FORTRAN stub to construct the Vpee object
+ * @ingroup Vpee
+ * @author Nathan Baker
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vpee_ctor2(
+ Vpee *thee, /**< The Vpee object */
+ Gem *gm, /**< FEtk geometry manager object */
+ int localPartID, /**< ID of the local partition (focus of refinement) */
+ int killFlag, /**< A flag to indicate how error estimates are to be
+ attenuated outside the local partition:
+ \li 0: no attenuation
+ \li 1: all error outside the local partition set to
+ zero
+ \li 2: all error is set to zero outside a sphere of
+ radius (killParam*partRadius), where
+ partRadius is the radius of the sphere
+ circumscribing the local partition
+ \li 3: all error is set to zero except for the local
+ partition and its immediate neighbors */
+ double killParam /**< @see killFlag for usage */
+ );
+
+/** @brief Object destructor
+ * @ingroup Vpee
+ * @author Nathan Baker
+ */
+VEXTERNC void Vpee_dtor(
+ Vpee **thee /**< Pointer to memory location of the Vpee object */
+ );
+
+/** @brief FORTRAN stub object destructor
+ * @ingroup Vpee
+ * @author Nathan Baker
+ */
+VEXTERNC void Vpee_dtor2(
+ Vpee *thee /**< Pointer to object to be destroyed */
+ );
+
+/** @brief Mark simplices for refinement based on attenuated error estimates.
+ *
+ * A wrapper/reimplementation of AM_markRefine that allows for more flexible
+ * attenuation of error-based markings outside the local partition. The error
+ * in each simplex is modified by the method (see killFlag) specified in the
+ * Vpee constructor. This allows the user to confine refinement to an
+ * arbitrary area around the local partition.
+ *
+ * @ingroup Vpee
+ * @author Nathan Baker and Mike Holst
+ * @note This routine borrows very heavily from FEtk routines by Mike Holst.
+ * @return The number of simplices marked for refinement.
+ * @bug This function is no longer up-to-date with FEtk and may not function
+ * properly
+ */
+VEXTERNC int Vpee_markRefine(
+ Vpee *thee, /**< The Vpee object */
+ AM *am, /**< The FEtk algebra manager currently used to solve the PB */
+ int level, /**< The current level of the multigrid hierarchy */
+ int akey, /**< The marking method:
+ \li -1: Reset markings --> killFlag has no effect.
+ \li 0: Uniform.
+ \li 1: User defined (geometry-based).
+ \li >1: A numerical estimate for the error has already been
+ set in am and should be attenuated according to
+ killFlag and used, in conjunction with etol, to mark
+ simplices for refinement. */
+ int rcol, /**< The ID of the main parition on which to mark (or -1 if
+ all partitions should be marked). NOte that we shouldhave
+ (rcol == thee->localPartID) for (thee->killFlag == 2 or 3) */
+ double etol, /**< The error tolerance criterion for marking */
+ int bkey /**< How the error tolerance is interpreted:
+ \li 0: Simplex marked if error > etol.
+ \li 1: Simplex marked if error >
+ sqrt(etol^2/L) where L$ is the number of simplices */
+ );
+
+/** @brief Returns the number of simplices in the local partition
+ * @ingroup Vpee
+ * @author Nathan Baker
+ * @return Number of simplices in the local partition
+ */
+VEXTERNC int Vpee_numSS(
+ Vpee *thee /**< The Vpee object */
+ );
+
+#endif /* ifndef _VPEE_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/biom.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/biom.h
new file mode 100644
index 0000000000000000000000000000000000000000..da625ab66a54689f3cb729eebb66ebba1175c8cf
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/biom.h
@@ -0,0 +1,315 @@
+/**
+ * @file biom.h
+ * @ingroup global_gamer
+ * @brief Some parameter/datatype definitions
+ * @author Zeyun Yu (zeyun.yu@gmail.com)
+ * @note None
+ * @version $Id: biom.h,v 1.28 2010/10/14 19:25:09 fetk Exp $
+ *
+ * @attention
+ * @verbatim
+ *
+ * GAMER = < Geometry-preserving Adaptive MeshER >
+ * Copyright (C) 1994-- Michael Holst and Zeyun Yu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @endverbatim
+ */
+
+#ifndef _BIOM_H_
+#define _BIOM_H_
+
+#include
+
+#include
+#include
+
+#if 0
+#include /* One of 15 ISO-C headers -- get via MALOC */
+#include /* One of 15 ISO-C headers -- get via MALOC */
+#include /* One of 15 ISO-C headers -- get via MALOC */
+#include /* One of 15 ISO-C headers -- get via MALOC */
+#include /* One of 15 ISO-C headers -- get via MALOC */
+#include /* System-dependent; include in .c file via MALOC */
+#include /* System-dependent; include in .c file via MALOC */
+#include /* System-dependent; include in .c file via MALOC */
+#endif
+
+// critical parameters for mesh generation
+
+/** @brief Isovalue used in the Marching Cube method */
+#define IsoValue 2.5
+/** @brief Blurring blobyness used in conversion from PDB/PQR to 3D volumes */
+#define BLOBBYNESS -0.2f
+/** @brief Discretization rate of 3D volumes */
+#define DIM_SCALE 1.99
+/** @brief Coarsening Rate in surface post-processing */
+#define CoarsenRate 0.1666
+/** @brief The minimal volumes (in voxels) of islands to be removed */
+#define MIN_VOLUME 333333
+/** @brief The size of the bounding sphere (= object size X the following rate) */
+#define SphereRatio 40
+
+#define MaxVal 999999
+#define MaxAtom 10
+
+// Other definitions and data structures
+
+/** @brief Other definition */
+#define PIE 3.14159265358979f
+/** @brief Other definition */
+#define IndexVect(i,j,k) ((k)*xdim*ydim + (j)*xdim + (i))
+#define IndexVect1(i,j,k) ((k)*xdim1*ydim1 + (j)*xdim1 + (i))
+/** @brief Other definition */
+#define max(x, y) ((x>y) ? (x):(y))
+/** @brief Other definition */
+#define min(x, y) ((x
+ * Copyright (C) 1994-- Michael Holst and Zeyun Yu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @endverbatim
+ */
+
+
+#ifndef _GAMER_H_
+#define _GAMER_H_
+
+#include
+
+#include
+#include
+#include
+
+#endif /* _GAMER_H_ */
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/gamer_base.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/gamer_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..2759fd1d4d594a2376a39987f1bb5b19cea56aea
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/gamer_base.h
@@ -0,0 +1,70 @@
+/**
+ * @defgroup global_gamer global_gamer class
+ * @brief Global group for gamer
+ */
+
+/**
+ * @file gamer_base.h
+ * @ingroup global_gamer
+ * @brief The base (or foundation) header for GAMER.
+ * @authors Michael Holst
+ * @note This header sets things up correctly for using ISO/ANSI-C.
+ * The following macros affect the behavior of the header:
+ @verbatim
+ Inlining for speed: (Normal C functions if VINLINE_XXX not defined.)
+ ------------------
+ -DVINLINE_GAMER : Enables macro time-critical funcs in GAMER.
+ @endverbatim
+ *
+ * @version $Id: gamer_base.h,v 1.11 2010/08/12 05:43:10 fetk Exp $
+ *
+ * @attention
+ * @verbatim
+ *
+ * GAMER = < Geometry-preserving Adaptive MeshER >
+ * Copyright (C) 1994-- Michael Holst and Zeyun Yu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @endverbatim
+ */
+
+#ifndef _GAMER_BASE_H_
+#define _GAMER_BASE_H_
+
+#include
+
+/** @brief Triangle-specific macros */
+#define TRILIBRARY
+/** @brief Triangle-specific macros */
+#define REAL double
+/** @brief Triangle-specific macros */
+#define VOID void
+/** @brief Triangle-specific macros */
+#define ANSI_DECLARATORS
+
+
+/** @brief Tetgen-specific macros */
+#define TETLIBRARY
+/* #define REAL double */ /* This is common with Triangle */
+
+/*
+ * ***************************************************************************
+ * Biom-specific macros
+ * ***************************************************************************
+ */
+
+#endif /* _GAMER_BASE_H_ */
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/tetgen.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/tetgen.h
new file mode 100644
index 0000000000000000000000000000000000000000..119e60ed883f25316047cc8566065361838a89c1
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/tetgen.h
@@ -0,0 +1,1962 @@
+///////////////////////////////////////////////////////////////////////////////
+// //
+// TetGen //
+// //
+// A Quality Tetrahedral Mesh Generator and 3D Delaunay Triangulator //
+// //
+// Version 1.4 //
+// January 14, 2006 //
+// //
+// Copyright 2002, 2004, 2005, 2006 //
+// Hang Si //
+// Rathausstr. 9, 10178 Berlin, Germany //
+// si@wias-berlin.de //
+// //
+// You can obtain TetGen via internet: http://tetgen.berlios.de. It may be //
+// freely copied, modified, and redistributed under the copyright notices //
+// given in the file LICENSE. //
+// //
+// TetGen computes Delaunay tetrahedralizations, constrained Delaunay tetra- //
+// hedralizations, and quality Delaunay tetrahedral meshes. The latter are //
+// nicely graded and whose tetrahedra have radius-edge ratio bounded. Such //
+// meshes are suitable for finite element and finite volume methods. //
+// //
+// TetGen incorporates a suit of geometrical and mesh generation algorithms. //
+// A brief description of algorithms used in TetGen is found in the first //
+// section of the user's manual. References are given for users who are //
+// interesting in these approaches. The main references are given below: //
+// //
+// The efficient Delaunay tetrahedralization algorithm is: H. Edelsbrunner //
+// and N. R. Shah, "Incremental Topological Flipping Works for Regular //
+// Triangulations". Algorithmica 15: 223-241, 1996. //
+// //
+// The constrained Delaunay tetrahedralization algorithm is described in: //
+// H. Si and K. Gaertner, "Meshing Piecewise Linear Complexes by Constr- //
+// ained Delaunay Tetrahedralizations". In Proceeding of the 14th Inter- //
+// national Meshing Roundtable. September 2005. //
+// //
+// The Delaunay refinement algorithm is from: Hang Si, "On Refinement of //
+// Constrained Delaunay Tetrahedralizations". In Proceeding of the 15th //
+// International Meshing Roundtable. September 2006. //
+// //
+// The mesh data structure of TetGen is a combination of two types of mesh //
+// data structures. The tetrahedron-based mesh data structure introduced //
+// by Shewchuk is eligible for tetrahedralization algorithms. The triangle //
+// -edge data structure developed by Muecke is adopted for representing //
+// boundary elements: subfaces and subsegments. Both data structures have //
+// a set of fast mesh manipulation primitives. //
+// //
+// J. R. Shewchuk, "Delaunay Refinement Mesh Generation". PhD thesis, //
+// Carnegie Mellon University, 1997. //
+// //
+// E. P. Muecke, "Shapes and Implementations in Three-Dimensional //
+// Geometry". PhD thesis, Univ. of Illinois, Urbana, Illinois, 1993. //
+// //
+// The research of mesh generation is definitly on the move. Many State-of- //
+// the-art algorithms need implementing and evaluating. I heartily welcome //
+// any new algorithm especially for generating quality conforming Delaunay //
+// meshes and anisotropic conforming Delaunay meshes. //
+// //
+// TetGen is supported by the "pdelib" project of Weierstrass Institute for //
+// Applied Analysis and Stochastics (WIAS) in Berlin. It is a collection //
+// of software components for solving non-linear partial differential //
+// equations including 2D and 3D mesh generators, sparse matrix solvers, //
+// and scientific visualization tools, etc. For more information please //
+// visit: http://www.wias-berlin.de/software/pdelib. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// tetgen.h //
+// //
+// Header file of the TetGen library. Also is the user-level header file. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// TetGen Library Overview //
+// //
+// TetGen library is comprised by several data types and global functions. //
+// //
+// There are three main data types: tetgenio, tetgenbehavior, and tetgenmesh.//
+// Tetgenio is used to pass data into and out of TetGen library; tetgenbeha- //
+// vior keeps the runtime options and thus controls the behaviors of TetGen; //
+// tetgenmesh, the biggest data type I've ever defined, contains mesh data //
+// structures and mesh traversing and transformation operators. The meshing //
+// algorithms are implemented on top of it. These data types are defined as //
+// C++ classes. //
+// //
+// There are few global functions. tetrahedralize() is provided for calling //
+// TetGen from another program. Two functions: orient3d() and insphere() are //
+// incorporated from a public C code provided by Shewchuk. They performing //
+// exact geometrical tests. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef tetgenH
+#define tetgenH
+
+
+#include // added by Zeyun Yu
+// The following data structures are used for passing meshes to FETK
+//typedef struct FETK_VX{
+// int id;
+// int chrt;
+// float x;
+// float y;
+// float z;
+//}FETK_VX;
+//
+//typedef struct FETK_SS{
+// int id;
+// int grp;
+// int mat;
+// int fa;
+// int fb;
+// int fc;
+// int fd;
+// int na;
+// int nb;
+// int nc;
+// int nd;
+//}FETK_SS;
+//
+//typedef struct GemMesh{
+// int dim;
+// int dimii;
+// int vertices;
+// int simplices;
+// FETK_VX *vv;
+// FETK_SS *ss;
+//}GemMesh;
+
+// End of data structures, added by Zeyun Yu
+
+
+// To compile TetGen as a library instead of an executable program, define
+// the TETLIBRARY symbol.
+
+// #define TETLIBRARY
+
+// Uncomment the following line to disable assert macros. These macros are
+// inserted in places where I hope to catch bugs.
+
+// #define NDEBUG
+
+// To insert lots of self-checks for internal errors, define the SELF_CHECK
+// symbol. This will slow down the program significantly.
+
+// #define SELF_CHECK
+
+// For single precision ( which will save some memory and reduce paging ),
+// define the symbol SINGLE by using the -DSINGLE compiler switch or by
+// writing "#define SINGLE" below.
+//
+// For double precision ( which will allow you to refine meshes to a smaller
+// edge length), leave SINGLE undefined.
+
+// #define SINGLE
+
+#if 0
+#ifdef SINGLE
+ #define REAL float
+#else
+ #define REAL double
+#endif // not defined SINGLE
+#endif
+
+// Here are the most general used head files for C/C++ programs.
+
+#if 0
+#include // Standard IO: FILE, NULL, EOF, printf(), ...
+#include // Standard lib: abort(), system(), getenv(), ...
+#include // String lib: strcpy(), strcat(), strcmp(), ...
+#include // Math lib: sin(), sqrt(), pow(), ...
+#include
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The tetgenio data type //
+// //
+// Used to pass data into and out of the library of TetGen. //
+// //
+// If you want to program with the library of TetGen, it's necessary for you //
+// to understand the tetgenio data type, while the other two data types can //
+// be hidden through calling the global function "tetrahedralize()". As you //
+// will see, that tetgenio is just a collection of arrays to storing points //
+// (by coodinates), tetrahedra (by indexes), faces, boundary markers, and so //
+// forth. Each array corresponds to a list of data in the file formats of //
+// TetGen. It is necessary to understand TetGen's input/output file formats //
+// (see user's manual) before using tetgenio objects. //
+// //
+// Once an object of tetgenio is declared (or created), all arrays of it are //
+// automatically initialized to NULLs (by routine initialize()). Before they //
+// can be used, one has to first allocate enough memory for them, i.e., use //
+// either 'malloc()' or 'new' operator. On deletion of the object, one needs //
+// to free the memory occupied by these arrays. Routine deinitialize() will //
+// be automatically called. It will deallocate the memory for an array if it //
+// is not a NULL. However, it assumes that the memory is allocated by 'new' //
+// (C++ operator). If you use malloc(), you should free() them and set the //
+// pointers to NULLs before reaching deinitialize(). //
+// //
+// In all cases, the first item in any array is stored starting at index [0].//
+// However, that item is item number `firstnumber' which may be '0' or '1'. //
+// Be sure to set the 'firstnumber' be '1' if your indices pointing into the //
+// pointlist is starting from '1'. Default, it is initialized be '0'. //
+// //
+// Tetgenio also contains routines for reading and writing TetGen's files as //
+// well. Both the library of TetGen and TetView use these routines to parse //
+// input files, i.e., .node, .poly, .smesh, .ele, .face, and .edge files. //
+// Other routines are provided mainly for debugging purpose. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+class tetgenio {
+
+ public:
+
+ // Maximum number of characters in a file name (including the null).
+ enum {FILENAMESIZE = 1024};
+
+ // Maxi. numbers of chars in a line read from a file (incl. the null).
+ enum {INPUTLINESIZE = 1024};
+
+ // The polygon data structure. A "polygon" is a planar polygon. It can
+ // be arbitrary shaped (convex or non-convex) and bounded by non-
+ // crossing segments, i.e., the number of vertices it has indictes the
+ // same number of edges.
+ // 'vertexlist' is a list of vertex indices (integers), its length is
+ // indicated by 'numberofvertices'. The vertex indices are odered in
+ // either counterclockwise or clockwise way.
+ typedef struct {
+ int *vertexlist;
+ int numberofvertices;
+ } polygon;
+
+ static void init(polygon* p) {
+ p->vertexlist = (int *) NULL;
+ p->numberofvertices = 0;
+ }
+
+ // The facet data structure. A "facet" is a planar facet. It is used
+ // to represent a planar straight line graph (PSLG) in two dimension.
+ // A PSLG contains a list of polygons. It also may conatin holes in it,
+ // indicated by a list of hole points (their coordinates).
+ typedef struct {
+ polygon *polygonlist;
+ int numberofpolygons;
+ REAL *holelist;
+ int numberofholes;
+ } facet;
+
+ static void init(facet* f) {
+ f->polygonlist = (polygon *) NULL;
+ f->numberofpolygons = 0;
+ f->holelist = (REAL *) NULL;
+ f->numberofholes = 0;
+ }
+
+ // The periodic boundary condition group data structure. A "pbcgroup"
+ // contains the definition of a pbc and the list of pbc point pairs.
+ // 'fmark1' and 'fmark2' are the facetmarkers of the two pbc facets f1
+ // and f2, respectively. 'transmat' is the transformation matrix which
+ // maps a point in f1 into f2. An array of pbc point pairs are saved
+ // in 'pointpairlist'. The first point pair is at indices [0] and [1],
+ // followed by remaining pairs. Two integers per pair.
+ typedef struct {
+ int fmark1, fmark2;
+ REAL transmat[4][4];
+ int numberofpointpairs;
+ int *pointpairlist;
+ } pbcgroup;
+
+ public:
+
+ // Items are numbered starting from 'firstnumber' (0 or 1), default is 0.
+ int firstnumber;
+
+ // Dimension of the mesh (2 or 3), default is 3.
+ int mesh_dim;
+
+ // `pointlist': An array of point coordinates. The first point's x
+ // coordinate is at index [0] and its y coordinate at index [1], its
+ // z coordinate is at index [2], followed by the coordinates of the
+ // remaining points. Each point occupies three REALs.
+ // `pointattributelist': An array of point attributes. Each point's
+ // attributes occupy `numberofpointattributes' REALs.
+ // 'addpointlist': An array of additional point coordinates.
+ // 'addpointattributelist': An array of attributes for addition points.
+ // `pointmarkerlist': An array of point markers; one int per point.
+ REAL *pointlist;
+ REAL *pointattributelist;
+ REAL *addpointlist;
+ REAL *addpointattributelist;
+ int *pointmarkerlist;
+ int numberofpoints;
+ int numberofpointattributes;
+ int numberofaddpoints;
+
+ // `elementlist': An array of element (triangle or tetrahedron) corners.
+ // The first element's first corner is at index [0], followed by its
+ // other corners in counterclockwise order, followed by any other
+ // nodes if the element represents a nonlinear element. Each element
+ // occupies `numberofcorners' ints.
+ // `elementattributelist': An array of element attributes. Each
+ // element's attributes occupy `numberofelementattributes' REALs.
+ // `elementconstraintlist': An array of constraints, i.e. triangle's
+ // area or tetrahedron's volume; one REAL per element. Input only.
+ // `neighborlist': An array of element neighbors; 3 or 4 ints per
+ // element. Output only.
+ int *tetrahedronlist;
+ REAL *tetrahedronattributelist;
+ REAL *tetrahedronvolumelist;
+ int *neighborlist;
+ int numberoftetrahedra;
+ int numberofcorners;
+ int numberoftetrahedronattributes;
+
+ // `facetlist': An array of facets. Each entry is a structure of facet.
+ // `facetmarkerlist': An array of facet markers; one int per facet.
+ facet *facetlist;
+ int *facetmarkerlist;
+ int numberoffacets;
+
+ // `holelist': An array of holes. The first hole's x, y and z
+ // coordinates are at indices [0], [1] and [2], followed by the
+ // remaining holes. Three REALs per hole.
+ REAL *holelist;
+ int numberofholes;
+
+ // `regionlist': An array of regional attributes and volume constraints.
+ // The first constraint's x, y and z coordinates are at indices [0],
+ // [1] and [2], followed by the regional attribute at index [3], foll-
+ // owed by the maximum volume at index [4]. Five REALs per constraint.
+ // Note that each regional attribute is used only if you select the `A'
+ // switch, and each volume constraint is used only if you select the
+ // `a' switch (with no number following).
+ REAL *regionlist;
+ int numberofregions;
+
+ // `facetconstraintlist': An array of facet maximal area constraints.
+ // Two REALs per constraint. The first one is the facet marker (cast
+ // it to int), the second is its maximum area bound.
+ // Note the 'facetconstraintlist' is used only for the 'q' switch.
+ REAL *facetconstraintlist;
+ int numberoffacetconstraints;
+
+ // `segmentconstraintlist': An array of segment max. length constraints.
+ // Three REALs per constraint. The first two are the indices (pointing
+ // into 'pointlist') of the endpoints of the segment, the third is its
+ // maximum length bound.
+ // Note the 'segmentconstraintlist' is used only for the 'q' switch.
+ REAL *segmentconstraintlist;
+ int numberofsegmentconstraints;
+
+ // `nodeconstraintlist': An array of segment length constraints. Two
+ // REALs per constraint. The first one is the index (pointing into
+ // 'pointlist') of the node, the second is its edge length bound.
+ // Note the 'nodeconstraintlist' is used only for the 'q' switch.
+ REAL *nodeconstraintlist;
+ int numberofnodeconstraints;
+
+ // 'pbcgrouplist': An array of periodic boundary condition groups.
+ pbcgroup *pbcgrouplist;
+ int numberofpbcgroups;
+
+ // `trifacelist': An array of triangular face endpoints. The first
+ // face's endpoints are at indices [0], [1] and [2], followed by the
+ // remaining faces. Three ints per face.
+ // `adjtetlist': An array of adjacent tetrahedra to the faces of
+ // trifacelist. Each face has at most two adjacent tets, the first
+ // face's adjacent tets are at [0], [1]. Two ints per face. A '-1'
+ // indicates outside (no adj. tet). This list is output when '-n'
+ // switch is used.
+ // `trifacemarkerlist': An array of face markers; one int per face.
+ int *trifacelist;
+ int *adjtetlist;
+ int *trifacemarkerlist;
+ int numberoftrifaces;
+
+ // `edgelist': An array of edge endpoints. The first edge's endpoints
+ // are at indices [0] and [1], followed by the remaining edges. Two
+ // ints per edge.
+ // `edgemarkerlist': An array of edge markers; one int per edge.
+ int *edgelist;
+ int *edgemarkerlist;
+ int numberofedges;
+
+ public:
+
+ // Initialize routine.
+ void initialize();
+ void deinitialize();
+
+ // Input & output routines.
+ bool load_node_call(FILE* infile, int markers, char* nodefilename);
+ bool load_node(char* filename);
+ bool load_addnodes(char* filename);
+ bool load_pbc(char* filename);
+ bool load_var(char* filename);
+ bool load_mtr(char* filename);
+ bool load_poly(char* filename);
+ bool load_off(char* filename);
+ bool load_ply(char* filename);
+ bool load_stl(char* filename);
+ bool load_medit(char* filename);
+ bool load_plc(char* filename, int object);
+ bool load_tetmesh(char* filename);
+ void save_nodes(char* filename);
+ void save_elements(char* filename);
+ void save_faces(char* filename);
+ void save_edges(char* filename);
+ void save_neighbors(char* filename);
+ void save_poly(char* filename);
+
+ // Added by Zeyun Yu
+ //void write_off(FILE*);
+ //void write_pdb_mcsf(char*,float,float,float,float,char*,int);
+ //void write_pdb_gem(GemMesh*,float,float,float,float,char*,int);
+ //void write_mcsf(char*, unsigned int*);
+
+ // Read line and parse string functions.
+ char *readline(char* string, FILE* infile, int *linenumber);
+ char *findnextfield(char* string);
+ char *readnumberline(char* string, FILE* infile, char* infilename);
+ char *findnextnumber(char* string);
+
+ // Constructor and destructor.
+ tetgenio() {initialize();}
+ ~tetgenio() {deinitialize();}
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The tetgenbehavior data type //
+// //
+// Used to parse command line switches and file names. //
+// //
+// It includes a list of variables corresponding to the commandline switches //
+// for control the behavior of TetGen. These varibales are all initialized //
+// to their default values. //
+// //
+// parse_commandline() provides an simple interface to set the vaules of the //
+// variables. It accepts the standard parameters (e.g., 'argc' and 'argv') //
+// that pass to C/C++ main() function. Alternatively a string which contains //
+// the command line options can be used as its parameter. //
+// //
+// You don't need to understand this data type. It can be implicitly called //
+// by the global function "tetrahedralize()" defined below. The necessary //
+// thing you need to know is the meaning of command line switches of TetGen. //
+// They are described in the third section of the user's manual. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+class tetgenbehavior {
+
+ public:
+
+ // Labels define the objects which are acceptable by TetGen. They are
+ // recognized by the file extensions.
+ // - NODES, a list of nodes (.node);
+ // - POLY, a piecewise linear complex (.poly or .smesh);
+ // - OFF, a polyhedron (.off, Geomview's file format);
+ // - PLY, a polyhedron (.ply, file format from gatech);
+ // - STL, a surface mesh (.stl, stereolithography format);
+ // - MEDIT, a surface mesh (.mesh, Medit's file format);
+ // - MESH, a tetrahedral mesh (.ele).
+ // If no extension is available, the imposed commandline switch
+ // (-p or -r) implies the object.
+
+ enum objecttype {NONE, NODES, POLY, OFF, PLY, STL, MEDIT, MESH};
+
+ // Variables of command line switches. Each variable is corresponding
+ // to a specific switch and will be properly initialized. Read the
+ // user's manul to find out the meaning of these switches.
+
+ int plc; // '-p' switch, 0.
+ int refine; // '-r' switch, 0.
+ int quality; // '-q' switch, 0.
+ int smooth; // '-s' switch, 0.
+ int metric; // '-m' switch, 0.
+ int bgmesh; // '-b' switch, 0.
+ int varvolume; // '-a' switch without number, 0.
+ int fixedvolume; // '-a' switch with number, 0.
+ int insertaddpoints; // '-i' switch, 0.
+ int regionattrib; // '-A' switch, 0.
+ int offcenter; // '-R' switch, 0.
+ int conformdel; // '-D' switch, 0.
+ int diagnose; // '-d' switch, 0.
+ int zeroindex; // '-z' switch, 0.
+ int order; // element order, specified after '-o' switch, 1.
+ int facesout; // '-f' switch, 0.
+ int edgesout; // '-e' switch, 0.
+ int neighout; // '-n' switch, 0.
+ int meditview; // '-g' switch, 0.
+ int gidview; // '-G' switch, 0.
+ int geomview; // '-O' switch, 0.
+ int nobound; // '-B' switch, 0.
+ int nonodewritten; // '-N' switch, 0.
+ int noelewritten; // '-E' switch, 0.
+ int nofacewritten; // '-F' switch, 0.
+ int noiterationnum; // '-I' switch, 0.
+ int nomerge; // count of how often '-M' switch is selected, 0.
+ int nobisect; // count of how often '-Y' switch is selected, 0.
+ int noflip; // do not perform flips. '-Y' switch. 0.
+ int nojettison; // do not jettison redundants nodes. '-J' switch. 0.
+ int steiner; // number after '-S' switch. 0.
+ int fliprepair; // '-X' switch, 1.
+ int docheck; // '-C' switch, 0.
+ int quiet; // '-Q' switch, 0.
+ int verbose; // count of how often '-V' switch is selected, 0.
+ int tol; // count of how often '-T' switch is selected, 0.
+ int useshelles; // '-p', '-r', '-q', '-d', or '-c' switch, 0.
+ REAL minratio; // number after '-q' switch, 2.0.
+ REAL goodratio; // number calculated from 'minratio', 0.0.
+ REAL minangle; // minimum angle bound, 20.0.
+ REAL goodangle; // cosine squared of minangle, 0.0.
+ REAL maxvolume; // number after '-a' switch, -1.0.
+ REAL maxdihedral; // number after '-s' switch, 175.0.
+ REAL alpha1; // number after '-R' switch, sqrt(2).
+ REAL alpha2; // number after '-RR' switch, 1/sqrt(2).
+ REAL alpha3; // number after '-RRR' switch, 0.6.
+ REAL epsilon; // number after '-T' switch, 1.0e-8.
+ REAL epsilon2; // number after '-TT' switch, 1.0e-5.
+ enum objecttype object; // determined by -p, or -r switch. NONE.
+
+ // Variables used to save command line switches and in/out file names.
+ char commandline[1024];
+ char infilename[1024];
+ char outfilename[1024];
+ char bgmeshfilename[1024];
+
+ tetgenbehavior();
+ ~tetgenbehavior() {}
+
+ void versioninfo();
+ void syntax();
+ void usage();
+
+ // Command line parse routine.
+ bool parse_commandline(int argc, char **argv);
+ bool parse_commandline(char *switches) {
+ return parse_commandline(0, &switches);
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Geometric predicates //
+// //
+// Return one of the values +1, 0, and -1 on basic geometric questions such //
+// as the orientation of point sets, in-circle, and in-sphere tests. They //
+// are basic units for the composition of geometric algorithms. TetGen uses //
+// two 3D geometric predicates, which are the orientation test and the in- //
+// sphere test (e.g. the locally Deklaunay test). //
+// //
+// Orientation test: let a, b, c be a sequence of 3 non-collinear points in //
+// R^3. They defines a unique hypeplane H. Let H+ and H- be the two spaces //
+// separated by H, which are defined as follows (using the left-hand rule): //
+// make a fist using your left hand in such a way that your fingers follow //
+// the order of a, b and c, then your thumb is pointing to H+. Given any //
+// point d in R^3, the orientation test returns +1 if d lies in H+, -1 if d //
+// lies in H-, or 0 if d lies on H. //
+// //
+// In-sphere test: let a, b, c, d be 4 non-coplanar points in R^3. They //
+// defines a unique circumsphere S. Given any point e in R^3, the in-sphere //
+// test returns +1 if e lies inside S, or -1 if e lies outside S, or 0 if e //
+// lies on S. //
+// //
+// The correctness of geometric predicates is crucial for the control flow //
+// and hence for the correctness and robustness of an implementation of a //
+// geometric algorithm. The following routines use arbitrary precision //
+// floating-point arithmetic. They are fast and robust. It is provided by J. //
+// Schewchuk in public domain (http://www.cs.cmu.edu/~quake/robust.html). //
+// The source code are found in a separate file "predicates.cxx". //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+REAL exactinit2(); //renamed by Zeyun Yu from exactinit()
+REAL orient3d(REAL *pa, REAL *pb, REAL *pc, REAL *pd);
+REAL insphere(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe);
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The tetgenmesh data type //
+// //
+// Includes data types and mesh routines for creating tetrahedral meshes and //
+// Delaunay tetrahedralizations, mesh input & output, and so on. //
+// //
+// An object of tetgenmesh can be used to store a triangular or tetrahedral //
+// mesh and its settings. TetGen's functions operates on one mesh each time. //
+// This type allows reusing of the same function for different meshes. //
+// //
+// The mesh data structure (tetrahedron-based and triangle-edge data struct- //
+// ures) are declared. There are other accessary data type defined as well, //
+// for efficient memory management and link list operations, etc. //
+// //
+// All algorithms TetGen used are implemented in this data type as member //
+// functions. References of these algorithms can be found in user's manual. //
+// //
+// It's not necessary to understand this type. There is a global function //
+// "tetrahedralize()" (defined at the end of this file) implicitly creates //
+// the object and calls its member functions according to the command line //
+// switches you specified. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+class tetgenmesh {
+
+ public:
+
+ // Maximum number of characters in a file name (including the null).
+ enum {FILENAMESIZE = 1024};
+
+ // For efficiency, a variety of data structures are allocated in bulk.
+ // The following constants determine how many of each structure is
+ // allocated at once.
+ enum {VERPERBLOCK = 4092, SUBPERBLOCK = 4092, ELEPERBLOCK = 8188};
+
+ // Used for the point location scheme of Mucke, Saias, and Zhu, to
+ // decide how large a random sample of tetrahedra to inspect.
+ enum {SAMPLEFACTOR = 11};
+
+ // Labels that signify two edge rings of a triangle defined in Muecke's
+ // triangle-edge data structure, one (CCW) traversing edges in count-
+ // erclockwise direction and one (CW) in clockwise direction.
+ enum {CCW = 0, CW = 1};
+
+ // Labels that signify whether a record consists primarily of pointers
+ // or of floating-point words. Used to make decisions about data
+ // alignment.
+ enum wordtype {POINTER, FLOATINGPOINT};
+
+ // Labels that signify the type of a vertex. An UNUSEDVERTEX is a vertex
+ // read from input (.node file or tetgenio structure) or an isolated
+ // vertex (outside the mesh). It is the default type for a newpoint.
+ enum verttype {UNUSEDVERTEX, DUPLICATEDVERTEX, NACUTEVERTEX, ACUTEVERTEX,
+ FREESEGVERTEX, FACETVERTEX, FREESUBVERTEX, VOLVERTEX,
+ FREEVOLVERTEX, DEADVERTEX = -32768};
+
+ // Labels that signify the type of a subface/subsegment. A subface is
+ // SKINNY if it has two edges which are subsegments and form a small
+ // angle (e.g., 10 degree); a subsegment is a SHARP if it is between
+ // two facets which form an acute dihedral angle.
+ enum shestype {NSHARPNSKINNY, SHARP, SKINNY};
+
+ // Labels that signify the type of flips can be applied on a face.
+ // A flipable face has the one of the types T23, T32, T22, and T44.
+ // Types UNFLIPABLE, NONCONVEX are unflipable.
+ enum fliptype {T23, T32, T22, T44, UNFLIPABLE, FORBIDDENFACE,
+ FORBIDDENEDGE, NONCONVEX};
+
+ // Labels that signify the result of triangle-triangle intersection test.
+ // Two triangles are DISJOINT, or adjoint at a vertex SHAREVERTEX, or
+ // adjoint at an edge SHAREEDGE, or coincident SHAREFACE or INTERSECT.
+ enum interresult {DISJOINT, SHAREVERTEX, SHAREEDGE, SHAREFACE, INTERSECT};
+
+ // Labels that signify the result of point location. The result of a
+ // search indicates that the point falls inside a tetrahedron, inside
+ // a triangle, on an edge, on a vertex, or outside the mesh.
+ enum locateresult {INTETRAHEDRON, ONFACE, ONEDGE, ONVERTEX, OUTSIDE};
+
+ // Labels that signify the result of vertex insertion. The result
+ // indicates that the vertex was inserted with complete success, was
+ // inserted but encroaches upon a subsegment, was not inserted because
+ // it lies on a segment, or was not inserted because another vertex
+ // occupies the same location.
+ enum insertsiteresult {SUCCESSINTET, SUCCESSONFACE, SUCCESSONEDGE,
+ DUPLICATEPOINT, OUTSIDEPOINT};
+
+ // Labels that signify the result of direction finding. The result
+ // indicates that a segment connecting the two query points accross
+ // an edge of the direction triangle/tetrahedron, across a face of
+ // the direction tetrahedron, along the left edge of the direction
+ // triangle/tetrahedron, along the right edge of the direction
+ // triangle/tetrahedron, or along the top edge of the tetrahedron.
+ enum finddirectionresult {ACROSSEDGE, ACROSSFACE, LEFTCOLLINEAR,
+ RIGHTCOLLINEAR, TOPCOLLINEAR, BELOWHULL};
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The basic mesh element data structures //
+// //
+// There are four types of mesh elements: tetrahedra, subfaces, subsegments, //
+// and points, where subfaces and subsegments are triangles and edges which //
+// appear on boundaries. A tetrahedralization of a 3D point set comprises //
+// tetrahedra and points; a surface mesh of a 3D domain comprises subfaces //
+// subsegments and points. The elements of all the four types consist of a //
+// tetrahedral mesh of a 3D domain. However, TetGen uses three data types: //
+// 'tetrahedron', 'shellface', and 'point'. A 'tetrahedron' is a tetrahedron;//
+// while a 'shellface' can be either a subface or a subsegment; and a 'point'//
+// is a point. These three data types, linked by pointers comprise a mesh. //
+// //
+// A tetrahedron primarily consists of a list of 4 pointers to its corners, //
+// a list of 4 pointers to its adjoining tetrahedra, a list of 4 pointers to //
+// its adjoining subfaces (when subfaces are needed). Optinoally, (depending //
+// on the selected switches), it may contain an arbitrary number of user- //
+// defined floating-point attributes, an optional maximum volume constraint //
+// (for -a switch), and a pointer to a list of high-order nodes (-o2 switch).//
+// Since the size of a tetrahedron is not determined until running time, it //
+// is not simply declared as a structure. //
+// //
+// The data structure of tetrahedron also stores the geometrical information.//
+// Let t be a tetrahedron, v0, v1, v2, and v3 be the 4 nodes corresponding //
+// to the order of their storage in t. v3 always has a negative orientation //
+// with respect to v0, v1, v2 (ie,, v3 lies above the oriented plane passes //
+// through v0, v1, v2). Let the 4 faces of t be f0, f1, f2, and f3. Vertices //
+// of each face are stipulated as follows: f0 (v0, v1, v2), f1 (v0, v3, v1), //
+// f2 (v1, v3, v2), f3 (v2, v3, v0). //
+// //
+// A subface has 3 pointers to vertices, 3 pointers to adjoining subfaces, 3 //
+// pointers to adjoining subsegments, 2 pointers to adjoining tetrahedra, a //
+// boundary marker(an integer). Like a tetrahedron, the pointers to vertices,//
+// subfaces, and subsegments are ordered in a way that indicates their geom- //
+// etric relation. Let s be a subface, v0, v1 and v2 be the 3 nodes corres- //
+// ponding to the order of their storage in s, e0, e1 and e2 be the 3 edges,//
+// then we have: e0 (v0, v1), e1 (v1, v2), e2 (v2, v0). //
+// //
+// A subsegment has exactly the same data fields as a subface has, but only //
+// uses some of them. It has 2 pointers to its endpoints, 2 pointers to its //
+// adjoining (and collinear) subsegments, a pointer to a subface containing //
+// it (there may exist any number of subfaces having it, choose one of them //
+// arbitrarily). The geometric relation between its endpoints and adjoining //
+// subsegments is kept with respect to the storing order of its endpoints. //
+// //
+// The data structure of point is relatively simple. A point is a list of //
+// floating-point numbers, starting with the x, y, and z coords, followed by //
+// an arbitrary number of optional user-defined floating-point attributes, //
+// an integer boundary marker, an integer for the point type, and a pointer //
+// to a tetrahedron (used for speeding up point location). //
+// //
+// For a tetrahedron on a boundary (or a hull) of the mesh, some or all of //
+// the adjoining tetrahedra may not be present. For an interior tetrahedron, //
+// often no neighboring subfaces are present, Such absent tetrahedra and //
+// subfaces are never represented by the NULL pointers; they are represented //
+// by two special records: `dummytet', the tetrahedron fills "outer space", //
+// and `dummysh', the vacuous subfaces which are omnipresent. //
+// //
+// Tetrahedra and adjoining subfaces are glued together through the pointers //
+// saved in each data fields of them. Subfaces and adjoining subsegments are //
+// connected in the same fashion. However, there are no pointers directly //
+// gluing tetrahedra and adjoining subsegments. For the purpose of saving //
+// space, the connections between tetrahedra and subsegments are entirely //
+// mediated through subfaces. The following part explains how subfaces are //
+// connected in TetGen. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The subface-subface and subface-subsegment connections //
+// //
+// Adjoining subfaces sharing a common edge are connected in such a way that //
+// they form a face ring around the edge. It is indeed a single linked list //
+// which is cyclic, e.g., one can start from any subface in it and traverse //
+// back. When the edge is not a subsegment, the ring only has two coplanar //
+// subfaces which are pointing to each other. Otherwise, the face ring may //
+// have any number of subfaces (and are not all coplanar). //
+// //
+// How is the face ring formed? Let s be a subsegment, f is one of subfaces //
+// containing s as an edge. The direction of s is stipulated from its first //
+// endpoint to its second (according to their storage in s). Once the dir of //
+// s is determined, the other two edges of f are oriented to follow this dir.//
+// The "directional normal" N_f is a vector formed from any point in f and a //
+// points orthogonally above f. //
+// //
+// The face ring of s is a cyclic ordered set of subfaces containing s, i.e.,//
+// F(s) = {f1, f2, ..., fn}, n >= 1. Where the order is defined as follows: //
+// let fi, fj be two faces in F(s), the "normal-angle", NAngle(i,j) (range //
+// from 0 to 360 degree) is the angle between the N_fi and N_fj; then fi is //
+// in front of fj (or symbolically, fi < fj) if there exists another fk in //
+// F(s), and NAangle(k, i) < NAngle(k, j). The face ring of s is: f1 < f2 < //
+// ... < fn < f1. //
+// //
+// The easiest way to imagine how a face ring is formed is to use the right- //
+// hand rule. Make a fist using your right hand with the thumb pointing to //
+// the direction of the subsegment. The face ring is connected following the //
+// direction of your fingers. //
+// //
+// The subface and subsegment are also connected through pointers stored in //
+// their own data fields. Every subface has a pointer to its adjoining sub- //
+// segment. However, a subsegment only has one pointer to a subface which is //
+// containing it. Such subface can be chosen arbitrarily, other subfaces are //
+// found through the face ring. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // The tetrahedron data structure. Fields of a tetrahedron contains:
+ // - a list of four adjoining tetrahedra;
+ // - a list of four vertices;
+ // - a list of four subfaces (optional, used for -p switch);
+ // - a list of user-defined floating-point attributes (optional);
+ // - a volume constraint (optional, used for -a switch);
+ // - an integer of element marker (optional, used for -n switch);
+ // - a pointer to a list of high-ordered nodes (optional, -o2 switch);
+
+ typedef REAL **tetrahedron;
+
+ // The shellface data structure. Fields of a shellface contains:
+ // - a list of three adjoining subfaces;
+ // - a list of three vertices;
+ // - a list of two adjoining tetrahedra;
+ // - a list of three adjoining subsegments;
+ // - a pointer to a badface containing it (used for -q);
+ // - an area constraint (optional, used for -q);
+ // - an integer for boundary marker;
+ // - an integer for type: SHARPSEGMENT, NONSHARPSEGMENT, ...;
+ // - an integer for pbc group (optional, if in->pbcgrouplist exists);
+
+ typedef REAL **shellface;
+
+ // The point data structure. It is actually an array of REALs:
+ // - x, y and z coordinates;
+ // - a list of user-defined point attributes (optional);
+ // - a REAL of local feature sizes (optional -p switch);
+ // - a pointer to a simplex (tet, tri, edge, or vertex);
+ // - a pointer to a parent (or duplicate) point;
+ // - a pointer to a tet in background mesh (optional);
+ // - a pointer to another pbc point (optional);
+ // - an integer for boundary marker;
+ // - an integer for verttype: INPUTVERTEX, FREEVERTEX, ...;
+
+ typedef REAL *point;
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The mesh handle (triface, face) data types //
+// //
+// Two special data types, 'triface' and 'face' are defined for maintaining //
+// and updating meshes. They are like pointers (or handles), which allow you //
+// to hold one particular part of the mesh, i.e., a tetrahedron, a triangle, //
+// an edge and a vertex. However, these data types do not themselves store //
+// any part of the mesh. The mesh is made of the data types defined above. //
+// //
+// Muecke's "triangle-edge" data structure is the prototype for these data //
+// types. It allows a universal representation for every tetrahedron, //
+// triangle, edge and vertex. For understanding the following descriptions //
+// of these handle data structures, readers are required to read both the //
+// introduction and implementation detail of "triangle-edge" data structure //
+// in Muecke's thesis. //
+// //
+// A 'triface' represents a face of a tetrahedron and an oriented edge of //
+// the face simultaneously. It has a pointer 'tet' to a tetrahedron, an //
+// integer 'loc' (range from 0 to 3) as the face index, and an integer 'ver' //
+// (range from 0 to 5) as the edge version. A face of the tetrahedron can be //
+// uniquly determined by the pair (tet, loc), and an oriented edge of this //
+// face can be uniquly determined by the triple (tet, loc, ver). Therefore, //
+// different usages of one triface are possible. If we only use the pair //
+// (tet, loc), it refers to a face, and if we add the 'ver' additionally to //
+// the pair, it is an oriented edge of this face. //
+// //
+// A 'face' represents a subface and an oriented edge of it simultaneously. //
+// It has a pointer 'sh' to a subface, an integer 'shver'(range from 0 to 5) //
+// as the edge version. The pair (sh, shver) determines a unique oriented //
+// edge of this subface. A 'face' is also used to represent a subsegment, //
+// in this case, 'sh' points to the subsegment, and 'shver' indicates the //
+// one of two orientations of this subsegment, hence, it only can be 0 or 1. //
+// //
+// Mesh navigation and updating are accomplished through a set of mesh //
+// manipulation primitives which operate on trifaces and faces. They are //
+// introduced below. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class triface {
+
+ public:
+
+ tetrahedron* tet;
+ int loc, ver;
+
+ // Constructors;
+ triface() : tet(0), loc(0), ver(0) {}
+ // Operators;
+ triface& operator=(const triface& t) {
+ tet = t.tet; loc = t.loc; ver = t.ver;
+ return *this;
+ }
+ bool operator==(triface& t) {
+ return tet == t.tet && loc == t.loc && ver == t.ver;
+ }
+ bool operator!=(triface& t) {
+ return tet != t.tet || loc != t.loc || ver != t.ver;
+ }
+ };
+
+ class face {
+
+ public:
+
+ shellface *sh;
+ int shver;
+
+ // Constructors;
+ face() : sh(0), shver(0) {}
+ // Operators;
+ face& operator=(const face& s) {
+ sh = s.sh; shver = s.shver;
+ return *this;
+ }
+ bool operator==(face& s) {return (sh == s.sh) && (shver == s.shver);}
+ bool operator!=(face& s) {return (sh != s.sh) || (shver != s.shver);}
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The badface structure //
+// //
+// A multiple usages structure. Despite of its name, a 'badface' can be used //
+// to represent the following objects: //
+// - a face of a tetrahedron which is (possibly) non-Delaunay; //
+// - an encroached subsegment or subface; //
+// - a bad-quality tetrahedron, i.e, has too large radius-edge ratio; //
+// - a sliver, i.e., has good radius-edge ratio but nearly zero volume; //
+// - a degenerate tetrahedron (see routine checkdegetet()). //
+// - a recently flipped face (saved for undoing the flip later). //
+// //
+// It has the following fields: 'tt' holds a tetrahedron; 'ss' holds a sub- //
+// segment or subface; 'cent' is the circumcent of 'tt' or 'ss', 'key' is a //
+// special value depending on the use, it can be either the square of the //
+// radius-edge ratio of 'tt' or the flipped type of 'tt'; 'forg', 'fdest', //
+// 'fapex', and 'foppo' are vertices saved for checking the object in 'tt' //
+// or 'ss' is still the same when it was stored; 'noppo' is the fifth vertex //
+// of a degenerate point set. 'previtem' and 'nextitem' implement a double //
+// link for managing many basfaces. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ struct badface {
+ triface tt;
+ face ss;
+ REAL key;
+ REAL cent[3];
+ point forg, fdest, fapex, foppo;
+ point noppo;
+ struct badface *previtem, *nextitem;
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The pbcdata structure //
+// //
+// A pbcdata stores data of a periodic boundary condition defined on a pair //
+// of facets or segments. Let f1 and f2 define a pbcgroup. 'fmark' saves the //
+// facet markers of f1 and f2; 'ss' contains two subfaces belong to f1 and //
+// f2, respectively. Let s1 and s2 define a segment pbcgroup. 'segid' are //
+// the segment ids of s1 and s2; 'ss' contains two segments belong to s1 and //
+// s2, respectively. 'transmat' are two transformation matrices. transmat[0] //
+// transforms a point of f1 (or s1) into a point of f2 (or s2), transmat[1] //
+// does the inverse. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ struct pbcdata {
+ int fmark[2];
+ int segid[2];
+ face ss[2];
+ REAL transmat[2][4][4];
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The Metric tensor data structure //
+// //
+// A metric is a function that specifies the "distance" between two points //
+// in a metric space E. Recall if d(p, q) is a metric of E, then we have: //
+// (1) d(p, q) = d(q, p). (d is symmetric) //
+// (2) d(p, q) = 0 if and only if p = q. //
+// (3) d(p, x) + d(x, q) >= d(p, q). (d satisfies triangle inequality) //
+// //
+// In d dimensions, the metric tensor of a point p is a (dxd) symmetric //
+// positive definie (non-degenerate) matrix M(p). Very roughly, it tells how //
+// to compute the distance of p and other points in the metric space of p. //
+// d_M(p, q) = \sqrt{(p - q)' M (p -q)}. //
+// If for any point p, a metric tensor M(p) is given, the field of tensors //
+// thus defines a Riemannian space. For example, if M(q) is a metric tensor //
+// defined on q. Then the distance d(p, q) can be calculated by: //
+// d(p, q) = \int_{0}{1} \sqrt((p - q)' M(t) (p - q)) dt. //
+// where M(t) is the interpolation of metric tensors between p and q, M(0) = //
+// M(p) and M(1) = M(q). //
+// //
+// A metric tensor in three dimension, for example, is a matrix: //
+// | a b c | //
+// M = | b d e | //
+// | c e f | //
+// such that a > 0, d > 0, f > 0, det(M) = adf + 2bce -ccd - eea - bbf > 0. //
+// //
+// It is defined as an array mat[6] = {a, b, c, d, e, f}. Operation on //
+// tensors are defined as well. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class metric {
+
+ public:
+
+ REAL mat[6];
+
+ // Initialization.
+ void init() {for (int i = 0; i < 6; i++) mat[i] = 0.0;}
+ void set(REAL a, REAL b, REAL c, REAL d, REAL e, REAL f) {
+ mat[0] = a; mat[1] = b; mat[2] = c;
+ mat[3] = d; mat[4] = e;
+ mat[5] = f;
+ }
+ void set(REAL a, REAL d, REAL f) {
+ mat[0] = a; mat[1] = 0.0; mat[2] = 0.0;
+ mat[3] = d; mat[4] = 0.0;
+ mat[5] = f;
+ }
+
+ // Constructors.
+ metric() {init();}
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The list, link and queue data structures //
+// //
+// These data types are used to manipulate a set of (same-typed) data items. //
+// For a given set S = {a, b, c, ...}, a list stores the elements of S in a //
+// piece of continuous memory. It allows quickly accessing each element of S,//
+// thus is suitable for storing a fix-sized set. While a link stores its //
+// elements incontinuously. It allows quickly inserting or deleting an item, //
+// thus is suitable for storing a size-variable set. A queue is basically a //
+// special case of a link where one data element joins the link at the end //
+// and leaves in an ordered fashion at the other end. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // The compfunc data type. "compfunc" is a pointer to a linear-order
+ // function, which takes two 'void*' arguments and returning an 'int'.
+ //
+ // A function: int cmp(const T &, const T &), is said to realize a
+ // linear order on the type T if there is a linear order <= on T such
+ // that for all x and y in T satisfy the following relation:
+ // -1 if x < y.
+ // comp(x, y) = 0 if x is equivalent to y.
+ // +1 if x > y.
+ typedef int (*compfunc) (const void *, const void *);
+
+ // The predefined compare functions for primitive data types. They
+ // take two pointers of the corresponding date type, perform the
+ // comparation, and return -1, 0 or 1 indicating the default linear
+ // order of them.
+
+ // Compare two 'integers'.
+ static int compare_2_ints(const void* x, const void* y);
+ // Compare two 'longs'.
+ static int compare_2_longs(const void* x, const void* y);
+ // Compare two 'unsigned longs'.
+ static int compare_2_unsignedlongs(const void* x, const void* y);
+
+ // The function used to determine the size of primitive data types and
+ // set the corresponding predefined linear order functions for them.
+ static void set_compfunc(char* str, int* itembytes, compfunc* pcomp);
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// List data structure. //
+// //
+// A 'list' is an array of items with automatically reallocation of memory. //
+// It behaves like an array. //
+// //
+// 'base' is the starting address of the array; The memory unit in list is //
+// byte, i.e., sizeof(char). 'itembytes' is the size of each item in byte, //
+// so that the next item in list will be found at the next 'itembytes' //
+// counted from the current position. //
+// //
+// 'items' is the number of items stored in list. 'maxitems' indicates how //
+// many items can be stored in this list. 'expandsize' is the increasing //
+// size (items) when the list is full. //
+// //
+// 'comp' is a pointer pointing to a linear order function for the list. //
+// default it is set to 'NULL'. //
+// //
+// The index of list always starts from zero, i.e., for a list L contains //
+// n elements, the first element is L[0], and the last element is L[n-1]. //
+// This feature lets lists like C/C++ arrays. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class list {
+
+ public:
+
+ char *base;
+ int itembytes;
+ int items, maxitems, expandsize;
+ compfunc comp;
+
+ public:
+
+ list(int itbytes, compfunc pcomp, int mitems = 256, int exsize = 128) {
+ listinit(itbytes, pcomp, mitems, exsize);
+ }
+ list(char* str, int mitems = 256, int exsize = 128) {
+ set_compfunc(str, &itembytes, &comp);
+ listinit(itembytes, comp, mitems, exsize);
+ }
+ ~list() { free(base); }
+
+ void *operator[](int i) { return (void *) (base + i * itembytes); }
+
+ void listinit(int itbytes, compfunc pcomp, int mitems, int exsize);
+ void setcomp(compfunc compf) { comp = compf; }
+ void clear() { items = 0; }
+ int len() { return items; }
+ void *append(void* appitem);
+ void *insert(int pos, void* insitem);
+ void del(int pos, int order);
+ int hasitem(void* checkitem);
+ void sort();
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Memorypool data structure. //
+// //
+// A type used to allocate memory. (It is incorporated from Shewchuk's //
+// Triangle program) //
+// //
+// firstblock is the first block of items. nowblock is the block from which //
+// items are currently being allocated. nextitem points to the next slab //
+// of free memory for an item. deaditemstack is the head of a linked list //
+// (stack) of deallocated items that can be recycled. unallocateditems is //
+// the number of items that remain to be allocated from nowblock. //
+// //
+// Traversal is the process of walking through the entire list of items, and //
+// is separate from allocation. Note that a traversal will visit items on //
+// the "deaditemstack" stack as well as live items. pathblock points to //
+// the block currently being traversed. pathitem points to the next item //
+// to be traversed. pathitemsleft is the number of items that remain to //
+// be traversed in pathblock. //
+// //
+// itemwordtype is set to POINTER or FLOATINGPOINT, and is used to suggest //
+// what sort of word the record is primarily made up of. alignbytes //
+// determines how new records should be aligned in memory. itembytes and //
+// itemwords are the length of a record in bytes (after rounding up) and //
+// words. itemsperblock is the number of items allocated at once in a //
+// single block. items is the number of currently allocated items. //
+// maxitems is the maximum number of items that have been allocated at //
+// once; it is the current number of items plus the number of records kept //
+// on deaditemstack. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class memorypool {
+
+ public:
+
+ void **firstblock, **nowblock;
+ void *nextitem;
+ void *deaditemstack;
+ void **pathblock;
+ void *pathitem;
+ wordtype itemwordtype;
+ int alignbytes;
+ int itembytes, itemwords;
+ int itemsperblock;
+ long items, maxitems;
+ int unallocateditems;
+ int pathitemsleft;
+
+ public:
+
+ memorypool();
+ memorypool(int, int, enum wordtype, int);
+ ~memorypool();
+
+ void poolinit(int, int, enum wordtype, int);
+ void restart();
+ void *alloc();
+ void dealloc(void*);
+ void traversalinit();
+ void *traverse();
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Link data structure. //
+// //
+// A 'link' is a double linked nodes. It uses the memorypool data structure //
+// for memory management. Following is an image of a link. //
+// //
+// head-> ____0____ ____1____ ____2____ _________<-tail //
+// |__next___|--> |__next___|--> |__next___|--> |__NULL___| //
+// |__NULL___|<-- |__prev___|<-- |__prev___|<-- |__prev___| //
+// | | |_ _| |_ _| | | //
+// | | |_ Data1 _| |_ Data2 _| | | //
+// |_________| |_________| |_________| |_________| //
+// //
+// The unit size for storage is size of pointer, which may be 4-byte (in 32- //
+// bit machine) or 8-byte (in 64-bit machine). The real size of an item is //
+// stored in 'linkitembytes'. //
+// //
+// 'head' and 'tail' are pointers pointing to the first and last nodes. They //
+// do not conatin data (See above). //
+// //
+// 'nextlinkitem' is a pointer pointing to a node which is the next one will //
+// be traversed. 'curpos' remembers the position (1-based) of the current //
+// traversing node. //
+// //
+// 'linkitems' indicates how many items in link. Note it is different with //
+// 'items' of memorypool. //
+// //
+// The index of link starts from 1, i.e., for a link K contains n elements, //
+// the first element of the link is K[1], and the last element is K[n]. //
+// See the above figure. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class link : public memorypool {
+
+ public:
+
+ void **head, **tail;
+ void *nextlinkitem;
+ int linkitembytes;
+ int linkitems;
+ int curpos;
+ compfunc comp;
+
+ public:
+
+ link(int _itembytes, compfunc _comp, int itemcount) {
+ linkinit(_itembytes, _comp, itemcount);
+ }
+ link(char* str, int itemcount) {
+ set_compfunc(str, &linkitembytes, &comp);
+ linkinit(linkitembytes, comp, itemcount);
+ }
+
+ void linkinit(int _itembytes, compfunc _comp, int itemcount);
+ void setcomp(compfunc compf) { comp = compf; }
+ void rewind() { nextlinkitem = *head; curpos = 1; }
+ void goend() { nextlinkitem = *(tail + 1); curpos = linkitems; }
+ long len() { return linkitems; }
+ void clear();
+ bool move(int numberofnodes);
+ bool locate(int pos);
+ void *add(void* newitem);
+ void *insert(int pos, void* insitem);
+ void *del(void* delitem);
+ void *del(int pos);
+ void *getitem();
+ void *getnitem(int pos);
+ int hasitem(void* checkitem);
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Queue data structure. //
+// //
+// A 'queue' is a basically a link. Following is an image of a queue. //
+// ___________ ___________ ___________ //
+// Pop() <-- |_ _|<--|_ _|<--|_ _| <-- Push() //
+// |_ Data0 _| |_ Data1 _| |_ Data2 _| //
+// |___________| |___________| |___________| //
+// queue head queue tail //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ class queue : public link {
+
+ public:
+
+ queue(int bytes, int count = 256) : link(bytes, NULL, count) {}
+ queue(char* str, int count = 256) : link(str, count) {}
+
+ int empty() { return linkitems == 0; }
+ void *push(void* newitem) { return link::add(newitem); }
+ void *bot() { return link::getnitem(1); }
+ void *pop() { return link::del(1); }
+ };
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Global variables used for miscellaneous purposes. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // Pointer to the input data (a set of nodes, a PLC, or a mesh).
+ tetgenio *in;
+ // Pointer to the options (and filenames).
+ tetgenbehavior *b;
+ // Pointer to a background mesh (contains size specification map).
+ tetgenmesh *bgm;
+
+ // Variables used to allocate and access memory for tetrahedra, subfaces
+ // subsegments, points, encroached subfaces, encroached subsegments,
+ // bad-quality tetrahedra, and so on.
+ memorypool *tetrahedrons;
+ memorypool *subfaces;
+ memorypool *subsegs;
+ memorypool *points;
+ memorypool *badsubsegs;
+ memorypool *badsubfaces;
+ memorypool *badtetrahedrons;
+ memorypool *flipstackers;
+
+ // Pointer to the 'tetrahedron' that occupies all of "outer space".
+ tetrahedron *dummytet;
+ tetrahedron *dummytetbase; // Keep base address so we can free it later.
+
+ // Pointer to the omnipresent subface. Referenced by any tetrahedron,
+ // or subface that isn't connected to a subface at that location.
+ shellface *dummysh;
+ shellface *dummyshbase; // Keep base address so we can free it later.
+
+ // A point above the plane in which the facet currently being used lies.
+ // It is used as a reference point for orient3d().
+ point *facetabovepointarray, abovepoint;
+
+ // Array (size = numberoftetrahedra * 6) for storing high-order nodes of
+ // tetrahedra (only used when -o2 switch is selected).
+ point *highordertable;
+
+ // Arrays for storing and searching pbc data. 'subpbcgrouptable', (size
+ // is numberofpbcgroups) for pbcgroup of subfaces. 'segpbcgrouptable',
+ // a list for pbcgroup of segments. Because a segment can have several
+ // pbcgroup incident on it, its size is unknown on input, it will be
+ // found in 'createsegpbcgrouptable()'.
+ pbcdata *subpbcgrouptable;
+ list *segpbcgrouptable;
+ // A map for searching the pbcgroups of a given segment. 'idx2segpglist'
+ // (size = number of input segments + 1), and 'segpglist'.
+ int *idx2segpglist, *segpglist;
+
+ // Queues that maintain the bad (badly-shaped or too large) tetrahedra.
+ // The tails are pointers to the pointers that have to be filled in to
+ // enqueue an item. The queues are ordered from 63 (highest priority)
+ // to 0 (lowest priority).
+ badface *subquefront[3], **subquetail[3];
+ badface *tetquefront[64], **tetquetail[64];
+
+ // Pointer to a recently visited tetrahedron. Improves point location
+ // if proximate points are inserted sequentially.
+ triface recenttet;
+
+ REAL xmax, xmin, ymax, ymin, zmax, zmin; // Bounding box of points.
+ REAL longest; // The longest possible edge length.
+ REAL lengthlimit; // The limiting length of a new edge.
+ long hullsize; // Number of faces of convex hull.
+ long insegments; // Number of input segments.
+ int steinerleft; // Number of Steiner points not yet used.
+ int pointlfsindex; // Index to find the local feature size of a point.
+ int point2simindex; // Index to find a simplex adjacent to a point.
+ int pointmarkindex; // Index to find boundary marker of a point.
+ int point2pbcptindex; // Index to find a pbc point to a point.
+ int highorderindex; // Index to find extra nodes for highorder elements.
+ int elemattribindex; // Index to find attributes of a tetrahedron.
+ int volumeboundindex; // Index to find volume bound of a tetrahedron.
+ int elemmarkerindex; // Index to find marker of a tetrahedron.
+ int shmarkindex; // Index to find boundary marker of a subface.
+ int areaboundindex; // Index to find area bound of a subface.
+ int checksubfaces; // Are there subfaces in the mesh yet?
+ int checkpbcs; // Are there periodic boundary conditions?
+ int varconstraint; // Are there variant (node, seg, facet) constraints?
+ int nonconvex; // Is current mesh non-convex?
+ int dupverts; // Are there duplicated vertices?
+ int unuverts; // Are there unused vertices?
+ int relverts; // The number of relocated vertices.
+ int suprelverts; // The number of suppressed relocated vertices.
+ int collapverts; // The number of collapsed relocated vertices.
+ int unsupverts; // The number of unsuppressed vertices.
+ int jettisoninverts; // The number of jettisoned input vertices.
+ int symbolic; // Use symbolic insphere test.
+ long samples; // Number of random samples for point location.
+ unsigned long randomseed; // Current random number seed.
+ REAL macheps; // The machine epsilon.
+ REAL cosmaxdihed, cosmindihed; // The cosine values of max/min dihedral.
+ int maxcavfaces, maxcavverts; // The size of the largest cavity.
+ int expcavcount; // The times of expanding cavitys.
+ long abovecount; // Number of abovepoints calculation.
+ long bowatvolcount, bowatsubcount, bowatsegcount; // Bowyer-Watsons.
+ long updvolcount, updsubcount, updsegcount; // Bow-Wat cavities updates.
+ long failvolcount, failsubcount, failsegcount; // Bow-Wat fails.
+ long repairflipcount; // Number of flips for repairing segments.
+ long outbowatcircumcount; // Number of circumcenters outside Bowat-cav.
+ long r1count, r2count, r3count, r4count; // Number of rules performed.
+ long cdtenforcesegpts; // Number of CDT enforcement points.
+ long rejsegpts, rejsubpts, rejtetpts; // Number of rejected points.
+ long striptetcount, fliptetcount, unimprovecount; // Mesh smooth counts.
+ long smoothcdtsegpt, smoothsegpt, smoothsubpt, smoothvolpt;
+ long unsmoothcdtsegpt, unsmoothsegpt, unsmoothsubpt, unsmoothvolpt;
+ long flip23s, flip32s, flip22s, flip44s; // Number of flips performed.
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Fast lookup tables for mesh manipulation primitives. //
+// //
+// Mesh manipulation primitives (given below) are basic operations on mesh //
+// data structures. They answer basic queries on mesh handles, such as "what //
+// is the origin (or destination, or apex) of the face?", "what is the next //
+// (or previous) edge in the edge ring?", and "what is the next face in the //
+// face ring?", and so on. //
+// //
+// The implementation of teste basic queries can take advangtage of the fact //
+// that the mesh data structures additionally store geometric informations. //
+// For example, we have ordered the 4 vertices (from 0 to 3) and the 4 faces //
+// (from 0 to 3) of a tetrahedron, and for each face of the tetrahedron, a //
+// sequence of vertices has stipulated, therefore the origin of any face of //
+// the tetrahedron can be quickly determined by a table 'locver2org', which //
+// takes the index of the face and the edge version as inputs. A list of //
+// fast lookup tables are defined below. They're just like global variables. //
+// These tables are initialized at the runtime. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // For enext() primitive, uses 'ver' as the index.
+ static int ve[6];
+
+ // For org(), dest() and apex() primitives, uses 'ver' as the index.
+ static int vo[6], vd[6], va[6];
+
+ // For org(), dest() and apex() primitives, uses 'loc' as the first
+ // index and 'ver' as the second index.
+ static int locver2org[4][6];
+ static int locver2dest[4][6];
+ static int locver2apex[4][6];
+
+ // For oppo() primitives, uses 'loc' as the index.
+ static int loc2oppo[4];
+
+ // For fnext() primitives, uses 'loc' as the first index and 'ver' as
+ // the second index, returns an array containing a new 'loc' and a
+ // new 'ver'. Note: Only valid for 'ver' equals one of {0, 2, 4}.
+ static int locver2nextf[4][6][2];
+
+ // For enumerating three edges of a triangle.
+ static int plus1mod3[3];
+ static int minus1mod3[3];
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Mesh manipulation primitives //
+// //
+// A serial of mesh operations such as topological maintenance, navigation, //
+// local modification, etc., is accomplished through a set of mesh manipul- //
+// ation primitives. These primitives are indeed very simple functions which //
+// take one or two handles ('triface's and 'face's) as parameters, perform //
+// basic operations such as "glue two tetrahedra at a face", "return the //
+// origin of a tetrahedron", "return the subface adjoining at the face of a //
+// tetrahedron", and so on. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // Primitives for tetrahedra.
+ inline void decode(tetrahedron ptr, triface& t);
+ inline tetrahedron encode(triface& t);
+ inline void sym(triface& t1, triface& t2);
+ inline void symself(triface& t);
+ inline void bond(triface& t1, triface& t2);
+ inline void dissolve(triface& t);
+ inline point org(triface& t);
+ inline point dest(triface& t);
+ inline point apex(triface& t);
+ inline point oppo(triface& t);
+ inline void setorg(triface& t, point pointptr);
+ inline void setdest(triface& t, point pointptr);
+ inline void setapex(triface& t, point pointptr);
+ inline void setoppo(triface& t, point pointptr);
+ inline void esym(triface& t1, triface& t2);
+ inline void esymself(triface& t);
+ inline void enext(triface& t1, triface& t2);
+ inline void enextself(triface& t);
+ inline void enext2(triface& t1, triface& t2);
+ inline void enext2self(triface& t);
+ inline bool fnext(triface& t1, triface& t2);
+ inline bool fnextself(triface& t);
+ inline void enextfnext(triface& t1, triface& t2);
+ inline void enextfnextself(triface& t);
+ inline void enext2fnext(triface& t1, triface& t2);
+ inline void enext2fnextself(triface& t);
+ inline void infect(triface& t);
+ inline void uninfect(triface& t);
+ inline bool infected(triface& t);
+ inline REAL elemattribute(tetrahedron* ptr, int attnum);
+ inline void setelemattribute(tetrahedron* ptr, int attnum, REAL value);
+ inline REAL volumebound(tetrahedron* ptr);
+ inline void setvolumebound(tetrahedron* ptr, REAL value);
+
+ // Primitives for subfaces and subsegments.
+ inline void sdecode(shellface sptr, face& s);
+ inline shellface sencode(face& s);
+ inline void spivot(face& s1, face& s2);
+ inline void spivotself(face& s);
+ inline void sbond(face& s1, face& s2);
+ inline void sbond1(face& s1, face& s2);
+ inline void sdissolve(face& s);
+ inline point sorg(face& s);
+ inline point sdest(face& s);
+ inline point sapex(face& s);
+ inline void setsorg(face& s, point pointptr);
+ inline void setsdest(face& s, point pointptr);
+ inline void setsapex(face& s, point pointptr);
+ inline void sesym(face& s1, face& s2);
+ inline void sesymself(face& s);
+ inline void senext(face& s1, face& s2);
+ inline void senextself(face& s);
+ inline void senext2(face& s1, face& s2);
+ inline void senext2self(face& s);
+ inline void sfnext(face&, face&);
+ inline void sfnextself(face&);
+ inline badface* shell2badface(face& s);
+ inline void setshell2badface(face& s, badface* value);
+ inline REAL areabound(face& s);
+ inline void setareabound(face& s, REAL value);
+ inline int shellmark(face& s);
+ inline void setshellmark(face& s, int value);
+ inline enum shestype shelltype(face& s);
+ inline void setshelltype(face& s, enum shestype value);
+ inline int shellpbcgroup(face& s);
+ inline void setshellpbcgroup(face& s, int value);
+ inline void sinfect(face& s);
+ inline void suninfect(face& s);
+ inline bool sinfected(face& s);
+
+ // Primitives for interacting tetrahedra and subfaces.
+ inline void tspivot(triface& t, face& s);
+ inline void stpivot(face& s, triface& t);
+ inline void tsbond(triface& t, face& s);
+ inline void tsdissolve(triface& t);
+ inline void stdissolve(face& s);
+
+ // Primitives for interacting subfaces and subsegs.
+ inline void sspivot(face& s, face& edge);
+ inline void ssbond(face& s, face& edge);
+ inline void ssdissolve(face& s);
+
+ // Primitives for points.
+ inline int pointmark(point pt);
+ inline void setpointmark(point pt, int value);
+ inline enum verttype pointtype(point pt);
+ inline void setpointtype(point pt, enum verttype value);
+ inline tetrahedron point2tet(point pt);
+ inline void setpoint2tet(point pt, tetrahedron value);
+ inline shellface point2sh(point pt);
+ inline void setpoint2sh(point pt, shellface value);
+ inline point point2ppt(point pt);
+ inline void setpoint2ppt(point pt, point value);
+ inline tetrahedron point2bgmtet(point pt);
+ inline void setpoint2bgmtet(point pt, tetrahedron value);
+ inline point point2pbcpt(point pt);
+ inline void setpoint2pbcpt(point pt, point value);
+
+ // Advanced primitives.
+ inline void adjustedgering(triface& t, int direction);
+ inline void adjustedgering(face& s, int direction);
+ inline bool isdead(triface* t);
+ inline bool isdead(face* s);
+ inline bool isfacehaspoint(triface* t, point testpoint);
+ inline bool isfacehaspoint(face* t, point testpoint);
+ inline bool isfacehasedge(face* s, point tend1, point tend2);
+ inline bool issymexist(triface* t);
+ bool getnextface(triface*, triface*);
+ void getnextsface(face*, face*);
+ void tsspivot(triface*, face*);
+ void sstpivot(face*, triface*);
+ bool findorg(triface* t, point dorg);
+ bool findorg(face* s, point dorg);
+ void findedge(triface* t, point eorg, point edest);
+ void findedge(face* s, point eorg, point edest);
+ void findface(triface *fface, point forg, point fdest, point fapex);
+ void getonextseg(face* s, face* lseg);
+ void getseghasorg(face* sseg, point dorg);
+ point getsubsegfarorg(face* sseg);
+ point getsubsegfardest(face* sseg);
+ void printtet(triface*);
+ void printsh(face*);
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Triangle-triangle intersection test //
+// //
+// The triangle-triangle intersection test is implemented with exact arithm- //
+// etic. It exactly tells whether or not two triangles in three dimensions //
+// intersect. Before implementing this test myself, I tried two C codes //
+// (implemented by Thomas Moeller and Philippe Guigue, respectively), which //
+// are all public available. However both of them failed frequently. Another //
+// unconvenience is both codes only tell whether or not the two triangles //
+// intersect without distinguishing the cases whether they exactly intersect //
+// in interior or they just share a vertex or share an edge. The two latter //
+// cases are acceptable and should return not intersection in TetGen. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ enum interresult edge_vert_col_inter(REAL*, REAL*, REAL*);
+ enum interresult edge_edge_cop_inter(REAL*, REAL*, REAL*, REAL*, REAL*);
+ enum interresult tri_vert_cop_inter(REAL*, REAL*, REAL*, REAL*, REAL*);
+ enum interresult tri_edge_cop_inter(REAL*, REAL*, REAL*, REAL*, REAL*,
+ REAL*);
+ enum interresult tri_edge_inter_tail(REAL*, REAL*, REAL*, REAL*, REAL*,
+ REAL, REAL);
+ enum interresult tri_edge_inter(REAL*, REAL*, REAL*, REAL*, REAL*);
+ enum interresult tri_tri_inter(REAL*, REAL*, REAL*, REAL*, REAL*, REAL*);
+
+ // Geometric predicates
+ REAL insphere_sos(REAL*, REAL*, REAL*, REAL*, REAL*, int, int, int, int,
+ int);
+ bool iscollinear(REAL*, REAL*, REAL*, REAL eps);
+ bool iscoplanar(REAL*, REAL*, REAL*, REAL*, REAL vol6, REAL eps);
+ bool iscospheric(REAL*, REAL*, REAL*, REAL*, REAL*, REAL vol24, REAL eps);
+
+ // Linear algebra functions
+ inline REAL dot(REAL* v1, REAL* v2);
+ inline void cross(REAL* v1, REAL* v2, REAL* n);
+ bool lu_decmp(REAL lu[4][4], int n, int* ps, REAL* d, int N);
+ void lu_solve(REAL lu[4][4], int n, int* ps, REAL* b, int N);
+
+ // Geometric quantities calculators.
+ inline REAL distance(REAL* p1, REAL* p2);
+ REAL shortdistance(REAL* p, REAL* e1, REAL* e2);
+ REAL shortdistance(REAL* p, REAL* e1, REAL* e2, REAL* e3);
+ REAL interiorangle(REAL* o, REAL* p1, REAL* p2, REAL* n);
+ void projpt2edge(REAL* p, REAL* e1, REAL* e2, REAL* prj);
+ void projpt2face(REAL* p, REAL* f1, REAL* f2, REAL* f3, REAL* prj);
+ void facenormal(REAL* pa, REAL* pb, REAL* pc, REAL* n, REAL* nlen);
+ void edgeorthonormal(REAL* e1, REAL* e2, REAL* op, REAL* n);
+ REAL facedihedral(REAL* pa, REAL* pb, REAL* pc1, REAL* pc2);
+ void tetalldihedral(point, point, point, point, REAL*, REAL*, REAL*);
+ void tetallnormal(point, point, point, point, REAL N[4][3], REAL* volume);
+ bool circumsphere(REAL*, REAL*, REAL*, REAL*, REAL* cent, REAL* radius);
+ void inscribedsphere(REAL*, REAL*, REAL*, REAL*, REAL* cent, REAL* radius);
+ void rotatepoint(REAL* p, REAL rotangle, REAL* p1, REAL* p2);
+ void spherelineint(REAL* p1, REAL* p2, REAL* C, REAL R, REAL p[7]);
+ void linelineint(REAL *p1,REAL *p2, REAL *p3, REAL *p4, REAL p[7]);
+ void planelineint(REAL*, REAL*, REAL*, REAL*, REAL*, REAL*, REAL*);
+
+ // Memory managment routines.
+ void dummyinit(int, int);
+ void initializepools();
+ void tetrahedrondealloc(tetrahedron*);
+ tetrahedron *tetrahedrontraverse();
+ void shellfacedealloc(memorypool*, shellface*);
+ shellface *shellfacetraverse(memorypool*);
+ void badfacedealloc(memorypool*, badface*);
+ badface *badfacetraverse(memorypool*);
+ void pointdealloc(point);
+ point pointtraverse();
+ void maketetrahedron(triface*);
+ void makeshellface(memorypool*, face*);
+ void makepoint(point*);
+
+ // Mesh items searching routines.
+ void makepoint2tetmap();
+ void makeindex2pointmap(point*& idx2verlist);
+ void makesegmentmap(int*& idx2seglist, shellface**& segsperverlist);
+ void makesubfacemap(int*& idx2facelist, shellface**& facesperverlist);
+ void maketetrahedronmap(int*& idx2tetlist, tetrahedron**& tetsperverlist);
+
+ // Point location routines.
+ unsigned long randomnation(unsigned int choices);
+ REAL distance2(tetrahedron* tetptr, point p);
+ enum locateresult preciselocate(point searchpt, triface* searchtet, long);
+ enum locateresult locate(point searchpt, triface* searchtet);
+ enum locateresult adjustlocate(point, triface*, enum locateresult, REAL);
+ enum locateresult locatesub(point searchpt, face* searchsh, int, REAL);
+ enum locateresult adjustlocatesub(point, face*, enum locateresult, REAL);
+ enum locateresult locateseg(point searchpt, face* searchseg);
+ enum locateresult adjustlocateseg(point, face*, enum locateresult, REAL);
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Mesh Local Transformation Operators //
+// //
+// These operators (including flips, insert & remove vertices and so on) are //
+// used to transform (or replace) a set of mesh elements into another set of //
+// mesh elements. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+ // Mesh transformation routines.
+ enum fliptype categorizeface(triface& horiz);
+ void enqueueflipface(triface& checkface, queue* flipqueue);
+ void enqueueflipedge(face& checkedge, queue* flipqueue);
+ void flip23(triface* flipface, queue* flipqueue);
+ void flip32(triface* flipface, queue* flipqueue);
+ void flip22(triface* flipface, queue* flipqueue);
+ void flip22sub(face* flipedge, queue* flipqueue);
+ long flip(queue* flipqueue, badface **plastflip);
+ void undoflip(badface *lastflip);
+ long flipsub(queue* flipqueue);
+
+ void splittetrahedron(point newpoint, triface* splittet, queue* flipqueue);
+ void unsplittetrahedron(triface* splittet);
+ void splittetface(point newpoint, triface* splittet, queue* flipqueue);
+ void unsplittetface(triface* splittet);
+ void splitsubface(point newpoint, face* splitface, queue* flipqueue);
+ void unsplitsubface(face* splitsh);
+ void splittetedge(point newpoint, triface* splittet, queue* flipqueue);
+ void unsplittetedge(triface* splittet);
+ void splitsubedge(point newpoint, face* splitsh, queue* flipqueue);
+ void unsplitsubedge(face* splitsh);
+ enum insertsiteresult insertsite(point newpoint, triface* searchtet,
+ bool approx, queue* flipqueue);
+ void undosite(enum insertsiteresult insresult, triface* splittet,
+ point torg, point tdest, point tapex, point toppo);
+
+ void formbowatcavitysub(point, face*, list*, list*);
+ void formbowatcavityquad(point, list*, list*);
+ void formbowatcavitysegquad(point, list*, list*);
+ void formbowatcavity(point bp, face* bpseg, face* bpsh, int* n, int* nmax,
+ list** sublists, list** subceillists, list** tetlists,
+ list** ceillists);
+ void releasebowatcavity(face*, int, list**, list**, list**, list**);
+ bool validatebowatcavityquad(point bp, list* ceillist, REAL maxcosd);
+ void updatebowatcavityquad(list* tetlist, list* ceillist);
+ void updatebowatcavitysub(list* sublist, list* subceillist, int* cutcount);
+ bool trimbowatcavity(point bp, face* bpseg, int n, list** sublists,
+ list** subceillists, list** tetlists,list** ceillists,
+ REAL maxcosd);
+ void bowatinsertsite(point bp, face* splitseg, int n, list** sublists,
+ list** subceillists, list** tetlists,
+ list** ceillists, list* verlist, queue* flipque,
+ bool chkencseg, bool chkencsub, bool chkbadtet);
+
+ // Delaunay tetrahedralization routines.
+ void formstarpolyhedron(point pt, list* tetlist, list* verlist, bool);
+ bool unifypoint(point testpt, triface*, enum locateresult, REAL);
+ void closeopenface(triface* openface, queue* flipque);
+ void inserthullsite(point inspoint, triface* horiz, queue* flipque);
+ void incrflipdelaunay(triface*, point*, long, bool, bool, REAL, queue*);
+ long delaunizevertices();
+
+ // Surface triangulation routines.
+ void formstarpolygon(point pt, list* trilist, list* verlist);
+ void getfacetabovepoint(face* facetsh);
+ void collectcavsubs(point newpoint, list* cavsublist);
+ void collectvisiblesubs(int shmark, point inspoint, face* horiz, queue*);
+ void incrflipdelaunaysub(int shmark, REAL eps, list*, int, REAL*, queue*);
+ enum finddirectionresult finddirectionsub(face* searchsh, point tend);
+ void insertsubseg(face* tri);
+ bool scoutsegmentsub(face* searchsh, point tend);
+ void flipedgerecursive(face* flipedge, queue* flipqueue);
+ void constrainededge(face* startsh, point tend, queue* flipqueue);
+ void recoversegment(point tstart, point tend, queue* flipqueue);
+ void infecthullsub(memorypool* viri);
+ void plaguesub(memorypool* viri);
+ void carveholessub(int holes, REAL* holelist, memorypool* viri);
+ void triangulate(int shmark, REAL eps, list* ptlist, list* conlist,
+ int holes, REAL* holelist, memorypool* viri, queue*);
+ void retrievenewsubs(list* newshlist, bool removeseg);
+ void unifysegments();
+ void mergefacets(queue* flipqueue);
+ long meshsurface();
+
+ // Detect intersecting facets of PLC.
+ void interecursive(shellface** subfacearray, int arraysize, int axis,
+ REAL bxmin, REAL bxmax, REAL bymin, REAL bymax,
+ REAL bzmin, REAL bzmax, int* internum);
+ void detectinterfaces();
+
+ // Periodic boundary condition supporting routines.
+ void createsubpbcgrouptable();
+ void getsubpbcgroup(face* pbcsub, pbcdata** pd, int *f1, int *f2);
+ enum locateresult getsubpbcsympoint(point, face*, point, face*);
+ void createsegpbcgrouptable();
+ enum locateresult getsegpbcsympoint(point, face*, point, face*, int);
+
+ // Vertex perturbation routines.
+ REAL randgenerator(REAL range);
+ bool checksub4cocir(face* testsub, REAL eps, bool once, bool enqflag);
+ void tallcocirsubs(REAL eps, bool enqflag);
+ bool tallencsegsfsubs(point testpt, list* cavsublist);
+ void collectflipedges(point inspoint, face* splitseg, queue* flipqueue);
+ void perturbrepairencsegs(queue* flipqueue);
+ void perturbrepairencsubs(list* cavsublist, queue* flipqueue);
+ void incrperturbvertices(REAL eps);
+
+ // Segment recovery routines.
+ void markacutevertices(REAL acuteangle);
+ enum finddirectionresult finddirection(triface* searchtet, point, long);
+ void getsearchtet(point p1, point p2, triface* searchtet, point* tend);
+ bool isedgeencroached(point p1, point p2, point testpt, bool degflag);
+ point scoutrefpoint(triface* searchtet, point tend);
+ point getsegmentorigin(face* splitseg);
+ point getsplitpoint(face* splitseg, point refpoint);
+ void delaunizesegments();
+
+ // Facets recovery routines.
+ bool insertsubface(face* insertsh, triface* searchtet);
+ bool tritritest(triface* checktet, point p1, point p2, point p3);
+ void initializecavity(list* floorlist, list* ceillist, list* frontlist);
+ void delaunizecavvertices(triface*, list*, list*, list*, queue*);
+ void retrievenewtets(list* newtetlist);
+ void insertauxsubface(triface* front, triface* idfront);
+ bool scoutfront(triface* front, triface* idfront, list* newtetlist);
+ void gluefronts(triface* front, triface* front1);
+ bool identifyfronts(list* frontlist, list* misfrontlist, list* newtetlist);
+ void detachauxsubfaces(list* newtetlist);
+ void expandcavity(list* frontlist, list* misfrontlist, list* newtetlist,
+ list* crosstetlist, queue* missingshqueue, queue*);
+ void carvecavity(list* newtetlist, list* outtetlist, queue* flipque);
+ void delaunizecavity(list* floorlist, list* ceillist, list* ceilptlist,
+ list* floorptlist, list* frontlist,list* misfrontlist,
+ list* newtetlist, list* crosstetlist, queue*, queue*);
+ void formmissingregion(face* missingsh, list* missingshlist,
+ list* equatptlist, int* worklist);
+ void formcavity(list* missingshlist, list* crossedgelist,
+ list* equatptlist, list* crossshlist, list* crosstetlist,
+ list* belowfacelist, list* abovefacelist,
+ list* horizptlist, list* belowptlist, list* aboveptlist,
+ queue* missingshqueue, int* worklist);
+ bool scoutcrossingedge(list* missingshlist, list* boundedgelist,
+ list* crossedgelist, int* worklist);
+ void rearrangesubfaces(list* missingshlist, list* boundedgelist,
+ list* equatptlist, int* worklist);
+ void insertallsubfaces(queue* missingshqueue);
+ void constrainedfacets();
+
+ // Carving out holes and concavities routines.
+ void infecthull(memorypool *viri);
+ void plague(memorypool *viri);
+ void regionplague(memorypool *viri, REAL attribute, REAL volume);
+ void removeholetets(memorypool *viri);
+ void assignregionattribs();
+ void carveholes();
+
+ // Steiner points removing routines.
+ void replacepolygonsubs(list* oldshlist, list* newshlist);
+ void orientnewsubs(list* newshlist, face* orientsh, REAL* norm);
+ bool constrainedflip(triface* flipface, triface* front, queue* flipque);
+ bool recoverfront(triface* front, list* newtetlist, queue* flipque);
+ void repairflips(queue* flipque);
+ bool constrainedcavity(triface* oldtet, list* floorlist, list* ceillist,
+ list* ptlist, list* frontlist, list* misfrontlist,
+ list* newtetlist, queue* flipque);
+ void expandsteinercavity(point steinpt, REAL eps, list* frontlist, list*);
+ bool findrelocatepoint(point sp, point np, REAL* n, list*, list*);
+ void relocatepoint(point steinpt, triface* oldtet, list*, list*, queue*);
+ bool findcollapseedge(point suppt, point* conpt, list* oldtetlist, list*);
+ void collapseedge(point suppt, point conpt, list* oldtetlist, list*);
+ void deallocfaketets(list* frontlist);
+ void restorepolyhedron(list* oldtetlist);
+ bool suppressfacetpoint(face* supsh, list* frontlist, list* misfrontlist,
+ list* ptlist, list* conlist, memorypool* viri,
+ queue* flipque);
+ bool suppresssegpoint(face* supseg, list* spinshlist, list* newsegshlist,
+ list* frontlist, list* misfrontlist, list* ptlist,
+ list* conlist, memorypool* viri, queue* flipque);
+ bool suppressvolpoint(point suppt, list* frontlist, list* misfrontlist,
+ list* ptlist, queue* flipque);
+ bool collapseedgepoint(point colpt, list* oldtetlist, list* newtetlist,
+ list* ptlist);
+ void removesteiners();
+
+ // Mesh reconstruction rotuines.
+ long reconstructmesh();
+ bool intettest(point testpt, triface* testtet, REAL eps);
+ void insertaddpoints();
+
+ // Background mesh operations.
+ bool interpolatepointsize(point pt, triface* bgmtet, long *scount);
+ void searchpointrecursive(triface *curtet, long *scount);
+ void interpolatesizemap();
+
+ // Delaunay refinement routines.
+ void calclocalfeaturesizes();
+ void marksharpsubsegs(REAL dihedbound);
+ void markskinnysubfaces(REAL anglebound);
+ void enqueuebadtet(triface* tt, REAL key, REAL* cent);
+ void enqueueencsub(face* ss, point encpt, int quenumber, REAL* cent);
+ badface* dequeuebadtet();
+ badface* dequeueencsub(int* quenumber);
+ bool checkseg4encroach(face* testseg, point testpt, point*, bool enqflag);
+ bool checksub4encroach(face* testsub, point testpt, bool enqflag);
+ bool checkseg4badqual(face* testseg, bool enqflag);
+ bool checksub4badqual(face* testsub, bool enqflag);
+ bool checktet4badqual(triface* testtet, bool enqflag);
+ bool acceptsegpt(point segpt, point refpt, face* splitseg);
+ bool acceptfacpt(point facpt, list* subceillist, list* verlist);
+ bool acceptvolpt(point volpt, list* ceillist, list* verlist);
+ void getsplitpoint(point e1, point e2, point refpt, point newpt);
+ void shepardinterpolate(point newpt, list* verlist);
+ void setnewpointsize(point newpt, list* verlist);
+ void splitencseg(point, face*, list*, list*, list*, queue*, bool, bool);
+ bool tallencsegs(point testpt, int n, list** ceillists);
+ bool tallencsubs(point testpt, int n, list** ceillists);
+ void tallbadtetrahedrons();
+ void repairencsegs(bool chkencsub, bool chkbadtet);
+ void repairencsubs(bool chkbadtet);
+ void repairbadtets();
+ void enforcequality();
+
+ // Mesh Smoothing routines.
+ bool checktet4ill(triface* testtet, bool enqflag);
+ bool checktet4sliver(triface* testtet, bool chkill, bool enqflag);
+ void removetetbystripoff(triface *striptet);
+ void removetetbyflip32(triface *fliptet, bool enq, bool chkill);
+ bool removetetbyrecon(badface* remtet, bool chkill);
+ bool removetetbysplit(badface* remtet);
+ void tallslivers(bool chkill);
+ void repairmesh();
+ void smoothmesh();
+
+ // I/O routines
+ void transfernodes();
+ void jettisonnodes();
+ void highorder();
+ void outnodes(tetgenio* out);
+ void outmetrics(tetgenio* out);
+ void outelements(tetgenio* out);
+ void outfaces(tetgenio* out);
+ void outhullfaces(tetgenio* out);
+ void outsubfaces(tetgenio* out);
+ void outsubsegments(tetgenio* out);
+ void outneighbors(tetgenio* out);
+ void outpbcnodes(tetgenio* out);
+ void outsmesh(char* smfilename);
+ void outmesh2medit(char* mfilename);
+ void outmesh2gid(char* gfilename);
+ void outmesh2off(char* ofilename);
+
+ // User interaction routines.
+ void internalerror();
+ void checkmesh();
+ void checkshells();
+ void checkdelaunay(REAL eps, queue* flipqueue);
+ void checkdegeneracy(REAL eps);
+ void checkconforming();
+ void algorithmicstatistics();
+ void qualitystatistics();
+ void statistics();
+
+ public:
+
+ // Constructor and destructor.
+ tetgenmesh();
+ ~tetgenmesh();
+
+}; // End of class tetgenmesh.
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// tetrahedralize() Interface for using TetGen's library to generate //
+// Delaunay tetrahedralizations, constrained Delaunay //
+// tetrahedralizations, quality tetrahedral meshes. //
+// //
+// Two functions (interfaces) are available. The difference is only the way //
+// of passing switches. One directly accepts an object of 'tetgenbehavior', //
+// while the other accepts a string which is the same as one can used in the //
+// command line. The latter may be more convenient for users who don't want //
+// to kown the 'tetgenbehavir' structure. //
+// //
+// 'in' is an object of 'tetgenio' which contains a PLC you want to tetrahed-//
+// ralize or a previously generated tetrahedral mesh you want to refine. It //
+// must not be a NULL. 'out' is another object of 'tetgenio' for storing the //
+// generated tetrahedral mesh. It can be a NULL. If so, the output will be //
+// saved to file(s). //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+void tetrahedralize(tetgenbehavior *b, tetgenio *in, tetgenio *out,
+ tetgenio *bgmesh = NULL);
+void tetrahedralize(char *switches, tetgenio *in, tetgenio *out,
+ tetgenio *bgmesh = NULL);
+
+#endif // #ifndef tetgenH
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/triangle.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/triangle.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d5afaf048798500b3460c9066ad5f6844ec2dc4
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gamer/triangle.h
@@ -0,0 +1,298 @@
+/*****************************************************************************/
+/* */
+/* (triangle.h) */
+/* */
+/* Include file for programs that call Triangle. */
+/* */
+/* Accompanies Triangle Version 1.6 */
+/* July 28, 2005 */
+/* */
+/* Copyright 1996, 2005 */
+/* Jonathan Richard Shewchuk */
+/* 2360 Woolsey #H */
+/* Berkeley, California 94705-1927 */
+/* jrs@cs.berkeley.edu */
+/* */
+/*****************************************************************************/
+
+#ifndef _TRIANGLE_H_
+#define _TRIANGLE_H_
+
+#include
+
+/*****************************************************************************/
+/* */
+/* How to call Triangle from another program */
+/* */
+/* */
+/* If you haven't read Triangle's instructions (run "triangle -h" to read */
+/* them), you won't understand what follows. */
+/* */
+/* Triangle must be compiled into an object file (triangle.o) with the */
+/* TRILIBRARY symbol defined (generally by using the -DTRILIBRARY compiler */
+/* switch). The makefile included with Triangle will do this for you if */
+/* you run "make trilibrary". The resulting object file can be called via */
+/* the procedure triangulate(). */
+/* */
+/* If the size of the object file is important to you, you may wish to */
+/* generate a reduced version of triangle.o. The REDUCED symbol gets rid */
+/* of all features that are primarily of research interest. Specifically, */
+/* the -DREDUCED switch eliminates Triangle's -i, -F, -s, and -C switches. */
+/* The CDT_ONLY symbol gets rid of all meshing algorithms above and beyond */
+/* constrained Delaunay triangulation. Specifically, the -DCDT_ONLY switch */
+/* eliminates Triangle's -r, -q, -a, -u, -D, -Y, -S, and -s switches. */
+/* */
+/* IMPORTANT: These definitions (TRILIBRARY, REDUCED, CDT_ONLY) must be */
+/* made in the makefile or in triangle.c itself. Putting these definitions */
+/* in this file (triangle.h) will not create the desired effect. */
+/* */
+/* */
+/* The calling convention for triangulate() follows. */
+/* */
+/* void triangulate(triswitches, in, out, vorout) */
+/* char *triswitches; */
+/* struct triangulateio *in; */
+/* struct triangulateio *out; */
+/* struct triangulateio *vorout; */
+/* */
+/* `triswitches' is a string containing the command line switches you wish */
+/* to invoke. No initial dash is required. Some suggestions: */
+/* */
+/* - You'll probably find it convenient to use the `z' switch so that */
+/* points (and other items) are numbered from zero. This simplifies */
+/* indexing, because the first item of any type always starts at index */
+/* [0] of the corresponding array, whether that item's number is zero or */
+/* one. */
+/* - You'll probably want to use the `Q' (quiet) switch in your final code, */
+/* but you can take advantage of Triangle's printed output (including the */
+/* `V' switch) while debugging. */
+/* - If you are not using the `q', `a', `u', `D', `j', or `s' switches, */
+/* then the output points will be identical to the input points, except */
+/* possibly for the boundary markers. If you don't need the boundary */
+/* markers, you should use the `N' (no nodes output) switch to save */
+/* memory. (If you do need boundary markers, but need to save memory, a */
+/* good nasty trick is to set out->pointlist equal to in->pointlist */
+/* before calling triangulate(), so that Triangle overwrites the input */
+/* points with identical copies.) */
+/* - The `I' (no iteration numbers) and `g' (.off file output) switches */
+/* have no effect when Triangle is compiled with TRILIBRARY defined. */
+/* */
+/* `in', `out', and `vorout' are descriptions of the input, the output, */
+/* and the Voronoi output. If the `v' (Voronoi output) switch is not used, */
+/* `vorout' may be NULL. `in' and `out' may never be NULL. */
+/* */
+/* Certain fields of the input and output structures must be initialized, */
+/* as described below. */
+/* */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* */
+/* The `triangulateio' structure. */
+/* */
+/* Used to pass data into and out of the triangulate() procedure. */
+/* */
+/* */
+/* Arrays are used to store points, triangles, markers, and so forth. In */
+/* all cases, the first item in any array is stored starting at index [0]. */
+/* However, that item is item number `1' unless the `z' switch is used, in */
+/* which case it is item number `0'. Hence, you may find it easier to */
+/* index points (and triangles in the neighbor list) if you use the `z' */
+/* switch. Unless, of course, you're calling Triangle from a Fortran */
+/* program. */
+/* */
+/* Description of fields (except the `numberof' fields, which are obvious): */
+/* */
+/* `pointlist': An array of point coordinates. The first point's x */
+/* coordinate is at index [0] and its y coordinate at index [1], followed */
+/* by the coordinates of the remaining points. Each point occupies two */
+/* REALs. */
+/* `pointattributelist': An array of point attributes. Each point's */
+/* attributes occupy `numberofpointattributes' REALs. */
+/* `pointmarkerlist': An array of point markers; one int per point. */
+/* */
+/* `trianglelist': An array of triangle corners. The first triangle's */
+/* first corner is at index [0], followed by its other two corners in */
+/* counterclockwise order, followed by any other nodes if the triangle */
+/* represents a nonlinear element. Each triangle occupies */
+/* `numberofcorners' ints. */
+/* `triangleattributelist': An array of triangle attributes. Each */
+/* triangle's attributes occupy `numberoftriangleattributes' REALs. */
+/* `trianglearealist': An array of triangle area constraints; one REAL per */
+/* triangle. Input only. */
+/* `neighborlist': An array of triangle neighbors; three ints per */
+/* triangle. Output only. */
+/* */
+/* `segmentlist': An array of segment endpoints. The first segment's */
+/* endpoints are at indices [0] and [1], followed by the remaining */
+/* segments. Two ints per segment. */
+/* `segmentmarkerlist': An array of segment markers; one int per segment. */
+/* */
+/* `holelist': An array of holes. The first hole's x and y coordinates */
+/* are at indices [0] and [1], followed by the remaining holes. Two */
+/* REALs per hole. Input only, although the pointer is copied to the */
+/* output structure for your convenience. */
+/* */
+/* `regionlist': An array of regional attributes and area constraints. */
+/* The first constraint's x and y coordinates are at indices [0] and [1], */
+/* followed by the regional attribute at index [2], followed by the */
+/* maximum area at index [3], followed by the remaining area constraints. */
+/* Four REALs per area constraint. Note that each regional attribute is */
+/* used only if you select the `A' switch, and each area constraint is */
+/* used only if you select the `a' switch (with no number following), but */
+/* omitting one of these switches does not change the memory layout. */
+/* Input only, although the pointer is copied to the output structure for */
+/* your convenience. */
+/* */
+/* `edgelist': An array of edge endpoints. The first edge's endpoints are */
+/* at indices [0] and [1], followed by the remaining edges. Two ints per */
+/* edge. Output only. */
+/* `edgemarkerlist': An array of edge markers; one int per edge. Output */
+/* only. */
+/* `normlist': An array of normal vectors, used for infinite rays in */
+/* Voronoi diagrams. The first normal vector's x and y magnitudes are */
+/* at indices [0] and [1], followed by the remaining vectors. For each */
+/* finite edge in a Voronoi diagram, the normal vector written is the */
+/* zero vector. Two REALs per edge. Output only. */
+/* */
+/* */
+/* Any input fields that Triangle will examine must be initialized. */
+/* Furthermore, for each output array that Triangle will write to, you */
+/* must either provide space by setting the appropriate pointer to point */
+/* to the space you want the data written to, or you must initialize the */
+/* pointer to NULL, which tells Triangle to allocate space for the results. */
+/* The latter option is preferable, because Triangle always knows exactly */
+/* how much space to allocate. The former option is provided mainly for */
+/* people who need to call Triangle from Fortran code, though it also makes */
+/* possible some nasty space-saving tricks, like writing the output to the */
+/* same arrays as the input. */
+/* */
+/* Triangle will not free() any input or output arrays, including those it */
+/* allocates itself; that's up to you. You should free arrays allocated by */
+/* Triangle by calling the trifree() procedure defined below. (By default, */
+/* trifree() just calls the standard free() library procedure, but */
+/* applications that call triangulate() may replace trimalloc() and */
+/* trifree() in triangle.c to use specialized memory allocators.) */
+/* */
+/* Here's a guide to help you decide which fields you must initialize */
+/* before you call triangulate(). */
+/* */
+/* `in': */
+/* */
+/* - `pointlist' must always point to a list of points; `numberofpoints' */
+/* and `numberofpointattributes' must be properly set. */
+/* `pointmarkerlist' must either be set to NULL (in which case all */
+/* markers default to zero), or must point to a list of markers. If */
+/* `numberofpointattributes' is not zero, `pointattributelist' must */
+/* point to a list of point attributes. */
+/* - If the `r' switch is used, `trianglelist' must point to a list of */
+/* triangles, and `numberoftriangles', `numberofcorners', and */
+/* `numberoftriangleattributes' must be properly set. If */
+/* `numberoftriangleattributes' is not zero, `triangleattributelist' */
+/* must point to a list of triangle attributes. If the `a' switch is */
+/* used (with no number following), `trianglearealist' must point to a */
+/* list of triangle area constraints. `neighborlist' may be ignored. */
+/* - If the `p' switch is used, `segmentlist' must point to a list of */
+/* segments, `numberofsegments' must be properly set, and */
+/* `segmentmarkerlist' must either be set to NULL (in which case all */
+/* markers default to zero), or must point to a list of markers. */
+/* - If the `p' switch is used without the `r' switch, then */
+/* `numberofholes' and `numberofregions' must be properly set. If */
+/* `numberofholes' is not zero, `holelist' must point to a list of */
+/* holes. If `numberofregions' is not zero, `regionlist' must point to */
+/* a list of region constraints. */
+/* - If the `p' switch is used, `holelist', `numberofholes', */
+/* `regionlist', and `numberofregions' is copied to `out'. (You can */
+/* nonetheless get away with not initializing them if the `r' switch is */
+/* used.) */
+/* - `edgelist', `edgemarkerlist', `normlist', and `numberofedges' may be */
+/* ignored. */
+/* */
+/* `out': */
+/* */
+/* - `pointlist' must be initialized (NULL or pointing to memory) unless */
+/* the `N' switch is used. `pointmarkerlist' must be initialized */
+/* unless the `N' or `B' switch is used. If `N' is not used and */
+/* `in->numberofpointattributes' is not zero, `pointattributelist' must */
+/* be initialized. */
+/* - `trianglelist' must be initialized unless the `E' switch is used. */
+/* `neighborlist' must be initialized if the `n' switch is used. If */
+/* the `E' switch is not used and (`in->numberofelementattributes' is */
+/* not zero or the `A' switch is used), `elementattributelist' must be */
+/* initialized. `trianglearealist' may be ignored. */
+/* - `segmentlist' must be initialized if the `p' or `c' switch is used, */
+/* and the `P' switch is not used. `segmentmarkerlist' must also be */
+/* initialized under these circumstances unless the `B' switch is used. */
+/* - `edgelist' must be initialized if the `e' switch is used. */
+/* `edgemarkerlist' must be initialized if the `e' switch is used and */
+/* the `B' switch is not. */
+/* - `holelist', `regionlist', `normlist', and all scalars may be ignored.*/
+/* */
+/* `vorout' (only needed if `v' switch is used): */
+/* */
+/* - `pointlist' must be initialized. If `in->numberofpointattributes' */
+/* is not zero, `pointattributelist' must be initialized. */
+/* `pointmarkerlist' may be ignored. */
+/* - `edgelist' and `normlist' must both be initialized. */
+/* `edgemarkerlist' may be ignored. */
+/* - Everything else may be ignored. */
+/* */
+/* After a call to triangulate(), the valid fields of `out' and `vorout' */
+/* will depend, in an obvious way, on the choice of switches used. Note */
+/* that when the `p' switch is used, the pointers `holelist' and */
+/* `regionlist' are copied from `in' to `out', but no new space is */
+/* allocated; be careful that you don't free() the same array twice. On */
+/* the other hand, Triangle will never copy the `pointlist' pointer (or any */
+/* others); new space is allocated for `out->pointlist', or if the `N' */
+/* switch is used, `out->pointlist' remains uninitialized. */
+/* */
+/* All of the meaningful `numberof' fields will be properly set; for */
+/* instance, `numberofedges' will represent the number of edges in the */
+/* triangulation whether or not the edges were written. If segments are */
+/* not used, `numberofsegments' will indicate the number of boundary edges. */
+/* */
+/*****************************************************************************/
+
+struct triangulateio {
+ REAL *pointlist; /* In / out */
+ REAL *pointattributelist; /* In / out */
+ int *pointmarkerlist; /* In / out */
+ int numberofpoints; /* In / out */
+ int numberofpointattributes; /* In / out */
+
+ int *trianglelist; /* In / out */
+ REAL *triangleattributelist; /* In / out */
+ REAL *trianglearealist; /* In only */
+ int *neighborlist; /* Out only */
+ int numberoftriangles; /* In / out */
+ int numberofcorners; /* In / out */
+ int numberoftriangleattributes; /* In / out */
+
+ int *segmentlist; /* In / out */
+ int *segmentmarkerlist; /* In / out */
+ int numberofsegments; /* In / out */
+
+ REAL *holelist; /* In / pointer to array copied out */
+ int numberofholes; /* In / copied out */
+
+ REAL *regionlist; /* In / pointer to array copied out */
+ int numberofregions; /* In / copied out */
+
+ int *edgelist; /* Out only */
+ int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
+ REAL *normlist; /* Used only with Voronoi diagram; out only */
+ int numberofedges; /* Out only */
+};
+
+#ifdef ANSI_DECLARATORS
+VEXTERNC
+void triangulate(char *, struct triangulateio *, struct triangulateio *,
+ struct triangulateio *);
+VEXTERNC
+void trifree(VOID *memptr);
+#else /* not ANSI_DECLARATORS */
+void triangulate();
+void trifree();
+#endif /* not ANSI_DECLARATORS */
+#endif /* _TRIANGLE_H_ */
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/apolparm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/apolparm.h
new file mode 100644
index 0000000000000000000000000000000000000000..ecbcf3c378086946bbf35b8c0c517d5f22248be6
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/apolparm.h
@@ -0,0 +1,254 @@
+/** @defgroup APOLparm APOLparm class
+ * @brief Parameter structure for APOL-specific variables from input files
+ */
+
+/**
+ * @file femparm.h
+ * @ingroup APOLparm
+ * @brief Contains declarations for class APOLparm
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+
+#ifndef _APOLPARM_H_
+#define _APOLPARM_H_
+
+/* Generic header files */
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vstring.h"
+#include "generic/vparam.h"
+
+/**
+* @ingroup APOLparm
+ * @brief Define energy calculation enumeration
+ */
+enum eAPOLparm_calcEnergy {
+ ACE_NO=0, /**< Do not perform energy calculation */
+ ACE_TOTAL=1, /**< Calculate total energy only */
+ ACE_COMPS=2 /**< Calculate per-atom energy components */
+};
+
+/**
+* @ingroup APOLparm
+ * @brief Define eAPOLparm_calcEnergy enumeration as APOLparm_calcEnergy
+ */
+typedef enum eAPOLparm_calcEnergy APOLparm_calcEnergy;
+
+/**
+* @ingroup APOLparm
+ * @brief Define force calculation enumeration
+ */
+enum eAPOLparm_calcForce {
+ ACF_NO=0, /**< Do not perform force calculation */
+ ACF_TOTAL=1, /**< Calculate total force only */
+ ACF_COMPS=2 /**< Calculate per-atom force components */
+};
+
+/**
+* @ingroup APOLparm
+ * @brief Define eAPOLparm_calcForce enumeration as APOLparm_calcForce
+ */
+typedef enum eAPOLparm_calcForce APOLparm_calcForce;
+
+/**
+* @ingroup APOLparm
+ * @brief Define force calculation enumeration
+ */
+enum eAPOLparm_doCalc {
+ ACD_NO=0, /**< Do not perform calculation */
+ ACD_YES=1, /**< Perform calculations */
+ ACD_ERROR=2 /**< Error setting up calculation */
+};
+
+/**
+* @ingroup APOLparm
+ * @brief Define eAPOLparm_calcForce enumeration as APOLparm_calcForce
+ */
+typedef enum eAPOLparm_doCalc APOLparm_doCalc;
+
+
+/**
+ * @ingroup APOLparm
+ * @author David Gohara
+ * @brief Parameter structure for APOL-specific variables from input files
+ */
+struct sAPOLparm {
+
+ int parsed; /**< Flag: Has this structure been filled with anything other than the default values? (0 = no, 1 = yes) */
+
+ double grid[3]; /**< Grid spacing */
+ int setgrid; /**< Flag, @see grid */
+
+ int molid; /**< Molecule ID to perform calculation on */
+ int setmolid; /**< Flag, @see molid */
+
+ double bconc; /**< Vacc sphere density */
+ int setbconc; /**< Flag, @see bconc */
+
+ double sdens; /**< Vacc sphere density */
+ int setsdens; /**< Flag, @see sdens */
+
+ double dpos; /**< Atom position offset */
+ int setdpos; /**< Flag, @see dpos */
+
+ double press; /**< Solvent pressure */
+ int setpress; /**< Flag, @see press */
+
+ Vsurf_Meth srfm; /**< Surface calculation method */
+ int setsrfm; /**< Flag, @see srfm */
+
+ double srad; /**< Solvent radius */
+ int setsrad; /**< Flag, @see srad */
+
+ double swin; /**< Cubic spline window */
+ int setswin; /**< Flag, @see swin */
+
+ double temp; /**< Temperature (in K) */
+ int settemp; /**< Flag, @see temp */
+
+ double gamma; /**< Surface tension for apolar energies/forces
+ * (in kJ/mol/A^2) */
+ int setgamma; /**< Flag, @see gamma */
+
+ APOLparm_calcEnergy calcenergy; /**< Energy calculation flag */
+ int setcalcenergy; /**< Flag, @see calcenergy */
+
+ APOLparm_calcForce calcforce; /**< Atomic forces calculation */
+ int setcalcforce; /**< Flag, @see calcforce */
+
+ double watsigma; /**< Water oxygen Lennard-Jones radius (A) */
+ double watepsilon; /**< Water oxygen Lennard-Jones well depth (kJ/mol) */
+ double sasa; /**< Solvent accessible surface area for this calculation */
+ double sav; /**< Solvent accessible volume for this calculation */
+ double wcaEnergy; /**< wcaEnergy */
+ double totForce[3]; /**< Total forces on x, y, z */
+
+ int setwat; /**< Boolean for determining if a water parameter
+ * is supplied. Yes = 1, No = 0 */
+};
+
+/** @typedef APOLparm
+ * @ingroup APOLparm
+ * @brief Declaration of the APOLparm class as the APOLparm structure
+ */
+typedef struct sAPOLparm APOLparm;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class NOsh: Non-inlineable methods (nosh.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct APOLparm
+ * @ingroup APOLparm
+ * @author David Gohara
+ * @returns Newly allocated and initialized Vpmgp object
+ */
+VEXTERNC APOLparm* APOLparm_ctor();
+
+/** @brief FORTRAN stub to construct APOLparm
+ * @ingroup APOLparm
+ * @author David Gohara, Yong Huang
+ * @param thee Pointer to allocated APOLparm object
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes APOLparm_ctor2(APOLparm *thee);
+
+/** @brief Object destructor
+ * @ingroup APOLparm
+ * @author David Gohara
+ * @param thee Pointer to memory location of APOLparm object
+ */
+VEXTERNC void APOLparm_dtor(APOLparm **thee);
+
+/** @brief FORTRAN stub for object destructor
+ * @ingroup APOLparm
+ * @author David Gohara
+ * @param thee Pointer to APOLparm object
+ */
+VEXTERNC void APOLparm_dtor2(APOLparm *thee);
+
+/**
+ * @brief Consistency check for parameter values stored in object
+ * @ingroup APOLparm
+ * @author David Gohara, Yong Huang
+ * @param thee APOLparm object
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes APOLparm_check(APOLparm *thee);
+
+/** @brief Copy target object into thee
+ @ingroup APOLparm
+ @author Nathan Baker
+ @param thee Destination object
+ @param source Source object
+*/
+VEXTERNC void APOLparm_copy(APOLparm *thee, APOLparm *source);
+
+/**
+ * @brief Parse an MG keyword from an input file
+ * @ingroup MGparm
+ * @author David Gohara
+ * @param thee MGparm object
+ * @param tok Token to parse
+ * @param sock Stream for more tokens
+ * @returns Success enumeration (1 if matched and assigned; -1 if matched, but there's
+ * some sort of error (i.e., too few args); 0 if not matched)
+ */
+VEXTERNC Vrc_Codes APOLparm_parseToken(APOLparm *thee, char tok[VMAX_BUFSIZE],
+ Vio *sock);
+
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/bemparm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/bemparm.h
new file mode 100644
index 0000000000000000000000000000000000000000..513b2d76adfdb4ff92829138bd6c658f32046d81
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/bemparm.h
@@ -0,0 +1,180 @@
+/** @defgroup BEMparm BEMparm class
+ * @brief Parameter which holds useful parameters for generic multigrid
+ * calculations
+ */
+
+/**
+ * @file beparm.h
+ * @ingroup BEMparm
+ * @brief Contains declarations for class BEMparm
+ * @version $Id$
+ * @author Nathan A. Baker, Weihua Geng, and Andrew J. Stevens
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+
+#ifndef _BEMPARM_H_
+#define _BEMPARM_H_
+
+/* Generic header files */
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vstring.h"
+
+/**
+ * @brief Calculation type
+ * @ingroup BEMparm
+ */
+enum eBEMparm_CalcType {
+ BCT_MANUAL=0, /**< bem-manual */
+ BCT_NONE=1 /**< not defined */
+};
+
+/**
+ * @brief Declare BEMparm_CalcType type
+ * @ingroup BEMparm
+ */
+typedef enum eBEMparm_CalcType BEMparm_CalcType;
+
+/**
+ * @ingroup BEMparm
+ * @author Nathan Baker and Todd Dolinsky and Weihua Geng
+ * @brief Parameter structure for BEM-specific variables from input files
+ * @note If you add/delete/change something in this class, the member
+ * functions -- especially BEMparm_copy -- must be modified
+ * accordingly
+ */
+typedef struct sBEMparm {
+
+ BEMparm_CalcType type; /**< What type of BEM calculation? */
+ int parsed; /**< Has this structure been filled? (0 = no, 1 = yes) */
+
+ /* *** GENERIC PARAMETERS *** */
+ Vchrg_Src chgs; /**< Charge source (Charge, Multipole, Induced Dipole,
+ * NL Induced. Not currently implemented but should be relatively easy to add in the future (cf Pengyu Ren) */
+ int tree_order; /**< User-defined order for the treecode expansion */
+ int settree_order; /**< Flag, @see tree_order */
+ int tree_n0; /**< Number of particles per leaf of the tree */
+ int settree_n0; /**< Flag, @see tree_npart */
+ double mac; /**< Multipole acceptance criterion (should be between 0 and 1) */
+ int setmac; /**< Flag, @see mac */
+ int nonlintype; /**< Linearity Type Method to be used */
+ int setnonlintype; /**< Flag, @see nonlintype */
+
+ int mesh; /**< 0 for 1 for NanoShaper SES, 2 for NanoShaper Skin */
+ int setmesh; /**< Flag, @see mesh */
+
+ int outdata; /**< 0 does not output vtk, 1 outputs vtk */
+ int setoutdata; /** is a parallel calculation, 0 => is not */
+ int proc_rank; /**< Processor rank in parallel calculation */
+ int proc_size; /**< Number of processors in parallel calculation */
+ int bogus; /**< A flag which tells routines using NOsh that this particular
+ NOsh is broken -- useful for parallel focusing calculations where the
+ user gave us too many processors (1 => ignore this NOsh; 0 => this NOsh
+ is OK) */
+ int elec2calc[NOSH_MAXCALC]; /**< A mapping between ELEC statements which
+ appear in the input file and calc objects stored above. Since we allow
+ both normal and focused multigrid, there isn't a 1-to-1 correspondence
+ between ELEC statements and actual calcualtions. This can really
+ confuse operations which work on specific calculations further down the
+ road (like PRINT). Therefore this array is the initial point of entry
+ for any calculation-specific operation. It points to a specific entry
+ in the calc array. */
+ int apol2calc[NOSH_MAXCALC]; /**< (see elec2calc) */
+
+ int nmol; /**< Number of molecules */
+ char molpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to mol files */
+ NOsh_MolFormat molfmt[NOSH_MAXMOL]; /**< Mol files formats */
+ Valist *alist[NOSH_MAXMOL]; /**< Molecules for calculation (can be used in
+ setting mesh centers */
+ int gotparm; /**< Either have (1) or don't have (0) parm */
+ char parmpath[VMAX_ARGLEN]; /**< Paths to parm file */
+ NOsh_ParmFormat parmfmt; /**< Parm file format */
+ int ndiel; /**< Number of dielectric maps */
+ char dielXpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to x-shifted
+ dielectric map files */
+ char dielYpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to y-shifted
+ dielectric map files */
+ char dielZpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to z-shifted
+ dielectric map files */
+ Vdata_Format dielfmt[NOSH_MAXMOL]; /**< Dielectric maps file formats */
+ int nkappa; /**< Number of kappa maps */
+ char kappapath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to kappa map files */
+ Vdata_Format kappafmt[NOSH_MAXMOL]; /**< Kappa maps file formats */
+ int npot; /**< Number of potential maps */
+ char potpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to potential map files */
+ Vdata_Format potfmt[NOSH_MAXMOL]; /**< Potential maps file formats */
+ int ncharge; /**< Number of charge maps */
+ char chargepath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to charge map files */
+ Vdata_Format chargefmt[NOSH_MAXMOL]; /**< Charge maps fileformats */
+ int nmesh; /**< Number of meshes */
+ char meshpath[NOSH_MAXMOL][VMAX_ARGLEN]; /**< Paths to mesh files */
+ Vdata_Format meshfmt[NOSH_MAXMOL]; /**< Mesh fileformats */
+ int nprint; /**< How many print sections? */
+ NOsh_PrintType printwhat[NOSH_MAXPRINT]; /**< What do we print: \li 0 =
+ energy, \li 1 = force */
+ int printnarg[NOSH_MAXPRINT]; /**< How many arguments in energy list */
+ int printcalc[NOSH_MAXPRINT][NOSH_MAXPOP]; /**< ELEC id (see elec2calc) */
+ int printop[NOSH_MAXPRINT][NOSH_MAXPOP]; /**< Operation id (0 = add, 1 =
+ subtract) */
+ int parsed; /**< Have we parsed an input file yet? */
+ char elecname[NOSH_MAXCALC][VMAX_ARGLEN]; /**< Optional user-specified name
+ for ELEC statement */
+ char apolname[NOSH_MAXCALC][VMAX_ARGLEN]; /**< Optional user-specified name
+ for APOLAR statement */
+};
+
+/**
+* @ingroup NOsh
+* @brief Declaration of the NOsh class as the NOsh structure
+*/
+typedef struct sNOsh NOsh;
+
+/* ///////////////////////////////////////////////////////////////////////////
+ // Class NOsh: Inlineable methods (mcsh.c)
+ /////////////////////////////////////////////////////////////////////////// */
+#if !defined(VINLINE_NOSH)
+/** @brief Returns path to specified molecule
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imol Molecule ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getMolpath(NOsh *thee, int imol);
+
+/** @brief Returns path to specified x-shifted dielectric map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Map ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getDielXpath(NOsh *thee, int imap);
+
+/** @brief Returns path to specified y-shifted dielectric map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Map ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getDielYpath(NOsh *thee, int imap);
+
+/** @brief Returns path to specified z-shifted dielectric map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Map ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getDielZpath(NOsh *thee, int imap);
+
+/** @brief Returns path to specified kappa map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Map ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getKappapath(NOsh *thee, int imap);
+
+/** @brief Returns path to specified potential map
+ * @ingroup NOsh
+ * @author David Gohara
+ * @param thee Pointer to NOsh object
+ * @param imap Map ID of interest
+ * @returns Path string
+ */
+VEXTERNC char* NOsh_getPotpath(NOsh *thee, int imap);
+
+/** @brief Returns path to specified charge distribution map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Map ID of interest
+* @returns Path string
+*/
+VEXTERNC char* NOsh_getChargepath(NOsh *thee, int imap);
+
+/** @brief Returns specified calculation object
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param icalc Calculation ID of interest
+* @returns Pointer to specified calculation object
+*/
+VEXTERNC NOsh_calc* NOsh_getCalc(NOsh *thee, int icalc);
+
+/** @brief Returns format of specified dielectric map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Calculation ID of interest
+* @returns Format of dielectric map
+*/
+VEXTERNC int NOsh_getDielfmt(NOsh *thee, int imap);
+
+/** @brief Returns format of specified kappa map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Calculation ID of interest
+* @returns Format of kappa map
+*/
+VEXTERNC int NOsh_getKappafmt(NOsh *thee, int imap);
+
+/** @brief Returns format of specified potential map
+ * @ingroup NOsh
+ * @author Nathan Baker
+ * @param thee Pointer to NOsh object
+ * @param imap Calculation ID of interest
+ * @returns Format of potential map
+ */
+VEXTERNC int NOsh_getPotfmt(NOsh *thee, int imap);
+
+/** @brief Returns format of specified charge map
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+* @param imap Calculation ID of interest
+* @returns Format of charge map
+*/
+VEXTERNC int NOsh_getChargefmt(NOsh *thee, int imap);
+
+#else
+
+# define NOsh_getMolpath(thee, imol) ((thee)->molpath[(imol)])
+# define NOsh_getDielXpath(thee, imol) ((thee)->dielXpath[(imol)])
+# define NOsh_getDielYpath(thee, imol) ((thee)->dielYpath[(imol)])
+# define NOsh_getDielZpath(thee, imol) ((thee)->dielZpath[(imol)])
+# define NOsh_getKappapath(thee, imol) ((thee)->kappapath[(imol)])
+# define NOsh_getPotpath(thee, imol) ((thee)->potpath[(imol)])
+# define NOsh_getChargepath(thee, imol) ((thee)->chargepath[(imol)])
+# define NOsh_getCalc(thee, icalc) ((thee)->calc[(icalc)])
+# define NOsh_getDielfmt(thee, imap) ((thee)->dielfmt[(imap)])
+# define NOsh_getKappafmt(thee, imap) ((thee)->kappafmt[(imap)])
+# define NOsh_getPotfmt(thee, imap) ((thee)->potfmt[(imap)])
+# define NOsh_getChargefmt(thee, imap) ((thee)->chargefmt[(imap)])
+
+#endif
+
+
+/* ///////////////////////////////////////////////////////////////////////////
+ // Class NOsh: Non-inlineable methods (mcsh.c)
+ /////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Return an integer ID of the observable to print (@see printwhat)
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee NOsh object to use
+* @param iprint ID of PRINT statement
+* @returns An integer ID of the observable to print (@see printwhat)
+*/
+VEXTERNC NOsh_PrintType NOsh_printWhat(NOsh *thee, int iprint);
+
+/** @brief Return an integer mapping of an ELEC statement to a calculation ID
+* (@see elec2calc)
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee NOsh object to use
+* @param ielec ID of ELEC statement
+* @returns An integer mapping of an ELEC statement to a calculation ID
+* (@see elec2calc)
+*/
+VEXTERNC char* NOsh_elecname(NOsh *thee, int ielec);
+
+/** @brief Return the name of an elec statement
+* @ingroup NOsh
+* @author Todd Dolinsky
+* @param thee NOsh object to use
+* @param icalc ID of CALC statement
+* @returns The name (if present) of an ELEC statement
+*/
+VEXTERNC int NOsh_elec2calc(NOsh *thee, int icalc);
+
+/** @brief Return the name of an apol statement
+* @ingroup NOsh
+* @author David Gohara
+* @param thee NOsh object to use
+* @param icalc ID of CALC statement
+* @returns The name (if present) of an APOL statement
+*/
+VEXTERNC int NOsh_apol2calc(NOsh *thee, int icalc);
+
+/** @brief Return number of arguments to PRINT statement (@see printnarg)
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee NOsh object to use
+* @param iprint ID of PRINT statement
+* @returns Number of arguments to PRINT statement (@see printnarg)
+*/
+VEXTERNC int NOsh_printNarg(NOsh *thee, int iprint);
+
+/** @brief Return integer ID for specified operation (@see printop)
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee NOsh object to use
+* @param iprint ID of PRINT statement
+* @param iarg ID of operation in PRINT statement
+* @returns Integer ID for specified operation (@see printop)
+*/
+VEXTERNC int NOsh_printOp(NOsh *thee, int iprint, int iarg);
+
+/** @brief Return calculation ID for specified PRINT statement
+* (@see printcalc)
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee NOsh object to use
+* @param iprint ID of PRINT statement
+* @param iarg ID of operation in PRINT statement
+* @returns Calculation ID for specified PRINT statement
+* (@see printcalc)
+*/
+VEXTERNC int NOsh_printCalc(NOsh *thee, int iprint, int iarg);
+
+/** @brief Construct NOsh
+* @ingroup NOsh
+* @author Nathan Baker
+* @param rank Rank of current processor in parallel calculation (0 if not
+* parallel)
+* @param size Number of processors in parallel calculation (1 if not
+* parallel)
+* @returns Newly allocated and initialized NOsh object
+*/
+VEXTERNC NOsh* NOsh_ctor(int rank, int size);
+
+/** @brief Construct NOsh_calc
+* @ingroup NOsh
+* @author Nathan Baker
+* @param calcType Calculation type
+* @returns Newly allocated and initialized NOsh object
+*/
+VEXTERNC NOsh_calc* NOsh_calc_ctor(
+ NOsh_CalcType calcType
+ );
+
+/** @brief Copy NOsh_calc object into thee
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Target object
+* @param source Source object
+*/
+VEXTERNC int NOsh_calc_copy(
+ NOsh_calc *thee,
+ NOsh_calc *source
+ );
+
+/** @brief Object destructor
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to memory location of NOsh_calc object
+*/
+VEXTERNC void NOsh_calc_dtor(NOsh_calc **thee);
+
+/** @brief FORTRAN stub to construct NOsh
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Space for NOsh objet
+* @param rank Rank of current processor in parallel calculation (0 if not
+* parallel)
+* @param size Number of processors in parallel calculation (1 if not
+* parallel)
+* @returns 1 if successful, 0 otherwise
+*/
+VEXTERNC int NOsh_ctor2(NOsh *thee, int rank, int size);
+
+/** @brief Object destructor
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to memory location of NOsh object
+*/
+VEXTERNC void NOsh_dtor(NOsh **thee);
+
+/** @brief FORTRAN stub for object destructor
+* @ingroup NOsh
+* @author Nathan Baker
+* @param thee Pointer to NOsh object
+*/
+VEXTERNC void NOsh_dtor2(NOsh *thee);
+
+/** @brief Parse an input file from a socket
+* @ingroup NOsh
+* @note Should be called before NOsh_setupCalc
+* @author Nathan Baker and Todd Dolinsky
+* @param thee Pointer to NOsh object
+* @param sock Stream of tokens to parse
+* @return 1 if successful, 0 otherwise
+*/
+VEXTERNC int NOsh_parseInput(NOsh *thee, Vio *sock);
+
+/** @brief Parse an input file only from a file
+* @note Included for SWIG wrapper compatibility
+* @note Should be called before NOsh_setupCalc
+* @ingroup NOsh
+* @author Nathan Baker and Todd Dolinsky
+* @param thee Pointer to NOsh object
+* @param filename Name/path of readable file
+* @return 1 if successful, 0 otherwise
+*/
+VEXTERNC int NOsh_parseInputFile(NOsh *thee, char *filename);
+
+/** @brief Setup the series of electrostatics calculations
+* @note Should be called after NOsh_parseInput*
+* @ingroup NOsh
+* @author Nathan Baker and Todd Dolinsky
+* @param thee Pointer to NOsh object
+* @param alist Array of pointers to Valist objects (molecules used to center
+ mesh);
+* @return 1 if successful, 0 otherwise
+*/
+VEXTERNC int NOsh_setupElecCalc(
+ NOsh *thee, /**< NOsh object */
+ Valist *alist[NOSH_MAXMOL] /**< Atom list for calculation */
+ );
+
+/** @brief Setup the series of non-polar calculations
+* @note Should be called after NOsh_parseInput*
+* @ingroup NOsh
+* @author Nathan Baker and Todd Dolinsky
+* @param thee Pointer to NOsh object
+* @param alist Array of pointers to Valist objects (molecules used to center
+ mesh);
+* @return 1 if successful, 0 otherwise
+*/
+VEXTERNC int NOsh_setupApolCalc(
+ NOsh *thee, /**< NOsh object */
+ Valist *alist[NOSH_MAXMOL] /**< Atom list for calculation */
+ );
+
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbamparm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbamparm.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2cf94e049a5dd072a609dd9a5e5857cb36fb0d0
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbamparm.h
@@ -0,0 +1,365 @@
+/** @defgroup PBAMparm PBAMparm class
+ * @brief Parameter which holds useful parameters for Poisson-boltzmann
+ * analytical method calculations
+ */
+
+/**
+ * @file pbamparm.h
+ * @ingroup PBAMparm
+ * @brief Contains declarations for class PBAMparm
+ * @version $Id$
+ * @author Lisa Felberg
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+
+#ifndef _PBAMPARM_H_
+#define _PBAMPARM_H_
+
+/* Generic header files */
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vstring.h"
+
+ /** @brief Number of things that can be written out in a single calculation
+ * @ingroup PBAMparm
+ */
+#define CHR_MAXLEN 1000
+#define PBAMPARM_MAXWRITE 15
+#define PBAMPARM_MAXMOL 150
+
+/**
+ * @brief Calculation type
+ * @ingroup PBAMparm
+ */
+enum ePBAMparm_CalcType {
+ //other methods disabled for now only auto currently implemented.
+ //PBAMCT_MANUAL=0, /**< PBAM-manual */
+ PBAMCT_AUTO=1, /**< PBAM-auto */
+ //PBAMCT_NONE=2 /**< not defined */
+};
+
+/**
+ * @brief Declare PBAMparm_CalcType type
+ * @ingroup PBAMparm
+ */
+typedef enum ePBAMparm_CalcType PBAMparm_CalcType;
+
+/**
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @brief Parameter structure for PBAM-specific variables from input files
+ * @note If you add/delete/change something in this class, the member
+ * functions -- especially PBAMparm_copy -- must be modified
+ * accordingly
+ */
+typedef struct sPBAMparm {
+
+ PBAMparm_CalcType type; /**< What type of PBAM calculation? */
+ int parsed; /**< Has this structure been filled? (0 = no, 1 = yes) */
+
+ /* *** GENERIC PARAMETERS *** */
+ double salt;
+ int setsalt;
+
+ // This is the type of run you want
+ char runtype[CHR_MAXLEN];
+ int setruntype;
+
+ // This is the name for output files
+ char runname[CHR_MAXLEN];
+ int setrunname;
+
+ // For setting random orientation of molecules
+ int setrandorient;
+
+ // For periodic boundary conditions
+ double pbcboxlen;
+ int setpbcs;
+
+ // This is units of the calculation
+ char units[CHR_MAXLEN];
+ int setunits;
+
+ //
+ // ELECTROSTATICS
+ //
+ // For the grid, store gridpt
+ int gridpt;
+ int setgridpt;
+
+ // For 3d map printing
+ char map3dname[CHR_MAXLEN];
+ int set3dmap;
+
+ // For 2D
+ char grid2Dname[PBAMPARM_MAXWRITE][CHR_MAXLEN];
+ char grid2Dax[PBAMPARM_MAXWRITE][CHR_MAXLEN];
+ double grid2Dloc[PBAMPARM_MAXWRITE];
+ int grid2Dct;
+ int setgrid2Dname;
+
+ // For dx
+ char dxname[CHR_MAXLEN];
+ int setdxname;
+
+ //
+ // DYNAMICS
+ //
+ int ntraj;
+ int setntraj;
+
+ char termcombine[CHR_MAXLEN];
+ int settermcombine;
+
+ int diffct;
+ char moveType[PBAMPARM_MAXMOL][CHR_MAXLEN];
+ double transDiff[PBAMPARM_MAXMOL];
+ double rotDiff[PBAMPARM_MAXMOL];
+
+ int termct;
+ int setterm;
+
+ char termnam[PBAMPARM_MAXWRITE][CHR_MAXLEN];
+ int termnu[PBAMPARM_MAXWRITE][1];
+ double termVal[PBAMPARM_MAXWRITE];
+ char confil[PBAMPARM_MAXWRITE][CHR_MAXLEN];
+ double conpad[PBAMPARM_MAXWRITE];
+ int confilct;
+
+ int setxyz;
+ int xyzct[PBAMPARM_MAXMOL];
+ char xyzfil[PBAMPARM_MAXMOL][PBAMPARM_MAXWRITE][CHR_MAXLEN];
+
+} PBAMparm;
+
+/** @brief Construct PBAMparm object
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param type Type of PBAM calculation
+ * @returns Newly allocated and initialized PBAMparm object
+ */
+VEXTERNC PBAMparm* PBAMparm_ctor(PBAMparm_CalcType type);
+
+/** @brief FORTRAN stub to construct PBAMparm object ?????????!!!!!!!
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param thee Space for PBAMparm object
+ * @param type Type of MG calculation
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes PBAMparm_ctor2(PBAMparm *thee, PBAMparm_CalcType type);
+
+/** @brief Object destructor
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param thee Pointer to memory location of PBAMparm object
+ */
+VEXTERNC void PBAMparm_dtor(PBAMparm **thee);
+
+/** @brief FORTRAN stub for object destructor ?????????!!!!!!!!!!!!
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param thee Pointer to PBAMparm object
+ */
+VEXTERNC void PBAMparm_dtor2(PBAMparm *thee);
+
+/** @brief Consistency check for parameter values stored in object
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param thee PBAMparm object
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes PBAMparm_check(PBAMparm *thee);
+
+/** @brief Parse an MG keyword from an input file
+ * @ingroup PBAMparm
+ * @author Andrew Stevens, Kyle Monson
+ * @param thee PBAMparm object
+ * @param tok Token to parse
+ * @param sock Stream for more tokens
+ * @returns Success enumeration (1 if matched and assigned; -1 if matched, but there's some sort
+ * of error (i.e., too few args); 0 if not matched)
+ */
+VEXTERNC Vrc_Codes PBAMparm_parseToken(PBAMparm *thee, char tok[VMAX_BUFSIZE],
+ Vio *sock);
+/**
+ * @brief copy PBAMparm object int thee.
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param parm PBAMparm object.
+ */
+VEXTERNC void PBAMparm_copy(PBAMparm *thee, PBAMparm *parm);
+
+/**
+ * @brief Find salt conc and save it as a structure variable
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param parm The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseSalt(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find runType and save it as a structure variable
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseRunType(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find runName and save it as a structure variable
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseRunName(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find randomorientation flag and save it as a boolean
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseRandorient(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find PBC flag and save the type and the boxlength
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parsePBCS(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find units flag and save units
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseUnits(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find 3D map filename and save it
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parse3Dmap(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find 2D grid filename and save it
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseGrid2D(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find DX filename and save it
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseDX(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find Grid points and save them
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseGridPts(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find Termination logic and save it
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseTermcombine(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find diffusion coeffs for each molecule and save them
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseDiff(PBAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find xyz files for each molecule for each traj and save them
+ * @ingroup PBAMparm
+ * @author
+ * @param thee PBAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBAMparm_parseXYZ(PBAMparm *thee, Vio *sock);
+
+
+
+
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbeparm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbeparm.h
new file mode 100644
index 0000000000000000000000000000000000000000..96ea59b8652a7355623000cedcaf0374f6a216b0
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbeparm.h
@@ -0,0 +1,314 @@
+/** @defgroup PBEparm PBEparm class
+ * @brief Parameter structure for PBE variables independent of solver
+ */
+
+/**
+ * @file pbeparm.h
+ * @ingroup PBEparm
+ * @brief Contains declarations for class PBEparm
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _PBEPARM_H_
+#define _PBEPARM_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vstring.h"
+
+/** @brief Number of things that can be written out in a single calculation
+ * @ingroup PBEparm
+ */
+#define PBEPARM_MAXWRITE 20
+
+/**
+ * @ingroup PBEparm
+ * @brief Define energy calculation enumeration
+ */
+enum ePBEparm_calcEnergy {
+ PCE_NO=0, /**< Do not perform energy calculation */
+ PCE_TOTAL=1, /**< Calculate total energy only */
+ PCE_COMPS=2 /**< Calculate per-atom energy components */
+};
+
+/**
+ * @ingroup PBEparm
+ * @brief Define ePBEparm_calcEnergy enumeration as PBEparm_calcEnergy
+ */
+typedef enum ePBEparm_calcEnergy PBEparm_calcEnergy;
+
+/**
+ * @ingroup PBEparm
+ * @brief Define force calculation enumeration
+ */
+enum ePBEparm_calcForce {
+ PCF_NO=0, /**< Do not perform force calculation */
+ PCF_TOTAL=1, /**< Calculate total force only */
+ PCF_COMPS=2 /**< Calculate per-atom force components */
+};
+
+/**
+ * @ingroup PBEparm
+ * @brief Define ePBEparm_calcForce enumeration as PBEparm_calcForce
+ */
+typedef enum ePBEparm_calcForce PBEparm_calcForce;
+
+/**
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @brief Parameter structure for PBE variables from input files
+ * @note If you add/delete/change something in this class, the member
+ * functions -- especially PBEparm_copy -- must be modified
+ * accordingly
+ */
+struct sPBEparm {
+
+ int molid; /**< Molecule ID to perform calculation on */
+ int setmolid; /**< Flag, @see molid */
+ int useDielMap; /**< Indicates whether we use external
+ * dielectric maps (note plural) */
+ int dielMapID; /**< Dielectric map ID (if used) */
+ int useKappaMap; /**< Indicates whether we use an external
+ * kappa map */
+ int kappaMapID; /**< Kappa map ID (if used) */
+ int usePotMap; /**< Indicates whether we use an external
+ * kappa map */
+ int potMapID; /**< Kappa map ID (if used) */
+
+ int useChargeMap; /**< Indicates whether we use an external
+ * charge distribution map */
+ int chargeMapID; /**< Charge distribution map ID (if used) */
+ Vhal_PBEType pbetype; /**< Which version of the PBE are we solving? */
+ int setpbetype; /**< Flag, @see pbetype */
+ Vbcfl bcfl; /**< Boundary condition method */
+ int setbcfl; /**< Flag, @see bcfl */
+ int nion; /**< Number of counterion species */
+ int setnion; /**< Flag, @see nion */
+ double ionq[MAXION]; /**< Counterion charges (in e) */
+ double ionc[MAXION]; /**< Counterion concentrations (in M) */
+ double ionr[MAXION]; /**< Counterion radii (in A) */
+ int setion[MAXION]; /**< Flag, @see ionq */
+ double pdie; /**< Solute dielectric */
+ int setpdie; /**< Flag, @see pdie */
+ double sdens; /**< Vacc sphere density */
+ int setsdens; /**< Flag, @see sdens */
+ double sdie; /**< Solvent dielectric */
+ int setsdie; /**< Flag, @see sdie */
+ Vsurf_Meth srfm; /**< Surface calculation method */
+ int setsrfm; /**< Flag, @see srfm */
+ double srad; /**< Solvent radius */
+ int setsrad; /**< Flag, @see srad */
+ double swin; /**< Cubic spline window */
+ int setswin; /**< Flag, @see swin */
+ double temp; /**< Temperature (in K) */
+ int settemp; /**< Flag, @see temp */
+
+ double smsize; /**< SMPBE size */
+ int setsmsize; /**< Flag, @see temp */
+
+ double smvolume; /**< SMPBE size */
+ int setsmvolume; /**< Flag, @see temp */
+
+ PBEparm_calcEnergy calcenergy; /**< Energy calculation flag */
+ int setcalcenergy; /**< Flag, @see calcenergy */
+ PBEparm_calcForce calcforce; /**< Atomic forces calculation */
+ int setcalcforce; /**< Flag, @see calcforce */
+
+ /*----------------------------------------------------------------*/
+ /* Added by Michael Grabe */
+ /*----------------------------------------------------------------*/
+
+ double zmem; /**< z value of membrane bottom */
+ int setzmem; /**< Flag */
+ double Lmem; /**< membrane width */
+ int setLmem; /**< Flag */
+ double mdie; /**< membrane dielectric constant */
+ int setmdie; /**< Flag */
+ double memv; /**< Membrane potential */
+ int setmemv; /**< Flag */
+
+ /*----------------------------------------------------------------*/
+
+ int numwrite; /**< Number of write statements encountered */
+ char writestem[PBEPARM_MAXWRITE][VMAX_ARGLEN]; /**< File stem to write
+ * data to */
+ Vdata_Type writetype[PBEPARM_MAXWRITE]; /**< What data to write */
+ Vdata_Format writefmt[PBEPARM_MAXWRITE]; /**< File format to write data
+ * in */
+ int writemat; /**< Write out the operator matrix?
+ * \li 0 => no
+ * \li 1 => yes */
+ int setwritemat; /**< Flag, @see writemat */
+ char writematstem[VMAX_ARGLEN]; /**< File stem to write mat */
+ int writematflag; /**< What matrix should we write:
+ * \li 0 => Poisson (differential operator)
+ * \li 1 => Poisson-Boltzmann operator linearized around
+ * solution (if applicable) */
+
+ /*Added for issue 482*/
+ char pbam_3dmapstem[VMAX_ARGLEN];
+ int pbam_3dmapflag;
+
+ int parsed; /**< Has this been filled with anything other
+ * than the default values? */
+};
+
+/**
+ * @ingroup PBEparm
+ * @brief Declaration of the PBEparm class as the PBEparm structure
+ */
+typedef struct sPBEparm PBEparm;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class NOsh: Non-inlineable methods (mcsh.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Get charge (e) of specified ion species
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns Charge of ion species (e)
+ */
+VEXTERNC double PBEparm_getIonCharge(
+ PBEparm *thee, /**< PBEparm object */
+ int iion /**< Ion species ID/index */
+ );
+
+/** @brief Get concentration (M) of specified ion species
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns Concentration of ion species (M)
+ */
+VEXTERNC double PBEparm_getIonConc(
+ PBEparm *thee, /**< PBEparm object */
+ int iion /**< Ion species ID/index */
+ );
+
+/** @brief Get radius (A) of specified ion species
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns Radius of ion species (A)
+ */
+VEXTERNC double PBEparm_getIonRadius(
+ PBEparm *thee, /**< PBEparm object */
+ int iion /**< Ion species ID/index */
+ );
+
+
+/** @brief Construct PBEparm object
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns Newly allocated and initialized PBEparm object
+ */
+VEXTERNC PBEparm* PBEparm_ctor();
+
+/** @brief FORTRAN stub to construct PBEparm object
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns 1 if succesful, 0 otherwise
+ */
+VEXTERNC int PBEparm_ctor2(
+ PBEparm *thee /**< Memory location for object */
+ );
+
+/** @brief Object destructor
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ */
+VEXTERNC void PBEparm_dtor(
+ PBEparm **thee /**< Pointer to memory location of object */
+ );
+
+/** @brief FORTRAN stub for object destructor
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ */
+VEXTERNC void PBEparm_dtor2(
+ PBEparm *thee /**< Pointer to object to be destroyed */
+ );
+
+/** @brief Consistency check for parameter values stored in object
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @returns 1 if OK, 0 otherwise
+ */
+VEXTERNC int PBEparm_check(
+ PBEparm *thee /**< Object to be checked */
+ );
+
+/** @brief Copy PBEparm object into thee
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ */
+VEXTERNC void PBEparm_copy(
+ PBEparm *thee, /**< Target for copy */
+ PBEparm *parm /**< Source for copy */
+ );
+
+/** @brief Parse a keyword from an input file
+ * @ingroup PBEparm
+ * @author Nathan Baker
+ * @return 1 if matched and assigned; -1 if matched, but there's some sort
+ * of error (i.e., too few args); 0 if not matched
+ */
+VEXTERNC int PBEparm_parseToken(
+ PBEparm *thee, /**< Parsing object */
+ char tok[VMAX_BUFSIZE], /**< Token to parse */
+ Vio *sock /**< Socket for additional tokens */
+ );
+
+
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbsamparm.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbsamparm.h
new file mode 100644
index 0000000000000000000000000000000000000000..93c8d0cc5635e068b6d5017322b53644cc7cafa9
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/pbsamparm.h
@@ -0,0 +1,228 @@
+/** @defgroup PBSAMparm PBSAMparm class
+ * @brief Parameter which holds useful parameters for Poisson-boltzmann
+ * analytical method calculations
+ */
+
+/**
+ * @file pbsamparm.h
+ * @ingroup PBSAMparm
+ * @brief Contains declarations for class PBSAMparm
+ * @version $Id$
+ * @author Lisa Felberg
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+
+#ifndef _PBSAMPARM_H_
+#define _PBSAMPARM_H_
+
+/* Generic header files */
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vstring.h"
+
+ /** @brief Number of things that can be written out in a single calculation
+ * @ingroup PBSAMparm
+ */
+#define CHR_MAXLEN 1000
+#define PBSAMPARM_MAXWRITE 15
+#define PBSAMPARM_MAXMOL 150
+
+/**
+ * @brief Calculation type
+ * @ingroup PBSAMparm
+ */
+enum ePBSAMparm_CalcType {
+ //other methods disabled for now only auto currently implemented.
+ //PBSAMCT_MANUAL=0, /**< PBSAM-manual */
+ PBSAMCT_AUTO=1, /**< PBSAM-auto */
+ //PBSAMCT_NONE=2 /**< not defined */
+};
+
+/**
+ * @brief Declare PBSAMparm_CalcType type
+ * @ingroup PBSAMparm
+ */
+typedef enum ePBSAMparm_CalcType PBSAMparm_CalcType;
+
+/**
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @brief Parameter structure for PBSAM-specific variables from input files
+ * @note If you add/delete/change something in this class, the member
+ * functions -- especially PBSAMparm_copy -- must be modified
+ * accordingly
+ */
+typedef struct sPBSAMparm {
+
+ PBSAMparm_CalcType type; /**< What type of PBSAM calculation? */
+ int parsed; /**< Has this structure been filled? (0 = no, 1 = yes) */
+
+ /* The only parms in addition to PBAM would be
+ IMAT and Selfpol */
+ int settolsp;
+ double tolsp;
+
+ double probe_radius;
+ double density;
+
+ int setsurf;
+ int surfct;
+ char surffil[PBSAMPARM_MAXMOL][CHR_MAXLEN];
+
+ int setimat;
+ int imatct;
+ char imatfil[PBSAMPARM_MAXMOL][CHR_MAXLEN];
+
+ int setexp;
+ int expct;
+ char expfil[PBSAMPARM_MAXMOL][CHR_MAXLEN];
+
+} PBSAMparm;
+
+/** @brief Construct PBSAMparm object
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param type Type of PBSAM calculation
+ * @returns Newly allocated and initialized PBSAMparm object
+ */
+VEXTERNC PBSAMparm* PBSAMparm_ctor(PBSAMparm_CalcType type);
+
+/** @brief FORTRAN stub to construct PBSAMparm object ?????????!!!!!!!
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param thee Space for PBSAMparm object
+ * @param type Type of MG calculation
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes PBSAMparm_ctor2(PBSAMparm *thee, PBSAMparm_CalcType type);
+
+/** @brief Object destructor
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param thee Pointer to memory location of PBSAMparm object
+ */
+VEXTERNC void PBSAMparm_dtor(PBSAMparm **thee);
+
+/** @brief FORTRAN stub for object destructor ?????????!!!!!!!!!!!!
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param thee Pointer to PBSAMparm object
+ */
+VEXTERNC void PBSAMparm_dtor2(PBSAMparm *thee);
+
+/** @brief Consistency check for parameter values stored in object
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param thee PBSAMparm object
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes PBSAMparm_check(PBSAMparm *thee);
+
+/** @brief Parse an MG keyword from an input file
+ * @ingroup PBSAMparm
+ * @author Lisa Felberg
+ * @param thee PBSAMparm object
+ * @param tok Token to parse
+ * @param sock Stream for more tokens
+ * @returns Success enumeration (1 if matched and assigned; -1 if matched, but there's some sort
+ * of error (i.e., too few args); 0 if not matched)
+ */
+VEXTERNC Vrc_Codes PBSAMparm_parseToken(PBSAMparm *thee, char tok[VMAX_BUFSIZE],
+ Vio *sock);
+/**
+ * @brief copy PBSAMparm object int thee.
+ * @ingroup PBSAMparm
+ * @author
+ * @param thee PBSAMparm object to be copied into
+ * @param parm PBSAMparm object.
+ */
+VEXTERNC void PBSAMparm_copy(PBSAMparm *thee, PBSAMparm *parm);
+
+/**
+ * @brief Find sphere tolerance for coarse-graining
+ * @ingroup PBSAMparm
+ * @author
+ * @param thee PBSAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBSAMparm_parseTolsp(PBSAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find vertex files for each molecule and save them
+ * @ingroup PBSAMparm
+ * @author
+ * @param thee PBSAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBSAMparm_parseSurf(PBSAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find IMAT files for each molecule and save them
+ * @ingroup PBSAMparm
+ * @author
+ * @param thee PBSAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBSAMparm_parseImat(PBSAMparm *thee, Vio *sock);
+
+/**
+ * @brief Find expansion files for each molecule and save them
+ * @ingroup PBSAMparm
+ * @author
+ * @param thee PBSAMparm object to be copied into
+ * @param sock The stream from which parameter is taken
+ */
+VPRIVATE Vrc_Codes PBSAMparm_parseExp(PBSAMparm *thee, Vio *sock);
+
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vacc.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vacc.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a617627c110d0a961a4278bb39b74191b04ba0b
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vacc.h
@@ -0,0 +1,625 @@
+/** @defgroup Vacc Vacc class
+ * @brief Solvent- and ion-accessibility oracle
+ */
+
+/**
+ * @file vacc.h
+ * @ingroup Vacc
+ * @brief Contains declarations for class Vacc
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VACC_H_
+#define _VACC_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#if defined(HAVE_MC)
+#include "mc/mc.h"
+#endif
+
+#include "generic/vhal.h"
+#include "generic/valist.h"
+#include "generic/vclist.h"
+#include "generic/vatom.h"
+#include "generic/vunit.h"
+#include "generic/apolparm.h"
+
+/**
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @brief Surface object list of per-atom surface points
+ */
+struct sVaccSurf {
+ Vmem *mem; /**< Memory object */
+ double *xpts; /**< Array of point x-locations */
+ double *ypts; /**< Array of point y-locations */
+ double *zpts; /**< Array of point z-locations */
+ char *bpts; /**< Array of booleans indicating whether a point is (1) or is
+ * not (0) part of the surface */
+ double area; /**< Area spanned by these points */
+ int npts; /**< Length of thee->xpts, ypts, zpts arrays */
+ double probe_radius; /**< Probe radius (A) with which this surface was
+ * constructed */
+};
+
+/**
+ * @ingroup Vacc
+ * @brief Declaration of the VaccSurf class as the VaccSurf structure
+ */
+typedef struct sVaccSurf VaccSurf;
+
+/**
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @brief Oracle for solvent- and ion-accessibility around a biomolecule
+ */
+struct sVacc {
+
+ Vmem *mem; /**< Memory management object for this class */
+ Valist *alist; /**< Valist structure for list of atoms */
+ Vclist *clist; /**< Vclist structure for atom cell list */
+ int *atomFlags; /**< Array of boolean flags of length
+ * Valist_getNumberAtoms(thee->alist) to prevent
+ * double-counting atoms during calculations */
+ VaccSurf *refSphere; /**< Reference sphere for SASA calculations */
+ VaccSurf **surf; /**< Array of surface points for each atom; is not
+ * initialized until needed (test against VNULL to
+ * determine initialization state) */
+ Vset acc; /**< An integer array (to be treated as bitfields) of Vset type
+ * with length equal to the number of vertices in the mesh */
+ double surf_density; /**< Minimum solvent accessible surface point density
+ * (in pts/A^2) */
+
+};
+
+/**
+ * @ingroup Vacc
+ * @brief Declaration of the Vacc class as the Vacc structure
+ */
+typedef struct sVacc Vacc;
+
+#if !defined(VINLINE_VACC)
+
+ /** @brief Get number of bytes in this object and its members
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Number of bytes allocated for object
+ */
+ VEXTERNC unsigned long int Vacc_memChk(
+ Vacc *thee /**< Object for memory check */
+ );
+
+#else /* if defined(VINLINE_VACC) */
+
+# define Vacc_memChk(thee) (Vmem_bytes((thee)->mem))
+
+#endif /* if !defined(VINLINE_VACC) */
+
+/**
+ * @brief Allocate and construct the surface object; do not assign surface
+ * points to positions
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Newly allocated and constructed surface object
+ */
+VEXTERNC VaccSurf* VaccSurf_ctor(
+ Vmem *mem, /**< Memory manager (can be VNULL) */
+ double probe_radius, /**< Probe radius (in A) for this surface */
+ int nsphere /**< Number of points in sphere */
+ );
+
+/**
+ * @brief Construct the surface object using previously allocated memory; do
+ * not assign surface points to positions
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns 1 if successful, 0 otherwise
+ */
+VEXTERNC int VaccSurf_ctor2(
+ VaccSurf *thee, /**< Allocated memory */
+ Vmem *mem, /**< Memory manager (can be VNULL) */
+ double probe_radius, /**< Probe radius (in A) for this surface */
+ int nsphere /**< Number of points in sphere */
+ );
+
+/**
+ * @brief Destroy the surface object and free its memory
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void VaccSurf_dtor(
+ VaccSurf **thee /**< Object to be destroyed */
+ );
+
+/**
+ * @brief Destroy the surface object
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void VaccSurf_dtor2(
+ VaccSurf *thee /**< Object to be destroyed */
+ );
+
+/**
+ * @brief Set up an array of points for a reference sphere of unit radius
+ *
+ * Generates approximately npts # of points (actual number stored in
+ * thee->npts) somewhat uniformly distributed across a sphere of unit radius
+ * centered at the origin.
+ *
+ * @note This routine was shamelessly ripped off from sphere.f from UHBD as
+ * developed by Michael K. Gilson.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker (original FORTRAN code by Mike Gilson)
+ * @return Reference sphere surface object
+ */
+VEXTERNC VaccSurf* VaccSurf_refSphere(
+ Vmem *mem, /**< Memory object */
+ int npts /**< Requested number of points on sphere */
+ );
+
+/**
+ * @brief Set up an array of points corresponding to the SAS due to a
+ * particular atom.
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @return Atom sphere surface object
+ */
+VEXTERNC VaccSurf* Vacc_atomSurf(
+ Vacc *thee, /**< Accessibility object for molecule */
+ Vatom *atom, /**< Atom for which the surface should be constructed */
+ VaccSurf *ref, /**< Reference sphere which sets the resolution for the
+ * surface. @see VaccSurf_refSphere */
+ double probe_radius /**< Probe radius (in A) */
+ );
+
+/** @brief Construct the accessibility object
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Newly allocated Vacc object */
+VEXTERNC Vacc* Vacc_ctor(
+ Valist *alist, /**< Molecule for accessibility queries */
+ Vclist *clist, /**< Pre-constructed cell list for looking up atoms
+ * near specific positions */
+ double surf_density /**< Minimum per-atom solvent accessible surface
+ * point density (in pts/A^2)*/
+ );
+
+/** @brief FORTRAN stub to construct the accessibility object
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns 1 if successful, 0 otherwise */
+VEXTERNC int Vacc_ctor2(
+ Vacc *thee, /**< Memory for Vacc objet */
+ Valist *alist, /**< Molecule for accessibility queries */
+ Vclist *clist, /**< Pre-constructed cell list for looking up atoms
+ * near specific positions */
+ double surf_density /**< Minimum per-atom solvent accessible surface
+ * point density (in pts/A^2)*/
+ );
+
+/** @brief Destroy object
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void Vacc_dtor(
+ Vacc **thee /**< Pointer to memory location of object */
+ );
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void Vacc_dtor2(
+ Vacc *thee /**< Pointer to object */
+ );
+
+/** @brief Report van der Waals accessibility
+ *
+ * Determines if a point is within the union of the atomic spheres (with
+ * radii equal to their van der Waals radii).
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ */
+VEXTERNC double Vacc_vdwAcc(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM] /**< Probe center coordinates */
+ );
+
+/** @brief Report inflated van der Waals accessibility
+ *
+ * Determines if a point is within the union of the spheres centered at the
+ * atomic centers with radii equal to the sum of the atomic van der Waals
+ * radius and the probe radius.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ */
+VEXTERNC double Vacc_ivdwAcc(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double radius /**< Probe radius (Å) */
+ );
+
+/** @brief Report molecular accessibility
+ *
+ * Determine accessibility of a probe (of radius radius) at a given point,
+ * given a collection of atomic spheres. Uses molecular (Connolly) surface
+ * definition.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ * @bug This routine has a slight bug which can generate very small
+ * internal regions of high dielectric (thanks to John Mongan and
+ * Jess Swanson for finding this)
+ */
+VEXTERNC double Vacc_molAcc(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double radius /**< Probe radius (in Å) */
+ );
+
+/** @brief Report molecular accessibility quickly
+ *
+ * Given a point which is INSIDE the collection of inflated van der Waals
+ * spheres, but OUTSIDE the collection of non-inflated van der Waals spheres,
+ * determine accessibility of a probe (of radius radius) at a given point,
+ * given a collection of atomic spheres. Uses molecular (Connolly) surface
+ * definition.
+ *
+ * @note THIS ASSUMES YOU HAVE TESTED THAT THIS POINT IS DEFINITELY INSIDE
+ * THE INFLATED AND NON-INFLATED VAN DER WAALS SURFACES!
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ * @bug This routine has a slight bug which can generate very small
+ * internal regions of high dielectric (thanks to John Mongan and
+ * Jess Swanson for finding this)
+ */
+VEXTERNC double Vacc_fastMolAcc(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double radius /**< Probe radius (in Å) */
+ );
+
+/** @brief Report spline-based accessibility
+ *
+ * Determine accessibility at a given point, given a collection of atomic
+ * spheres. Uses Benoit Roux (Im et al, Comp Phys Comm, 111, 59--75, 1998)
+ * definition suitable for force evalation; basically a cubic spline.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ */
+VEXTERNC double Vacc_splineAcc(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad /**< Inflation radius (Å) for ion access. */
+ );
+
+/** @brief Report gradient of spline-based accessibility.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void Vacc_splineAccGrad(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ double *grad /**< 3-vector set to gradient of accessibility */
+ );
+
+/** @brief Report spline-based accessibility for a given atom
+ *
+ * Determine accessibility at a given point for a given atomic
+ * spheres. Uses Benoit Roux (Im et al, Comp Phys Comm, 111, 59--75, 1998)
+ * definition suitable for force evalation; basically a cubic spline.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @returns Characteristic function value between 1.0 (accessible) and 0.0
+ * (inaccessible)
+ */
+VEXTERNC double Vacc_splineAccAtom(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ Vatom *atom /**< Atom */
+ );
+
+/** @brief Report gradient of spline-based accessibility with respect to a
+ * particular atom (see Vpmg_splineAccAtom)
+ *
+ * Determine accessibility at a given point, given a collection of atomic
+ * spheres. Uses Benoit Roux (Im et al, Comp Phys Comm, 111, 59--75, 1998)
+ * definition suitable for force evalation; basically a cubic spline.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void Vacc_splineAccGradAtomUnnorm(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ Vatom *atom, /**< Atom */
+ double *force /**< VAPBS_DIM-vector set to gradient of accessibility */
+ );
+
+/** @brief Report gradient of spline-based accessibility with respect to a
+ * particular atom normalized by the accessibility value due to that
+ * atom at that point (see Vpmg_splineAccAtom)
+ *
+ * Determine accessibility at a given point, given a collection of atomic
+ * spheres. Uses Benoit Roux (Im et al, Comp Phys Comm, 111, 59--75, 1998)
+ * definition suitable for force evalation; basically a cubic spline.
+ *
+ * @ingroup Vacc
+ * @author Nathan Baker
+ */
+VEXTERNC void Vacc_splineAccGradAtomNorm(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ Vatom *atom, /**< Atom */
+ double *force /**< VAPBS_DIM-vector set to gradient of accessibility */
+ );
+
+/** @brief Report gradient of spline-based accessibility with respect to a
+ * particular atom normalized by a 4th order accessibility value due
+ * to that atom at that point (see Vpmg_splineAccAtom)
+ *
+ * @ingroup Vacc
+ * @author Michael Schnieders
+ */
+VEXTERNC void Vacc_splineAccGradAtomNorm4(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ Vatom *atom, /**< Atom */
+ double *force /**< VAPBS_DIM-vector set to gradient of accessibility */
+ );
+
+/** @brief Report gradient of spline-based accessibility with respect to a
+* particular atom normalized by a 3rd order accessibility value due
+* to that atom at that point (see Vpmg_splineAccAtom)
+*
+* @ingroup Vacc
+* @author Michael Schnieders
+*/
+VEXTERNC void Vacc_splineAccGradAtomNorm3(
+ Vacc *thee, /**< Accessibility object */
+ double center[VAPBS_DIM], /**< Probe center coordinates */
+ double win, /**< Spline window (Å) */
+ double infrad, /**< Inflation radius (Å) for ion access. */
+ Vatom *atom, /**< Atom */
+ double *force /**< VAPBS_DIM-vector set to gradient of accessibility */
+ );
+
+
+/**
+ * @brief Build the solvent accessible surface (SAS) and calculate the
+ * solvent accessible surface area
+ * @ingroup Vacc
+ * @note Similar to UHBD FORTRAN routine by Brock Luty
+ * (returns UHBD's asas2)
+ * @author Nathan Baker (original FORTRAN routine by Brock Luty)
+ * @return Total solvent accessible area (A^2)
+ */
+VEXTERNC double Vacc_SASA(
+ Vacc *thee, /**< Accessibility object */
+ double radius /**< Probe molecule radius (Å) */
+ );
+
+/**
+ * @brief Return the total solvent accessible surface area (SASA)
+ * @ingroup Vacc
+ * @note Alias for Vacc_SASA
+ * @author Nathan Baker
+ * @return Total solvent accessible area (A^2)
+ */
+VEXTERNC double Vacc_totalSASA(
+ Vacc *thee, /**< Accessibility object */
+ double radius /**< Probe molecule radius (Å) */
+ );
+
+/**
+ * @brief Return the atomic solvent accessible surface area (SASA)
+ * @ingroup Vacc
+ * @note Alias for Vacc_SASA
+ * @author Nathan Baker
+ * @return Atomic solvent accessible area (A^2)
+ */
+VEXTERNC double Vacc_atomSASA(
+ Vacc *thee, /**< Accessibility object */
+ double radius, /**< Probe molecule radius (Å) */
+ Vatom *atom /**< Atom of interest */
+ );
+
+/**
+ * @brief Get the set of points for this atom's solvent-accessible surface
+ * @ingroup Vacc
+ * @author Nathan Baker
+ * @return Pointer to VaccSurf object for this atom
+ */
+VEXTERNC VaccSurf* Vacc_atomSASPoints(
+ Vacc *thee, /**< Accessibility object */
+ double radius, /**< Probe molecule radius (Å) */
+ Vatom *atom /**< Atom of interest */
+ );
+
+/**
+* @brief Get the derivatve of solvent accessible volume
+ * @ingroup Vacc
+ * @author Jason Wagoner, Nathan Baker
+ */
+VEXTERNC void Vacc_atomdSAV(
+ Vacc *thee, /**< Acessibility object */
+ double radius, /**< Probe radius (Å) */
+ Vatom *atom, /**< Atom of interest */
+ double *dSA /**< Array holding answers of calc */
+ );
+
+/**
+* @brief Get the derivatve of solvent accessible area
+ * @ingroup Vacc
+ * @author Jason Wagoner, David Gohara, Nathan Baker
+ */
+VEXTERNC void Vacc_atomdSASA(
+ Vacc *thee, /**< Acessibility object */
+ double dpos, /**< Atom position offset */
+ double radius, /**< Probe radius (Å) */
+ Vatom *atom, /**< Atom of interest */
+ double *dSA /**< Array holding answers of calc */
+ );
+
+/**
+* @brief Testing purposes only
+ * @ingroup Vacc
+ * @author David Gohara, Nathan Baker
+ */
+VEXTERNC void Vacc_totalAtomdSASA(
+ Vacc *thee, /**< Acessibility object */
+ double dpos, /**< Atom position offset */
+ double radius, /**< Probe radius (Å) */
+ Vatom *atom, /**< Atom of interest */
+ double *dSA /**< Array holding answers of calc */
+ );
+
+/**
+* @brief Total solvent accessible volume
+ * @ingroup Vacc
+ * @author David Gohara, Nathan Baker
+ */
+VEXTERNC void Vacc_totalAtomdSAV(
+ Vacc *thee, /**< Acessibility object */
+ double dpos, /**< Atom position offset */
+ double radius, /**< Probe radius (Å) */
+ Vatom *atom, /**< Atom of interest */
+ double *dSA, /**< Array holding answers of calc */
+ Vclist *clist /**< clist for this calculation */
+ );
+
+/**
+ * @brief Return the total solvent accessible volume (SAV)
+ * @ingroup Vacc
+ * @note Alias for Vacc_SAV
+ * @author David Gohara
+ * @return Total solvent accessible volume (A^3)
+ */
+VEXTERNC double Vacc_totalSAV(
+ Vacc *thee, /**< Accessibility object */
+ Vclist *clist, /**< Clist for acc object */
+ APOLparm *apolparm, /**< Apolar parameters -- could be VNULL if none required for this calculation.
+ * If VNULL, then default settings are used */
+ double radius /**< Probe molecule radius (Å) */
+ );
+
+/**
+ * @brief Return the WCA integral energy
+ * @ingroup Vacc
+ * @author David Gohara
+ * @return Success flag
+ */
+VEXTERNC int Vacc_wcaEnergy(
+ Vacc *thee, /**< Accessibility object */
+ APOLparm *apolparm, /**< Apolar calculation parameters */
+ Valist *alist, /**< Alist for acc object */
+ Vclist *clist /**< Clist for acc object */
+ );
+/**
+ * @brief Return the WCA integral force
+ * @ingroup Vacc
+ * @author David Gohara
+ * @return WCA energy (kJ/mol/A)
+ */
+VEXTERNC int Vacc_wcaForceAtom(Vacc *thee, /**< Accessibility object */
+ APOLparm *apolparm, /**< Apolar calculation parameters */
+ Vclist *clist, /**< Clist for acc object */
+ Vatom *atom, /**< Current atom */
+ double *force /**< Force for atom */
+ );
+
+/** @brief Calculate the WCA energy for an atom
+ @ingroup Vacc
+ @author Dave Gohara and Nathan Baker
+ @return Success flag
+ */
+VEXTERNC int Vacc_wcaEnergyAtom(
+ Vacc *thee, /**< Accessibility object */
+ APOLparm *apolparm, /**< Apolar calculation parameters */
+ Valist *alist, /**< Atom list */
+ Vclist *clist, /**< Cell list associated with Vacc object */
+ int iatom, /**< Index for atom of interest */
+ double *value /**< Set to energy value */
+ );
+
+#endif /* ifndef _VACC_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/valist.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/valist.h
new file mode 100644
index 0000000000000000000000000000000000000000..8036db457ecf52d8c81ee3b8e03bcbe4cdd5d7e8
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/valist.h
@@ -0,0 +1,262 @@
+/** @defgroup Valist Valist class
+ * @brief Container class for list of atom objects
+ */
+
+/**
+ * @file valist.h
+ * @ingroup Valist
+ * @brief Contains declarations for class Valist
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VALIST_H_
+#define _VALIST_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vatom.h"
+#include "generic/vparam.h"
+
+/**
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @brief Container class for list of atom objects
+ */
+struct sValist {
+
+ int number; /**< Number of atoms in list */
+ double center[3]; /**< Molecule center (xmin - xmax)/2, etc.*/
+ double mincrd[3]; /**< Minimum coordinates */
+ double maxcrd[3]; /**< Maximum coordinates */
+ double maxrad; /**< Maximum radius */
+ double charge; /**< Net charge */
+ Vatom *atoms; /**< Atom list */
+ Vmem *vmem; /**< Memory management object */
+
+};
+
+/**
+ * @ingroup Valist
+ * @brief Declaration of the Valist class as the Valist structure
+ */
+typedef struct sValist Valist;
+
+#if !defined(VINLINE_VATOM)
+
+/**
+ * @brief Get actual array of atom objects from the list
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Array of atom objects
+ */
+VEXTERNC Vatom* Valist_getAtomList(
+ Valist *thee /**< Atom list object */
+ );
+
+/** @brief Get x-coordinate of molecule center
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return X-coordinate of molecule center
+ */
+VEXTERNC double Valist_getCenterX(
+ Valist *thee /**< Atom list object */
+ );
+
+/** @brief Get y-coordinate of molecule center
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Y-coordinate of molecule center
+ */
+VEXTERNC double Valist_getCenterY(
+ Valist *thee /**< Atom list object */
+ );
+
+/** @brief Get z-coordinate of molecule center
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Z-coordinate of molecule center
+ */
+VEXTERNC double Valist_getCenterZ(
+ Valist *thee /**< Atom list object */
+ );
+
+/** @brief Get number of atoms in the list
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Number of atoms in list
+ */
+VEXTERNC int Valist_getNumberAtoms(
+ Valist *thee /**< Atom list object */
+ );
+
+/** @brief Get pointer to particular atom in list
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Pointer to atom object i
+ */
+VEXTERNC Vatom* Valist_getAtom(
+ Valist *thee, /**< Atom list object */
+ int i /**< Index of atom in list */
+ );
+
+/** @brief Get total memory allocated for this object and its members
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @return Total memory in bytes
+ */
+VEXTERNC unsigned long int Valist_memChk(
+ Valist *thee /**< Atom list object */
+ );
+
+#else /* if defined(VINLINE_VATOM) */
+# define Valist_getAtomList(thee) ((thee)->atoms)
+# define Valist_getNumberAtoms(thee) ((thee)->number)
+# define Valist_getAtom(thee, i) (&((thee)->atoms[i]))
+# define Valist_memChk(thee) (Vmem_bytes((thee)->vmem))
+# define Valist_getCenterX(thee) ((thee)->center[0])
+# define Valist_getCenterY(thee) ((thee)->center[1])
+# define Valist_getCenterZ(thee) ((thee)->center[2])
+#endif /* if !defined(VINLINE_VATOM) */
+
+/** @brief Construct the atom list object
+ * @ingroup Valist
+ * @author Nathan Baker
+ * @returns Pointer to newly allocated (empty) atom list
+ */
+VEXTERNC Valist* Valist_ctor();
+
+/** @brief FORTRAN stub to construct the atom list object
+ * @ingroup Valist
+ * @author Nathan Baker, Yong Huang
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes Valist_ctor2(
+ Valist *thee /**< Storage for new atom list */
+ );
+
+/** @brief Destroys atom list object
+ * @ingroup Valist
+ * @author Nathan Baker
+ */
+VEXTERNC void Valist_dtor(
+ Valist **thee /**< Pointer to storage for atom list */
+ );
+
+/** @brief FORTRAN stub to destroy atom list object
+ * @ingroup Valist
+ * @author Nathan Baker
+ */
+VEXTERNC void Valist_dtor2(
+ Valist *thee /**< Pointer to atom list object */
+ );
+
+/**
+ * @brief Fill atom list with information from a PQR file
+ * @ingroup Valist
+ * @author Nathan Baker, Yong Huang
+ * @returns Success enumeration
+ * @note \li A PQR file has PDB structure with charge and radius in the last
+ * two columns instead of weight and occupancy
+ * \li We don't actually respect PDB format; instead recognize
+ * whitespace- or tab-delimited fields which allows us to deal with
+ * structures with coordinates > 999 or < -999.
+ */
+VEXTERNC Vrc_Codes Valist_readPQR(
+ Valist *thee, /**< Atom list object */
+ Vparam *param, /**< A pre-initialized parameter object */
+ Vio *sock /**< Socket reading for reading PQR file */
+ );
+
+/**
+ * @brief Fill atom list with information from a PDB file
+ * @ingroup Valist
+ * @author Nathan Baker, Todd Dolinsky, Yong Huang
+ * @returns Success enumeration
+ * @note We don't actually respect PDB format; instead recognize whitespace-
+ * or tab-delimited fields which allows us to deal with structures with
+ * coordinates > 999 or < -999.
+ */
+VEXTERNC Vrc_Codes Valist_readPDB(
+ Valist *thee, /**< Atom list object */
+ Vparam *param, /**< A pre-initialized parameter object */
+ Vio *sock /**< Socket read for reading PDB file */
+ );
+
+/**
+ * @brief Fill atom list with information from an XML file
+ * @ingroup Valist
+ * @author Todd Dolinsky, Yong Huang
+ * @returns Success enumeration
+ * @note \li The XML file must adhere to some guidelines, notably the
+ * presence of an <atom> tag with all other useful information
+ * (x, y, z, charge, and radius) as nested elements.
+ */
+VEXTERNC Vrc_Codes Valist_readXML(
+ Valist *thee, /**< Atom list object */
+ Vparam *param, /**< A pre-initialized parameter object */
+ Vio *sock /**< Socket reading for reading PQR file */
+ );
+
+/**
+ * @brief Load up Valist with various statistics
+ * @ingroup Valist
+ * @author Nathan Baker, Yong Huang
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes Valist_getStatistics(Valist *thee);
+
+
+#endif /* ifndef _VALIST_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vatom.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vatom.h
new file mode 100644
index 0000000000000000000000000000000000000000..3dd65e161ed9ef3689cf43e128bdf8c5b82594dd
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vatom.h
@@ -0,0 +1,318 @@
+/** @defgroup Vatom Vatom class
+ * @brief Atom class for interfacing APBS with PDB files
+ */
+
+/**
+ * @file vatom.h
+ * @ingroup Vatom
+ * @brief Contains declarations for class Vatom
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VATOM_H_
+#define _VATOM_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+
+/**
+ * @ingroup Vatom
+ * @def VMAX_RECLEN
+ * @author Nathan Baker, David Gohara, Mike Schneiders
+ * @brief Residue name length
+ */
+#define VMAX_RECLEN 64
+
+/**
+ * @ingroup Vatom
+ * @author Nathan Baker, David Gohara, Mike Schneiders
+ * @brief Contains public data members for Vatom class/module
+ */
+struct sVatom {
+
+ double position[3]; /**< Atomic position */
+ double radius; /**< Atomic radius */
+ double charge; /**< Atomic charge */
+ double partID; /**< Partition value for assigning atoms to particular
+ * processors and/or partitions */
+ double epsilon; /**< Epsilon value for WCA calculations */
+
+ int id; /**< Atomic ID; this should be a unique non-negative integer
+ * assigned based on the index of the atom in a Valist atom
+ * array */
+
+ char resName[VMAX_RECLEN]; /**< Residue name from PDB/PQR file */
+ char atomName[VMAX_RECLEN]; /**< Atom name from PDB/PDR file */
+
+};
+
+/**
+ * @ingroup Vatom
+ * @brief Declaration of the Vatom class as the Vatom structure
+ */
+typedef struct sVatom Vatom;
+
+#if !defined(VINLINE_VATOM)
+
+ /** @brief Get atomic position
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @returns Pointer to 3*double array of atomic coordinates (in Å)
+ */
+ VEXTERNC double* Vatom_getPosition(Vatom *thee);
+
+ /** @brief Set atomic radius
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @param radius Atomic radius (in Å)
+ */
+ VEXTERNC void Vatom_setRadius(Vatom *thee, double radius);
+
+ /** @brief Get atomic position
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @returns Atomic radius (in Å)
+ */
+ VEXTERNC double Vatom_getRadius(Vatom *thee);
+
+ /** @brief Set partition ID
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @param partID Partition ID; a negative value means this atom is not
+ * assigned to any partition
+ */
+ VEXTERNC void Vatom_setPartID(Vatom *thee, int partID);
+
+ /** @brief Get partition ID
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @return Partition ID; a negative value means this atom is not
+ * assigned to any partition
+ */
+ VEXTERNC double Vatom_getPartID(Vatom *thee);
+
+ /** @brief Set atom ID
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @param id Unique non-negative number
+ */
+ VEXTERNC void Vatom_setAtomID(Vatom *thee, int id);
+
+ /** @brief Get atom ID
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @return Unique non-negative number
+ */
+ VEXTERNC double Vatom_getAtomID(Vatom *thee);
+
+ /** @brief Set atomic charge
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @param charge Atom partial charge (in e)
+ */
+ VEXTERNC void Vatom_setCharge(Vatom *thee, double charge);
+
+ /** @brief Get atomic charge
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object
+ * @return Atom partial charge (in e)
+ */
+ VEXTERNC double Vatom_getCharge(Vatom *thee);
+
+ /** @brief Set atomic epsilon
+ * @ingroup Vatom
+ * @author David Gohara
+ * @param thee Vatom object
+ * @param epsilon Atomic epsilon (in Å)
+ */
+ VEXTERNC void Vatom_setEpsilon(Vatom *thee, double epsilon);
+
+ /** @brief Get atomic epsilon
+ * @ingroup Vatom
+ * @author David Gohara
+ * @param thee Vatom object
+ * @returns Atomic epsilon (in Å)
+ */
+ VEXTERNC double Vatom_getEpsilon(Vatom *thee);
+
+ /** @brief Return the memory used by this structure (and its contents)
+ * in bytes
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vpmg object
+ * @return The memory used by this structure and its contents in bytes
+ */
+ VEXTERNC unsigned long int Vatom_memChk(Vatom *thee);
+
+#else /* if defined(VINLINE_VATOM) */
+# define Vatom_getPosition(thee) ((thee)->position)
+# define Vatom_setRadius(thee, tRadius) ((thee)->radius = (tRadius))
+# define Vatom_getRadius(thee) ((thee)->radius)
+# define Vatom_setPartID(thee, tpartID) ((thee)->partID = (double)(tpartID))
+# define Vatom_getPartID(thee) ((thee)->partID)
+# define Vatom_setAtomID(thee, tatomID) ((thee)->id = (tatomID))
+# define Vatom_getAtomID(thee) ((thee)->id)
+# define Vatom_setCharge(thee, tCharge) ((thee)->charge = (tCharge))
+# define Vatom_getCharge(thee) ((thee)->charge)
+# define Vatom_setEpsilon(thee, tEpsilon) ((thee)->epsilon = (tEpsilon))
+# define Vatom_getEpsilon(thee) ((thee)->epsilon)
+# define Vatom_memChk(thee) (sizeof(Vatom))
+#endif /* if !defined(VINLINE_VATOM) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vatom: Non-Inlineable methods (vatom.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Set residue name
+* @ingroup Vatom
+* @author Jason Wagoner
+* @param thee Vatom object
+* @param resName Residue Name
+*/
+VEXTERNC void Vatom_setResName(Vatom *thee, char resName[VMAX_RECLEN]);
+
+/** @brief Set atom name
+* @ingroup Vatom
+* @author Jason Wagoner
+*/
+VEXTERNC void Vatom_setAtomName(
+ Vatom *thee, /**< Vatom object */
+ char atomName[VMAX_RECLEN] /**< Atom name */
+ );
+
+/** @brief Retrieve residue name
+* @ingroup Vatom
+* @author Jason Wagoner
+* @param thee Vatom object
+* @param resName Residue Name
+*/
+VEXTERNC void Vatom_getResName(Vatom *thee, char resName[VMAX_RECLEN]);
+
+/** @brief Retrieve atom name
+* @ingroup Vatom
+* @author Jason Wagoner
+*/
+VEXTERNC void Vatom_getAtomName(
+ Vatom *thee, /**< Vatom object */
+ char atomName[VMAX_RECLEN] /**< Atom name */
+ );
+
+/** @brief Constructor for the Vatom class
+ * @author Nathan Baker
+ * @ingroup Vatom
+ * @returns Pointer to newly allocated Vatom object
+ */
+VEXTERNC Vatom* Vatom_ctor();
+
+/** @brief FORTRAN stub constructor for the Vatom class
+ * @author Nathan Baker
+ * @ingroup Vatom
+ * @param thee Pointer to Vatom allocated memory location
+ * @returns 1 if succesful, 0 otherwise
+ */
+VEXTERNC int Vatom_ctor2(Vatom *thee);
+
+/** @brief Object destructor
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Pointer to memory location of object to be destroyed
+ */
+VEXTERNC void Vatom_dtor(Vatom **thee);
+
+/** @brief FORTRAN stub object destructor
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Pointer to object to be destroyed
+ */
+VEXTERNC void Vatom_dtor2(Vatom *thee);
+
+/** @brief Set the atomic position
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Vatom object to be modified
+ * @param position Coordinates (in Å)
+ */
+VEXTERNC void Vatom_setPosition(Vatom *thee, double position[3]);
+
+/**
+ * @brief Copy information to another atom
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Source for atom information
+ * @param dest Destination for atom information
+ */
+VEXTERNC void Vatom_copyTo(Vatom *thee, Vatom *dest);
+
+/**
+ * @brief Copy information to another atom
+ * @ingroup Vatom
+ * @author Nathan Baker
+ * @param thee Destination for atom information
+ * @param src Source for atom information
+ */
+VEXTERNC void Vatom_copyFrom(Vatom *thee, Vatom *src);
+
+
+#endif /* ifndef _VATOM_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vcap.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vcap.h
new file mode 100644
index 0000000000000000000000000000000000000000..509f97773a99f9fb8f47fe083854ddd5ddff1c23
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vcap.h
@@ -0,0 +1,151 @@
+/** @defgroup Vcap Vcap class
+ * @brief Collection of routines which cap certain exponential and hyperbolic
+ * functions
+ * @note These routines are based on FORTRAN code by Mike Holst
+ */
+
+/**
+ * @file vcap.h
+ * @ingroup Vcap
+ * @brief Contains declarations for class Vcap
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VCAP_H_
+#define _VCAP_H_
+
+#include "apbscfg.h"
+
+/** @brief Maximum argument for exp(), sinh(), or cosh()
+ * @ingroup Vcap
+ */
+#define EXPMAX 85.00
+
+/** @brief Minimum argument for exp(), sinh(), or cosh()
+ * @ingroup Vcap
+ */
+#define EXPMIN -85.00
+
+#include "maloc/maloc.h"
+
+/** @brief Provide a capped exp() function
+ *
+ * If the argument x of Vcap_exp() exceeds EXPMAX or EXPMIN, then we
+ * return exp(EXPMAX) or exp(EXPMIN) rather than exp(x).
+ *
+ * @note Original FORTRAN routine from PMG library by Mike Holst
+ * Original notes:
+ * to control overflow in the hyperbolic and exp functions, note
+ * that the following are the argument limits of the various
+ * functions on various machines after which overflow occurs:
+ * Convex C240, Sun 3/60, Sun SPARC, IBM RS/6000:
+ * sinh, cosh, exp: maximal argument (abs value) = 88.0d0
+ * dsinh, dcosh, dexp: maximal argument (abs value) = 709.0d0
+ *
+ * @ingroup Vcap
+ * @author Nathan Baker (based on FORTRAN code by Mike Holst)
+ * @return exp(x) or capped equivalent
+ */
+VEXTERNC double Vcap_exp(
+ double x, /**< Argument to exp() */
+ int *ichop /**< Set to 1 if function capped, 0 otherwise */
+ );
+
+
+/** @brief Provide a capped sinh() function
+ *
+ * If the argument x of Vcap_sinh() exceeds EXPMAX or EXPMIN, then we
+ * return sinh(EXPMAX) or sinh(EXPMIN) rather than sinh(x).
+ *
+ * @note Original FORTRAN routine from PMG library by Mike Holst
+ * Original notes:
+ * to control overflow in the hyperbolic and exp functions, note
+ * that the following are the argument limits of the various
+ * functions on various machines after which overflow occurs:
+ * Convex C240, Sun 3/60, Sun SPARC, IBM RS/6000:
+ * sinh, cosh, exp: maximal argument (abs value) = 88.0d0
+ * dsinh, dcosh, dexp: maximal argument (abs value) = 709.0d0
+ *
+ * @ingroup Vcap
+ * @author Nathan Baker (based on FORTRAN code by Mike Holst)
+ * @return sinh(x) or capped equivalent
+ */
+VEXTERNC double Vcap_sinh(
+ double x, /**< Argument to sinh() */
+ int *ichop /**< Set to 1 if function capped, 0 otherwise */
+ );
+
+/** @brief Provide a capped cosh() function
+ *
+ * If the argument x of Vcap_cosh() exceeds EXPMAX or EXPMIN, then we
+ * return cosh(EXPMAX) or cosh(EXPMIN) rather than cosh(x).
+ *
+ * @note Original FORTRAN routine from PMG library by Mike Holst
+ * Original notes:
+ * to control overflow in the hyperbolic and exp functions, note
+ * that the following are the argument limits of the various
+ * functions on various machines after which overflow occurs:
+ * Convex C240, Sun 3/60, Sun SPARC, IBM RS/6000:
+ * sinh, cosh, exp: maximal argument (abs value) = 88.0d0
+ * dsinh, dcosh, dexp: maximal argument (abs value) = 709.0d0
+ *
+ * @ingroup Vcap
+ * @author Nathan Baker (based on FORTRAN code by Mike Holst)
+ * @return cosh(x) or capped equivalent
+ */
+VEXTERNC double Vcap_cosh(
+ double x, /**< Argument to cosh() */
+ int *ichop /**< Set to 1 if function capped, 0 otherwise */
+ );
+
+#endif /* ifndef _VCAP_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vclist.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vclist.h
new file mode 100644
index 0000000000000000000000000000000000000000..84263b0f9c51b43f0851ea0c11ebc3542fc5f023
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vclist.h
@@ -0,0 +1,273 @@
+/** @defgroup Vclist Vclist class
+ * @brief Atom cell list
+ */
+
+/**
+ * @file vclist.h
+ * @ingroup Vclist
+ * @brief Contains declarations for class Vclist
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VCLIST_H_
+#define _VCLIST_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#if defined(HAVE_MC)
+#include "mc/mc.h"
+#endif
+
+#include "generic/vhal.h"
+#include "generic/valist.h"
+#include "generic/vatom.h"
+#include "generic/vunit.h"
+
+/**
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @brief Atom cell list domain setup mode
+ */
+enum eVclist_DomainMode {
+ CLIST_AUTO_DOMAIN, /**< Setup the cell list domain automatically to
+ * encompass the entire molecule */
+ CLIST_MANUAL_DOMAIN /**< Specify the cell list domain manually through
+ * the constructor */
+};
+
+/**
+ * @typedef Vclist_DomainMode
+ * @ingroup Vclist
+ * @brief Declaration of Vclist_DomainMode enumeration type
+ */
+typedef enum eVclist_DomainMode Vclist_DomainMode;
+
+/**
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @brief Atom cell list cell
+ */
+struct sVclistCell {
+ Vatom **atoms; /**< Array of atom objects associated with this cell */
+ int natoms; /**< Length of thee->atoms array */
+};
+
+/**
+ * @ingroup Vclist
+ * @brief Declaration of the VclistCell class as the VclistCell structure
+ */
+typedef struct sVclistCell VclistCell;
+
+/**
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @brief Atom cell list
+ */
+struct sVclist {
+
+ Vmem *vmem; /**< Memory management object for this class */
+ Valist *alist; /**< Original Valist structure for list of atoms */
+ Vclist_DomainMode mode; /**< How the cell list was constructed */
+ int npts[VAPBS_DIM]; /**< Hash table grid dimensions */
+ int n; /**< n = nx*nz*ny */
+ double max_radius; /**< Maximum probe radius */
+ VclistCell *cells; /**< Cell array of length thee->n */
+ double lower_corner[VAPBS_DIM]; /**< Hash table grid corner */
+ double upper_corner[VAPBS_DIM]; /**< Hash table grid corner */
+ double spacs[VAPBS_DIM]; /**< Hash table grid spacings */
+
+};
+
+/**
+ * @ingroup Vclist
+ * @brief Declaration of the Vclist class as the Vclist structure
+ */
+typedef struct sVclist Vclist;
+
+#if !defined(VINLINE_VCLIST)
+
+ /** @brief Get number of bytes in this object and its members
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @returns Number of bytes allocated for object
+ */
+ VEXTERNC unsigned long int Vclist_memChk(
+ Vclist *thee /**< Object for memory check */
+ );
+
+ /**
+ * @brief Get the max probe radius value (in A) the cell list was
+ * constructed with
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @returns Max probe radius (in A)
+ */
+ VEXTERNC double Vclist_maxRadius(
+ Vclist *thee /**< Cell list object */
+ );
+
+#else /* if defined(VINLINE_VCLIST) */
+
+# define Vclist_memChk(thee) (Vmem_bytes((thee)->vmem))
+# define Vclist_maxRadius(thee) ((thee)->max_radius)
+
+#endif /* if !defined(VINLINE_VCLIST) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vclist: Non-Inlineable methods (vclist.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct the cell list object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @returns Newly allocated Vclist object */
+VEXTERNC Vclist* Vclist_ctor(
+ Valist *alist, /**< Molecule for cell list queries */
+ double max_radius, /**< Max probe radius (Å) to be queried */
+ int npts[VAPBS_DIM], /**< Number of in hash table points in each
+ * direction*/
+ Vclist_DomainMode mode, /**< Mode to construct table */
+ double lower_corner[VAPBS_DIM], /**< Hash table lower corner for
+ manual construction (see mode
+ variable); ignored otherwise */
+ double upper_corner[VAPBS_DIM] /**< Hash table upper corner for
+ manual construction (see mode
+ variable); ignored otherwise */
+ );
+
+/** @brief FORTRAN stub to construct the cell list object
+ * @ingroup Vclist
+ * @author Nathan Baker, Yong Huang
+ * @returns Success enumeration */
+VEXTERNC Vrc_Codes Vclist_ctor2(
+ Vclist *thee, /**< Memory for Vclist objet */
+ Valist *alist, /**< Molecule for cell list queries */
+ double max_radius, /**< Max probe radius (Å) to be queried */
+ int npts[VAPBS_DIM], /**< Number of in hash table points in each
+ * direction*/
+ Vclist_DomainMode mode, /**< Mode to construct table */
+ double lower_corner[VAPBS_DIM], /**< Hash table lower corner for
+ manual construction (see mode
+ variable); ignored otherwise */
+ double upper_corner[VAPBS_DIM] /**< Hash table upper corner for
+ manual construction (see mode
+ variable); ignored otherwise */
+ );
+
+/** @brief Destroy object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ */
+VEXTERNC void Vclist_dtor(
+ Vclist **thee /**< Pointer to memory location of object */
+ );
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ */
+VEXTERNC void Vclist_dtor2(
+ Vclist *thee /**< Pointer to object */
+ );
+
+/**
+ * @brief Return cell corresponding to specified position or return VNULL.
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @returns Pointer to VclistCell object or VNULL if no cell available (away
+ * from molecule).
+ */
+VEXTERNC VclistCell* Vclist_getCell(
+ Vclist *thee, /**< Pointer to Vclist cell list */
+ double position[VAPBS_DIM] /**< Position to evaluate */
+ );
+
+/**
+ * @brief Allocate and construct a cell list cell object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ * @returns Pointer to newly-allocated and constructed object.
+ */
+VEXTERNC VclistCell* VclistCell_ctor(
+ int natoms /**< Number of atoms associated with this cell */
+ );
+
+/**
+ * @brief Construct a cell list object
+ * @ingroup Vclist
+ * @author Nathan Baker, Yong Huang
+ * @returns Success enumeration
+ */
+VEXTERNC Vrc_Codes VclistCell_ctor2(
+ VclistCell *thee, /**< Memory location for object */
+ int natoms /**< Number of atoms associated with this cell */
+ );
+
+/** @brief Destroy object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ */
+VEXTERNC void VclistCell_dtor(
+ VclistCell **thee /**< Pointer to memory location of object */
+ );
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vclist
+ * @author Nathan Baker
+ */
+VEXTERNC void VclistCell_dtor2(
+ VclistCell *thee /**< Pointer to object */
+ );
+
+#endif /* ifndef _VCLIST_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vgreen.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vgreen.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5a194108601afeed65f6a5f1a45efd87c24dbe5
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vgreen.h
@@ -0,0 +1,324 @@
+/** @defgroup Vgreen Vgreen class
+ * @brief Provides capabilities for pointwise evaluation of free space
+ * Green's function for point charges in a uniform dielectric.
+ * @note Right now, these are very slow methods without any fast multipole
+ * acceleration.
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+/**
+ * @file vgreen.h
+ * @ingroup Vgreen
+ * @brief Contains declarations for class Vgreen
+ * @version $Id$
+ * @author Nathan A. Baker
+ */
+
+#ifndef _VGREEN_H_
+#define _VGREEN_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vunit.h"
+#include "generic/vatom.h"
+#include "generic/valist.h"
+
+/**
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @brief Contains public data members for Vgreen class/module
+ */
+struct sVgreen {
+
+ Valist *alist; /**< Atom (charge) list for Green's function */
+ Vmem *vmem; /**< Memory management object */
+ double *xp; /**< Array of particle x-coordinates for use with
+ * treecode routines */
+ double *yp; /**< Array of particle y-coordinates for use with
+ * treecode routines */
+ double *zp; /**< Array of particle z-coordinates for use with
+ * treecode routines */
+ double *qp; /**< Array of particle charges for use with
+ * treecode routines */
+ int np; /**< Set to size of above arrays */
+};
+
+/**
+ * @ingroup Vgreen
+ * @brief Declaration of the Vgreen class as the Vgreen structure
+ */
+typedef struct sVgreen Vgreen;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vgreen: Inlineable methods (vgreen.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+#if !defined(VINLINE_VGREEN)
+
+ /** @brief Get the atom list associated with this Green's function object
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @return Pointer to Valist object associated with this Green's function
+ * object
+ */
+ VEXTERNC Valist* Vgreen_getValist(Vgreen *thee);
+
+ /** @brief Return the memory used by this structure (and its contents)
+ * in bytes
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @return The memory used by this structure and its contents in bytes
+ */
+ VEXTERNC unsigned long int Vgreen_memChk(Vgreen *thee);
+
+#else /* if defined(VINLINE_VGREEN) */
+# define Vgreen_getValist(thee) ((thee)->alist)
+# define Vgreen_memChk(thee) (Vmem_bytes((thee)->vmem))
+#endif /* if !defined(VINLINE_VGREEN) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vgreen: Non-Inlineable methods (vgreen.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct the Green's function oracle
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param alist Atom (charge) list associated with object
+ * @return Pointer to newly allocated Green's function oracle
+ */
+VEXTERNC Vgreen* Vgreen_ctor(Valist *alist);
+
+/** @brief FORTRAN stub to construct the Green's function oracle
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Pointer to memory allocated for object
+ * @param alist Atom (charge) list associated with object
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_ctor2(Vgreen *thee, Valist *alist);
+
+/** @brief Destruct the Green's function oracle
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Pointer to memory location for object
+ */
+VEXTERNC void Vgreen_dtor(Vgreen **thee);
+
+/** @brief FORTRAN stub to destruct the Green's function oracle
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Pointer to object
+ */
+VEXTERNC void Vgreen_dtor2(Vgreen *thee);
+
+/** @brief Get the Green's function for Helmholtz's equation integrated over
+ * the atomic point charges
+ *
+ * Returns the potential \f$\phi\f$ defined by
+ * \f[ \phi(r) = \sum_i \frac{q_i e^{-\kappa r_i}}{r_i} \f]
+ *
+ * where \f$\kappa\f$ is the inverse screening length (in Å)
+ * \f$q_i\f$ is the atomic charge (in e), and \f$r_i\f$ r_i is the
+ * distance from atom \f$i\f$ to the observation point \f$r\f$. The
+ * potential is scaled to units of V.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @bug Not implemented yet
+ * @note Not implemented yet
+ * @param thee Vgreen object
+ * @param npos Number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param val The npos values
+ * @param kappa The value of \f$\kappa\f$ (see above)
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_helmholtz(Vgreen *thee, int npos, double *x, double *y,
+ double *z, double *val, double kappa);
+
+/** @brief Get the gradient of Green's function for Helmholtz's equation
+ * integrated over the atomic point charges
+ *
+ * Returns the field \f$\nabla \phi\f$ defined by
+ * \f[ \nabla \phi(r) = \nabla \sum_i \frac{q_i e^{-\kappa r_i}}{r_i}
+ * \f]
+ *
+ * where \f$\kappa\f$ is the inverse screening length (in Å).
+ * \f$q_i\f$ is the atomic charge (in e), and \f$r_i\f$ r_i is the
+ * distance from atom \f$i\f$ to the observation point \f$r\f$. The
+ * potential is scaled to units of V/Å.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @bug Not implemented yet
+ * @note Not implemented yet
+ * @param thee Vgreen object
+ * @param npos The number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param gradx The npos gradient x-components
+ * @param grady The npos gradient y-components
+ * @param gradz The npos gradient z-components
+ * @param kappa The value of \f$\kappa\f$ (see above)
+ * @return int 1 if sucessful, 0 otherwise
+ */
+VEXTERNC int Vgreen_helmholtzD(Vgreen *thee, int npos, double *x, double *y,
+ double *z, double *gradx, double *grady, double *gradz, double kappa);
+
+/** @brief Get the Coulomb's Law Green's function (solution to Laplace's
+ * equation) integrated over the atomic point charges using direct
+ * summation
+ *
+ * Returns the potential \f$\phi\f$ defined by
+ * \f[ \phi(r) = \sum_i \frac{q_i}{r_i} \f]
+ * where \f$q_i\f$ is the atomic charge (in e) and \f$r_i\f$ is the
+ * distance to the observation point \f$r\f$. The potential is
+ * scaled to units of V.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @param npos The number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param val The npos values
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_coulomb_direct(Vgreen *thee, int npos, double *x,
+ double *y, double *z, double *val);
+
+/** @brief Get the Coulomb's Law Green's function (solution to Laplace's
+ * equation) integrated over the atomic point charges using direct
+ * summation or H. E. Johnston, R. Krasny FMM library (if available)
+ *
+ * Returns the potential \f$\phi\f$ defined by
+ * \f[ \phi(r) = \sum_i \frac{q_i}{r_i} \f]
+ * where \f$q_i\f$ is the atomic charge (in e) and \f$r_i\f$ is the
+ * distance to the observation point \f$r\f$. The potential is
+ * scaled to units of V.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @param npos The number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param val The npos values
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_coulomb(Vgreen *thee, int npos, double *x, double *y,
+ double *z, double *val);
+
+/** @brief Get gradient of the Coulomb's Law Green's function (solution to
+ * Laplace's equation) integrated over the atomic point charges using
+ * direct summation
+ *
+ * Returns the field \f$\nabla \phi\f$ defined by
+ * \f[ \nabla \phi(r) = \sum_i \frac{q_i}{r_i} \f]
+ * where \f$q_i\f$ is the atomic charge (in e) and \f$r_i\f$ is the
+ * distance to the observation point \f$r\f$. The field is
+ * scaled to units of V/Å.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @param npos The number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param pot The npos potential values
+ * @param gradx The npos gradient x-components
+ * @param grady The npos gradient y-components
+ * @param gradz The npos gradient z-components
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_coulombD_direct(Vgreen *thee, int npos, double *x,
+ double *y, double *z, double *pot, double *gradx, double *grady, double
+ *gradz);
+
+/** @brief Get gradient of the Coulomb's Law Green's function (solution to
+ * Laplace's equation) integrated over the atomic point charges using
+ * either direct summation or H. E. Johnston/R. Krasny FMM library
+ * (if available)
+ *
+ * Returns the field \f$\nabla \phi\f$ defined by
+ * \f[ \nabla \phi(r) = \sum_i \frac{q_i}{r_i} \f]
+ * where \f$q_i\f$ is the atomic charge (in e) and \f$r_i\f$ is the
+ * distance to the observation point \f$r\f$. The field is
+ * scaled to units of V/Å.
+ *
+ * @ingroup Vgreen
+ * @author Nathan Baker
+ * @param thee Vgreen object
+ * @param npos The number of positions to evaluate
+ * @param x The npos x-coordinates
+ * @param y The npos y-coordinates
+ * @param z The npos z-coordinates
+ * @param pot The npos potential values
+ * @param gradx The npos gradient x-components
+ * @param grady The npos gradient y-components
+ * @param gradz The npos gradient z-components
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vgreen_coulombD(Vgreen *thee, int npos, double *x, double *y,
+ double *z, double *pot, double *gradx, double *grady, double *gradz);
+
+#endif /* ifndef _VGREEN_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vhal.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vhal.h
new file mode 100644
index 0000000000000000000000000000000000000000..de71653d84d4e69e34c0c9a7542ef845739b1957
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vhal.h
@@ -0,0 +1,971 @@
+/** @defgroup Vhal Vhal class
+ * @brief A "class" which consists solely of macro definitions which are
+ * used by several other classes
+ */
+
+/**
+ * @file vhal.h
+ * @ingroup Vhal
+ * @brief Contains generic macro definitions for APBS
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the Pacific Northwest National Laboratory, operated by Battelle Memorial Institute, Pacific Northwest Division for the U.S. Department Energy. Portions Copyright (c) 2002-2010, Washington University in St. Louis. Portions Copyright (c) 2002-2010, Nathan A. Baker. Portions Copyright (c) 1999-2002, The Regents of the University of California. Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Washington University in St. Louis nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VAPBSHAL_H_
+#define _VAPBSHAL_H_
+
+#include "stdio.h"
+
+/**
+ * @ingroup Vhal
+ * @author David Gohara
+ * @brief Return code enumerations
+ * @note Note that the enumerated values are opposite the standard for FAILURE and SUCCESS
+ */
+enum eVrc_Codes {
+
+ VRC_WARNING=-1, /** A non-fatal error */
+ VRC_FAILURE=0, /** A fatal error */
+ VRC_SUCCESS=1 /** A successful execution */
+
+};
+typedef enum eVrc_Codes Vrc_Codes;
+
+/**
+ * @ingroup Vhal
+ * @author David Gohara
+ * @brief Solution Method enumerations
+ * @note Note that the enumerated values are opposite the standard for FAILURE and SUCCESS
+ */
+enum eVsol_Meth {
+
+ VSOL_CGMG, /* 0: conjugate gradient multigrid */
+ VSOL_Newton, /* 1: newton */
+ VSOL_MG, /* 2: multigrid */
+ VSOL_CG, /* 3: conjugate gradient */
+ VSOL_SOR, /* 4: sucessive overrelaxation */
+ VSOL_RBGS, /* 5: red-black gauss-seidel */
+ VSOL_WJ, /* 6: weighted jacobi */
+ VSOL_Richardson,/* 7: richardson */
+ VSOL_CGMGAqua, /* 8: conjugate gradient multigrid aqua */
+ VSOL_NewtonAqua /* 9: newton aqua */
+
+};
+typedef enum eVsol_Meth Vsol_Meth;
+
+/**
+ * @ingroup Vhal
+ * @author Nathan Baker
+ * @brief Types of molecular surface definitions
+ */
+enum eVsurf_Meth {
+ VSM_MOL=0, /**< Ion accessibility is defined using inflated van der Waals
+ * radii, the dielectric coefficient ( ) is defined using the
+ * molecular (Conolly) surface definition without
+ * smoothing */
+ VSM_MOLSMOOTH=1, /**< As VSM_MOL but with a simple harmonic average
+ * smoothing */
+ VSM_SPLINE=2, /**< Spline-based surface definitions. This is primarily
+ * for use with force calculations, since it requires
+ * substantial reparameterization of radii. This is based
+ * on the work of Im et al, Comp. Phys. Comm. 111 ,
+ * (1998) and uses a cubic spline to define a smoothly
+ * varying characteristic function for the surface-based
+ * parameters. Ion accessibility is defined using inflated
+ * van der Waals radii with the spline function and the
+ * dielectric coefficient is defined using the standard
+ * van der Waals radii with the spline function. */
+ VSM_SPLINE3=3, /**< A 5th order polynomial spline is used to create
+ * a smoothly varying characteristic function
+ * (continuity through 2nd derivatives) for surface
+ * based paramters. */
+ VSM_SPLINE4=4 /**< A 7th order polynomial spline is used to create
+ * a smoothly varying characteristic function
+ * (continuity through 3rd derivatives) for surface
+ * based paramters. */
+};
+
+/** @typedef Vsurf_Meth
+ * @ingroup Vhal
+ * @brief Declaration of the Vsurf_Meth type as the Vsurf_Meth enum
+ */
+typedef enum eVsurf_Meth Vsurf_Meth;
+
+/**
+ * @brief Version of PBE to solve
+ * @ingroup Vhal
+ */
+enum eVhal_PBEType {
+ PBE_LPBE, /**< Traditional Poisson-Boltzmann equation, linearized */
+ PBE_NPBE, /**< Traditional Poisson-Boltzmann equation, full */
+ PBE_LRPBE, /**< Regularized Poisson-Boltzmann equation, linearized */
+ PBE_NRPBE, /** < Regularized Poisson-Boltzmann equation, full */
+ PBE_SMPBE /**< SM PBE */
+};
+
+/**
+ * @brief Declaration of the Vhal_PBEType type as the Vhal_PBEType enum
+ * @ingroup Vhal
+ */
+typedef enum eVhal_PBEType Vhal_PBEType;
+
+/**
+* @brief Type of ipkey to use for MG methods
+ * @ingroup Vhal
+ */
+enum eVhal_IPKEYType {
+ IPKEY_SMPBE = -2, /**< SMPBE ipkey */
+ IPKEY_LPBE, /**< LPBE ipkey */
+ IPKEY_NPBE /**< NPBE ipkey */
+};
+
+/**
+* @brief Declaration of the Vhal_IPKEYType type as the Vhal_IPKEYType enum
+* @ingroup Vhal
+*/
+typedef enum eVhal_IPKEYType Vhal_IPKEYType;
+
+/**
+* @brief Type of nonlinear to use for MG methods
+ * @ingroup Vhal
+ */
+enum eVhal_NONLINType {
+ NONLIN_LPBE = 0,
+ NONLIN_NPBE,
+ NONLIN_SMPBE,
+ NONLIN_LPBEAQUA,
+ NONLIN_NPBEAQUA
+};
+
+/**
+* @brief Declaration of the Vhal_NONLINType type as the Vhal_NONLINType enum
+* @ingroup Vhal
+*/
+typedef enum eVhal_NONLINType Vhal_NONLINType;
+
+/**
+ * @brief Output file format
+ * @ingroup Vhal
+ */
+enum eVoutput_Format {
+ OUTPUT_NULL, /**< No output */
+ OUTPUT_FLAT, /**< Output in flat-file format */
+};
+
+/**
+ * @brief Declaration of the Voutput_Format type as the VOutput_Format enum
+ * @ingroup Vhal
+ */
+typedef enum eVoutput_Format Voutput_Format;
+
+/**
+ * @ingroup Vhal
+ * @author Nathan Baker
+ * @brief Types of boundary conditions
+ */
+enum eVbcfl {
+ BCFL_ZERO=0, /**< Zero Dirichlet boundary conditions */
+ BCFL_SDH=1, /**< Single-sphere Debye-Huckel Dirichlet boundary
+ * condition */
+ BCFL_MDH=2, /**< Multiple-sphere Debye-Huckel Dirichlet boundary
+ * condition */
+ BCFL_UNUSED=3, /**< Unused boundary condition method (placeholder) */
+ BCFL_FOCUS=4, /**< Focusing Dirichlet boundary condition */
+ BCFL_MEM=5, /**< Focusing membrane boundary condition */
+ BCFL_MAP=6 /**< Skip first level of focusing use an external map */
+};
+
+/**
+ * @brief Declare Vbcfl type
+ * @ingroup Vhal
+ */
+typedef enum eVbcfl Vbcfl;
+
+/**
+ * @ingroup Vhal
+ * @author Nathan Baker
+ * @brief Types of charge discretization methods
+ */
+enum eVchrg_Meth {
+ VCM_TRIL=0, /**< Trilinear interpolation of charge to 8 nearest grid
+ * points. The traditional method; not particularly good to
+ * use with PBE forces. */
+ VCM_BSPL2=1, /**< Cubic B-spline across nearest- and
+ * next-nearest-neighbors. Mainly for use in grid-sensitive
+ * applications (such as force calculations). */
+ VCM_BSPL4=2 /**< 5th order B-spline for AMOEBA permanent multipoles. */
+};
+
+/** @typedef Vchrg_Meth
+ * @ingroup Vhal
+ * @brief Declaration of the Vchrg_Meth type as the Vchrg_Meth enum
+ */
+typedef enum eVchrg_Meth Vchrg_Meth;
+
+/**
+ * @ingroup Vhal
+ * @author Michael Schnieders
+ * @brief Charge source
+ */
+enum eVchrg_Src {
+ VCM_CHARGE=0, /**< Partial Charge source distribution */
+ VCM_PERMANENT=1, /**< Permanent Multipole source distribution */
+ VCM_INDUCED=2, /**< Induced Dipole source distribution */
+ VCM_NLINDUCED=3 /**< NL Induced Dipole source distribution */
+};
+
+/** @typedef Vchrg_Src
+ * @ingroup Vhal
+ * @brief Declaration of the Vchrg_Src type as the Vchrg_Meth enum
+ */
+typedef enum eVchrg_Src Vchrg_Src;
+
+/**
+ * @ingroup Vhal
+ * @author Nathan Baker
+ * @brief Types of (scalar) data that can be written out of APBS
+ */
+enum eVdata_Type {
+ VDT_CHARGE, /**< Charge distribution (e) */
+ VDT_POT, /**< Potential (kT/e) */
+ VDT_ATOMPOT, /**< Atom potential (kT/e) */
+ VDT_SMOL, /**< Solvent accessibility defined by molecular/Connolly
+ * surface definition (1 = accessible, 0 = inaccessible) */
+ VDT_SSPL, /**< Spline-based solvent accessibility (1 = accessible, 0 =
+ * inaccessible) */
+ VDT_VDW, /**< van der Waals-based accessibility (1 = accessible, 0 =
+ * inaccessible) */
+ VDT_IVDW, /**< Ion accessibility/inflated van der Waals (1 =
+ * accessible, 0 = inaccessible) */
+ VDT_LAP, /**< Laplacian of potential (kT/e/A^2) */
+ VDT_EDENS, /**< Energy density \f$\epsilon (\nabla u)^2\f$, where \f$u\f$
+ * is potential (kT/e/A)^2 */
+ VDT_NDENS, /**< Ion number density \f$\sum c_i \exp (-q_i u)^2\f$,
+ * where \f$u\f$ is potential (output in M) */
+ VDT_QDENS, /**< Ion charge density \f$\sum q_i c_i \exp (-q_i u)^2\f$,
+ * where \f$u\f$ is potential (output in \f$e_c M\f$) */
+ VDT_DIELX, /**< Dielectric x-shifted map as calculated with the currently
+ * specified scheme (dimensionless) */
+ VDT_DIELY, /**< Dielectric y-shifted map as calculated with the currently
+ * specified scheme (dimensionless) */
+ VDT_DIELZ, /**< Dielectric y-shifted map as calculated with the currently
+ * specified scheme (dimensionless) */
+ VDT_KAPPA /**< Kappa map as calculated with the currently
+ * specified scheme (\f$\AA^{-3}\f$) */
+};
+
+/** @typedef Vdata_Type
+ * @ingroup Vhal
+ * @brief Declaration of the Vdata_Type type as the Vdata_Type enum
+ */
+typedef enum eVdata_Type Vdata_Type;
+
+/**
+ * @ingroup Vhal
+ * @author Nathan Baker
+ * @brief Format of data for APBS I/O
+ */
+enum eVdata_Format {
+ VDF_DX=0, /**< OpenDX (Data Explorer) format */
+ VDF_UHBD=1, /**< UHBD format */
+ VDF_AVS=2, /**< AVS UCD format */
+ VDF_MCSF=3, /**< FEtk MC Simplex Format (MCSF) */
+ VDF_GZ=4, /**< Binary file (GZip) */
+ VDF_FLAT=5, /**< Write flat file */
+ VDF_DXBIN=6 /**< OpendDX (Data Explorer) binary format */
+};
+
+/** @typedef Vdata_Format
+ * @ingroup Vhal
+ * @brief Declaration of the Vdata_Format type as the Vdata_Format enum
+ */
+typedef enum eVdata_Format Vdata_Format;
+
+/**
+ * @brief APBS total execution timer ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_WALL_CLOCK 26
+
+/**
+ * @brief APBS setup timer ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_SETUP 27
+
+/**
+ * @brief APBS solver timer ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_SOLVER 28
+
+/**
+ * @brief APBS energy timer ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_ENERGY 29
+
+/**
+ * @brief APBS force timer ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_FORCE 30
+
+/**
+ * @brief APBS temp timer #1 ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_TEMP1 31
+
+/**
+ * @brief APBS temp timer #2 ID
+ * @ingroup Vhal
+ */
+#define APBS_TIMER_TEMP2 32
+
+/** @brief The maximum number of molecules that can be involved in a single
+ * PBE calculation
+ * @ingroup Vhal
+ */
+#define MAXMOL 5
+
+/** @brief The maximum number of ion species that can be involved in a single
+ * PBE calculation
+ * @ingroup Vhal
+ */
+#define MAXION 10
+
+/** @brief The maximum number of times an MG calculation can be focused
+ * @ingroup Vhal
+ */
+#define MAXFOCUS 5
+
+/** @brief Minimum number of levels in a multigrid calculations
+ * @ingroup Vhal
+ */
+#define VMGNLEV 4
+
+/** @brief Maximum reduction of grid spacing during a focusing calculation
+ * @ingroup Vhal
+ */
+#define VREDFRAC 0.25
+
+/** @brief Number of vertices per simplex (hard-coded to 3D)
+ * @ingroup Vhal
+ */
+#define VAPBS_NVS 4
+
+/** @brief Our dimension
+ * @ingroup Vhal
+ */
+#define VAPBS_DIM 3
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_RIGHT 0
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_FRONT 1
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_UP 2
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_LEFT 3
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_BACK 4
+
+/** @brief Face definition for a volume
+ * @note Consistent with PMG if RIGHT = EAST, BACK = SOUTH
+ * @ingroup Vhal
+ */
+#define VAPBS_DOWN 5
+
+/** @brief A small number used in Vpmg to decide if points are on/off
+ * grid-lines or non-zer0 (etc.)
+ * @ingroup Vhal
+ */
+#define VPMGSMALL 1e-12
+
+/** @brief Used to set the min values acceptable for sinh chopping
+ * @def SINH_MIN
+ * @ingroup Vhal
+ */
+#define SINH_MIN -85.0
+
+/** @brief Used to set the max values acceptable for sinh chopping
+ * @def SINH_MAX
+ * @ingroup Vhal
+ */
+#define SINH_MAX 85.0
+
+#define MAX_HASH_DIM 75
+
+#if defined(VDEBUG)
+# if !defined(APBS_NOINLINE)
+# define APBS_NOINLINE 1
+# endif
+#endif
+
+#if !defined(APBS_NOINLINE)
+
+/** @brief Turns on inlining macros in Vacc class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VACC
+
+/** @brief Turns on inlining macros in Vatom class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VATOM
+
+/** @brief Turns on inlining macros in Vcsm class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VCSM
+
+/** @brief Turns on inlining macros in Vpbe class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VPBE
+
+/** @brief Turns on inlining macros in Vpee class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VPEE
+
+/** @brief Turns on inlining macros in Vgreen class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VGREEN
+
+/** @brief Turns on inlining macros in Vfetk class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VFETK
+
+/** @brief Turns on inlining macros in Vpmg class if defined
+ * @ingroup Vhal
+ */
+# define VINLINE_VPMG
+
+/** @brief Defines the maximum hash table size in any direction
+ * @ingroup Vhal
+ */
+
+#endif
+
+/* Fortran name mangling */
+#if defined(VF77_UPPERCASE)
+# if defined(VF77_NOUNDERSCORE)
+# define VF77_MANGLE(name,NAME) NAME
+# elif defined(VF77_ONEUNDERSCORE)
+# define VF77_MANGLE(name,NAME) NAME ## _
+# else
+# define VF77_MANGLE(name,NAME) name
+# endif
+#else
+# if defined(VF77_NOUNDERSCORE)
+# define VF77_MANGLE(name,NAME) name
+# elif defined(VF77_ONEUNDERSCORE)
+# define VF77_MANGLE(name,NAME) name ## _
+# else
+ /** @brief Name-mangling macro for using FORTRAN functions in C code
+ * @ingroup Vhal
+ */
+# define VF77_MANGLE(name,NAME) name
+# endif
+#endif
+
+/* Floating Point Error */
+#if defined(FLOAT_EPSILON)
+# define VFLOOR(value) \
+ ((floor(value) != floor(value + FLOAT_EPSILON)) ? \
+ floor(value + FLOAT_EPSILON) : floor(value))
+#else
+ /** @brief Wrapped floor to fix floating point issues in the Intel
+ * compiler
+ * @author Todd Dolinksy
+ * @ingroup Vhal
+ */
+# define VFLOOR(value) floor(value)
+#endif
+
+/* String embedding for ident */
+#if defined(HAVE_EMBED)
+/**
+ * @brief Allows embedding of RCS ID tags in object files.
+ * @author Mike Holst
+ * @ingroup Vhal */
+# define VEMBED(rctag) \
+ VPRIVATE const char* rctag; \
+ static void* use_rcsid=(0 ? &use_rcsid : (void**)&rcsid);
+#else
+/**
+ * @brief Allows embedding of RCS ID tags in object files.
+ * @author Mike Holst
+ * @ingroup Vhal */
+# define VEMBED(rctag)
+#endif /* if defined(HAVE_EMBED) */
+
+
+
+/** OS specific flags and etcetera */
+#if !defined(_WIN32) || defined(__MINGW32__)
+#define PRINT_FUNC __PRETTY_FUNCTION__
+#define OS_SEP_STR "/"
+#define OS_SEP_CHAR '/'
+#else
+#define OS_SEP_STR "\\"
+#define OS_SEP_CHAR '\\'
+#define PRINT_FUNC __FUNCSIG__
+#define snprintf sprintf_s
+#endif
+
+#ifdef VERGBOSE_DEBUG
+#define ANNOUNCE_FUNCTION \
+ do { \
+ Vnm_prrint(2, "%s() [%s:%d]\n", \
+ PRINT_FUNC, __FILE__, __LINE__ ); \
+ } while(0)
+
+#define WARN_UNTESTED \
+ do { \
+ Vnm_print(2, "%s() [%s:%d]: Untested Translation!\n", \
+ __FUNCTION__, __FILE__, __LINE__); \
+ } while(0)
+
+#define WARN_PARTTESTED \
+ do{ \
+ Vnm_print(2, "%s() [%s:%d]: Partially Tested Translation.\n", \
+ __FUNCTION__, __FILE__, __LINE__); \
+ } while(0)
+#else
+#define ANNOUNCE_FUNCTION
+#define WARN_UNTESTED
+#define WARN_PARTTESTED
+#endif
+
+
+
+/* Utility messages. Print out messages with location information */
+#ifdef DEBUG
+#define VCHANNELEDMESSAGE0(channel, msg) \
+ do { \
+ Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, msg); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE1(channel, msg, arg) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg ); \
+ Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, buff); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE2(channel, msg, arg0, arg1) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1 ); \
+ Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, buff); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE3(channel, msg, arg0, arg1, arg2) \
+ do { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0, arg1, arg2); \
+ Vnm_print(channel, "%s:%d [%s()]: MESSAGE:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, buff); \
+ } while(0)
+
+#define VMESSAGE0(msg) VCHANNELEDMESSAGE0(2, msg)
+#define VMESSAGE1(msg, arg0) VCHANNELEDMESSAGE1(2, msg, arg0)
+#define VMESSAGE2(msg, arg0, arg1) VCHANNELEDMESSAGE2(2, msg, arg0, arg1)
+#define VMESSAGE3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(2, msg, arg0, arg1, arg2)
+
+#define VERRMSG0(msg) VMESSAGE0(msg)
+#define VERRMSG1(msg, arg0) VMESSAGE1(msg, arg0)
+#define VERRMSG2(msg, arg0, arg1) VMESSAGE2(msg, arg0, arg1)
+#define VERRMSG3(msg, arg0, arg1, arg2) VMESSAGE3(msg, arg0, arg1, arg2)
+#else
+#define VCHANNELEDMESSAGE0(channel, msg) \
+ do { \
+ Vnm_print(channel, "%s: %s\n", __FUNCTION__, msg); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE1(channel, msg, arg0) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0 ); \
+ Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE2(channel, msg, arg0, arg1) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1 ); \
+ Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
+ } while(0)
+
+#define VCHANNELEDMESSAGE3(channel, msg, arg0, arg1, arg2) \
+ do { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0, arg1, arg2); \
+ Vnm_print(channel, "%s: %s\n", __FUNCTION__, buff); \
+ } while(0)
+
+#define VMESSAGE0(msg) VCHANNELEDMESSAGE0(0, msg)
+#define VMESSAGE1(msg, arg0) VCHANNELEDMESSAGE1(0, msg, arg0)
+#define VMESSAGE2(msg, arg0, arg1) VCHANNELEDMESSAGE2(0, msg, arg0, arg1)
+#define VMESSAGE3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(0, msg, arg0, arg1, arg2)
+
+#define VERRMSG0(msg) VCHANNELEDMESSAGE0(2, msg)
+#define VERRMSG1(msg, arg0) VCHANNELEDMESSAGE1(2, msg, arg0)
+#define VERRMSG2(msg, arg0, arg1) VCHANNELEDMESSAGE2(2, msg, arg0, arg1)
+#define VERRMSG3(msg, arg0, arg1, arg2) VCHANNELEDMESSAGE3(2, msg, arg0, arg1, arg2)
+#endif
+
+
+
+/* Utility assertions. If they fail, they print out messages with possible
+ * arguments and then abort
+ * The do{...} while(0) simply enforces that a semicolon appears at the end
+ */
+#ifdef DEBUG
+#define VASSERT_MSG0(cnd, msg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, #cnd, msg); \
+ abort(); \
+ } \
+ } while(0)
+
+#define VASSERT_MSG1(cnd, msg, arg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg ); \
+ Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, #cnd, buff); \
+ abort(); \
+ } \
+ } while(0)
+
+#define VASSERT_MSG2(cnd, msg, arg0, arg1) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1 ); \
+ Vnm_print(2, "%s:%d [%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, #cnd, buff); \
+ abort(); \
+ } \
+ } while(0)
+#else
+#define VASSERT_MSG0(cnd, msg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ Vnm_print(2, "%[%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FUNCTION__, #cnd, msg); \
+ abort(); \
+ } \
+ } while(0)
+
+#define VASSERT_MSG1(cnd, msg, arg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg ); \
+ Vnm_print(2, "[%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FUNCTION__, #cnd, buff); \
+ abort(); \
+ } \
+ } while(0)
+
+#define VASSERT_MSG2(cnd, msg, arg0, arg1) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1 ); \
+ Vnm_print(2, "[%s()]: ERROR:\n" \
+ " Assertion Failed (%s): %s\n\n", \
+ __FUNCTION__, #cnd, buff); \
+ abort(); \
+ } \
+ } while(0)
+#endif
+
+
+
+/* Utility warning. Tests a condition and if it fails prints out a message
+ * with optional arguments
+ * The do{...} while(0) simply enforces that a semicolon at the end
+ */
+#ifdef DEBUG
+#define VWARN_MSG0(cnd, msg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ Vnm_print( \
+ 2, \
+ "%s:%d [%s()]: WARNING:\n" \
+ " Condition Failed (%s):\n %s\n\n", \
+ __FILE__, \
+ __LINE__, \
+ __FUNCTION__, \
+ #cnd, \
+ msg \
+ ); \
+ } \
+ } while(0)
+
+#define VWARN_MSG1(cnd, msg, arg0) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0); \
+ Vnm_print( \
+ 2, \
+ "%s:%d [%s()]: WARNING:\n" \
+ " Condition Failed (%s):\n %s\n\n", \
+ __FILE__, \
+ __LINE__, \
+ __FUNCTION__, \
+ #cnd, \
+ buff \
+ ); \
+ } \
+ } while(0)
+
+#define VWARN_MSG2(cnd, msg, arg0, arg1) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0, arg1); \
+ Vnm_print( \
+ 2, \
+ "%s:%d [%s()]: WARNING:\n" \
+ " Condition Failed (%s):\n %s\n\n", \
+ __FILE__, \
+ __LINE__, \
+ __FUNCTION__, \
+ #cnd, \
+ buff \
+ ); \
+ } \
+ } while(0)
+#else
+#define VWARN_MSG0(cnd, msg) \
+ do { \
+ if( (cnd) == 0 ) { \
+ Vnm_print( \
+ 2, \
+ "[%s()]: WARNING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, \
+ msg \
+ ); \
+ } \
+ } while(0)
+
+#define VWARN_MSG1(cnd, msg, arg0) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0); \
+ Vnm_print( \
+ 2, \
+ "[%s()]: WARNING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, \
+ buff \
+ ); \
+ } \
+ } while(0)
+
+#define VWARN_MSG2(cnd, msg, arg0, arg1) \
+ do { \
+ if( (cnd) == 0 ) { \
+ char buff[1000]; \
+ snprintf(buff, 1000, msg, arg0, arg1); \
+ Vnm_print( \
+ 2, \
+ "[%s()]: WARNING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, \
+ buff \
+ ); \
+ } \
+ } while(0)
+#endif
+
+/* Utility Abort. Prints a message with optional arugments and aborts */
+#ifdef DEBUG
+#define VABORT_MSG0(msg) \
+ do { \
+ Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, msg); \
+ abort(); \
+ } while(0)
+
+#define VABORT_MSG1(msg, arg) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg ); \
+ Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, buff); \
+ abort(); \
+ } while(0)
+
+#define VABORT_MSG2(msg, arg0, arg1) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1); \
+ Vnm_print(2, "%s:%d [%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, buff); \
+ abort(); \
+ } while(0)
+#else
+#define VABORT_MSG0(msg) \
+ do { \
+ Vnm_print(2, "%[%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, msg); \
+ abort(); \
+ } while(0)
+
+#define VABORT_MSG1(msg, arg) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg ); \
+ Vnm_print(2, "[%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, buff); \
+ abort(); \
+ } while(0)
+
+#define VABORT_MSG2(msg, arg0, arg1) \
+ do { \
+ char buff[1000]; \
+ snprintf( buff, 1000, msg, arg0, arg1); \
+ Vnm_print(2, "[%s()]: ABORTING:\n" \
+ " %s\n\n", \
+ __FUNCTION__, buff); \
+ abort(); \
+ } while(0)
+#endif
+
+
+
+/* Utility expression printers. Print the expression and its value */
+#ifdef DEBUG
+#define PRINT_INT(expr) \
+ do { \
+ Vnm_print(2, "%s:%d [%s()]: %s == %d\n", \
+ __FILE__, __LINE__, __FUNCTION__, #expr, expr); \
+ } while(0)
+
+#define PRINT_DBL(expr) \
+ do { \
+ Vnm_print(2, "%s:%d [%s()]: %s == %f\n\n", \
+ __FILE__, __LINE__, __FUNCTION__, #expr, expr); \
+ } while(0)
+#else
+#define PRINT_INT(expr)
+#define PRINT_DBL(expr)
+#endif
+
+#define VMALLOC(vmem, n, type) ((type*)Vmem_malloc(vmem, n, sizeof(type)))
+
+#define VFREE(vmem, n, type, ptr) (Vmem_free(vmem, n, sizeof(type), (void **)&(ptr)))
+
+#define VFILL(vec, n, val) \
+ do { \
+ int fill_idx; \
+ for (fill_idx = 0; fill_idx < n; fill_idx++) \
+ vec[fill_idx] = val; \
+ } while(0)
+
+#define VCOPY(srcvec, dstvec, i, n) \
+ do { \
+ for (i = 0; i < n; i++) \
+ dstvec[i] = srcvec[i]; \
+ } while(0)
+
+
+char* wrap_text( char* str, int right_margin, int left_padding );
+
+#define VAT(array, i) ((array)[(i) - 1])
+#define RAT(array, i) ((array) + i - 1)
+
+#endif /* #ifndef _VAPBSHAL_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vmatrix.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vmatrix.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c1ffcd928e91f9f4329345dbd1df81c5f7cb988
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vmatrix.h
@@ -0,0 +1,89 @@
+/** @defgroup Vmatrix Matrix wrapper class
+ * @brief A header for including data wrapping matrices
+ */
+
+/**
+ * @file vmatrix.h
+ * @ingroup Vmatrix
+ * @brief Contains inclusions for matrix data wrappers
+ * @version
+ * @author Tucker A. Beck
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory,
+ * operated by Battelle Memorial Institute,
+ * Pacific Northwest Division for the U.S. Department Energy.
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of California
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of Washington University in St. Louis nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VMATRIX_H_
+#define _VMATRIX_H_
+
+#define MAT2(mat, dx, dy) \
+ int dx_##mat = dx; \
+ int dy_##mat = dy
+
+#define RAT2(mat, x, y) \
+ &VAT2(mat, x, y)
+
+#define VAT2(mat, x, y) \
+ mat[(y - 1) * dx_##mat + (x - 1)]
+
+
+
+#define MAT3(mat, dx, dy, dz) \
+ int dx_##mat = dx; \
+ int dy_##mat = dy; \
+ int dz_##mat = dz
+
+#define RAT3(mat, x, y, z) \
+ &VAT3(mat, x, y, z)
+
+#define VAT3(mat, x, y, z) \
+ mat[(z - 1) * dy_##mat * dx_##mat + \
+ (y - 1) * dx_##mat + \
+ (x - 1)]
+
+#endif /* _VMATRIX_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vparam.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vparam.h
new file mode 100644
index 0000000000000000000000000000000000000000..11db95b97de7bd6c56f7ceff60027e68b5e378af
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vparam.h
@@ -0,0 +1,351 @@
+/** @defgroup Vparam Vparam class
+ * @brief Reads and assigns charge/radii parameters
+ */
+
+/**
+ * @file vparam.h
+ * @ingroup Vparam
+ * @brief Contains declarations for class Vparam
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VPARAM_H_
+#define _VPARAM_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+#if defined(HAVE_MC)
+#include "mc/mc.h"
+#endif
+
+#include "generic/vhal.h"
+#include "generic/vunit.h"
+#include "generic/vstring.h"
+
+/**
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @brief AtomData sub-class; stores atom data
+ * @note The epsilon and radius members of this class refer use the following
+ * formula for calculating the van der Waals energy of atom \f$i\f$
+ * interacting with atom \f$j\f$:
+ * \f[ V_{ij}(r_{ij}) = \epsilon_{ij} \left[
+ * \left( \frac{\sigma_{ij}}{r_{ij}} \right)^{12} - 2
+ * \left( \frac{\sigma_{ij}}{r_{ij}} \right)^{6} \right]
+ * \f]
+ * where \f$\epsilon_{ij} = \sqrt{\epsilon_i \epsilon_j}\f$ is the well-depth
+ * (in the desired energy units), \f$r_{ij}\f$ is the distance between atoms
+ * \f$i\f$ and \f$j\f$, and \f$\sigma_{ij} = \sigma_i + \sigma_j\f$ is the sum
+ * of the van der Waals radii.
+ */
+struct sVparam_AtomData {
+ char atomName[VMAX_ARGLEN]; /**< Atom name */
+ char resName[VMAX_ARGLEN]; /**< Residue name */
+ double charge; /**< Atom charge (in e) */
+ double radius; /**< Atom VdW radius (\f$\sigma_i\f$ above; in Å) */
+ double epsilon; /**< Atom VdW well depth (\f$\epsilon_i\f$ above; in
+ * kJ/mol) */
+};
+
+/**
+ * @ingroup Vparam
+ * @brief Declaration of the Vparam_AtomData class as the sVparam_AtomData
+ * structure
+ */
+typedef struct sVparam_AtomData Vparam_AtomData;
+
+/**
+ * @struct Vparam_ResData
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @brief ResData sub-class; stores residue data
+ */
+struct Vparam_ResData {
+ Vmem *vmem; /**< Pointer to memory manager from Vparam master class */
+ char name[VMAX_ARGLEN]; /**< Residue name */
+ int nAtomData; /**< Number of Vparam_AtomData objects associated with
+ * this object */
+ Vparam_AtomData *atomData; /**< Array of Vparam_AtomData natom objects */
+};
+
+/** @typedef Vparam_ResData
+ * @ingroup Vparam
+ * @brief Declaration of the Vparam_ResData class as the Vparam_ResData
+ * structure
+ */
+typedef struct Vparam_ResData Vparam_ResData;
+
+/**
+ * @struct Vparam
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @brief Reads and assigns charge/radii parameters
+ */
+struct Vparam {
+
+ Vmem *vmem; /**< Memory management object for this class */
+ int nResData; /**< Number of Vparam_ResData objects associated with
+ * this object */
+ Vparam_ResData *resData; /**< Array of nResData Vparam_ResData objects */
+};
+
+/** @typedef Vparam
+ * @ingroup Vparam
+ * @brief Declaration of the Vparam class as the Vparam structure
+ */
+typedef struct Vparam Vparam;
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vparam: Inlineable methods (vparam.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+#if !defined(VINLINE_VPARAM)
+
+ /** @brief Get number of bytes in this object and its members
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Vparam object
+ * @returns Number of bytes allocated for object
+ */
+ VEXTERNC unsigned long int Vparam_memChk(Vparam *thee);
+
+#else /* if defined(VINLINE_VPARAM) */
+
+# define Vparam_memChk(thee) (Vmem_bytes((thee)->vmem))
+
+#endif /* if !defined(VINLINE_VPARAM) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+// Class Vparam: Non-Inlineable methods (vparam.c)
+/////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @returns Newly allocated object */
+VEXTERNC Vparam_AtomData* Vparam_AtomData_ctor();
+
+/** @brief FORTRAN stub to construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Allocated memory
+ * @returns 1 if successful, 0 otherwise */
+VEXTERNC int Vparam_AtomData_ctor2(Vparam_AtomData *thee);
+
+/** @brief Destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to memory location of object */
+VEXTERNC void Vparam_AtomData_dtor(Vparam_AtomData **thee);
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to object */
+VEXTERNC void Vparam_AtomData_dtor2(Vparam_AtomData *thee);
+
+/**
+ * @brief Copy current atom object to destination
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to source object
+ * @param dest Pointer to destination object
+ */
+VEXTERNC void Vparam_AtomData_copyTo(Vparam_AtomData *thee,
+ Vparam_AtomData *dest);
+
+/**
+ * @brief Copy current residue object to destination
+ * @ingroup Vparam
+ * @author Todd Dolinsky
+ * @param thee Pointer to source object
+ * @param dest Pointer to destination object
+ */
+VEXTERNC void Vparam_ResData_copyTo(Vparam_ResData *thee,
+ Vparam_ResData *dest);
+
+/**
+ * @brief Copy current atom object from another
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to destination object
+ * @param src Pointer to source object
+ */
+VEXTERNC void Vparam_AtomData_copyFrom(Vparam_AtomData *thee,
+ Vparam_AtomData *src);
+
+/** @brief Construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param mem Memory object of Vparam master class
+ * @returns Newly allocated object */
+VEXTERNC Vparam_ResData* Vparam_ResData_ctor(Vmem *mem);
+
+/** @brief FORTRAN stub to construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Allocated memory
+ * @param mem Memory object of Vparam master class
+ * @returns 1 if successful, 0 otherwise */
+VEXTERNC int Vparam_ResData_ctor2(Vparam_ResData *thee, Vmem *mem);
+
+/** @brief Destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to memory location of object */
+VEXTERNC void Vparam_ResData_dtor(Vparam_ResData **thee);
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to object */
+VEXTERNC void Vparam_ResData_dtor2(Vparam_ResData *thee);
+
+/** @brief Construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @returns Newly allocated Vparam object */
+VEXTERNC Vparam* Vparam_ctor();
+
+/** @brief FORTRAN stub to construct the object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Allocated Vparam memory
+ * @returns 1 if successful, 0 otherwise */
+VEXTERNC int Vparam_ctor2(Vparam *thee);
+
+/** @brief Destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to memory location of object */
+VEXTERNC void Vparam_dtor(Vparam **thee);
+
+/** @brief FORTRAN stub to destroy object
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Pointer to object */
+VEXTERNC void Vparam_dtor2(Vparam *thee);
+
+/** @brief Get residue data
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Vparam object
+ * @param resName Residue name
+ * @returns Pointer to the desired residue object or VNULL if residue not
+ * found
+ * @note Some method to initialize the database must be called before this
+ * method (e.g., @see Vparam_readFlatFile)
+ */
+VEXTERNC Vparam_ResData* Vparam_getResData(Vparam *thee,
+ char resName[VMAX_ARGLEN]);
+
+/** @brief Get atom data
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Vparam object
+ * @param resName Residue name
+ * @param atomName Atom name
+ * @returns Pointer to the desired atom object or VNULL if residue not
+ * found
+ * @note Some method to initialize the database must be called before this
+ * method (e.g., @see Vparam_readFlatFile)
+ */
+VEXTERNC Vparam_AtomData* Vparam_getAtomData(Vparam *thee,
+ char resName[VMAX_ARGLEN], char atomName[VMAX_ARGLEN]);
+
+/** @brief Read a flat-file format parameter database
+ * @ingroup Vparam
+ * @author Nathan Baker
+ * @param thee Vparam object
+ * @param iodev Input device type (FILE/BUFF/UNIX/INET)
+ * @param iofmt Input device format (ASCII/XDR)
+ * @param thost Input hostname (for sockets)
+ * @param fname Input FILE/BUFF/UNIX/INET name
+ * (see note below for format)
+ * @returns 1 if successful, 0 otherwise
+ * @note The database file should have the following format:
+ *
+ * RESIDUE ATOM CHARGE RADIUS EPSILON
+ *
+ * where RESIDUE is the residue name string, ATOM is the atom name string,
+ * CHARGE is the charge in e, RADIUS is the van der Waals radius
+ * (\f$\sigma_i\f$) in Å, and EPSILON is the van der Waals well-depth
+ * (\f$\epsilon_i\f$) in kJ/mol. See the Vparam structure documentation for
+ * the precise definitions of \f$\sigma_i\f$ and \f$\epsilon_i\f$.
+ *
+ * ASCII-format flat files are provided with the APBS source code:
+ *
+ * - tools/conversion/vparam-amber-parm94.dat
+ *
- AMBER parm94 parameters
+ *
- tools/conversion/vparam-charmm-par_all27.dat
+ *
- CHARMM par_all27_prot_na parameters
+ *
+ * */
+VEXTERNC int Vparam_readFlatFile(Vparam *thee, const char *iodev,
+ const char *iofmt, const char *thost, const char *fname);
+
+/** @brief Read an XML format parameter database
+ * @ingroup Vparam
+ * @author Todd Dolinsky
+ * @param thee Vparam object
+ * @param iodev Input device type (FILE/BUFF/UNIX/INET)
+ * @param iofmt Input device format (ASCII/XDR)
+ * @param thost Input hostname (for sockets)
+ * @param fname Input FILE/BUFF/UNIX/INET name
+ * @returns 1 if successful, 0 otherwise
+ * */
+VEXTERNC int Vparam_readXMLFile(Vparam *thee, const char *iodev,
+ const char *iofmt, const char *thost, const char *fname);
+
+#endif /* ifndef _VPARAM_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vpbe.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vpbe.h
new file mode 100644
index 0000000000000000000000000000000000000000..77930a07267722a49100434a498c7ed2ee7e21a6
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vpbe.h
@@ -0,0 +1,508 @@
+/** @defgroup Vpbe Vpbe class
+* @brief The Poisson-Boltzmann master class
+*
+* Contains objects and parameters used in every PBE calculation,
+* regardless of method.
+*
+*/
+
+/**
+ * @file vpbe.h
+ * @ingroup Vpbe
+ * @brief Contains declarations for class Vpbe
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VPBE_H_
+#define _VPBE_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+#include "generic/vunit.h"
+#include "generic/vatom.h"
+#include "generic/vacc.h"
+#include "generic/vclist.h"
+
+/**
+* @ingroup Vpbe
+ * @author Nathan Baker
+ * @brief Contains public data members for Vpbe class/module
+ */
+struct sVpbe {
+
+ Vmem *vmem; /**< Memory management object */
+
+ Valist *alist; /**< Atom (charge) list */
+ Vclist *clist; /**< Atom location cell list */
+ Vacc *acc; /**< Accessibility object */
+
+ double T; /**< Temperature (K) */
+ double soluteDiel; /**< Solute dielectric constant (unitless) */
+ double solventDiel; /**< Solvent dielectric constant (unitless) */
+ double solventRadius;
+ /**< Solvent probe radius (angstroms) for accessibility;
+ * determining defining volumes for the dielectric
+ * coefficient */
+ double bulkIonicStrength; /**< Bulk ionic strength (M) */
+ double maxIonRadius; /**< Max ion radius (A; used for calculating
+ * accessiblity and defining volumes for ionic
+ * strength coeffcients) */
+ int numIon; /**< Total number of ion species */
+ double ionConc[MAXION]; /**< Concentration (M) of each species */
+ double ionRadii[MAXION]; /**< Ionic radius (A) of each species */
+ double ionQ[MAXION]; /**< Charge (e) of each species */
+
+ double xkappa; /**< Debye-Huckel parameter (bulk) */
+ double deblen; /**< Debye length (bulk) */
+ double zkappa2; /**< Square of modified Debye-Huckel parameter (bulk) */
+ double zmagic; /**< Delta function scaling parameter */
+
+ double soluteCenter[3]; /**< Center of solute molecule (A) */
+ double soluteRadius; /**< Radius of solute molecule (A) */
+ double soluteXlen; /**< Solute length in x-direction */
+ double soluteYlen; /**< Solute length in y-direction */
+ double soluteZlen; /**< Solute length in z-direction */
+ double soluteCharge; /**< Charge of solute molecule (e) */
+
+ double smvolume; /**< Size-Modified PBE relative volume */
+ double smsize; /**< Size-Modified PBE size */
+ int ipkey; /**< PBE calculation type (this is a cached copy
+ * it should not be used directly in code) */
+
+ int paramFlag; /**< Check to see if the parameters have been set */
+
+ /*-------------------------------------------------------*/
+ /* Added by Michael Grabe */
+ /*-------------------------------------------------------*/
+
+ double z_mem; /**< Z value of the botton of the membrane (A) */
+ double L; /**< Length of the membrane (A) */
+ double membraneDiel; /**< Membrane dielectric constant */
+ double V; /**< Membrane potential */
+ int param2Flag; /**< Check to see if bcfl=3 parms have been set */
+ /*-------------------------------------------------------*/
+
+};
+
+/**
+* @ingroup Vpbe
+* @brief Declaration of the Vpbe class as the Vpbe structure
+*/
+typedef struct sVpbe Vpbe;
+
+/* ///////////////////////////////////////////////////////////////////////////
+ // Class Vpbe: Inlineable methods (vpbe.c)
+ /////////////////////////////////////////////////////////////////////////// */
+
+#if !defined(VINLINE_VPBE)
+
+/** @brief Get atom list
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Pointer to internal Valist object
+*/
+VEXTERNC Valist* Vpbe_getValist(Vpbe *thee);
+
+/** @brief Get accessibility oracle
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Pointer to internal Vacc object
+*/
+VEXTERNC Vacc* Vpbe_getVacc(Vpbe *thee);
+
+/** @brief Get bulk ionic strength
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Bulk ionic strength (M)
+*/
+VEXTERNC double Vpbe_getBulkIonicStrength(Vpbe *thee);
+
+/** @brief Get maximum radius of ion species
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Maximum radius (A)
+*/
+VEXTERNC double Vpbe_getMaxIonRadius(Vpbe *thee);
+
+/** @brief Get temperature
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Temperature (K)
+*/
+VEXTERNC double Vpbe_getTemperature(Vpbe *thee);
+
+/** @brief Get solute dielectric constant
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Solute dielectric constant
+*/
+VEXTERNC double Vpbe_getSoluteDiel(Vpbe *thee);
+
+/** @brief Get apolar coefficient
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Apolar coefficent (kJ/mol/A^2)
+*/
+VEXTERNC double Vpbe_getGamma(Vpbe *thee);
+
+/** @brief Get sphere radius which bounds biomolecule
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Sphere radius which bounds biomolecule (A)
+*/
+VEXTERNC double Vpbe_getSoluteRadius(Vpbe *thee);
+
+/** @brief Get length of solute in x dimension
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Length of solute in x dimension (A)
+*/
+VEXTERNC double Vpbe_getSoluteXlen(Vpbe *thee);
+
+/** @brief Get length of solute in y dimension
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Length of solute in y dimension (A)
+*/
+VEXTERNC double Vpbe_getSoluteYlen(Vpbe *thee);
+
+/** @brief Get length of solute in z dimension
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Length of solute in z dimension (A)
+*/
+VEXTERNC double Vpbe_getSoluteZlen(Vpbe *thee);
+
+/** @brief Get coordinates of solute center
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Pointer to 3*double array with solute center coordinates (A)
+*/
+VEXTERNC double* Vpbe_getSoluteCenter(Vpbe *thee);
+
+/** @brief Get total solute charge
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Total solute charge (e)
+*/
+VEXTERNC double Vpbe_getSoluteCharge(Vpbe *thee);
+
+/** @brief Get solvent dielectric constant
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Solvent dielectric constant
+*/
+VEXTERNC double Vpbe_getSolventDiel(Vpbe *thee);
+
+/** @brief Get solvent molecule radius
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Solvent molecule radius (A)
+*/
+VEXTERNC double Vpbe_getSolventRadius(Vpbe *thee);
+
+/** @brief Get Debye-Huckel parameter
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Bulk Debye-Huckel parameter (Å)
+*/
+VEXTERNC double Vpbe_getXkappa(Vpbe *thee);
+
+/** @brief Get Debye-Huckel screening length
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Debye-Huckel screening length (Å)
+*/
+VEXTERNC double Vpbe_getDeblen(Vpbe *thee);
+
+/** @brief Get modified squared Debye-Huckel parameter
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Modified squared Debye-Huckel parameter (\f$\AA^{-2}\f$)
+*/
+VEXTERNC double Vpbe_getZkappa2(Vpbe *thee);
+
+/** @brief Get charge scaling factor
+* @ingroup Vpbe
+* @author Nathan Baker and Mike Holst
+* @param thee Vpbe object
+* @return Get factor for scaling charges (in e) to internal units
+*/
+VEXTERNC double Vpbe_getZmagic(Vpbe *thee);
+
+/*--------------------------------------------------------------*/
+/* Added by Michael Grabe */
+/*--------------------------------------------------------------*/
+
+/** @brief Get z position of the membrane bottom
+ * @ingroup Vpbe
+ * @author Michael Grabe
+ * @param thee Vpbe object
+ * @return z value of membrane (A)
+ */
+VEXTERNC double Vpbe_getzmem(Vpbe *thee);
+
+/** @brief Get length of the membrane (A)
+ * @ingroup Vpbe
+ * aauthor Michael Grabe
+ * @param thee Vpbe object
+ * @return Length of the membrane (A)
+ */
+VEXTERNC double Vpbe_getLmem(Vpbe *thee);
+
+/** @brief Get membrane dielectric constant
+ * @ingroup Vpbe
+ * @author Michael Grabe
+ * @param thee Vpbe object
+ * @return Membrane dielectric constant
+ */
+VEXTERNC double Vpbe_getmembraneDiel(Vpbe *thee);
+
+/** @brief Get membrane potential (kT)
+ * @ingroup Vpbe
+ * @author Michael Grabe
+ * @param thee Vpbe object
+ */
+VEXTERNC double Vpbe_getmemv(Vpbe *thee);
+
+/*--------------------------------------------------------------*/
+
+#else /* if defined(VINLINE_VPBE) */
+# define Vpbe_getValist(thee) ((thee)->alist)
+# define Vpbe_getVacc(thee) ((thee)->acc)
+# define Vpbe_getBulkIonicStrength(thee) ((thee)->bulkIonicStrength)
+# define Vpbe_getTemperature(thee) ((thee)->T)
+# define Vpbe_getSoluteDiel(thee) ((thee)->soluteDiel)
+# define Vpbe_getSoluteCenter(thee) ((thee)->soluteCenter)
+# define Vpbe_getSoluteRadius(thee) ((thee)->soluteRadius)
+# define Vpbe_getSoluteXlen(thee) ((thee)->soluteXlen)
+# define Vpbe_getSoluteYlen(thee) ((thee)->soluteYlen)
+# define Vpbe_getSoluteZlen(thee) ((thee)->soluteZlen)
+# define Vpbe_getSoluteCharge(thee) ((thee)->soluteCharge)
+# define Vpbe_getSolventDiel(thee) ((thee)->solventDiel)
+# define Vpbe_getSolventRadius(thee) ((thee)->solventRadius)
+# define Vpbe_getMaxIonRadius(thee) ((thee)->maxIonRadius)
+# define Vpbe_getXkappa(thee) ((thee)->xkappa)
+# define Vpbe_getDeblen(thee) ((thee)->deblen)
+# define Vpbe_getZkappa2(thee) ((thee)->zkappa2)
+# define Vpbe_getZmagic(thee) ((thee)->zmagic)
+
+/*------------------------------------------------------------*/
+/* Added by Michael Grabe */
+/*------------------------------------------------------------*/
+
+# define Vpbe_getzmem(thee) ((thee)->z_mem)
+# define Vpbe_getLmem(thee) ((thee)->L)
+# define Vpbe_getmembraneDiel(thee) ((thee)->membraneDiel)
+# define Vpbe_getmemv(thee) ((thee)->V)
+
+/*------------------------------------------------------------*/
+
+
+#endif /* if !defined(VINLINE_VPBE) */
+
+/* ///////////////////////////////////////////////////////////////////////////
+ // Class Vpbe: Non-Inlineable methods (vpbe.c)
+ /////////////////////////////////////////////////////////////////////////// */
+
+/** @brief Construct Vpbe object
+* @ingroup Vpbe
+* @author Nathan Baker and Mike Holst and Michael Grabe
+* @note This is partially based on some of Mike Holst's PMG code. Here
+* are a few of the original function comments:
+* kappa is defined as follows:
+* \f[ \kappa^2 = \frac{8 \pi N_A e_c^2 I_s}{1000 \epsilon_w k_B T}
+ * \f]
+* where the units are esu*esu/erg/mol. To obtain \f$\AA^{-2}\f$, we
+* multiply by \f$10^{-16}\f$. Thus, in \f$\AA^{-2}\f$, where
+* \f$k_B\f$ and \f$e_c\f$ are in gaussian rather than mks units, the
+* proper value for kappa is:
+* \f[ \kappa^2 = \frac{8 \pi N_A e_c^2 I_s}{1000 \epsilon_w k_b T}
+ * \times 10^{-16} \f]
+* and the factor of \f$10^{-16}\f$ results from converting cm^2 to
+* angstroms^2, noting that the 1000 in the denominator has converted
+* m^3 to cm^3, since the ionic strength \f$I_s\f$ is assumed to have
+* been provided in moles per liter, which is moles per 1000 cm^3.
+* @return Pointer to newly allocated Vpbe object
+*/
+VEXTERNC Vpbe* Vpbe_ctor(
+ Valist *alist, /**< Atom list */
+ int ionNum, /**< Number of counterion species */
+ double *ionConc, /**< Array containing counterion concentrations (M) */
+ double *ionRadii, /**< Array containing counterion radii (A) */
+ double *ionQ, /**< Array containing counterion charges (e) */
+ double T, /**< Temperature for Boltzmann distribution (K) */
+ double soluteDiel, /**< Solute internal dielectric constant */
+ double solventDiel, /**< Solvent dielectric constant */
+ double solventRadius, /**< Solvent probe radius for surfaces that use it (A) */
+ int focusFlag, /**< 1 if focusing operation, 0 otherwise */
+ double sdens, /**< Vacc sphere density */
+ double z_mem, /**< Membrane location (A) */
+ double L, /**< Membrane thickness (A) */
+ double membraneDiel, /**< Membrane dielectric constant */
+ double V /**< Transmembrane potential (V) */
+ );
+
+/** @brief FORTRAN stub to construct Vpbe objct
+ * @ingroup Vpbe
+ * @author Nathan Baker and Mike Holst and Michael Grabe
+ * @note This is partially based on some of Mike Holst's PMG code. Here
+ * are a few of the original function comments:
+ * kappa is defined as follows:
+ * \f[ \kappa^2 = \frac{8 \pi N_A e_c^2 I_s}{1000 eps_w k_B T} \f]
+ * where the units are esu*esu/erg/mol. To obtain \f$\AA^{-2}\f$, we
+ * multiply by \f$10^{-16}\f$.
+ * Thus, in \f$\AA^{-2}\f$, where \f$k_B\f$ and \f$e_c\f$ are in
+ * gaussian rather than mks units, the proper value for kappa is:
+ * \f[ \kappa^2 = \frac{8 pi N_A e_c^2 I_s}{1000 eps_w k_b T} \times
+ * 10^{-16} \f]
+ * and the factor of \f$10^{-16}\f$ results from converting cm^2 to
+ * angstroms^2, noting that the 1000 in the denominator has converted
+ * m^3 to cm^3, since the ionic strength \f$I_s\f$ is assumed to have
+ * been provided in moles per liter, which is moles per 1000 cm^3.
+ * @bug The focusing flag is currently not used!!
+ * @return 1 if successful, 0 otherwise
+ */
+VEXTERNC int Vpbe_ctor2(
+ Vpbe *thee, /**< Pointer to memory allocated for Vpbe object */
+ Valist *alist, /**< Atom list */
+ int ionNum, /**< Number of counterion species */
+ double *ionConc, /**< Array containing counterion concentrations (M) */
+ double *ionRadii, /**< Array containing counterion radii (A) */
+ double *ionQ, /**< Array containing counterion charges (e) */
+ double T, /**< Temperature for Boltzmann distribution (K) */
+ double soluteDiel, /**< Solute internal dielectric constant */
+ double solventDiel, /**< Solvent dielectric constant */
+ double solventRadius, /**< Solvent probe radius for surfaces that use it (A) */
+ int focusFlag, /**< 1 if focusing operation, 0 otherwise */
+ double sdens, /**< Vacc sphere density */
+ double z_mem, /**< Membrane location (A) */
+ double L, /**< Membrane thickness (A) */
+ double membraneDiel, /**< Membrane dielectric constant */
+ double V /**< Transmembrane potential (V) */
+ );
+
+/** @brief Get information about the counterion species present
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Pointer to Vpbe object
+* @param nion Set to the number of counterion species
+* @param ionConc Array to store counterion species' concentrations (M)
+* @param ionRadii Array to store counterion species' radii (A)
+* @param ionQ Array to store counterion species' charges (e)
+* @return Number of ions
+*/
+VEXTERNC int Vpbe_getIons(Vpbe *thee, int *nion, double ionConc[MAXION],
+ double ionRadii[MAXION], double ionQ[MAXION]);
+
+/** @brief Object destructor
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Pointer to memory location of object to be destroyed
+*/
+VEXTERNC void Vpbe_dtor(Vpbe **thee);
+
+/** @brief FORTRAN stub object destructor
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Pointer to object to be destroyed
+*/
+VEXTERNC void Vpbe_dtor2(Vpbe *thee);
+
+/** @brief Calculate coulombic energy of set of charges
+*
+* Perform an inefficient double sum to calculate the Coulombic
+* energy of a set of charges in a homogeneous dielectric (with
+ * permittivity equal to the protein interior) and zero ionic
+* strength. Result is returned in units of k_B T. The sum can be
+* restriction to charges present in simplices of specified color
+* (pcolor); if (color == -1) no restrictions are used.
+*
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return Coulombic energy in units of \f$k_B T\f$.
+*/
+VEXTERNC double Vpbe_getCoulombEnergy1(Vpbe *thee);
+
+/** @brief Return the memory used by this structure (and its contents)
+* in bytes
+* @ingroup Vpbe
+* @author Nathan Baker
+* @param thee Vpbe object
+* @return The memory used by this structure and its contents in bytes
+*/
+VEXTERNC unsigned long int Vpbe_memChk(Vpbe *thee);
+
+#endif /* ifndef _VPBE_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vstring.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vstring.h
new file mode 100644
index 0000000000000000000000000000000000000000..159f2ef93609a02410812469c7c36b0c1bbea857
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vstring.h
@@ -0,0 +1,120 @@
+/** @defgroup Vstring Vstring class
+ * @brief Provides a collection of useful non-ANSI string functions
+ */
+
+/**
+ * @file vstring.h
+ * @ingroup Vstring
+ * @brief Contains declarations for class Vstring
+ * @version $Id$
+ * @author Nathan A. Baker
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Washington University in St. Louis nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+#ifndef _VSTRING_H_
+#define _VSTRING_H_
+
+#include "apbscfg.h"
+
+#include "maloc/maloc.h"
+
+#include "generic/vhal.h"
+
+/** @brief Case-insensitive string comparison (BSD standard)
+ * @ingroup Vstring
+ * @author Copyright (c) 1988-1993 The Regents of the University of
+ * California. Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * @note Copyright (c) 1988-1993 The Regents of the University of
+ * California. Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * @param s1 First string for comparison
+ * @param s2 Second string for comparison
+ * @return An integer less than, equal to, or greater than zero if s1 is
+ * found, respectively, to be less than, to match, or be greater
+ * than s2. (Source: Linux man pages)
+ */
+VEXTERNC int Vstring_strcasecmp(const char *s1, const char *s2);
+
+/** @brief A modified sscanf that examines the complete string
+ * @ingroup Vstring
+ * @author Todd Dolinsky
+ * @param tok The string to examine
+ * @return 1 if the entire string is an integer, 0 if otherwise.
+ */
+VEXTERNC int Vstring_isdigit(const char *tok);
+
+/** Creates a wrapped and indented string from an input string
+ * @author Tucker Beck
+ * @ingroup Vstring
+ * @note This function allocates a new string, so be sure to free it!
+ */
+VEXTERNC char* Vstring_wrappedtext(
+ const char* str, /**< The input string to wrap and indent */
+ int right_margin, /**< The number of characters to the right margin */
+ int left_padding /**< The number of characters in the left indent */
+ );
+
+#endif /* ifndef _VSTRING_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vunit.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vunit.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0703c1bbc7f66b94d278ba491accbade3a3f76d
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/generic/vunit.h
@@ -0,0 +1,118 @@
+/**
+ * @file vunit.h
+ * @ingroup Vunit
+ * @author Nathan Baker
+ * @brief Contains a collection of useful constants and conversion factors
+ * @author Nathan A. Baker
+ * @version $Id$
+ *
+ * @attention
+ * @verbatim
+ *
+ * APBS -- Adaptive Poisson-Boltzmann Solver
+ *
+ * Nathan A. Baker (nathan.baker@pnnl.gov)
+ * Pacific Northwest National Laboratory
+ *
+ * Additional contributing authors listed in the code documentation.
+ *
+ * Copyright (c) 2010-2020 Battelle Memorial Institute. Developed at the
+ * Pacific Northwest National Laboratory, operated by Battelle Memorial
+ * Institute, Pacific Northwest Division for the U.S. Department of Energy.
+ *
+ * Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+ * Portions Copyright (c) 2002-2010, Nathan A. Baker.
+ * Portions Copyright (c) 1999-2002, The Regents of the University of
+ * California.
+ * Portions Copyright (c) 1995, Michael Holst.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the developer nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @endverbatim
+ */
+
+/** @defgroup Vunit Vunit class
+ * @brief Collection of constants and conversion factors
+ */
+
+#ifndef _VUNIT_H_
+#define _VUNIT_H_
+
+/** @brief Multiply by this to convert J to cal
+ * @ingroup Vunit */
+#define Vunit_J_to_cal 4.1840000e+00
+
+/** @brief Multiply by this to convert cal to J
+ * @ingroup Vunit */
+#define Vunit_cal_to_J 2.3900574e-01
+
+/** @brief Multiply by this to convert amu to kg
+ * @ingroup Vunit */
+#define Vunit_amu_to_kg 1.6605402e-27
+
+/** @brief Multiply by this to convert kg to amu
+ * @ingroup Vunit */
+#define Vunit_kg_to_amu 6.0221367e+26
+
+/** @brief Multiply by this to convert ec to C
+ * @ingroup Vunit */
+#define Vunit_ec_to_C 1.6021773e-19
+
+/** @brief Multiply by this to convert C to ec
+ * @ingroup Vunit */
+#define Vunit_C_to_ec 6.2415065e+18
+
+/** @brief Charge of an electron in C
+ * @ingroup Vunit */
+#define Vunit_ec 1.6021773e-19
+
+/** @brief Boltzmann constant
+ * @ingroup Vunit */
+#define Vunit_kb 1.3806581e-23
+
+/** @brief Avogadro's number
+ * @ingroup Vunit */
+#define Vunit_Na 6.0221367e+23
+
+/** @brief Pi
+ * @ingroup Vunit */
+#define Vunit_pi VPI
+
+/** @brief Vacuum permittivity
+ * @ingroup Vunit */
+#define Vunit_eps0 8.8541878e-12
+
+/** @brief \f${e_c}^2/\AA\f$ in ESU units => kcal/mol
+ * @ingroup Vunit */
+#define Vunit_esu_ec2A 3.3206364e+02
+
+/** @brief \f$k_b\f$ in ESU units => kcal/mol
+ * @ingroup Vunit */
+#define Vunit_esu_kb 1.9871913e-03
+
+#endif /* ifndef _VUNIT_H_ */
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/geoflow_apbs/geoflow_wrap_apbs.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/geoflow_apbs/geoflow_wrap_apbs.h
new file mode 100644
index 0000000000000000000000000000000000000000..24258903dca827750858b54efaad8113b713d69f
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/geoflow_apbs/geoflow_wrap_apbs.h
@@ -0,0 +1,70 @@
+/// @file GeometricFlowWrap.h
+/// @author Elizabeth Jurrus
+/// @brief C interface for the C++ GeometricFlowClass
+/// @ingroup Geoflow
+/// @version $Id$
+/// @attention
+/// @verbatim
+///
+/// APBS -- Adaptive Poisson-Boltzmann Solver
+///
+/// Nathan A. Baker (nathan.baker@pnnl.gov)
+/// Pacific Northwest National Laboratory
+///
+/// Additional contributing authors listed in the code documentation.
+///
+/// Copyright (c) 2010-2015 Battelle Memorial Institute. Developed at the
+/// Pacific Northwest National Laboratory, operated by Battelle Memorial
+/// Institute, Pacific Northwest Division for the U.S. Department of Energy.
+///
+/// Portions Copyright (c) 2002-2010, Washington University in St. Louis.
+/// Portions Copyright (c) 2002-2010, Nathan A. Baker.
+/// Portions Copyright (c) 1999-2002, The Regents of the University of
+/// California.
+/// Portions Copyright (c) 1995, Michael Holst.
+/// All rights reserved.
+///
+/// Redistribution and use in source and binary forms, with or without
+/// modification, are permitted provided that the following conditions are met:
+///
+/// Redistributions of source code must retain the above copyright notice, this
+/// list of conditions and the following disclaimer.
+///
+/// Redistributions in binary form must reproduce the above copyright notice,
+/// this list of conditions and the following disclaimer in the documentation
+/// and/or other materials provided with the distribution.
+///
+/// Neither the name of the developer nor the names of its contributors may be
+/// used to endorse or promote products derived from this software without
+/// specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+/// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+/// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+/// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+/// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+/// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+/// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+/// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+/// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+/// THE POSSIBILITY OF SUCH DAMAGE.
+///
+/// @endverbatim
+
+#include "GeometricFlowStruct.h"
+
+#include "generic/valist.h"
+
+#ifdef __cplusplus
+ extern "C"{
+#endif
+
+struct GeometricFlowOutput runGeometricFlowWrapAPBS(
+ struct GeometricFlowInput* geoflowParams,
+ Valist* all_molecules );
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gmock/gmock-actions.h b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gmock/gmock-actions.h
new file mode 100644
index 0000000000000000000000000000000000000000..f2393bd3afadaba8506261b18a32040395a28267
--- /dev/null
+++ b/model/comp_surface/tools/transfer/APBS-3.4.1.Linux/include/gmock/gmock-actions.h
@@ -0,0 +1,1687 @@
+// Copyright 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+// Google Mock - a framework for writing C++ mock classes.
+//
+// The ACTION* family of macros can be used in a namespace scope to
+// define custom actions easily. The syntax:
+//
+// ACTION(name) { statements; }
+//
+// will define an action with the given name that executes the
+// statements. The value returned by the statements will be used as
+// the return value of the action. Inside the statements, you can
+// refer to the K-th (0-based) argument of the mock function by
+// 'argK', and refer to its type by 'argK_type'. For example:
+//
+// ACTION(IncrementArg1) {
+// arg1_type temp = arg1;
+// return ++(*temp);
+// }
+//
+// allows you to write
+//
+// ...WillOnce(IncrementArg1());
+//
+// You can also refer to the entire argument tuple and its type by
+// 'args' and 'args_type', and refer to the mock function type and its
+// return type by 'function_type' and 'return_type'.
+//
+// Note that you don't need to specify the types of the mock function
+// arguments. However rest assured that your code is still type-safe:
+// you'll get a compiler error if *arg1 doesn't support the ++
+// operator, or if the type of ++(*arg1) isn't compatible with the
+// mock function's return type, for example.
+//
+// Sometimes you'll want to parameterize the action. For that you can use
+// another macro:
+//
+// ACTION_P(name, param_name) { statements; }
+//
+// For example:
+//
+// ACTION_P(Add, n) { return arg0 + n; }
+//
+// will allow you to write:
+//
+// ...WillOnce(Add(5));
+//
+// Note that you don't need to provide the type of the parameter
+// either. If you need to reference the type of a parameter named
+// 'foo', you can write 'foo_type'. For example, in the body of
+// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type
+// of 'n'.
+//
+// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support
+// multi-parameter actions.
+//
+// For the purpose of typing, you can view
+//
+// ACTION_Pk(Foo, p1, ..., pk) { ... }
+//
+// as shorthand for
+//
+// template
+// FooActionPk Foo(p1_type p1, ..., pk_type pk) { ... }
+//
+// In particular, you can provide the template type arguments
+// explicitly when invoking Foo(), as in Foo(5, false);
+// although usually you can rely on the compiler to infer the types
+// for you automatically. You can assign the result of expression
+// Foo(p1, ..., pk) to a variable of type FooActionPk. This can be useful when composing actions.
+//
+// You can also overload actions with different numbers of parameters:
+//
+// ACTION_P(Plus, a) { ... }
+// ACTION_P2(Plus, a, b) { ... }
+//
+// While it's tempting to always use the ACTION* macros when defining
+// a new action, you should also consider implementing ActionInterface
+// or using MakePolymorphicAction() instead, especially if you need to
+// use the action a lot. While these approaches require more work,
+// they give you more control on the types of the mock function
+// arguments and the action parameters, which in general leads to
+// better compiler error messages that pay off in the long run. They
+// also allow overloading actions based on parameter types (as opposed
+// to just based on the number of parameters).
+//
+// CAVEAT:
+//
+// ACTION*() can only be used in a namespace scope as templates cannot be
+// declared inside of a local class.
+// Users can, however, define any local functors (e.g. a lambda) that
+// can be used as actions.
+//
+// MORE INFORMATION:
+//
+// To learn more about using these macros, please search for 'ACTION' on
+// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
+
+// GOOGLETEST_CM0002 DO NOT DELETE
+
+#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
+#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
+
+#ifndef _WIN32_WCE
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "gmock/internal/gmock-internal-utils.h"
+#include "gmock/internal/gmock-port.h"
+#include "gmock/internal/gmock-pp.h"
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4100)
+#endif
+
+namespace testing {
+
+// To implement an action Foo, define:
+// 1. a class FooAction that implements the ActionInterface interface, and
+// 2. a factory function that creates an Action object from a
+// const FooAction*.
+//
+// The two-level delegation design follows that of Matcher, providing
+// consistency for extension developers. It also eases ownership
+// management as Action objects can now be copied like plain values.
+
+namespace internal {
+
+// BuiltInDefaultValueGetter::Get() returns a
+// default-constructed T value. BuiltInDefaultValueGetter::Get() crashes with an error.
+//
+// This primary template is used when kDefaultConstructible is true.
+template
+struct BuiltInDefaultValueGetter {
+ static T Get() { return T(); }
+};
+template
+struct BuiltInDefaultValueGetter {
+ static T Get() {
+ Assert(false, __FILE__, __LINE__,
+ "Default action undefined for the function return type.");
+ return internal::Invalid();
+ // The above statement will never be reached, but is required in
+ // order for this function to compile.
+ }
+};
+
+// BuiltInDefaultValue::Get() returns the "built-in" default value
+// for type T, which is NULL when T is a raw pointer type, 0 when T is
+// a numeric type, false when T is bool, or "" when T is string or
+// std::string. In addition, in C++11 and above, it turns a
+// default-constructed T value if T is default constructible. For any
+// other type T, the built-in default T value is undefined, and the
+// function will abort the process.
+template
+class BuiltInDefaultValue {
+ public:
+ // This function returns true if and only if type T has a built-in default
+ // value.
+ static bool Exists() {
+ return ::std::is_default_constructible::value;
+ }
+
+ static T Get() {
+ return BuiltInDefaultValueGetter<
+ T, ::std::is_default_constructible::value>::Get();
+ }
+};
+
+// This partial specialization says that we use the same built-in
+// default value for T and const T.
+template
+class BuiltInDefaultValue {
+ public:
+ static bool Exists() { return BuiltInDefaultValue::Exists(); }
+ static T Get() { return BuiltInDefaultValue::Get(); }
+};
+
+// This partial specialization defines the default values for pointer
+// types.
+template
+class BuiltInDefaultValue {
+ public:
+ static bool Exists() { return true; }
+ static T* Get() { return nullptr; }
+};
+
+// The following specializations define the default values for
+// specific types we care about.
+#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \
+ template <> \
+ class BuiltInDefaultValue { \
+ public: \
+ static bool Exists() { return true; } \
+ static type Get() { return value; } \
+ }
+
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, "");
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false);
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0');
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0');
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0');
+
+// There's no need for a default action for signed wchar_t, as that
+// type is the same as wchar_t for gcc, and invalid for MSVC.
+//
+// There's also no need for a default action for unsigned wchar_t, as
+// that type is the same as unsigned int for gcc, and invalid for
+// MSVC.
+#if GMOCK_WCHAR_T_IS_NATIVE_
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT
+#endif
+
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U);
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0);
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long long, 0); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long long, 0); // NOLINT
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0);
+GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0);
+
+#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_
+
+// Simple two-arg form of std::disjunction.
+template
+using disjunction = typename ::std::conditional::type;
+
+} // namespace internal
+
+// When an unexpected function call is encountered, Google Mock will
+// let it return a default value if the user has specified one for its
+// return type, or if the return type has a built-in default value;
+// otherwise Google Mock won't know what value to return and will have
+// to abort the process.
+//
+// The DefaultValue class allows a user to specify the
+// default value for a type T that is both copyable and publicly
+// destructible (i.e. anything that can be used as a function return
+// type). The usage is:
+//
+// // Sets the default value for type T to be foo.
+// DefaultValue::Set(foo);
+template
+class DefaultValue {
+ public:
+ // Sets the default value for type T; requires T to be
+ // copy-constructable and have a public destructor.
+ static void Set(T x) {
+ delete producer_;
+ producer_ = new FixedValueProducer(x);
+ }
+
+ // Provides a factory function to be called to generate the default value.
+ // This method can be used even if T is only move-constructible, but it is not
+ // limited to that case.
+ typedef T (*FactoryFunction)();
+ static void SetFactory(FactoryFunction factory) {
+ delete producer_;
+ producer_ = new FactoryValueProducer(factory);
+ }
+
+ // Unsets the default value for type T.
+ static void Clear() {
+ delete producer_;
+ producer_ = nullptr;
+ }
+
+ // Returns true if and only if the user has set the default value for type T.
+ static bool IsSet() { return producer_ != nullptr; }
+
+ // Returns true if T has a default return value set by the user or there
+ // exists a built-in default value.
+ static bool Exists() {
+ return IsSet() || internal::BuiltInDefaultValue::Exists();
+ }
+
+ // Returns the default value for type T if the user has set one;
+ // otherwise returns the built-in default value. Requires that Exists()
+ // is true, which ensures that the return value is well-defined.
+ static T Get() {
+ return producer_ == nullptr ? internal::BuiltInDefaultValue::Get()
+ : producer_->Produce();
+ }
+
+ private:
+ class ValueProducer {
+ public:
+ virtual ~ValueProducer() {}
+ virtual T Produce() = 0;
+ };
+
+ class FixedValueProducer : public ValueProducer {
+ public:
+ explicit FixedValueProducer(T value) : value_(value) {}
+ T Produce() override { return value_; }
+
+ private:
+ const T value_;
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer);
+ };
+
+ class FactoryValueProducer : public ValueProducer {
+ public:
+ explicit FactoryValueProducer(FactoryFunction factory)
+ : factory_(factory) {}
+ T Produce() override { return factory_(); }
+
+ private:
+ const FactoryFunction factory_;
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer);
+ };
+
+ static ValueProducer* producer_;
+};
+
+// This partial specialization allows a user to set default values for
+// reference types.
+template
+class DefaultValue {
+ public:
+ // Sets the default value for type T&.
+ static void Set(T& x) { // NOLINT
+ address_ = &x;
+ }
+
+ // Unsets the default value for type T&.
+ static void Clear() { address_ = nullptr; }
+
+ // Returns true if and only if the user has set the default value for type T&.
+ static bool IsSet() { return address_ != nullptr; }
+
+ // Returns true if T has a default return value set by the user or there
+ // exists a built-in default value.
+ static bool Exists() {
+ return IsSet() || internal::BuiltInDefaultValue::Exists();
+ }
+
+ // Returns the default value for type T& if the user has set one;
+ // otherwise returns the built-in default value if there is one;
+ // otherwise aborts the process.
+ static T& Get() {
+ return address_ == nullptr ? internal::BuiltInDefaultValue::Get()
+ : *address_;
+ }
+
+ private:
+ static T* address_;
+};
+
+// This specialization allows DefaultValue::Get() to
+// compile.
+template <>
+class DefaultValue {
+ public:
+ static bool Exists() { return true; }
+ static void Get() {}
+};
+
+// Points to the user-set default value for type T.
+template
+typename DefaultValue::ValueProducer* DefaultValue::producer_ = nullptr;
+
+// Points to the user-set default value for type T&.
+template
+T* DefaultValue::address_ = nullptr;
+
+// Implement this interface to define an action for function type F.
+template
+class ActionInterface {
+ public:
+ typedef typename internal::Function::Result Result;
+ typedef typename internal::Function::ArgumentTuple ArgumentTuple;
+
+ ActionInterface() {}
+ virtual ~ActionInterface() {}
+
+ // Performs the action. This method is not const, as in general an
+ // action can have side effects and be stateful. For example, a
+ // get-the-next-element-from-the-collection action will need to
+ // remember the current element.
+ virtual Result Perform(const ArgumentTuple& args) = 0;
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface);
+};
+
+// An Action is a copyable and IMMUTABLE (except by assignment)
+// object that represents an action to be taken when a mock function
+// of type F is called. The implementation of Action is just a
+// std::shared_ptr to const ActionInterface. Don't inherit from Action!
+// You can view an object implementing ActionInterface as a
+// concrete action (including its current state), and an Action
+// object as a handle to it.
+template
+class Action {
+ // Adapter class to allow constructing Action from a legacy ActionInterface.
+ // New code should create Actions from functors instead.
+ struct ActionAdapter {
+ // Adapter must be copyable to satisfy std::function requirements.
+ ::std::shared_ptr> impl_;
+
+ template
+ typename internal::Function::Result operator()(Args&&... args) {
+ return impl_->Perform(
+ ::std::forward_as_tuple(::std::forward(args)...));
+ }
+ };
+
+ template
+ using IsCompatibleFunctor = std::is_constructible, G>;
+
+ public:
+ typedef typename internal::Function::Result Result;
+ typedef typename internal::Function::ArgumentTuple ArgumentTuple;
+
+ // Constructs a null Action. Needed for storing Action objects in
+ // STL containers.
+ Action() {}
+
+ // Construct an Action from a specified callable.
+ // This cannot take std::function directly, because then Action would not be
+ // directly constructible from lambda (it would require two conversions).
+ template <
+ typename G,
+ typename = typename std::enable_if, std::is_constructible,
+ G>>::value>::type>
+ Action(G&& fun) { // NOLINT
+ Init(::std::forward(fun), IsCompatibleFunctor());
+ }
+
+ // Constructs an Action from its implementation.
+ explicit Action(ActionInterface* impl)
+ : fun_(ActionAdapter{::std::shared_ptr>(impl)}) {}
+
+ // This constructor allows us to turn an Action object into an
+ // Action, as long as F's arguments can be implicitly converted
+ // to Func's and Func's return type can be implicitly converted to F's.
+ template
+ explicit Action(const Action& action) : fun_(action.fun_) {}
+
+ // Returns true if and only if this is the DoDefault() action.
+ bool IsDoDefault() const { return fun_ == nullptr; }
+
+ // Performs the action. Note that this method is const even though
+ // the corresponding method in ActionInterface is not. The reason
+ // is that a const Action means that it cannot be re-bound to
+ // another concrete action, not that the concrete action it binds to
+ // cannot change state. (Think of the difference between a const
+ // pointer and a pointer to const.)
+ Result Perform(ArgumentTuple args) const {
+ if (IsDoDefault()) {
+ internal::IllegalDoDefault(__FILE__, __LINE__);
+ }
+ return internal::Apply(fun_, ::std::move(args));
+ }
+
+ private:
+ template
+ friend class Action;
+
+ template
+ void Init(G&& g, ::std::true_type) {
+ fun_ = ::std::forward(g);
+ }
+
+ template
+ void Init(G&& g, ::std::false_type) {
+ fun_ = IgnoreArgs::type>{::std::forward(g)};
+ }
+
+ template
+ struct IgnoreArgs {
+ template
+ Result operator()(const Args&...) const {
+ return function_impl();
+ }
+
+ FunctionImpl function_impl;
+ };
+
+ // fun_ is an empty function if and only if this is the DoDefault() action.
+ ::std::function fun_;
+};
+
+// The PolymorphicAction class template makes it easy to implement a
+// polymorphic action (i.e. an action that can be used in mock
+// functions of than one type, e.g. Return()).
+//
+// To define a polymorphic action, a user first provides a COPYABLE
+// implementation class that has a Perform() method template:
+//
+// class FooAction {
+// public:
+// template
+// Result Perform(const ArgumentTuple& args) const {
+// // Processes the arguments and returns a result, using
+// // std::get(args) to get the N-th (0-based) argument in the tuple.
+// }
+// ...
+// };
+//
+// Then the user creates the polymorphic action using
+// MakePolymorphicAction(object) where object has type FooAction. See
+// the definition of Return(void) and SetArgumentPointee(value) for
+// complete examples.
+template
+class PolymorphicAction {
+ public:
+ explicit PolymorphicAction(const Impl& impl) : impl_(impl) {}
+
+ template
+ operator Action() const {
+ return Action(new MonomorphicImpl(impl_));
+ }
+
+ private:
+ template
+ class MonomorphicImpl : public ActionInterface {
+ public:
+ typedef typename internal::Function::Result Result;
+ typedef typename internal::Function::ArgumentTuple ArgumentTuple;
+
+ explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
+
+ Result Perform(const ArgumentTuple& args) override {
+ return impl_.template Perform(args);
+ }
+
+ private:
+ Impl impl_;
+ };
+
+ Impl impl_;
+};
+
+// Creates an Action from its implementation and returns it. The
+// created Action object owns the implementation.
+template
+Action MakeAction(ActionInterface* impl) {
+ return Action(impl);
+}
+
+// Creates a polymorphic action from its implementation. This is
+// easier to use than the PolymorphicAction constructor as it
+// doesn't require you to explicitly write the template argument, e.g.
+//
+// MakePolymorphicAction(foo);
+// vs
+// PolymorphicAction(foo);
+template
+inline PolymorphicAction MakePolymorphicAction(const Impl& impl) {
+ return PolymorphicAction(impl);
+}
+
+namespace internal {
+
+// Helper struct to specialize ReturnAction to execute a move instead of a copy
+// on return. Useful for move-only types, but could be used on any type.
+template
+struct ByMoveWrapper {
+ explicit ByMoveWrapper(T value) : payload(std::move(value)) {}
+ T payload;
+};
+
+// Implements the polymorphic Return(x) action, which can be used in
+// any function that returns the type of x, regardless of the argument
+// types.
+//
+// Note: The value passed into Return must be converted into
+// Function::Result when this action is cast to Action rather than
+// when that action is performed. This is important in scenarios like
+//
+// MOCK_METHOD1(Method, T(U));
+// ...
+// {
+// Foo foo;
+// X x(&foo);
+// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x));
+// }
+//
+// In the example above the variable x holds reference to foo which leaves
+// scope and gets destroyed. If copying X just copies a reference to foo,
+// that copy will be left with a hanging reference. If conversion to T
+// makes a copy of foo, the above code is safe. To support that scenario, we
+// need to make sure that the type conversion happens inside the EXPECT_CALL
+// statement, and conversion of the result of Return to Action is a
+// good place for that.
+//
+// The real life example of the above scenario happens when an invocation
+// of gtl::Container() is passed into Return.
+//
+template
+class ReturnAction {
+ public:
+ // Constructs a ReturnAction object from the value to be returned.
+ // 'value' is passed by value instead of by const reference in order
+ // to allow Return("string literal") to compile.
+ explicit ReturnAction(R value) : value_(new R(std::move(value))) {}
+
+ // This template type conversion operator allows Return(x) to be
+ // used in ANY function that returns x's type.
+ template
+ operator Action() const { // NOLINT
+ // Assert statement belongs here because this is the best place to verify
+ // conditions on F. It produces the clearest error messages
+ // in most compilers.
+ // Impl really belongs in this scope as a local class but can't
+ // because MSVC produces duplicate symbols in different translation units
+ // in this case. Until MS fixes that bug we put Impl into the class scope
+ // and put the typedef both here (for use in assert statement) and
+ // in the Impl class. But both definitions must be the same.
+ typedef typename Function::Result Result;
+ GTEST_COMPILE_ASSERT_(
+ !std::is_reference::value,
+ use_ReturnRef_instead_of_Return_to_return_a_reference);
+ static_assert(!std::is_void::value,
+ "Can't use Return() on an action expected to return `void`.");
+ return Action(new Impl(value_));
+ }
+
+ private:
+ // Implements the Return(x) action for a particular function type F.
+ template
+ class Impl : public ActionInterface {
+ public:
+ typedef typename Function::Result Result;
+ typedef typename Function::ArgumentTuple ArgumentTuple;
+
+ // The implicit cast is necessary when Result has more than one
+ // single-argument constructor (e.g. Result is std::vector) and R
+ // has a type conversion operator template. In that case, value_(value)
+ // won't compile as the compiler doesn't known which constructor of
+ // Result to call. ImplicitCast_ forces the compiler to convert R to
+ // Result without considering explicit constructors, thus resolving the
+ // ambiguity. value_ is then initialized using its copy constructor.
+ explicit Impl(const std::shared_ptr& value)
+ : value_before_cast_(*value),
+ value_(ImplicitCast_(value_before_cast_)) {}
+
+ Result Perform(const ArgumentTuple&) override { return value_; }
+
+ private:
+ GTEST_COMPILE_ASSERT_(!std::is_reference::value,
+ Result_cannot_be_a_reference_type);
+ // We save the value before casting just in case it is being cast to a
+ // wrapper type.
+ R value_before_cast_;
+ Result value_;
+
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl);
+ };
+
+ // Partially specialize for ByMoveWrapper. This version of ReturnAction will
+ // move its contents instead.
+ template
+ class Impl, F> : public ActionInterface {
+ public:
+ typedef typename Function::Result Result;
+ typedef typename Function::ArgumentTuple ArgumentTuple;
+
+ explicit Impl(const std::shared_ptr& wrapper)
+ : performed_(false), wrapper_(wrapper) {}
+
+ Result Perform(const ArgumentTuple&) override {
+ GTEST_CHECK_(!performed_)
+ << "A ByMove() action should only be performed once.";
+ performed_ = true;
+ return std::move(wrapper_->payload);
+ }
+
+ private:
+ bool performed_;
+ const std::shared_ptr wrapper_;
+ };
+
+ const std::shared_ptr value_;
+};
+
+// Implements the ReturnNull() action.
+class ReturnNullAction {
+ public:
+ // Allows ReturnNull() to be used in any pointer-returning function. In C++11
+ // this is enforced by returning nullptr, and in non-C++11 by asserting a
+ // pointer type on compile time.
+ template
+ static Result Perform(const ArgumentTuple&) {
+ return nullptr;
+ }
+};
+
+// Implements the Return() action.
+class ReturnVoidAction {
+ public:
+ // Allows Return() to be used in any void-returning function.
+ template
+ static void Perform(const ArgumentTuple&) {
+ static_assert(std::is_void::value, "Result should be void.");
+ }
+};
+
+// Implements the polymorphic ReturnRef(x) action, which can be used
+// in any function that returns a reference to the type of x,
+// regardless of the argument types.
+template
+class ReturnRefAction {
+ public:
+ // Constructs a ReturnRefAction object from the reference to be returned.
+ explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT
+
+ // This template type conversion operator allows ReturnRef(x) to be
+ // used in ANY function that returns a reference to x's type.
+ template
+ operator Action() const {
+ typedef typename Function::Result Result;
+ // Asserts that the function return type is a reference. This
+ // catches the user error of using ReturnRef(x) when Return(x)
+ // should be used, and generates some helpful error message.
+ GTEST_COMPILE_ASSERT_(std::is_reference::value,
+ use_Return_instead_of_ReturnRef_to_return_a_value);
+ return Action(new Impl(ref_));
+ }
+
+ private:
+ // Implements the ReturnRef(x) action for a particular function type F.
+ template
+ class Impl : public ActionInterface {
+ public:
+ typedef typename Function::Result Result;
+ typedef typename Function::ArgumentTuple ArgumentTuple;
+
+ explicit Impl(T& ref) : ref_(ref) {} // NOLINT
+
+ Result Perform(const ArgumentTuple&) override { return ref_; }
+
+ private:
+ T& ref_;
+ };
+
+ T& ref_;
+};
+
+// Implements the polymorphic ReturnRefOfCopy(x) action, which can be
+// used in any function that returns a reference to the type of x,
+// regardless of the argument types.
+template
+class ReturnRefOfCopyAction {
+ public:
+ // Constructs a ReturnRefOfCopyAction object from the reference to
+ // be returned.
+ explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT
+
+ // This template type conversion operator allows ReturnRefOfCopy(x) to be
+ // used in ANY function that returns a reference to x's type.
+ template
+ operator Action() const {
+ typedef typename Function::Result Result;
+ // Asserts that the function return type is a reference. This
+ // catches the user error of using ReturnRefOfCopy(x) when Return(x)
+ // should be used, and generates some helpful error message.
+ GTEST_COMPILE_ASSERT_(
+ std::is_reference::value,
+ use_Return_instead_of_ReturnRefOfCopy_to_return_a_value);
+ return Action(new Impl(value_));
+ }
+
+ private:
+ // Implements the ReturnRefOfCopy(x) action for a particular function type F.
+ template
+ class Impl : public ActionInterface {
+ public:
+ typedef typename Function::Result Result;
+ typedef typename Function::ArgumentTuple ArgumentTuple;
+
+ explicit Impl(const T& value) : value_(value) {} // NOLINT
+
+ Result Perform(const ArgumentTuple&) override { return value_; }
+
+ private:
+ T value_;
+ };
+
+ const T value_;
+};
+
+// Implements the polymorphic ReturnRoundRobin(v) action, which can be
+// used in any function that returns the element_type of v.
+template
+class ReturnRoundRobinAction {
+ public:
+ explicit ReturnRoundRobinAction(std::vector values) {
+ GTEST_CHECK_(!values.empty())
+ << "ReturnRoundRobin requires at least one element.";
+ state_->values = std::move(values);
+ }
+
+ template
+ T operator()(Args&&...) const {
+ return state_->Next();
+ }
+
+ private:
+ struct State {
+ T Next() {
+ T ret_val = values[i++];
+ if (i == values.size()) i = 0;
+ return ret_val;
+ }
+
+ std::vector values;
+ size_t i = 0;
+ };
+ std::shared_ptr state_ = std::make_shared();
+};
+
+// Implements the polymorphic DoDefault() action.
+class DoDefaultAction {
+ public:
+ // This template type conversion operator allows DoDefault() to be
+ // used in any function.
+ template
+ operator Action() const { return Action(); } // NOLINT
+};
+
+// Implements the Assign action to set a given pointer referent to a
+// particular value.
+template
+class AssignAction {
+ public:
+ AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {}
+
+ template
+ void Perform(const ArgumentTuple& /* args */) const {
+ *ptr_ = value_;
+ }
+
+ private:
+ T1* const ptr_;
+ const T2 value_;
+};
+
+#if !GTEST_OS_WINDOWS_MOBILE
+
+// Implements the SetErrnoAndReturn action to simulate return from
+// various system calls and libc functions.
+template
+class SetErrnoAndReturnAction {
+ public:
+ SetErrnoAndReturnAction(int errno_value, T result)
+ : errno_(errno_value),
+ result_(result) {}
+ template
+ Result Perform(const ArgumentTuple& /* args */) const {
+ errno = errno_;
+ return result_;
+ }
+
+ private:
+ const int errno_;
+ const T result_;
+};
+
+#endif // !GTEST_OS_WINDOWS_MOBILE
+
+// Implements the SetArgumentPointee(x) action for any function
+// whose N-th argument (0-based) is a pointer to x's type.
+template