unifyingtrussdesignspace
Code for 'Unifying the design space of truss metamaterials by generative modeling'
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: nature.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.4%) to scientific vocabulary
Repository
Code for 'Unifying the design space of truss metamaterials by generative modeling'
Basic Info
- Host: GitHub
- Owner: li-zhengz
- License: mit
- Language: Python
- Default Branch: main
- Size: 19.1 MB
Statistics
- Stars: 16
- Watchers: 1
- Forks: 7
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
UnifyingTrussDesignSpace
This repository contains the generative modeling framework and code for constructing a unified design space for the use of inverse design with truss lattices as described in Unifying the design space and optimizing linear and nonlinear truss metamaterials by generative modeling.
The corresponding dataset used in this work can be found under ETH Zurich research colletion.
Requirements
- Python (tested on version 3.10.4)
- Python packages:
- Pytorch (tested on CUDA version 11.0)
- Pandas
- NumPy
- SciPy
- prefetch_generator
File descriptions
__fwdTrain__:main.py: trains the presented generative modeling framework and the property predictor using the dataset given above.validation.py: loads the pre-trained models and predicts the reconstructed truss structures and their corresponding effective stiffness (given in Voigt notation) for a test dataset. Additionally, it randomly samples 1000 points from a multivariate Gaussian distribution and calculates the validity score (the percentage of random samples that can be translated into a valid truss structure).
__invOpt__:invOpt.py: inverse design of structures with desired properties using gradient-based optimization.
__models__:parameters.py: hyperparameters used in training (neural network model shape, training epochs, learning rate, loss weight, etc.).model.py: defines the structure of the VAE modelvaeModeland the property predictorcModel.utils.py: data postprocessing.
__results__: saves the trained model, including the VAE model and the property predictor.
Quick start
To start with the code, simply clone this repository via
git clone https://github.com/li-zhengz/UnifyingTrussDesignSpace.git
and run the corresponding script (estimated runtime of around 1 minute).
Generative modeling and forward property prediction
After cloning this repo and running the validation.py script, you can obtain the reconstructed adjacency matrix, node positions, predicted effective stiffness, and the ground truth values for a holdout test dataset of size 2000 (estimated runtime of around 2 minutes).
To run the code on your own data, the truss structures input must be provided in the form of the adjacency matrix adj and node offsets x as described in the publication. By loading the pre-trained neural network models, you can get the encoded latent representations by
python
encoded, mu, std = model.encoder(adj, x)
The jointly-trained property predictor predicts the effective stiffness matrix by
python
c_pred = c_model(c_input)
Note that the output c_pred is given in Voigt notation and only contains the following 9 independent components of the stiffness tensor $(C{1111}, C{1122}, C{1133}, C{2222}, C{2233}, C{3333}, C{2323}, C{3131}, C{1212})$.
The variational autoencoder (VAE) reconstructs the truss structure by
```python
adjdecoded, x_decoded = model.decoder(encoded)
```
Inverse design
The continuous latent representation of truss lattices allows for the use of gradient-based optimization to search for structures with desired properties. An example optimizing for maximum effective Young's moduli $E{33}$ can be found in invOpt.py.
You can use the code to optimize for other properties by defining the target property in `opttarget, e.g.,
``python
target property names: ['E11', 'E22', 'E33', 'G23', 'G31', 'G12', 'v21', 'v31', 'v32', 'v12', 'v13', 'v23']
opttarget = ['E33']
``
The number of initial guessesnumsampleand the number of cores used in multiprocessingnum_workers` can be modified to fit specific requirements.
Citation
If this code is useful for your research, please cite our publication. ```bibtex @article{zheng2023unifying, title={Unifying the design space and optimizing linear and nonlinear truss metamaterials by generative modeling}, author={Zheng, Li and Karapiperis, Konstantinos and Kumar, Siddhant and Kochmann, Dennis M}, journal={Nature Communications}, volume={14}, number={1}, pages={7563}, year={2023}, publisher={Nature Publishing Group UK London} }
Owner
- Login: li-zhengz
- Kind: user
- Repositories: 1
- Profile: https://github.com/li-zhengz
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If this code is useful for your research, please cite it as below."
authors:
- family-names: Zheng
given-names: Li
orcid: https://orcid.org/1234-5678-9101-1121
title: "UnifyingTrussDesignSpace"
version: 0.1.0
doi: 10.5281/zenodo.8255658
url: "https://github.com/li-zhengz/UnifyingTrussDesignSpace"
date-released: 2023-08-17
GitHub Events
Total
- Issues event: 6
- Watch event: 4
- Issue comment event: 4
- Push event: 1
- Fork event: 3
Last Year
- Issues event: 6
- Watch event: 4
- Issue comment event: 4
- Push event: 1
- Fork event: 3