Skip to content

Commit

Permalink
Merge branch 'master' into bcif
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed May 20, 2024
2 parents 23bef14 + fbfda4a commit 0653390
Show file tree
Hide file tree
Showing 178 changed files with 4,254 additions and 3,088 deletions.
94 changes: 90 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: CI

on: [push]
on: [push, pull_request]

jobs:
build:
build-Linux:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.0.0

- name: Install system dependencies
run: >
sudo apt-get update;
sudo apt-get --no-install-recommends install
catch2
cmake
libfreetype6-dev
libglew-dev
libglm-dev
Expand All @@ -25,7 +26,7 @@ jobs:
python-is-python3
python3-biopython
python3-dev
python3-distutils
python3-setuptools
python3-numpy
python3-pil
python3-pytest
Expand All @@ -49,3 +50,88 @@ jobs:
- name: Test
run: |
./install-prefix/bin/pymol -ckqy testing/testing.py --run all
build-Windows:

runs-on: windows-latest

env:
CONDA_ROOT: ${{github.workspace}}\..\tmp\mambaforge
MAMBAFORGE_EXEC: ${{github.workspace}}\..\tmp\mambaforge.exe

steps:
- uses: actions/[email protected]
- name: Download miniconda
shell: cmd
run: |-
if not exist %CONDA_ROOT% mkdir %CONDA_ROOT%
curl -L -o %MAMBAFORGE_EXEC% https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Windows-x86_64.exe
start /wait %MAMBAFORGE_EXEC% /S /D=%CONDA_ROOT%
- name: Set up Miniconda
shell: cmd
run: |-
CALL %CONDA_ROOT%\\Scripts\\activate.bat
conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest
- name: Conda info
shell: cmd
run: |-
CALL %CONDA_ROOT%\\Scripts\\activate.bat
conda info
- name: Get additional sources
shell: cmd
run: |
git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* %CONDA_ROOT%/Library/include/
git clone --depth 1 --single-branch --branch cpp_master https://github.com/msgpack/msgpack-c.git
cp -R msgpack-c/include/msgpack* %CONDA_ROOT%/Library/include/
- name: Build PyMOL
shell: cmd
run: |
CALL %CONDA_ROOT%\\Scripts\\activate.bat
python setup.py --testing install --prefix=%GITHUB_WORKSPACE%\\install-prefix
- name: Test
shell: cmd
run: |
CALL %CONDA_ROOT%\\Scripts\\activate.bat
%GITHUB_WORKSPACE%\\install-prefix\\Scripts\\pymol.bat -ckqy testing\\testing.py --run all
build-MacOS:

runs-on: macos-latest

env:
CONDA_ROOT: "/tmp/miniconda"

steps:
- uses: actions/[email protected]
- name: Set up Miniconda and Build
run: |-
curl -L -o $CONDA_ROOT.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-MacOSX-x86_64.sh
bash $CONDA_ROOT.sh -b -p $CONDA_ROOT
export PATH="$CONDA_ROOT/bin:$PATH"
conda config --set quiet yes
conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest
conda info
- name: Get additional sources
run: |
git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git
cp -R mmtf-cpp/include/mmtf* ${CONDA_ROOT}/include/
git clone --depth 1 --single-branch --branch cpp_master https://github.com/msgpack/msgpack-c.git
cp -R msgpack-c/include/msgpack* ${CONDA_ROOT}/include/
- name: Build PyMOL
run: |-
export MACOSX_DEPLOYMENT_TARGET=12.0
export PATH="$CONDA_ROOT/bin:$PATH"
python setup.py install --prefix=${GITHUB_WORKSPACE}/install-prefix
- name: Test
run: |-
export PATH="$CONDA_ROOT/bin:$PATH"
${GITHUB_WORKSPACE}/install-prefix/bin/pymol -ckqy testing/testing.py --run all
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.13)

project(${TARGET_NAME})

