Package: pyobjcryst
pyobjcrystPython bindings to ObjCryst++, the Object-Oriented Crystallographic Library.The documentation for this release of pyobjcryst can be found on-line athttps://pyobjcryst.readthedocs.io/INSTALLATIONpyobjcryst is available for Python 3.7 (deprecated), and 3.8 to 3.11.Using conda (recommended)We recommend to usecondaas it allows to install all software dependencies
together with pyobjcryst, without too much compiling hastle.Two distributions can be used:Anaconda Python, the historical
main conda-based distributionMamba-forge, which
has the advantage off providingmambain addition to conda, and ismuch fasterwhen resolving dependencies during installation. It also
uses by default the conda-forge repository, which is what almost all
users would want.Using conda, we you can install pyobjcryst using the “conda-forge” channelconda install -c conda-forge pyobjcrystAlternatively using mambamamba install pyobjcrystYou can also install from the “diffpy” channel - especially if you use
pyobjcryst allong with the other diffpy tools for PDF calculations,
but it is not updated as often as conda-forge.pyobjcryst is also included in the “diffpy-cmi” collection
of packages for structure analysisconda install -c diffpy diffpy-cmiComplete new conda environment with optional GUI and jupyter dependenciesAssuming you have installedMamba-forge,
you can directly create a new conda environment namedpyobjcrystwith all useful dependencies (including
jupyter-lab, python 3.11..) usingmamba create -n pyobjcryst python=3.11 pyobjcryst matplotlib py3dmol jupyterlab ipympl multiprocessThen you can activate the environment and launch jupyter-lab usingconda activate pyobjcryst
jupyter-labFrom sourceThe requirements are:libobjcryst- Object-Oriented Crystallographic Library for C++,https://github.com/diffpy/libobjcrystsetuptools- tools for installing Python packagesNumPy- library for scientific computing with Pythonpython-dev- header files for interfacing Python with Clibboost-all-dev- Boost C++ libraries and development filesscons- software construction tool (optional)The above requirements are easily installed through conda using e.g.:conda install numpy compilers boost scons libobjcrystAlternatively, on Ubuntu Linux the required software can be installed using:sudo apt-get install \
   python-setuptools python-numpy scons \
   build-essential python-dev libboost-all-devThe libobjcryst library can also be installed as per the instructions athttps://github.com/diffpy/libobjcryst. Make sure other required
software are also in place and then run from the pyobjcryst directory:pip install .You may need to usesudowith system Python so the process is
allowed to copy files to system directories, unless you are installing
into a conda environment.  If administrator (root)
access is not available, see the usage information frompython setup.py install--helpfor options to install to
a user-writable location.  The installation integrity can be
verified by executing the included tests withpython -m pyobjcryst.tests.runAn alternative way of installing pyobjcryst is to use the SCons tool,
which can speed up the process by compiling C++ files in several
parallel jobs (-j4):scons -j4 installSeescons-hfor description of build targets and options.Optional graphical dependencies for jupyter notebooksSome of the classes can produce graphical outputs, which can be
displayed in a jupyter notebook:a Crystal structure can be displayed in 3D: this requires thepy3dmolandipywidgetsmodules. See the notebookexamples/cystal_3d_widget.ipynba PowderPattern can be displayed (and live-updated) ifmatplotlibandipymplare installed. See the
notebookexamples/cimetidine-structure-solution-powder.ipynbIn short,conda install jupyter matplotlib ipympl py3dmolwill give you all the required dependencies. You can also
use this in jupyterlab.These packages can also be installed usingpipif you do not use conda.DEVELOPMENTpyobjcryst is an open-source software originally developed as a part of the
DiffPy-CMI complex modeling initiative at the Brookhaven National
Laboratory, and is also further developed at ESRF.
The pyobjcryst sources are hosted athttps://github.com/diffpy/pyobjcryst.Feel free to fork the project and contribute.  To install pyobjcryst
in a development mode, where its sources are directly used by Python
rather than copied to a system directory, usepython setup.py develop --userWhen developing it is preferable to compile the C++ files with
SCons using thebuild=developoption, which compiles the extension
module with debug information and C-assertions checksscons -j4 build=debug developThe build script checks for a presence ofsconsvars.pyfile, which
can be used to permanently set thebuildvariable.  The SCons
construction environment can be further customized in asconscript.localscript.  The package integrity can be verified by executing unit tests withscons-j4test.When developing with Anaconda Python it is essential to specify
header path, library path and runtime library path for the active
Anaconda environment.  This can be achieved by setting theCPATH,LIBRARY_PATHandLDFLAGSenvironment variables as follows:# resolve the prefix directory P of the active Anaconda environment
P=$CONDA_PREFIX
export CPATH=$P/include
export LIBRARY_PATH=$P/lib
export LDFLAGS=-Wl,-rpath,$P/lib
# compile and re-install pyobjcryst
scons -j4 build=debug developNote the Anaconda package for the required libobjcryst library is built
with a C++ compiler provided by Anaconda.  This may cause incompatibility
with system C++.  In such case please use Anaconda C++ to build pyobjcryst.Quick conda environment from libobjcryst and pyobjcryst sourcesIfcondais available, you can create a pyobjcryst environment
from the git repositories (downloaded in the current directory) using:conda create --yes --name pyobjcryst numpy matplotlib ipywidgets jupyter
conda install --yes  -n pyobjcryst -c conda-forge boost scons py3dmol
conda activate pyobjcryst
git clone https://github.com/diffpy/libobjcryst.git
cd libobjcryst
scons -j4 install prefix=$CONDA_PREFIX
cd ..
git clone https://github.com/diffpy/pyobjcryst.git
cd pyobjcryst
export CPATH=$CONDA_PREFIX/include
export LIBRARY_PATH=$CONDA_PREFIX/lib
export LDFLAGS=-Wl,-rpath,$CONDA_PREFIX/lib
scons -j4 install prefix=$CONDA_PREFIXCONTACTSFor more information on pyobjcryst please visit the project web-pagehttp://www.diffpy.orgor email Prof. Simon Billinge atsb2896@columbia.edu.You can also contact Vincent Favre-Nicolin (favre@esrf.fr) if you
are using pyobjcryst outside diffpy, e.g. to display structures
in a notebook, refine powder patterns or solve structures using the
global optimisation algorithms, etc..