Questions tagged [chemistry]

For programming questions that involve chemistry - such as questions about programmatically working with chemical formulae, simulating chemical processes, or using chemistry-related libraries and APIs. Non-programming questions about chemistry are off-topic here, but may be on-topic on chemistry.stackexchange.com.

275 questions
0
votes
3 answers

R - Extracting a number associated with a character

I am trying to extract the number of carbons, hydrogens, and oxygens from a chemical formula. I previously found some code that I have been trying to use. The problem is that the code only works when the chemical formula has more than 1 of the…
TCB at UGA
  • 109
  • 6
0
votes
0 answers

How to get a file using OpenFileDialog so it can be read and analysed?

I'm trying to write a program that can analyse Mass Spectrometry .mzml files for my Chemistry project at university. I'm new to programming. I have some code that allows the user to browse a file, but the code only prints the file path. import…
0
votes
3 answers

How to model chemical kinetics in python using reaction constants?

I would like to make a concentration vs time graph in Python using data reaction reaction constants already provided to me. Are there any Python packages available? How should I go about solving this?
Ayanna
  • 1
  • 1
  • 6
0
votes
1 answer

Exploring linked point with recursing "for" function in python

I have a set of points in the space, each of them is linked to some other: http://molview.org/?q=Decane For each point I need to find three other points: One to form a bond: first neighbors Second to form an angle: second neighbors Third to form a…
Okano
  • 232
  • 2
  • 9
0
votes
1 answer

Correct display of chemical formulae in ggplot axis category labels

I'm plotting a data set with chemical formulae as categories, and values associated with each: data <- data.frame(compound = factor(c("SiO[2]", "Al[2]O[3]", "CaO")), value = rnorm(3, mean = 1, sd = 0.25)) I want to get the…
TimM
  • 109
  • 8
0
votes
1 answer

R function to find value in same table and column, but different value

I have a table (using R in Spotfire) where I am trying to determine the adjusted peak area based on data in the same table. So below is an example of the table df <- data.frame(Sample_Name = c("Smpl 1", "Smpl 1", "Smpl 2", "Smpl 2"), …
0
votes
1 answer

How to reduce coefficients to their lowest possible integers using Matlab - Balancing Chemical Equations

I am attempting to develop a Matlab program to balance chemical equations. I am able to balance them via solving a system of linear equations. Currently my output is a column vector with the coefficients. My problem is that I need to return the…
Joshua
  • 177
  • 3
  • 3
  • 14
0
votes
1 answer

Subtracting columns in two datasets based on another column is deleting my rows

So I have some code that looks at two data frames and subtracts a column value named "Intensity" for certain Compositions of molecules. However for instance if the molecule is not in the other data frame, it completely gets rid of that row for some…
David
  • 43
  • 5
0
votes
2 answers

What method of OOP would be appropriate for periodic table properties?

I'm trying to code in java a pet project using the periodic table. What's the best/efficient way to make a data set out of periodic element properties. Should I make a class of all the elements individually? or make an array or objects? Initial…
briancpark
  • 9
  • 1
  • 2
0
votes
1 answer

Sed: Substitute letters on certain positions

I have a file with the structure: N1H3O1 C2H2 C1H4 H201 C1H1N1 N1H3 C2N1O1P1H3 P5 What I am trying to do is to count the sum of coefficients in each of the formulae. Thus, the desire output is: 1+3+1 5 2+2 4 1+4 5 2+1 3 1+1+1 3 3+1 4 2+1+1+1+3 8 5…
MirrG
  • 406
  • 3
  • 10
0
votes
1 answer

boiling eggs at altitude Javascript

So i have a simple problem with a complex solution. I need some help figuring out how to convert this: T = m * K * log(ywr * (Tegg - Twater) / (Tyolk - Twater)) m = 56 – Grade A eggs mass in grams. K = ?? – Thermal properties of egg find out…
0
votes
1 answer

How to use a string or a char vector (containing any chemical composition respectively formula) and calculate its molar mass?

I try to write a simple console application in C++ which can read any chemical formula and afterwards compute its molar mass, for example: Na2CO3, or something like: La0.6Sr0.4CoO3, or with brackets: Fe(NO3)3 The problem is that I don't know in…
Florian
  • 61
  • 5
0
votes
1 answer

Trouble saving chemical names in mysql database (parenthesis and square brackets)

I am trying to save chemical names in mysql databsave and have tried various file formats, such as csv (both with and without "" around all the strings), opendocument format, xls etc but it keeps returning errors such as column count does not match…
rm65453
  • 81
  • 1
  • 8
0
votes
1 answer

Unsupported 'const' declaration on local variable (reaction_network in Julia)

I am new to Julia (version 1.0.2) and currently trying the @reaction_network from the package DiffEqBiological (also current version, I can't find the version number here): tspan = (0.0, 50.0); y0 = [100.0 50.0 0.0 0.0] #[substrate enzyme complex…
Lissa
  • 1
  • 2
0
votes
1 answer

How to store mathematical functions in two dimensional array in sympy?

from sympy.physics.hydrogen import R_nl from sympy import var from sympy import Matrix import sympy as sp sp.init_printing(use_latex="mathjax") r1,Z=var("r1 Z") r2,Z=var("r2,Z") …
user135580
  • 105
  • 1
  • 7