set(CMAKE_VERBOSE_MAKEFILE on)

add_library(${TARGET_NAME} SHARED ${ALL_SRC})

target_compile_options(${TARGET_NAME} PRIVATE ${ALL_COMP_ARGS})

set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ${SHARED_SUFFIX})

target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17)

set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")

target_include_directories(${TARGET_NAME} PUBLIC ${ALL_INC_DIR})

target_link_directories(${TARGET_NAME} PUBLIC ${ALL_LIB_DIR})


if(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
endif()

target_link_libraries(${TARGET_NAME}
${ALL_LIB}
${ALL_EXT_LINK}
)

target_compile_definitions(${TARGET_NAME} PUBLIC ${ALL_DEF})
32 changes: 32 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@
CHANGE LOG
=========================================================================

2024-04-09 Jarrett Johnson, Thomas Stewart, Thomas Holder, Anton Butsev

* 3.0.0

* Panels
- Nucleic Acid Builder supported
- Scenes Panel (Basic version)
- Improved APBS electrostatics plugin integrated

* Distance/Bonding detection
- Halogen-bond detection and display

* Python API
- `fnab` command (sequence to nucleic acid chain)
- Improved CGO builder API
- get_sasa_relative() `subsele` argument added
- new clip modes/API
- iterate() adds `explicit_valence` and `explicit_degree`
- `cell_centered` setting added
- by grid-cell background gradient `bg_gradient=2`
- look_at() added
- experimental `curve_new` / `move_on_curve`

* Developer
- C++17 required
- pymol-testing integrated
- pytest introduced
- Github Actions CI

* And many other fixes and small additions provided by developers
and the community...

2021-05-10 Jarrett Johnson, Thomas Holder, Thomas Stewart

* 2.5.0
Expand Down
3 changes: 2 additions & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ See also: http://pymolwiki.org/index.php/Linux_Install
REQUIREMENTS

- C++17 compiler (e.g. gcc 8+)
- Python 3.6+
- CMake (3.13+)
- Python 3.9+
- Pmw (Python Megawidgets) (optional, for legacy GUI/plugins)
https://github.com/schrodinger/pmw-patched
- OpenGL
Expand Down
2 changes: 1 addition & 1 deletion contrib/champ/champ_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ static PyMethodDef champ_methods[] = {
{NULL, NULL} /* sentinel */
};

PyObject * PyInit__champ(void)
PyMODINIT_FUNC PyInit__champ(void)
{
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
Expand Down
20 changes: 18 additions & 2 deletions contrib/champ/os_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ void *OSMemoryMalloc(unsigned int size,const char *file,int line,int type)
rec=(DebugRec*)malloc(sizeof(DebugRec)+size);
if(!rec)
return(NULL);
strcpy(rec->file,file);

int len = strlen(file);
int max_size = sizeof(rec->file) - 1;
if (len > max_size) {
strcpy(rec->file, file + len - max_size);
} else {
strcpy(rec->file, file);
}
rec->file[max_size - 1] = '\0';
rec->line=line;
rec->size=size;
rec->type=type;
Expand All @@ -196,7 +204,15 @@ void *OSMemoryCalloc(unsigned int count,unsigned int size,const char *file,int l
rec=(DebugRec*)calloc(1,sizeof(DebugRec)+size);
if(!rec)
return(NULL);
strcpy(rec->file,file);

int len = strlen(file);
int max_size = sizeof(rec->file) - 1;
if (len > max_size) {
strcpy(rec->file, file + len - max_size);
} else {
strcpy(rec->file, file);
}
rec->file[max_size - 1] = '\0';
rec->line=line;
rec->size=size;
rec->type=type;
Expand Down
3 changes: 1 addition & 2 deletions create_shadertext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from collections import defaultdict
from os.path import dirname
from subprocess import Popen, PIPE
from distutils import dir_util

def create_all(generated_dir, pymoldir="."):
'''
Expand All @@ -30,7 +29,7 @@ def __init__(self, filename):
self.out = cStringIO.StringIO()
self.filename = filename
else:
dir_util.mkpath(os.path.dirname(filename))
os.makedirs(os.path.dirname(filename), exist_ok=True)
self.out = open(filename, "w")
self.filename = None
def close(self):
Expand Down
Binary file added data/chempy/fragments/atpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/atpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/atp_ttpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/atp_ttpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ctpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ctpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ctp_gtpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ctp_gtpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/gtpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/gtpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/gtp_ctpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/gtp_ctpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ttpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ttpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ttp_atpA.pkl
Binary file not shown.
Binary file added data/chempy/fragments/ttp_atpB.pkl
Binary file not shown.
Binary file added data/chempy/fragments/utpA.pkl
Binary file not shown.
30 changes: 3 additions & 27 deletions include/pymol/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,6 @@ template <class C, class Pred> void erase_if(C& c, Pred pred)
#endif
}

/**
* @brief C++17's version of std::clamp
*/
template<typename T>
const T& clamp(const T& value, const T& low, const T& high){
assert(low <= high);
return std::max(low, std::min(value, high));
}

/**
* @brief C++14's std::equal
*/

template <typename InIter1, typename InIter2>
bool equal(InIter1 first1, InIter1 last1, InIter2 first2)
{
for (; first1 != last1; ++first1, ++first2) {
if (*first1 != *first2) {
return false;
}
}
return true;
}

/**
* @brief Checks whether two floating point values are nearly equal
* @param first floating point number
Expand All @@ -60,7 +36,7 @@ bool equal(InIter1 first1, InIter1 last1, InIter2 first2)
* @tparam U second floating point type
*/

template <typename T, typename U, typename CommonT = pymol::common_type_t<T, U>>
template <typename T, typename U, typename CommonT = std::common_type_t<T, U>>
bool almost_equal(T a, U b, CommonT epsilon = 1e-6)
{
return std::abs(a - b) <= epsilon;
Expand Down Expand Up @@ -136,7 +112,7 @@ bool equal(const RangeT1& first, const RangeT2& second)
if (range1Size != range2Size) {
return false;
}
return pymol::equal(std::begin(first), std::end(first), std::begin(second));
return std::equal(std::begin(first), std::end(first), std::begin(second));
}

/**
Expand Down Expand Up @@ -164,7 +140,7 @@ bool equal(const RangeT1& first, const RangeT2& second, Pred p)
}
}
return true;
//return pymol::equal(std::begin(first), std::end(first), std::begin(second));
//return std::equal(std::begin(first), std::end(first), std::begin(second));
}

/**
Expand Down
20 changes: 0 additions & 20 deletions include/pymol/functional.h

This file was deleted.

42 changes: 0 additions & 42 deletions include/pymol/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,6 @@

namespace pymol
{

#if __cplusplus >= 201402L
using std::make_unique;
#else
/**
* @brief C++14's std::make_unique<T>
* @param args arguments for constructor of Type T
* @return A std::unique_ptr for type T
*/

template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

template <typename T, typename = pymol::enable_if_t<std::is_array<T>::value>>
std::unique_ptr<T> make_unique(std::size_t size){
return std::unique_ptr<T>(new pymol::remove_extent_t<T>[size]());
}
#endif

#if __cplusplus >= 201703L
using std::destroy_at;
using std::destroy;
#else
/*
* @brief C++17's std::destroy_at
*/
template <typename T> void destroy_at(T* p) { p->~T(); }

/*
* @brief C++17's std::destroy
*/

template <typename T> void destroy(T* iter, T* end)
{
for(; iter != end; ++iter) {
destroy_at(std::addressof(*iter));
}
}
#endif

/**
* A copyable unique pointer. Will make a copy of the managed object with "new".
*/
Expand Down
Loading

0 comments on commit 0653390

Please sign in to comment.