.NET Library for processing of chemistry related files. Powers PorphyStruct!
ChemSharp |
|
ChemSharp.Molecules |
|
ChemSharp.Molecules.Blazor |
|
ChemSharp.Spectroscopy |
|
ChemSharp.UnitConversion |
CI Releases at: GitHub Packages
- 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)
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);
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);
-
Molecule
- Import (XYZ, CIF (crystallographic information file, CCDC), MOL2 (TRIPOS Mol2), PDB (Protein Data Bank file), CDXML (Single Molecule only))
- 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)