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.
Questions tagged [chemistry]
275 questions
-1
votes
3 answers
Extract positions from a list (Python)
I have an .xyz file of H2S and if I read the file like so:
with open('H2S.xyz','r') as stream:
for line in stream:
print(line)
I get this:
3
XYZ file of the hydrogen sulphide molecule
S 0.00000000 0.00000000 …

Butterfly
- 9
- 3
-1
votes
1 answer
How to read GDB 13 database? And is there any easy way to clean this data?
5
0001 -417.031
C 1.04168, -0.05620, -0.07148 1.041682, -0.056200, -0.071481
H 2.15109, -0.05620, -0.07150 2.130894, -0.056202, -0.071496
H 0.67187, 0.17923, -1.09059 0.678598, 0.174941, -1.072044
H 0.67188, 0.70866, …

Guanyan Lin
- 65
- 7
-1
votes
2 answers
Reading chemical symbols in Fortran
I'm reading a list of chemical symbols. Since there are 118 elements, a select case construct would have 119 cases. Is there a better way to do this? Some elements begin with the same letter, such as C, Ca, Cd, Co, so perhaps reading three A1…

Kurzd
- 99
- 1
-1
votes
1 answer
How to decide the priority of chemical reaction?
If there are more than one chemical reaction in a container, how to decide the order among those reaction.
For example, there are three chemicals in one beaker, called A,B and C. The chemical A can react with B, and A can react with C too. Is there…

XHLin
- 301
- 1
- 3
- 13
-1
votes
3 answers
How do I specify these variables correctly on perl?
I ran a molecular dynamics simulations which gave me 2,000 trajectory files. These files have the file name format au25-c2-benzalacetone.001 up to 2000. I wrote a general perl program but it isn't reading through the 2,000 files. How do I modify my…

Heh
- 3
- 3
-1
votes
2 answers
Molecule mass calculator program in C
I need to do a proyect that calculates me the molar mass of any molecule entered by the user.
For example if the user types CO2, my program needs to identify C (that is associated with a matrix with its mass), then identify O (associated with its…

Raphaelle
- 1
- 2
-1
votes
2 answers
Javascript ROY G BIV Line Spectrum?
I'm fairly new to javascript and I want to make a small line spectrum using html canvas and javascript so that I can later animate it when a button is clicked to show absorbtion lines and such just like in chemistry. I'm just not sure if pure…

user3786596
- 117
- 1
- 2
- 13
-1
votes
1 answer
Ok to use Java to model quantum mechanical behavior with ANNs?
I am working on a independent project. I am studying chemistry in school, along with computer science and would like to know if it is possible to model certain wave function phenomenon (schroedinger's equation, hamiltonians, eigenvalues) using…

Biochemist_HK
- 55
- 12
-1
votes
1 answer
Best thinkflow to make a Chemistry game in Flash?
So, as mentioned I'm doing some Flash this semester...I think I'd know how to do this in Python, with classes and all, but in AS3, everything is just so...detached.
I want to build a short chemistry game. You have 4 elements, fire, earth, wind and…

mechanicarts
- 171
- 1
- 15
-1
votes
2 answers
Separate String based on condition
I'm creating an iOS project for school and it works with chemical reactions.
The user would have a text field to insert the equation like this:
Fe3O4 + CO = 3FeO + CO2
My goal is to separate this into pieces based on some conditions:
-Finding a…

Elton Gruber
- 53
- 7
-2
votes
1 answer
Is there anyway to call PubChem API In python?
I have been using PubChem API to convert Chemical smiles to the structure but still have an error.
Here is my google colab I try with PIL image plus TKinter
https://colab.research.google.com/drive/1TE9WxXwaWKSLQzKRQoNlWFqztVSoIxB7
My desired output…
-2
votes
1 answer
"How to simplify an program for calculating molar mass of chemical fusion
The below program that calculates the molar by a given molecular formula
mass of a chemical compound containing no other elements than carbon,
hydrogen, nitrogen and oxygen.
At start up, the program should display the message on the console
Please…

Krass
- 86
- 1
- 7
-2
votes
1 answer
Trying to understand a Bash script given to me, specifically the while loop
I am using a script made by one of my former colleagues, he told me I'll need some working with it. I am wondering what this while loop does:
# This is the loop that does the simulation
lastsim=0
nextsim=`/usr/bin/expr $lastsim + 1`
while […

DS-V
- 123
- 1
- 1
- 7
-2
votes
2 answers
How can I convert a user-typed variable from a string to an integer?
I am creating a program that can determine the molecular mass of a chemical formula based on the atomic masses of the elements (respectively). The program won't run because when I am multiplying the elements by its subscript, it is essentially…

C. Programmer
- 1
- 2
-3
votes
2 answers
How to use regexp to identify the number of hydrogens in a chemical formula?
Which expression should I use to identify the number of hydrogen atoms in a chemical formula?
For example:
C40H51N11O19 - 51 hydrogens
C2HO - 1 hydrogen
CO2 - no hydrogens (empty)
Any suggestions?
Thanks!
Cheers!

German Andres Preciat Gonzalez
- 103
- 1
- 5