ChemSharp Molecules
.NET Library for processing of chemistry related files
com.chemsharp.molecules Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/molecules.git README Markdown
Copy this to your project's README.md
## Installation
Add **ChemSharp Molecules** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/molecules.git
```
[](https://www.pkglnk.dev/pkg/molecules)Dependencies (1)
README
![]()
ChemSharp
.NET Library for processing of chemistry related files. Powers PorphyStruct!
NuGet Packages
ChemSharp |
|
ChemSharp.Molecules |
|
ChemSharp.Molecules.Blazor |
|
ChemSharp.Molecules.HelixToolkit |
|
ChemSharp.Spectroscopy |
|
ChemSharp.UnitConversion |
CI Releases at: GitHub Packages
Features
- Open and process Molecular files (see Supported Filetypes)
- Sum formula operations and elemental analysis calculation
- Using Elemental Data from https://github.com/JensKrumsieck/periodic-table
- Blazor view for molecules using three.js
- Open and process Spectroscopy related files (see Supported Filetypes)
- Unit Conversion for (Energy, Magnetic Units, Mass)
Basic Usage
Create Molecules
Molecules can be created in a lot of ways. The easiest way is to use MoleculeFactory.Create, which accepts a string path. Depending on the File extension the correct DataProvider is used to load the file.
//Creates a molecule from cif file
const string path = "files/cif.cif";
var mol = MoleculeFactory.Create(path);
It is also possible to create a Molecule by using a specific DataProvider (e.g. if automatic detection fails or you only want to support a selected number of file types)
//You can also create molecules by selecting the provider yourself
const string path = "files/benzene.mol2";
var provider = new Mol2DataProvider(path);
var mol = new Molecule(provider);
You can also add Atoms and Bonds as Lists if you got the data from somewhere else.
//...or by just adding the Atoms & Bonds as Lists
const string path = "files/cif.cif";
var provider = new CIFDataProvider(path);
var mol = new Molecule(provider.Atoms, provider.Bonds);
Create Spectra
Spectra can be created in a lot of ways. The easiest way is to use SpectrumFactory.Create, which accepts a string path. Depending on the File extension the correct DataProvider is used to load the file.
//Creates an UV/Vis Spectrum
const string path = "files/uvvis.dsw";
var uvvis = SpectrumFactory.Create(path);
It is also possible to create a Spectrum by using a specific DataProvider (e.g. if automatic detection fails or you only want to support a selected number of file types)
//You can also create spectra by choosing the provider
//explicitly. e.g. csv files
//Reads in an CSV Spectrum (first data only)
const string path = "files/uvvis.csv";
var prov = new GenericCSVProvider(path);
var uvvis = new Spectrum(prov);
There is also the MultiCSVProvider which can provide data from multiple XY pairs in a csv file
//To read in all CSV Data stored as (X,Y) pairs use the MultiCSVProvider
//Each Spectrum will be stored as DataPoint[] in MultiXYData
const string file = "files/multicsv.csv";
var provider = new MultiCSVProvider(file);
Supported Filetypes
Molecule
- Import (XYZ, CIF (crystallographic information file, CCDC), MOL2 (TRIPOS Mol2), PDB (Protein Data Bank file), MOL (MDL MOL, ChemSpider), CDXML (Single Molecule only, 2D))
- Export (XYZ, MOL2)
Spectroscopy
- Import (Varian/Agilient DSW, Bruker EMX SPC/PAR, Bruker TopSpin (fid, (1r/1i processed spectra), JCAMP-DX (acqus, procs, ...)), CSV)
- Export (CSV)
Used Libraries:
Compatibility
- .NET Standard 2.0, .NET Standard 2.1, .NET 5, .NET 6
- Unity (see Wiki
- Godot Engine (see Wiki for Snippet)
- Blazor (see ChemSharp.Molecules.Blazor)
- HelixToolkit via ChemSharp.Molecules.HelixToolkit
No comments yet. Be the first!