-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContainerfile
More file actions
179 lines (153 loc) · 6.18 KB
/
Copy pathContainerfile
File metadata and controls
179 lines (153 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Quantum Fragment Methods Container
# Quantum Fragment Methods Container
FROM --platform=linux/amd64 ubuntu:22.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Add labels for documentation
LABEL maintainer="Thaddeus Pellegrini"
LABEL description="Complete environment for quantum fragment methods with PySCF, Qiskit, Vayesta, PyCI, and SBD"
LABEL version="1.0"
# Set working directory
WORKDIR /workspace
# ============================================================================
# PHASE 1: Install System Dependencies
RUN apt-get update && apt-get install -y \
# C++ Build Tools
gcc \
g++ \
gfortran \
make \
cmake \
# Version Control
git \
# Download Tools
wget \
curl \
# MPI for Parallel Computing
openmpi-bin \
libopenmpi-dev \
# Linear Algebra Libraries
libopenblas-dev \
# OpenMP for Parallelization
libomp-dev \
# Python Development
python3 \
python3-pip \
python3-dev \
# Graphviz for Qiskit visualization
graphviz \
libgraphviz-dev \
# Utilities
vim \
nano \
tree \
&& rm -rf /var/lib/apt/lists/*
# ============================================================================
# PHASE 2: Install Miniconda for Python Environment Management
# Install Miniconda for x86_64
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /opt/conda && \
rm /tmp/miniconda.sh
# Add conda to PATH
ENV PATH="/opt/conda/bin:${PATH}"
# Create .condarc to use only conda-forge and avoid TOS issues
RUN echo "channels:" > /root/.condarc && \
echo " - conda-forge" >> /root/.condarc && \
echo "channel_priority: strict" >> /root/.condarc && \
echo "auto_activate_base: false" >> /root/.condarc
# Initialize conda for bash
RUN conda init bash
# Create conda environment with Python 3.11.15 using conda-forge only
RUN conda create -n qfrag-env python=3.11.15 --override-channels -c conda-forge -y
# ============================================================================
# PHASE 3: Install Conda Packages
RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \
conda activate qfrag-env && \
conda install --override-channels -c conda-forge \
cmake=4.2.3 \
h5py=3.15.1 \
scipy=1.17.1 \
xcfun=2.1.1 \
-y"
# ============================================================================
# PHASE 4: Install Python Packages via pip
RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \
conda activate qfrag-env && \
pip install --no-cache-dir \
numpy==1.26.4 \
pyscf==2.9.0 \
ffsim==0.0.70 \
qiskit==2.3.0 \
qiskit-ibm-runtime==0.45.1 \
qiskit-addon-sqd==0.12.1 \
qc-pyci==0.6.3 \
matplotlib==3.10.8 \
pandas==3.0.1 \
seaborn==0.13.2 \
jupyter \
jupyterlab \
ipykernel \
ipywidgets \
pytest \
pytest-cov"
# Install block2 from preview repository (x86_64 wheel)
RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \
conda activate qfrag-env && \
pip install --no-cache-dir block2 --extra-index-url=https://block-hczhai.github.io/block2-preview/pypi/"
# ============================================================================
# PHASE 5: Clone and Install Vayesta
# Clone Vayesta and install without building pyscf (use conda version)
RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \
conda activate qfrag-env && \
git clone https://github.com/BoothGroup/Vayesta.git /workspace/Vayesta && \
cd /workspace/Vayesta && \
pip install --no-build-isolation --no-deps ."
# ============================================================================
# PHASE 6: Clone PyCI (compilation will be done interactively)
# Clone PyCI repository
RUN git clone https://github.com/theochem/pyci.git /workspace/pyci
# Set environment variables for PyCI compilation
ENV CC=gcc
ENV CXX=g++
# Note: PyCI compilation requires manual steps - see docs/installation.md
# Users should run: cd /workspace/pyci && make && pip install .
# ============================================================================
# PHASE 7: Clone SBD Solver (compilation will be done interactively)
# Clone SBD repository
RUN git clone https://github.com/r-ccs-cms/sbd.git /workspace/sbd
# Note: SBD requires complex setup - see docs/installation.md steps 75-126
# This includes fixing header paths and creating Configuration file
# ============================================================================
# PHASE 8: Install quantum-fragment-methods Package
# Copy the quantum-fragment-methods package into the container
COPY . /workspace/quantum-fragment-methods
# Install quantum-fragment-methods in editable mode
RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \
conda activate qfrag-env && \
cd /workspace/quantum-fragment-methods && \
pip install -e ."
# ============================================================================
# PHASE 9: Setup Environment Variables
# Set MPI environment variables
ENV OMPI_CXX=g++
ENV OMP_NUM_THREADS=1
# Add workspace to Python path
ENV PYTHONPATH="/workspace:${PYTHONPATH}"
# ============================================================================
# PHASE 10: Create Helper Directories
RUN mkdir -p /workspace/executable && \
mkdir -p /workspace/data
#mkdir -p /workspace/results
# ============================================================================
# PHASE 11: Setup Conda Activation in bashrc
RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate qfrag-env" >> ~/.bashrc && \
echo "echo ''" >> ~/.bashrc && \
echo "echo ' Quantum Fragment Methods Environment'" >> ~/.bashrc && \
echo "echo ' Python packages: PySCF, Qiskit, ffsim, scipy'" >> ~/.bashrc && \
echo "echo ' Special tools: Vayesta, PyCI, SBD'" >> ~/.bashrc && \
echo "echo ' Working directory: /workspace'" >> ~/.bashrc && \
echo "echo ' Architecture: x86_64 via emulation'" >> ~/.bashrc && \
echo "echo ''" >> ~/.bashrc
# Set default command to bash with conda environment activated
CMD ["/bin/bash"]