Before

…lines 1–101 unchanged (101 lines)
102 idx[shear_plane_normal],
103 lbf.shape[shear_plane_normal])]
104 unshifted_nodes = [lb_node(idx) for idx in dont_need_shift]
105 unshifted_weights = [
106 coupling_weight(pos_unshifted_lb_units, idx, lbf.shape)
107 for idx in dont_need_shift]
108
109 # Handle indices which are not in the primary box in the sheare plane
110 # normal
111 to_be_shifted_left = [
112 (idx, ijk) for idx, ijk in zip(indices_unshifted, ijks)
113 if idx[shear_plane_normal] >= lbf.shape[shear_plane_normal]]
114 to_be_shifted_right = [(idx, ijk) for idx, ijk in zip(
…lines 115–336 unchanged (222 lines)

After

…lines 1–102 unchanged (102 lines)
103 lbf.shape[shear_plane_normal])]
104 unshifted_nodes = [lb_node(idx) for idx in dont_need_shift]
105 unshifted_weights = [
106 coupling_weight(pos_unshifted_lb_units, idx, lbf.shape)
107 for idx in dont_need_shift]
108
109 # Handle indices which are not in the primary box in the sheared plane
110 # normal
111 to_be_shifted_left = [
112 (idx, ijk) for idx, ijk in zip(indices_unshifted, ijks)
113 if idx[shear_plane_normal] >= lbf.shape[shear_plane_normal]]
114 to_be_shifted_right = [(idx, ijk) for idx, ijk in zip(
115 indices_unshifted, ijks) if idx[shear_plane_normal] < 0]
…lines 116–336 unchanged (221 lines)

Before

