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
21
votes
5 answers

Parsing a chemical formula

I'm trying to write a method for an app that takes a chemical formula like "CH3COOH" and returns some sort of collection full of their symbols. CH3COOH would return [C,H,H,H,C,O,O,H] I already have something that is kinda working, but it's very…
Christian Kjær
  • 215
  • 1
  • 3
  • 6
12
votes
3 answers

monte carlo simulation of protein structure and grid

I am working Monte Carlo simulation script over protein structure. I have never done before Monte Carlo scripting. I will extent this program at large scale. According to protein xyz coordinates I have to define the box size. This box will be…
awanit
  • 263
  • 1
  • 2
  • 11
9
votes
6 answers

Extract numbers from chemical formula

Apologies if this has already been asked and answered but I couldn't find a satisfactory answer. I have a list of chemical formulas including, in this order: C, H, N and O. And I would like to pull the number after each of these letters. The problem…
Julian
  • 93
  • 4
8
votes
4 answers

Parsing a chemical formula from a string in C#?

I am trying to parse a chemical formula (in the format, for example: Al2O3 or O3 or C or C11H22O12) in C# from a string. It works fine unless there is only one atom of a particular element (e.g. the oxygen atom in H2O). How can I fix that problem,…
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
7
votes
6 answers

Counting significant figures in Python?

Is there a way in Python to count the significant figures in a double/float/etc? I'm not seeing an easy way to do this, but I'd expect it to be in the library. Thanks in advance.
user456584
  • 86,427
  • 15
  • 75
  • 107
7
votes
1 answer

Which algorithms are there to find the Smallest Set of Smallest Rings?

I have an unweighted undirected connected graph. Generally, it's a chemical compound with lots of cycles side by side. The problem is common in this field and is called like the title says. Good algorithm is Horton's one. However, I don't seem to…
6
votes
3 answers

How to organise DataFrame columns

I am trying to organise DataFrame columns based on the specific rules, but I don't know the way. For example, I have a DataFrame related to chemistry as shown below. Each row shows the number of chemical bonds in a chemical compound. OH HO CaO …
hiro
  • 87
  • 4
6
votes
4 answers

How to balance a chemical equation in Python 2.7 Using matrices

I have a college assignment where I must balance the following equation : NaOH + H2S04 --> Na2S04 + H20 my knowledge of python and coding in general is extremely limited at the moment. So far I have attempted to use matrices to solve the…
George Sandle
  • 61
  • 1
  • 7
5
votes
0 answers

Problem while solving a minimal 1D Poisson-Nernst-Planck equation

I am trying to solve the Poisson-Nernst-Planck equation in Python with the library FiPy. It is basically a set of equations that describes - in my example - the separation of two ion concentrations in a solution with a potential gradient. Like…
Nadav
  • 51
  • 1
5
votes
0 answers

R:Time dependent parameters in differential equations for Chemistry calculation (working)

edit: there was an error in the formula, and now everything works as expected. Thanks for the suggestions that made me review the code I'm trying to study a quite famous chemistry equation Šesták–Berggren that represent a powerful tool for the…
Jojostack
  • 181
  • 9
5
votes
3 answers

Parsing a string that represents a chemical reaction and verify if the reaction is possible

I have to write a program that takes a user's chemical equation as an input, like 12 CO2 + 6 H2O -> 2 C6H12O6 + 12 O2, and watch if the amount of Atoms is on both sites the same. Is there any way to calculate and parse this easily? For example: 12…
user7242750
5
votes
1 answer

Counting isomeric n-carbon aliphatic alkanes

An n-carbon aliphatic alkane is an unrooted tree consisting of n nodes where the degree of each node is atmost 4. As an example, see this for a list of the enumeration of some low values of n. I am looking for an algorithm to compute the number of…
5
votes
5 answers

Any library for basic science chemistry/physics programming?

I am wondering if there is an open source scientific library for chemistry and/or physics for C++ (or maybe C)? I am NOT looking for simulation models, visualization, 3-d modeling. I am just looking for a basic toolbox that would have, for example:…
Roger Nelson
  • 1,882
  • 2
  • 15
  • 21
5
votes
2 answers

How to make a python organic chemistry retro-synthesis generator?

I am trying to learn python by making a simple program which generates a typical type of practice problem, organic chemistry students usually face on exams: the retro-synthesis question. For those unfamiliar with this type of question: the student…
Dider
  • 367
  • 1
  • 3
  • 17
5
votes
2 answers

Plotting an IR Spectrum with Gnuplot

I have an infrared spectrum for a compound of interest that I would like to plot, and I have a spectrum.dat file with all of the data points. It is of the form: # X Y 300 100 301 100 302 99 303 70 ... 3999 …
ChemWes
  • 57
  • 2
  • 6
1
2 3
18 19