Skip to main content

A scientific Python library with constants, unit convertors, formulas, and data analysis tools.

Project description

PyGamLab

PyGamLab Logo

PyGamLab is a scientific Python library for researchers, engineers, and students who need powerful tools for nanostructure generation, alloy design, material data exploration, and AI-driven analysis. Designed for simplicity, clarity, and usability.


๐Ÿ“Œ Overview

PyGamLab stands for Python GAMLAb tools, a collection of scientific tools and functions developed at the GAMLab (Graphene and Advanced Material Laboratory) by Ali Pilehvar Meibody under the supervision of Prof. Malek Naderi at Amirkabir University of Technology (AUT).

  • Main Author: Ali Pilehvar Meibody
  • Supervisor: Prof. Malek Naderi
  • Co-Author: Danial Nekoonam
  • Contributor: Shokoofeh Karimi
  • Affiliation: GAMLab, Amirkabir University of Technology (AUT)

๐Ÿ“ฆ Modules

PyGamLab consists of several core modules, each focused on materials modeling, nanoscience, and data-driven discovery.


๐Ÿงฑ Structure

Provides tools to generate, manipulate, and analyze nanoscale and bulk materials.

Key Features:

  • Generate 0D (clusters, nanoparticles), 1D (nanowires, nanotubes), 2D (nanosheets, thin films), and bulk crystals.
  • Automated builders for nanoclusters, nanotubes, and supercells.
  • Geometric operations: rotation, translation, scaling, merging, slicing, and symmetry analysis.
  • Supports formats: .cif, .xyz, .pdb, .vasp, .json, etc.
  • Integration with ASE and Pymatgen via built-in converters.

๐ŸŽจ GAMVis

Internal visualization engine for interactive 2D and 3D visualization of molecules, nanostructures, and crystals.

Capabilities:

  • Real-time 2D/3D visualization
  • Graphical representation of bonds, surfaces, and charge distributions
  • Export publication-quality figures and animations

๐Ÿค– Ai_core

Integrates machine learning workflows into materials research.

Highlights:

  • Automated regression, classification, and clustering workflows
  • Access to 140+ pre-trained models
  • Fine-tuning and inference on user data
  • Predict material properties: band gap, formation energy, hardness
  • Built-in tools for data splitting, validation, and evaluation

๐Ÿงฌ databases

Provides seamless access to multiple materials databases.

Supported Databases:

  • Materials Project (MP)
  • AFLOW
  • JARVIS
  • Crystallography Open Database (COD)

Available Data:

  • Mechanical, electronic, thermodynamic properties
  • Structural and crystallographic information
  • Chemical composition and symmetry

A universal class GAM_Explorer unifies data retrieval across databases.


๐Ÿ“Š Data_Analysis

Tools for data preprocessing, analysis, and visualization.

Main Features:

  • Read and preprocess data from files or DataFrames
  • Filtering, normalization, and feature extraction
  • Publication-ready plots: line, scatter, histogram, heatmap
  • 68+ experimental analysis tools (NMR, XPS, XRD, UV-Vis, Raman)
  • Scientific constants, unit converters, and utilities

๐Ÿ”น Constants.py

Includes comprehensive scientific constants in physics, chemistry, and engineering.

Examples: Planck's constant, Boltzmann constant, speed of light, universal gas constant, density and melting points of metals.


๐Ÿ”น Convertors.py

Contains unit conversion functions that follow the format:
FirstUnit_To_SecondUnit()

Examples:

  • Kelvin_To_Celsius(k)
  • Celsius_To_Kelvin(c)
  • Meter_To_Foot(m)
  • ...and many more standard conversions used in science and engineering.

๐Ÿ”น Functions.py

This module provides a wide collection of scientific formulas and functional tools commonly used in engineering applications.

Examples:

  • Thermodynamics equations
  • Mechanical stress and strain calculations
  • Fluid dynamics formulas
  • General utility functions

๐Ÿ“ฆ Requirements

To use PyGamLab, make sure you have the following Python packages installed:

  • numpy
  • pandas
  • scipy
  • matplotlib
  • seaborn
  • scikit-learn
  • ase
  • plotly
  • PyQt5
  • jarvis
  • mp_api
  • aflow

You can install all dependencies using:

pip install numpy pandas scipy matplotlib seaborn scikit-learn json scipy ase plotly PyQt5

๐Ÿš€ Installation

To install PyGAMLab via pip:

pip install pygamlab

or

git clone https://github.com/APMaii/pygamlab.git

๐Ÿ“– Usage Example

import PyGamLab





#--------------Constants-----------------------
import PyGamLab.Constants as gamcn

print(gamcn.melting_point_of_Cu)
print(gamcn.melting_point_of_Al)
print(gamcn.Fe_Tm_Alpha)
print(gamcn.Fe_Tm_Gama)

print(gamcn.Boltzmann_Constant)
print(gamcn.Faraday_Constant)


#----------Converters------------------------
import PyGamLab.Converters as gamcv

print(gamcv.Kelvin_to_Celcius(300))           # Convert 300 K to ยฐC
print(gamcv.Coulomb_To_Electron_volt(1))      # Convert 1 Coulomb to eV
print(gamcv.Angstrom_To_Milimeter(1))         # Convert 1 ร… to mm
print(gamcv.Bar_To_Pascal(1))                 # Convert 1 bar to Pascal

#-----------Functions------------------------
import PyGamLab.Functions as gamfunc

# Gibb's Free Energy: G = H0 - T*S0
H0 = 100  # Enthalpy in kJ/mol
T = 298   # Temperature in Kelvin
S0 = 0.2  # Entropy in kJ/molยทK
print(gamfunc.Gibs_free_energy(H0, T, S0))


# Electrical Resistance: R = V / I
voltage = 10         # in Volts
current = 2          # in Amperes
print(gamfunc.Electrical_Resistance(voltage, current))

# Hall-Petch Relationship: ฯƒ = ฯƒ0 + k / โˆšd
d_grain = 0.01       # Grain diameter in mm
sigma0 = 150         # Friction stress in MPa
k = 0.5              # Strengthening coefficient in MPaยทmm^0.5
print(gamfunc.Hall_Petch(d_grain, sigma0, k))




#-----------Data_Analysis--------------------
import PyGamLab.Data_Analysis as gamdat
import pandas as pd

df= pd.read_csv('/users/apm/....../data.csv')
gamdat.Stress_Strain1(df, 'PLOT')
my_uts=gamdat.Stress_Strain1(df, 'UTS')


data=pd.read_csv('/users/apm/....../data.csv')
my_max=gamdat.Xrd_Analysis(data,'max intensity')
gamdat.Xrd_Analysis(data,'scatter plot')
gamdat.Xrd_Analysis(data,'line graph')






#-----------Structures--------------------

from PyGamLab.structures.Generators import Nano_ZeroD_Builder

builder=Nano_ZeroD_Builder(material='Au', crystal_structure='fcc', lattice_constant=2.14)

Au_atoms=builder.get_atoms()

from PyGamLab.structures.gamvis import Molecular_Visualizer

Molecular_Visualizer(Au_atoms,format='gamvis')

Molecular_Visualizer(Au_atoms,format='ase')

Molecular_Visualizer(Au_atoms,format='matplotlib')







from PyGamLab.structures.GAM_architectures import Nano_ZeroD_Builder

builder=Graphene(lattice_constant=2.46, width=10, length=82, edge_type='zigzag' )

graphene_atoms=builder.get_atoms()

from PyGamLab.structures.gamvis import Molecular_Visualizer

Molecular_Visualizer(graphene_atoms,format='gamvis')

Molecular_Visualizer(graphene_atoms,format='ase')

Molecular_Visualizer(graphene_atoms,format='matplotlib')




#-----------databases--------------------

from PyGamLab.databases.Main_DB import GAM_Explorer



explorer=GAM_Explorer(backend='aflow',timeout=60,max_results=5,batch_size=10)


explorer.search_materials(formula='SiO2')


mechanical_properties=explorer.fetch_mechanical_properties()


electronic_properties=explorer.fetch_electronic_properties()


#--------------Ai Core--------------------
from PyGamLab.ai_core import Gam_Ai_Workflow


workflow=Gam_Ai_Workflow('Graphene-armchair-rf')

workflow.summary()

workflow.predict(range(0,100))


workflow.evaluate_regressor()

๐Ÿ“š Documentation

For detailed documentation, please visit the official PyGamLab Documentation.


๐Ÿ“ Project Structure

๐Ÿ”น High-Level Overview

pygamlab/
โ”œโ”€โ”€ Constants.py
โ”œโ”€โ”€ Convertors.py
โ”œโ”€โ”€ Functions.py
โ”œโ”€โ”€ Data_Analysis.py
โ”œโ”€โ”€ contributors.md
โ”œโ”€โ”€ structures/
โ”œโ”€โ”€ io/
โ”œโ”€โ”€ databases/
โ””โ”€โ”€ ai_core/

๐Ÿ” Detailed Structure