module
comment "#"
comment "# Copyright (C) 2013-2023 The ESPResSo project"
comment "#"
comment "# This file is part of ESPResSo."
comment "#"
comment "# ESPResSo is free software: you can redistribute it and/or "...
comment "# it under the terms of the GNU General Public License as pu"...
comment "# the Free Software Foundation, either version 3 of the Lice"...
comment "# (at your option) any later version."
comment "#"
comment "# ESPResSo is distributed in the hope that it will be useful"...
comment "# but WITHOUT ANY WARRANTY; without even the implied warrant"...
comment "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See "...
comment "# GNU General Public License for more details."
comment "#"
comment "# You should have received a copy of the GNU General Public "...
comment "# along with this program. If not, see <http://www.gnu.org/"...
comment "#"
import_statement
import "import"
aliased_import
dotted_name
identifier "unittest"
as "as"
identifier "ut"
import_statement
import "import"
aliased_import
dotted_name
identifier "espressomd"
. "."
identifier "lees_edwards"
as "as"
identifier "lees_edwards"
import_statement
import "import"
dotted_name
identifier "espressomd"
import_statement
import "import"
dotted_name
identifier "espressomd"
. "."
identifier "lb"
import_statement
import "import"
aliased_import
dotted_name
identifier "numpy"
as "as"
identifier "np"
import_statement
import "import"
dotted_name
identifier "itertools"
import_statement
import "import"
dotted_name
identifier "copy"
import_statement
import "import"
aliased_import
dotted_name
identifier "unittest_decorators"
as "as"
identifier "utx"
import_from_statement
from "from"
dotted_name
identifier "tests_common"
import "import"
dotted_name
identifier "fold_index"
expression_statement (+23 nodes collapsed)
function_definition (+34 nodes collapsed)
function_definition (+39 nodes collapsed)
function_definition (+94 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition
def "def"
identifier "le_aware_lb_nodes_around_pos"
parameters
( "("
identifier "folded_pos"
, ","
identifier "lbf"
, ","
identifier "le_pos_offset"
, ","
identifier "shear_direction"
, ","
identifier "shear_plane_normal"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "Returns LB node(s) relevant for interpolation around the giv"...
string_end "\"\"\""
comment "# helper to get lb node from index with folding"
function_definition (+26 nodes collapsed)
comment "# center of first lb lattice point is at 0.5 in each Cartesi"...
comment "# determine position in lb units for 3 cases;"
comment "# unshifted, lees-edwards shifted to the left and to the rig"...
expression_statement
assignment
identifier "pos_unshifted_lb_units"
= "="
binary_operator
binary_operator
identifier "folded_pos"
/ "/"
attribute
identifier "lbf"
. "."
identifier "agrid"
- "-"
float "0.5"
comment "# relative to node centers"
expression_statement
assignment
identifier "shear_vec"
= "="
call
identifier "unit_vec"
argument_list
( "("
identifier "shear_direction"
) ")"
expression_statement (+23 nodes collapsed)
expression_statement (+23 nodes collapsed)
comment "# Particle couples to its 8 neighboring lattice sites"
comment "# when a particle is at a lattice site in any coordinate,"
comment "# the right hand side neighbor is included"
comment "# but the coupling weight for that neighbor is 0"
comment "# find the lower left lb node to which the particle couples"
expression_statement (+26 nodes collapsed)
expression_statement (+26 nodes collapsed)
expression_statement (+26 nodes collapsed)
expression_statement (+36 nodes collapsed)
expression_statement
assignment
identifier "indices_unshifted"
= "="
list_comprehension
[ "["
binary_operator
identifier "lower_idx_unshifted"
+ "+"
identifier "ijk"
for_in_clause
for "for"
identifier "ijk"
in "in"
identifier "ijks"
] "]"
comment "# Nodes with an index within the primary box in shear_plane_"...
comment "# do not need Lees-Edwards handling"
expression_statement (+34 nodes collapsed)
expression_statement
assignment
identifier "unshifted_nodes"
= "="
list_comprehension
[ "["
call
identifier "lb_node"
argument_list
( "("
identifier "idx"
) ")"
for_in_clause
for "for"
identifier "idx"
in "in"
identifier "dont_need_shift"
] "]"
expression_statement (+25 nodes collapsed)
comment "# Handle indices which are not in the primary box in the she"...
comment "# normal"
expression_statement (+45 nodes collapsed)
expression_statement (+38 nodes collapsed)
comment "# replace the index in shear direction"
expression_statement
assignment
identifier "shifted_left"
= "="
call
attribute
identifier "copy"
. "."
identifier "deepcopy"
argument_list
( "("
identifier "to_be_shifted_left"
) ")"
for_statement (+31 nodes collapsed)
expression_statement
assignment
identifier "shifted_right"
= "="
call
attribute
identifier "copy"
. "."
identifier "deepcopy"
argument_list
( "("
identifier "to_be_shifted_right"
) ")"
for_statement (+31 nodes collapsed)
expression_statement (+28 nodes collapsed)
expression_statement (+28 nodes collapsed)
expression_statement (+27 nodes collapsed)
expression_statement
assignment
identifier "shifted_weights"
= "="
binary_operator
identifier "weights_shifted_left"
+ "+"
identifier "weights_shifted_right"
expression_statement (+23 nodes collapsed)
assert_statement
assert "assert"
comparison_operator
call
identifier "len"
argument_list
( "("
binary_operator
identifier "shifted_nodes"
+ "+"
identifier "unshifted_nodes"
) ")"
== "=="
integer "8"
assert_statement
assert "assert"
comparison_operator
call
identifier "len"
argument_list
( "("
call
identifier "set"
argument_list
( "("
binary_operator
identifier "shifted_nodes"
+ "+"
identifier "unshifted_nodes"
) ")"
) ")"
== "=="
integer "8"
comment "# no duplicates"
return_statement
return "return"
expression_list
identifier "unshifted_nodes"
, ","
identifier "shifted_nodes"
, ","
identifier "unshifted_weights"
, ","
identifier "shifted_weights"
decorated_definition (+2619 nodes collapsed)
if_statement
if "if"
comparison_operator
identifier "__name__"
== "=="
string
string_start "'"
string_content "__main__"
string_end "'"
: ":"
block
expression_statement
call
attribute
identifier "ut"
. "."
identifier "main"
argument_list
( "("
) ")"

After

module
comment "#"
comment "# Copyright (C) 2013-2023 The ESPResSo project"
comment "#"
comment "# This file is part of ESPResSo."
comment "#"
comment "# ESPResSo is free software: you can redistribute it and/or "...
comment "# it under the terms of the GNU General Public License as pu"...
comment "# the Free Software Foundation, either version 3 of the Lice"...
comment "# (at your option) any later version."
comment "#"
comment "# ESPResSo is distributed in the hope that it will be useful"...
comment "# but WITHOUT ANY WARRANTY; without even the implied warrant"...
comment "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See "...
comment "# GNU General Public License for more details."
comment "#"
comment "# You should have received a copy of the GNU General Public "...
comment "# along with this program. If not, see <http://www.gnu.org/"...
comment "#"
import_statement
import "import"
aliased_import
dotted_name
identifier "unittest"
as "as"
identifier "ut"
import_statement
import "import"
aliased_import
dotted_name
identifier "espressomd"
. "."
identifier "lees_edwards"
as "as"
identifier "lees_edwards"
import_statement
import "import"
dotted_name
identifier "espressomd"
import_statement
import "import"
dotted_name
identifier "espressomd"
. "."
identifier "lb"
import_statement
import "import"
aliased_import
dotted_name
identifier "numpy"
as "as"
identifier "np"
import_statement
import "import"
dotted_name
identifier "itertools"
import_statement
import "import"
dotted_name
identifier "copy"
import_statement
import "import"
aliased_import
dotted_name
identifier "unittest_decorators"
as "as"
identifier "utx"
import_from_statement
from "from"
dotted_name
identifier "tests_common"
import "import"
dotted_name
identifier "fold_index"
expression_statement (+23 nodes collapsed)
function_definition (+34 nodes collapsed)
function_definition (+39 nodes collapsed)
function_definition (+94 nodes collapsed)
function_definition (+78 nodes collapsed)
function_definition
def "def"
identifier "le_aware_lb_nodes_around_pos"
parameters
( "("
identifier "folded_pos"
, ","
identifier "lbf"
, ","
identifier "le_pos_offset"
, ","
identifier "shear_direction"
, ","
identifier "shear_plane_normal"
) ")"
: ":"
block
expression_statement
string
string_start "\"\"\""
string_content "Returns LB node(s) relevant for interpolation around the giv"...
string_end "\"\"\""
comment "# helper to get lb node from index with folding"
function_definition (+26 nodes collapsed)
comment "# center of first lb lattice point is at 0.5 in each Cartesi"...
comment "# determine position in lb units for 3 cases;"
comment "# unshifted, lees-edwards shifted to the left and to the rig"...
expression_statement
assignment
identifier "pos_unshifted_lb_units"
= "="
binary_operator
binary_operator
identifier "folded_pos"
/ "/"
attribute
identifier "lbf"
. "."
identifier "agrid"
- "-"
float "0.5"
comment "# relative to node centers"
expression_statement
assignment
identifier "shear_vec"
= "="
call
identifier "unit_vec"
argument_list
( "("
identifier "shear_direction"
) ")"
expression_statement (+23 nodes collapsed)
expression_statement (+23 nodes collapsed)
comment "# Particle couples to its 8 neighboring lattice sites"
comment "# when a particle is at a lattice site in any coordinate,"
comment "# the right hand side neighbor is included"
comment "# but the coupling weight for that neighbor is 0"
comment "# find the lower left lb node to which the particle couples"
expression_statement (+26 nodes collapsed)
expression_statement (+26 nodes collapsed)
expression_statement (+26 nodes collapsed)
expression_statement (+36 nodes collapsed)
expression_statement
assignment
identifier "indices_unshifted"
= "="
list_comprehension
[ "["
binary_operator
identifier "lower_idx_unshifted"
+ "+"
identifier "ijk"
for_in_clause
for "for"
identifier "ijk"
in "in"
identifier "ijks"
] "]"
comment "# Nodes with an index within the primary box in shear_plane_"...
comment "# do not need Lees-Edwards handling"
expression_statement (+34 nodes collapsed)
expression_statement
assignment
identifier "unshifted_nodes"
= "="
list_comprehension
[ "["
call
identifier "lb_node"
argument_list
( "("
identifier "idx"
) ")"
for_in_clause
for "for"
identifier "idx"
in "in"
identifier "dont_need_shift"
] "]"
expression_statement (+25 nodes collapsed)
comment "# Handle indices which are not in the primary box in the she"...
comment "# normal"
expression_statement (+45 nodes collapsed)
expression_statement (+38 nodes collapsed)
comment "# replace the index in shear direction"
expression_statement
assignment
identifier "shifted_left"
= "="
call
attribute
identifier "copy"
. "."
identifier "deepcopy"
argument_list
( "("
identifier "to_be_shifted_left"
) ")"
for_statement (+31 nodes collapsed)
expression_statement
assignment
identifier "shifted_right"
= "="
call
attribute
identifier "copy"
. "."
identifier "deepcopy"
argument_list
( "("
identifier "to_be_shifted_right"
) ")"
for_statement (+31 nodes collapsed)
expression_statement (+28 nodes collapsed)
expression_statement (+28 nodes collapsed)
expression_statement (+27 nodes collapsed)
expression_statement
assignment
identifier "shifted_weights"
= "="
binary_operator
identifier "weights_shifted_left"
+ "+"
identifier "weights_shifted_right"
expression_statement (+23 nodes collapsed)
assert_statement
assert "assert"
comparison_operator
call
identifier "len"
argument_list
( "("
binary_operator
identifier "shifted_nodes"
+ "+"
identifier "unshifted_nodes"
) ")"
== "=="
integer "8"
assert_statement
assert "assert"
comparison_operator
call
identifier "len"
argument_list
( "("
call
identifier "set"
argument_list
( "("
binary_operator
identifier "shifted_nodes"
+ "+"
identifier "unshifted_nodes"
) ")"
) ")"
== "=="
integer "8"
comment "# no duplicates"
return_statement
return "return"
expression_list
identifier "unshifted_nodes"
, ","
identifier "shifted_nodes"
, ","
identifier "unshifted_weights"
, ","
identifier "shifted_weights"
decorated_definition (+2619 nodes collapsed)
if_statement
if "if"
comparison_operator
identifier "__name__"
== "=="
string
string_start "'"
string_content "__main__"
string_end "'"
: ":"
block
expression_statement
call
attribute
identifier "ut"
. "."
identifier "main"
argument_list
( "("
) ")"