Skip to content

Commit a4ec1a6

Browse files
committed
copy 2020 materials from Google Drive
1 parent 167d673 commit a4ec1a6

26 files changed

+17337
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Common git commands:
2+
0. `git clone <https://github.com/some_repo/some_repo.git>` Obtain exact copy of repo from github
3+
1. `git add <file>` Adds local file to git tracking
4+
2. `git log` Shows local history of commits
5+
3. `git status` Shows any changes to local files, in addition to any untracked files
6+
4. `git commit -m "text message"` Commits any files that have been added to stage with message
7+
5. `git commit -a` Adds then commits all changes in tracked files
8+
6. `git pull <remote> <branch>` Merges github history to local, taken from remote (usually origin) and branch (often master).
9+
7. `git push <remote> <branch>` Moves local commits to github repository at remote/branch
10+
8. `git checkout -b <branch_name>` Makes a new branch and switch to it
11+
9. `git checkout <branch_name>` Move to branch_name
12+
10. `git branch` Lists branches, shows which branch you are on
13+
11. `git branch -d` Delete branch locally
14+
12. `git push <remote> :<branch_name>` Deletes branch on remote.
15+
13. `git checkout <file>` Reverts any changes in `file` to state determined by current git hash
16+
14. `git init` Create a new git repository
17+
15. `git remote add origin <server>` Connects repository to a remote server
18+
16. `git diff` View all local changes relative to remote
19+
17. `git rm` Removes a tracked file
20+
18. `git remote -v` Shows identity of origin and other remotes
21+
19. `git remote add upstream <parent repo>` Adds upstream remote for a parent repo
22+
23+
24+
## Making a new repo
25+
1. First make repo on github
26+
2. `git clone` your new repo locally.
27+
3. Make some new file, `file.dat`
28+
4. See your new untracked file: `git status`
29+
5. Stage file for commit: `git add file.dat`
30+
6. Commit change, enter message, close file: `git commit -a`
31+
7. See your new history!: `git log`
32+
8. Push your changes to your repo on github.com: `git push origin master`
33+
34+
## Making a fork
35+
### Good practice for making changes to shared code
36+
1. On a parent repo page in github.com, click Fork on the top right.
37+
2. Clone to local machine: `git clone <your fork>`
38+
3. Setup upstream: `git remote add upstream <parent repository>`
39+
4. Make a branch of your fork: `git checkout -b new_branch` (branch name should be descriptive of changes)
40+
5. Make some local change: `vi new_file.dat`
41+
6. Add and commit change: `git add new_file.dat`, `git commit -m "Add new file"`
42+
7. Rebase to resolve any merge conflicts: `git pull --rebase upstream master`
43+
8. If your local branch differs from origin, you will need to make your changes and then push with force:
44+
`git push --force origin new_branch`
45+
9. Push changes: `git push origin new_branch` (this will create a new branch on github.com)
46+
10. On your fork on github.com, create a pull request pushing the "Compare & pull request" button.
47+
11. Open the pull request by by writing a description and clicking "Create pull request"
48+
12. Delete branch once PR is merged
Loading
Loading

PsiCon2020_Logo.png

87.5 KB
Loading

RollinKing_OptKing/h2o-opthelper.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import psi4
2+
import optking
3+
4+
# Test optimization with explicit loop using externally provided gradients
5+
# In this case, using Leonard-Jones potential
6+
h2o = psi4.geometry("""
7+
O
8+
H 1 1.0
9+
H 1 1.0 2 104.5
10+
""")
11+
12+
psi4_options = {
13+
'basis': 'sto-3g',
14+
'g_convergence': 'gau_verytight',
15+
'intrafrag_step_limit_max': 0.2
16+
}
17+
psi4.set_options(psi4_options)
18+
19+
# Create an OptHelper object. The comp_type == 'user' implies that the
20+
# user will provide the gradients directly.
21+
opt = optking.OptHelper('hf', comp_type='user')
22+
opt.build_coordinates()
23+
24+
for step in range(30):
25+
# Compute one's own energy and gradient
26+
E, gX = optking.lj_functions.calc_energy_and_gradient(opt.geom, 2.5, 0.01, True)
27+
28+
# Insert these values into the 'user' computer.
29+
opt.E = E
30+
opt.gX = gX
31+
opt.energy_gradient_hessian()
32+
33+
# Take step
34+
opt.step()
35+
conv = opt.test_convergence()
36+
if conv is True:
37+
print("Optimization SUCCESS:")
38+
break
39+
else:
40+
print("Optimization FAILURE:\n")
41+
42+
json_output = opt.close()
43+
44+
assert conv is True
45+
E = json_output['energies'][-1] # TEST
46+
RefEnergy = -0.03 # - epsilon * 3, where -epsilon is depth of each Vij well
47+
assert psi4.compare_values(RefEnergy, E, 6, "L-J Energy upon optimization")
48+

RollinKing_OptKing/h2o-psiapi.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Demonstration of python optking using psi api.
2+
# See optking/tests for lots of psi api examples.
3+
import psi4
4+
import optking
5+
6+
psi4.core.set_output_file('psi-out.dat')
7+
h2o = psi4.geometry("""
8+
O
9+
H 1 1.0
10+
H 1 1.0 2 104.5
11+
""")
12+
psi4_options = { 'basis': 'cc-pvdz' }
13+
psi4.set_options(psi4_options)
14+
15+
json_output = optking.optimize_psi4('hf')
16+
17+
print('Contents of QCSchema output:')
18+
for k in json_output.keys():
19+
print('\t' + k)
20+
21+
print('Properties of (next to) last geom:')
22+
for k in json_output['trajectory'][-1]['properties']:
23+
print('\t' + k)
24+
25+
print('Extras of (next to) last geom:')
26+
for k in json_output['trajectory'][-1]['extras']['qcvars']:
27+
print('\t' + k)
28+
29+
print('Energy {:15.10f}'.format(json_output['energies'][-1]))
30+
print('NRE {:15.10f}'.format(json_output['trajectory'][-1]['properties']['nuclear_repulsion_energy']))

RollinKing_OptKing/h2o-psithon.in

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# From psi4/tests/opt1
2+
REF_NRE = 8.9064890670
3+
REF_HF_ENERGY = -74.965901192
4+
5+
molecule h2o {
6+
O
7+
H 1 1.0
8+
H 1 1.0 2 104.5
9+
}
10+
11+
set {
12+
diis false
13+
basis sto-3g
14+
e_convergence 10
15+
d_convergence 10
16+
scf_type pk
17+
}
18+
# Runs C++ optimizer
19+
#thisenergy = optimize('scf')
20+
#compare_values(REF_NRE, h2o.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
21+
#compare_values(REF_HF_ENERGY, thisenergy, 6, "Reference energy")
22+
23+
# Runs python optimizer
24+
import optking
25+
rval = optking.optimize_psi4('scf')
26+
27+
nre = rval['trajectory'][-1]['properties']['nuclear_repulsion_energy']
28+
hf_energy = rval['energies'][-1]
29+
compare_values(REF_NRE, nre, 3, "Nuclear repulsion energy")
30+
compare_values(REF_HF_ENERGY, hf_energy, 6, "Reference energy")
31+
76.6 MB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)