less ambiguous tests for arguments being not None
This commit is contained in:
@ -1361,7 +1361,7 @@ class lammps(object):
|
|||||||
This function is a wrapper around the :cpp:func:`lammps_create_atoms`
|
This function is a wrapper around the :cpp:func:`lammps_create_atoms`
|
||||||
function of the C-library interface, and the behavior is similar except
|
function of the C-library interface, and the behavior is similar except
|
||||||
that the *v*, *image*, and *shrinkexceed* arguments are optional and
|
that the *v*, *image*, and *shrinkexceed* arguments are optional and
|
||||||
default to *None*, *None*, and *False*, respectively. With none being
|
default to *None*, *None*, and *False*, respectively. With *None* being
|
||||||
equivalent to a ``NULL`` pointer in C.
|
equivalent to a ``NULL`` pointer in C.
|
||||||
|
|
||||||
The lists of coordinates, types, atom IDs, velocities, image flags can
|
The lists of coordinates, types, atom IDs, velocities, image flags can
|
||||||
@ -1389,7 +1389,7 @@ class lammps(object):
|
|||||||
:return: number of atoms created. 0 if insufficient or invalid data
|
:return: number of atoms created. 0 if insufficient or invalid data
|
||||||
:rtype: int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
if id:
|
if id != None:
|
||||||
id_lmp = (self.c_tagint*n)()
|
id_lmp = (self.c_tagint*n)()
|
||||||
try:
|
try:
|
||||||
id_lmp[:] = id[0:n]
|
id_lmp[:] = id[0:n]
|
||||||
@ -1411,7 +1411,7 @@ class lammps(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if v:
|
if v != None:
|
||||||
v_lmp = (c_double*(three_n))()
|
v_lmp = (c_double*(three_n))()
|
||||||
try:
|
try:
|
||||||
v_lmp[:] = v[0:three_n]
|
v_lmp[:] = v[0:three_n]
|
||||||
@ -1420,7 +1420,7 @@ class lammps(object):
|
|||||||
else:
|
else:
|
||||||
v_lmp = None
|
v_lmp = None
|
||||||
|
|
||||||
if image:
|
if image != None:
|
||||||
img_lmp = (self.c_imageint*n)()
|
img_lmp = (self.c_imageint*n)()
|
||||||
try:
|
try:
|
||||||
img_lmp[:] = image[0:n]
|
img_lmp[:] = image[0:n]
|
||||||
|
|||||||
Reference in New Issue
Block a user