Skip to main content

Binding for LMGC90.

Project description

compas_lmgc90

Python bindings for LMGC90 discrete element solver.

Installation

Conda

With conda alreay installed, create a conda environment from the yaml file

conda env create -f environment.yml

Then activate it and install the module inside it:

conda activate compas_lmgc90-dev
python -m pip install .

Linux

# Install dependencies
sudo apt update
sudo apt install -y gfortran libopenblas-dev liblapack-dev cmake

# Clone and install
git clone https://github.com/BlockResearchGroup/compas_lmgc90.git
cd compas_lmgc90
conda create -n lmgc90 python=3.12 -y
conda activate lmgc90
conda install -c conda-forge libstdcxx-ng=14
pip install -r requirements-dev.txt
pip install --no-build-isolation -ve .

Note: The libstdcxx-ng=14 is required because the module is compiled with GCC 13.3+ and needs GLIBCXX_3.4.32.

macOS

# Install dependencies
brew install gcc openblas cmake

# Clone and install
git clone https://github.com/BlockResearchGroup/compas_lmgc90.git
cd compas_lmgc90
conda create -n lmgc90 python=3.12 -y
conda activate lmgc90
pip install -r requirements-dev.txt
pip install --no-build-isolation -ve .

Note: CMake will auto-detect Homebrew GCC/gfortran. If detection fails, set compilers manually:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14  
export CXX=$(brew --prefix gcc)/bin/g++-14

Windows

Windows is not currently supported. The package requires Fortran compilers and POSIX-style build tools.

Usage

from compas_dem.models import BlockModel
from compas_dem.templates import ArchTemplate
from compas_lmgc90.solver import Solver

# Create model
template = ArchTemplate(rise=3, span=10, thickness=0.5, depth=0.5, n=20)
model = BlockModel.from_boxes(template.blocks())

# Run simulation
solver = Solver(model)
solver.set_supports(z_threshold=0.4)
solver.preprocess()
solver.run(nb_steps=100)
solver.finalize()

Examples

python temp/dem_of_an_arch.py
python temp/dem_of_a_wall.py
python temp/dem_of_a_dome.py
python temp/contacts.py

Troubleshooting

ImportError: libmatlib.so not found

Make sure you installed the package with pip install -e . in the correct conda environment. The LMGC90 libraries are bundled during installation.

GLIBCXX version error (Linux)

Install the required libstdc++:

conda install -c conda-forge libstdcxx-ng=14

macOS: Compiler not found

If CMake can't find gfortran, manually set the compilers before building:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14
export CXX=$(brew --prefix gcc)/bin/g++-14
pip install --no-build-isolation -ve .

macOS: Compiler not found

If CMake can't find gfortran, manually set the compilers before building:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14
export CXX=$(brew --prefix gcc)/bin/g++-14
pip install --no-build-isolation -ve .

Contributing

Testing a Pull Request

# Fetch the PR branch (replace PR_NUMBER with the actual number)
git fetch upstream pull/PR_NUMBER/head:pr-branch-name
git checkout pr-branch-name

# Build and test
pip install --no-build-isolation -ve .
python temp/contacts.py

Pushing changes to a PR

# Add the PR author's fork as a remote
git remote add author https://github.com/AUTHOR/compas_lmgc90.git

# Push your changes to their branch
git push author branch-name

Note: This requires the PR author to have enabled "Allow edits from maintainers" on their PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compas_lmgc90-0.1.6.tar.gz (245.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

compas_lmgc90-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl (19.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

compas_lmgc90-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl (19.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

File details

Details for the file compas_lmgc90-0.1.6.tar.gz.

File metadata

  • Download URL: compas_lmgc90-0.1.6.tar.gz
  • Upload date:
  • Size: 245.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_lmgc90-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6f4b9fc89af5875ecec674730d35d2ea4d6eeb4e82013a8976f4834f156460aa
MD5 5a8ec08006f546c8f1f3cfa184637ca8
BLAKE2b-256 10962bd07e2f065e019168f47d7a8463d5405dc372609a769f972f1532e97dbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_lmgc90-0.1.6.tar.gz:

Publisher: release.yml on BlockResearchGroup/compas_lmgc90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_lmgc90-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_lmgc90-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 677956cf6ccd67fc6b7d3837ab3ca7ca4dec5fa4adf14b8dfb5861b06308038d
MD5 71ba5904a7b782cba71acb259d8bcd02
BLAKE2b-256 af7a25392c5830705114ad7f2cb7242960fc25fac64e69cfc7bb7657f07fc293

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_lmgc90-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on BlockResearchGroup/compas_lmgc90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_lmgc90-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_lmgc90-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fade8c7070941deee213c1b49fdc0919933bf069ef8c2a2f93f2f2b8f6e7e4bb
MD5 aaf799d3216c228796dadf0146661359
BLAKE2b-256 32488e476f3634c5a1767797060e07fbd48e96f7bad892cefab539c5dc17fffd

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_lmgc90-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on BlockResearchGroup/compas_lmgc90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page