GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tutorial/tutorial_data.py at master · qmlcode/tutorial

Expand file tree

/

tutorial_data.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
48 lines (33 loc) · 1.08 KB
/

tutorial_data.py

Copy path

File metadata and controls

48 lines (33 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import random
import os
import numpy as np
import qml
def get_energies(filename, key="dft"):
""" Returns a dictionary with heats of formation for each xyz-file.
"""
f = open(filename, "r")
lines = f.readlines()
f.close()
energies = dict()
for line in lines:
tokens = line.split()
xyz_name = tokens[0]
hof = float(tokens[1])
dftb = float(tokens[2])
if key=="dft":
energies[xyz_name] = hof
elif key=="delta":
energies[xyz_name] = hof - dftb
else:
energies[xyz_name] = hof
return energies
qm7_dft_energy = get_energies("hof_qm7.txt", key="dft")
qm7_delta_energy = get_energies("hof_qm7.txt", key = "delta")
compounds = [qml.Compound(xyz="qm7/"+f) for f in sorted(os.listdir("qm7/"))]
for mol in compounds:
mol.properties = qm7_dft_energy[mol.name]
mol.properties2 = qm7_delta_energy[mol.name]
random.seed(666)
random.shuffle(compounds)
energy_pbe0 = np.array([mol.properties for mol in compounds])
energy_delta = np.array([mol.properties2 for mol in compounds])
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.