Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tbgl
tools
mrdna
Commits
f20a449c
Commit
f20a449c
authored
Sep 22, 2020
by
cmaffeo2
Browse files
Fix to productpotential
parent
4a48abc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
mrdna/arbdmodel/__init__.py
View file @
f20a449c
...
...
@@ -157,9 +157,9 @@ class Parent():
# for b in (i,j): assert(b in beads)
self
.
bond_angles
.
append
(
(
i
,
j
,
k
,
l
,
bond_angle
)
)
def
add_product_potential
_angle
(
self
,
potential_list
):
def
add_product_potential
(
self
,
potential_list
):
""" potential_list: list of tuples of form (particle_i, particle_j,..., TabulatedPotential) """
if
len
(
terms
)
<
2
:
raise
ValueError
(
"Too few potentials"
)
if
len
(
potential_list
)
<
2
:
raise
ValueError
(
"Too few potentials"
)
for
elem
in
potential_list
:
beads
=
elem
[:
-
1
]
pot
=
elem
[
-
1
]
...
...
@@ -1272,20 +1272,23 @@ component "data" value 3
def
_writeArbdProductPotentialFile
(
self
):
if
len
(
self
.
product_potentials
)
>
0
:
with
open
(
self
.
_product_potential_filename
,
'w'
)
as
fh
:
for
ijk_tb
in
self
.
get_product_potentials
():
ijk
=
ijk_b
[:
-
1
]
tb
=
ijk_tb
[
-
1
]
if
not
(
type
(
tb
)
is
tuple
or
type
(
tb
)
is
list
):
if
len
(
tb
)
!=
2
:
raise
ValueError
(
"Invalid product potential"
)
type_
,
b
=
tb
if
type
(
type_
)
is
not
str
:
raise
ValueError
(
"Invalid product potential: unrecognized specification of potential type"
)
else
:
type_
=
""
b
=
tb
if
type
(
b
)
is
not
str
and
not
isinstance
(
b
,
Path
):
b
.
write_file
()
fh
.
write
(
"PRODUCTPOTENTIAL "
+
" "
.
join
([
str
(
x
)
for
x
in
ijk
+
[
type_
,
b
]
if
x
!=
""
]))
for
pot
in
self
.
get_product_potentials
():
line
=
"PRODUCTPOTENTIAL "
for
ijk_tb
in
pot
:
ijk
=
ijk_tb
[:
-
1
]
tb
=
ijk_tb
[
-
1
]
if
type
(
tb
)
is
tuple
or
type
(
tb
)
is
list
:
if
len
(
tb
)
!=
2
:
raise
ValueError
(
"Invalid product potential"
)
type_
,
b
=
tb
if
type
(
type_
)
is
not
str
:
raise
ValueError
(
"Invalid product potential: unrecognized specification of potential type"
)
else
:
type_
=
""
b
=
tb
if
type
(
b
)
is
not
str
and
not
isinstance
(
b
,
Path
):
b
.
write_file
()
line
=
line
+
" "
.
join
([
str
(
x
.
idx
)
for
x
in
ijk
])
+
" "
line
=
line
+
" "
.
join
([
str
(
x
)
for
x
in
[
type_
,
b
]
if
x
!=
""
])
+
" "
fh
.
write
(
line
)
def
dimensions_from_structure
(
self
,
padding_factor
=
1.5
,
isotropic
=
False
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment