Skip to content

Commit

Permalink
add possibility to not use dihedral angles
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrmnn committed Jul 19, 2018
1 parent 1916a45 commit f621ec1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
19 changes: 10 additions & 9 deletions berny/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def get_clusters(C):


class InternalCoords(object):
def __init__(self, geom, allowed=None, superweakdih=False):
def __init__(self, geom, allowed=None, dihedral=True, superweakdih=False):
self._coords = []
n = len(geom)
geom = geom.supercell()
Expand All @@ -232,14 +232,15 @@ def __init__(self, geom, allowed=None, superweakdih=False):
ang = Angle(i, j, k, C=C)
if ang.eval(geom.coords) > pi/4:
self.append(ang)
for bond in self.bonds:
self.extend(get_dihedrals(
[bond.i, bond.j],
geom.coords,
bondmatrix,
C,
superweak=superweakdih,
))
if dihedral:
for bond in self.bonds:
self.extend(get_dihedrals(
[bond.i, bond.j],
geom.coords,
bondmatrix,
C,
superweak=superweakdih,
))
if geom.lattice is not None:
self._reduce(n)

Expand Down
10 changes: 9 additions & 1 deletion berny/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'stepmax': 1.8e-3,
'steprms': 1.2e-3,
'trust': 0.3,
'dihedral': True,
'superweakdih': False,
}
"""
Expand All @@ -29,6 +30,9 @@
Initial trust radius in atomic units. It is the maximum RMS of the
quadratic step (see below).
- dihedral:
Form dihedral angles.
- superweakdih:
Form dihedral angles containing two or more noncovalent bonds.
"""
Expand Down Expand Up @@ -89,7 +93,11 @@ def __init__(self, geom, params):

def init(s, log=no_log):
s.trust = s.params['trust']
s.coords = InternalCoords(s.geom, superweakdih=s.params['superweakdih'])
s.coords = InternalCoords(
s.geom,
dihedral=s.params['dihedral'],
superweakdih=s.params['superweakdih'],
)
s.H = s.coords.hessian_guess(s.geom)
s.weights = s.coords.weights(s.geom)
for line in str(s.coords).split('\n'):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='pyberny',
version='0.3.2',
version='0.3.3',
description='Molecular/crystal structure optimizer',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit f621ec1

Please sign in to comment.