A pure Java package for cheminformatics.
The artifact can be found at Maven Central:
<dependency>
<groupId>io.github.elonlit</groupId>
<artifactId>monomer</artifactId>
<version>1.7</version>
</dependency>
- Properties of all Elements
- Compounds
- Formula
- Molar Mass
- Percentage Composition by Mass
- Stoichiometric Amounts
- Empirical Formulae
- Empirical Formula by Percentage Composition
- Combustion Analysis of Hydrocarbons
- Chemical Reactions
- Balancing the Equation
- Combustion Reactions
- Stoichiometric Amounts
- Limiting Reagent
- Aqueous Solutions
- Solute
- Molarity (mol/L)
- Stoichiometric Amounts
- Dilutions
- Electrochemistry
- Galvanic (Voltaic) Cells
- Anode, Cathode, Cell Potential
- Electrolysis
- Galvanic (Voltaic) Cells
- Quantum Mechanics
- Electromagnetic Waves
- Frequency, Wavelength, Energy per photon
- Energy in nth Hydrogen Orbital
- Rydberg Equation
- Nuclear-nuclear Repulsions
- Vector Fields in Cylindrical and Spherical Coordinates
- Quaternions
- Gaussian Functions
- Electromagnetic Waves
- Monomers
- Base Monomer
- DNA
- RNA
- Residues
- Polymers
- Generic Seq
Element carbon = Element("C"); // Declare Element from its symbol
System.out.println(carbon); // Carbon{atomicNumber=6.0,elementName='Carbon',elementSymbol='C',atomicMass=12.011,neutrons=6.0,protons=6.0,electrons=6.0,period=2.0,group=14.0,phase='solid',radioactive=false,natural=true,metal=false,nonmetal=true,metalloid=false,type='Nonmetal',atomicRadius='0.91',electronegativity='2.55',firstIonization='11.2603',density=2.27,meltingPoint=3948.15,boilingPoint=4300.0,isotopes=7.0,discoverer='Prehistoric',specificHeat=0.709,shells=2.0,valence=4.0,config='[He] 2s2 2p2',massNumber=12.0}
System.out.println(carbon.atomicMass) // 12.011
Compound moronicAcid = new Compound("C30H46O3"); // Moronic acid (3-oxoolean-18-en-28-oic acid) is a natural triterpene
System.out.println(moronicAcid.humanReadableOccurrences); // {Oxygen=3,Hydrogen=46,Carbon=30}
System.out.println(moronicAcid.getMolarMass()); // 454.695
System.out.println(moronicAcid.getPercentCompositionByMass(new Element("O"))); // 10.555866
var water = new Compound("H2O"); // Instantiate a water compound
System.out.println(water.formula); // H2O
// Accepted inputs: grams, moles, and molecules
System.out.println(water.getAmounts("Molecules", 2e+24)); // {Grams=59.8505,Molecules=2.0E24,Moles=3.3222592}
// Construct a HashMapping of Elements in a Compound to their constituent relative frequencies
HashMap<Element, Float> percentCompositionMap = new HashMap<Element, Float>() {{
put(new Element("C"), 52.14f);
put(new Element("O"), 34.73f);
put(new Element("H"), 13.13f);
}};
// Instantiate a Compound from the resulting empirical formula of a Compound that is composed of 52.14% C, 34.73% O, and 13.13% H by mass
Compound adipicAcid = new Compound(EmpiricalFormulaUtil.getEmpiricalFormulaFromPercentComposition(percentCompositionMap));
System.out.println(adipicAcid); // C2H6O1: {Oxygen=1, Hydrogen=6, Carbon=2}
// A hydrocarbon fuel is fully combusted with 18.214 g of oxygen to yield 23.118 g of carbon dioxide and 4.729 g of water.
// Find the empirical formula for the hydrocarbon
Compound compound = new Compound(EmpiricalFormulaUtil.getHydrocarbonFromCombustion(23.118f, 4.729f));
System.out.println(compound); // C1H1: {Hydrogen=1, Carbon=1}
var photosynthesis = new Reaction("CO2 + H2O --> C6H12O6 + O2"); // Reactions delimited by "-->"
// Automatic balancing
System.out.println(photosynthesis.equation); // 6CO2 + 6H2O --> C6H12O6 + 6O2
System.out.println(EquationBalancerUtil.isBalanced(photosynthesis)); // true
// Get the amounts of ALL compounds in the above reaction given 5 grams of C6H12O6
System.out.println(photosynthesis.getAmounts("C6H12O6", "Grams", 5f)); // [{Grams=7.328481, Molecules=1.0024645E23, Moles=0.16652234}, {Grams=2.9998999, Molecules=1.0024645E23, Moles=0.16652234}, {Grams=5.0, Molecules=1.6707742E22, Moles=0.027753724}, {Grams=5.3283815, Molecules=1.0024645E23, Moles=0.16652234}]
// Find the limiting reagent of the reaction when using 3 moles of the first reactant (CO2) and 1 mole of the second reactant (H2O)
Compound limitingReagent = photosynthesis.getLimitingReagent("Moles", 3, 1);
System.out.println(limitingReagent); // H2O: {Oxygen=1, Hydrogen=2}
// Instantiate a Solution with the solute and molarity
Solution solution = new Solution("NaCl", 0.25f);
// Find the dilution of 2.5 L of 0.25M NaCl to a 0.125M NaCl solution:
System.out.println(solution.dilute(2.5f, 0.125f, 0)); // {Volume=5.0, Molarity=0.125, Solute=NaCl}
// Make a Galvanic Cell with Lead and Zinc electrodes
GalvanicCell galvanicCell = new GalvanicCell("Pb", "Zn");
System.out.println(galvanicCell); // GalvanicCell{Cell='Zn|Zn2+||Pb2+|Pb', Anode=Zn, Cathode=Pb, CellPotential=0.63}
// A HashMapping of arguments to values of either two of "amps", "seconds", or "grams."
HashMap<String, Float> kwargs = new HashMap<>() {{
put("seconds", 24*60*60f);
put("grams", 805f);
}};
// Moles of electrons transferred
int mol = 3;
// How much current was used to produce 805 grams of Aluminum metal from Al2O3 in 24 hours?
System.out.println(GalvanicCell.electrolysis("Al", mol, kwargs)); // {Amps=99.95144, Grams=805.0, Seconds=86400.0}
// Determine the wavelength, frequency, and energy of a wave with energy 2.84e-19 Joules per particle
Wave red = new Wave("Energy", 2.84e-19);
System.out.println(red); // Wave{wavelength=6.99462948008421E-7, frequency=4.286145536363085E14, energy=2.84E-19}
// Determine the energy of an electron in the 3rd orbital of a Hydrogen atom in Joules
System.out.println(Wave.energyOfHydrogenOrbital(3)); // -2.4221748553237596E-19
// Instantiate a Seq of type DNA
Seq<DNA> myCodingStrand = new Seq<>();
// Populate myCodingStrand with random DNA nucleotides
Random random = new Random();
for(int i=0; i<15000; i++) {
myCodingStrand.elongate(new DNA(String.valueOf(DNA.nucleotidesDNA.values()[new Random().nextInt(DNA.nucleotidesDNA.values().length)])));
}
If you use Monomer in your scientific work, please consider citing:
| E. Litman, Monomer - An object-oriented cheminformatics library, 2022-- . Available at: https://github.com/elonlit/monomer.
The reference in the BibLaTeX format:
@software{monomer2022,
author = {Litman, Elon},
title = {{Monomer} -- An object-oriented cheminformatics library},
url = {https://github.com/elonlit/Monomer},
version = {1.7},
date = {2022--},
}