pygamlab/
โ”œโ”€โ”€ init.py
โ”œโ”€โ”€ Constants.py
โ”œโ”€โ”€ Convertors.py
โ”œโ”€โ”€ Functions.py
โ”œโ”€โ”€ Data_Analysis.py
โ””โ”€โ”€ contributors.md
โ”œโ”€โ”€ structures/
โ”‚ โ”œโ”€โ”€ Primatom/
โ”‚ โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”‚ โ”œโ”€โ”€ gam_universe.py
โ”‚ โ”‚ โ””โ”€โ”€ gam_molecule.py
โ”‚ โ”œโ”€โ”€ Generators/
โ”‚ โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”‚ โ”œโ”€โ”€ zero_d.py
โ”‚ โ”‚ โ”œโ”€โ”€ one_d.py
โ”‚ โ”‚ โ”œโ”€โ”€ two_d.py
โ”‚ โ”‚ โ””โ”€โ”€ auto_bulk.py
โ”‚ โ”œโ”€โ”€ GAM_architectures/
โ”‚ โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”‚ โ”œโ”€โ”€ GAM_Graphene.py
โ”‚ โ”‚ โ”œโ”€โ”€ GAM_phosphorene.py
โ”‚ โ”‚ โ”œโ”€โ”€ GAM_sillicene.py
โ”‚ โ”‚ โ”œโ”€โ”€ GAM_nano_particles.py
โ”‚ โ”‚ โ””โ”€โ”€ GAM_nanotubes.py
โ”‚ โ””โ”€โ”€ gamvis/
โ”‚   โ”œโ”€โ”€ init.py
โ”‚   โ”œโ”€โ”€ gamvis.py
โ”‚   โ””โ”€โ”€ gamvis_engine.py
โ”œโ”€โ”€ io/
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”œโ”€โ”€ read.py
โ”‚ โ”œโ”€โ”€ export.py
โ”‚ โ”œโ”€โ”€ checker.py
โ”‚ โ””โ”€โ”€ conversions.py
โ”œโ”€โ”€ databases/
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”œโ”€โ”€ Main_DB.py
โ”‚ โ”œโ”€โ”€ COD.py
โ”‚ โ”œโ”€โ”€ Material_projects.py
โ”‚ โ”œโ”€โ”€ Jarvis.py
โ”‚ โ””โ”€โ”€ Aflow.py
โ””โ”€โ”€ ai_core/
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”œโ”€โ”€ gam_ai.py
โ”‚ โ””โ”€โ”€ gam_models/
โ”‚   โ”œโ”€โ”€ init.py
โ”‚   โ”œโ”€โ”€ files.gam_ai
โ”‚   โ””โ”€โ”€ ...

๐Ÿค Contributing

Contributions are welcome! Here's how to get started:

Fork the repository. Create your feature branch

git checkout -b feature/my-feature

Commit your changes

git commit -am 'Add some feature'

Push to the branch

git push origin feature/my-feature

Create a new Pull Request. Please make sure to update tests as appropriate and follow PEP8 guidelines.


๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE.txt file for details


๐Ÿ™ Acknowledgements

This project is part of the scientific research activities at GAMLab (Generalized Applied Mechanics Laboratory) at Amirkabir University of Technology (AUT).

Special thanks to:

  • Prof. Malek Naderi โ€“ For his guidance, mentorship, and continuous support.
  • Ali Pilehvar Meibody โ€“ Main developer and author of PyGamLab.
  • Danial Nekoonam โ€“ Co-Author of PyGamLab.
  • Shokoofeh Karimi - For her Contribution of verify and testing most functions
  • GAMLab Research Group โ€“ For providing a collaborative and innovative environment.
  • Hossein Behjoo โ€“ For his guidance in taking the AI courses and his creative work in the development of the logo.

We would also like to thank all the students who participated in the GAMLab AI course and contributed to the growth and feedback of this project. Their names are proudly listed in the contributors.md file.

This project was made possible thanks to the powerful Python open-source ecosystem:
NumPy, SciPy, Pandas, Matplotlib, Seaborn, Scikit-learn, and many more.


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

pygamlab-1.9.8.tar.gz (6.3 MB view details)

Uploaded Source

Built Distribution

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

pygamlab-1.9.8-py3-none-any.whl (6.6 MB view details)

Uploaded Python 3

File details

Details for the file pygamlab-1.9.8.tar.gz.

File metadata

  • Download URL: pygamlab-1.9.8.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pygamlab-1.9.8.tar.gz
Algorithm Hash digest
SHA256 243c99f0ae77a11f9ae70b9d1dd8fa7d6a591580655a8f0b7627fd1d41f316f3
MD5 fe6c4962c125a58a8cbda6a5893af118
BLAKE2b-256 b3c929d5eec2c9e34e8042e0bb086a6237faa1130950e4caa56412f443a1523b

See more details on using hashes here.

File details

Details for the file pygamlab-1.9.8-py3-none-any.whl.

File metadata

  • Download URL: pygamlab-1.9.8-py3-none-any.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pygamlab-1.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c5f2f584c06e8b5e06222b3031b3155e1c8e24ea1f19f27bac9b9ea908044c8e
MD5 1f6e524bf445adca500db55dc3f96112
BLAKE2b-256 f829bf06296aa710499e0e17a14785e0629f9ffe5235c6771e9873b6622a99b7

See more details on using hashes here.

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