Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
1a513a66
Commit
1a513a66
authored
Nov 01, 2015
by
Robert McGibbon
Browse files
getState enforcePeriodicBox with triclinic unit cells
parent
7323ad80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
openmmapi/src/Context.cpp
openmmapi/src/Context.cpp
+5
-11
No files found.
openmmapi/src/Context.cpp
View file @
1a513a66
...
...
@@ -114,21 +114,15 @@ State Context::getState(int types, bool enforcePeriodicBox, int groups) const {
center
*=
1.0
/
molecules
[
i
].
size
();
// Find the displacement to move it into the first periodic box.
int
xcell
=
(
int
)
floor
(
center
[
0
]
/
periodicBoxSize
[
0
][
0
]);
int
ycell
=
(
int
)
floor
(
center
[
1
]
/
periodicBoxSize
[
1
][
1
]);
int
zcell
=
(
int
)
floor
(
center
[
2
]
/
periodicBoxSize
[
2
][
2
]);
double
dx
=
xcell
*
periodicBoxSize
[
0
][
0
];
double
dy
=
ycell
*
periodicBoxSize
[
1
][
1
];
double
dz
=
zcell
*
periodicBoxSize
[
2
][
2
];
Vec3
diff
;
diff
-=
periodicBoxSize
[
0
]
*
static_cast
<
int
>
(
center
[
0
]
/
periodicBoxSize
[
0
][
0
]);
diff
-=
periodicBoxSize
[
1
]
*
static_cast
<
int
>
(
center
[
1
]
/
periodicBoxSize
[
1
][
1
]);
diff
-=
periodicBoxSize
[
2
]
*
static_cast
<
int
>
(
center
[
2
]
/
periodicBoxSize
[
2
][
2
]);
// Translate all the particles in the molecule.
for
(
int
j
=
0
;
j
<
(
int
)
molecules
[
i
].
size
();
j
++
)
{
Vec3
&
pos
=
positions
[
molecules
[
i
][
j
]];
pos
[
0
]
-=
dx
;
pos
[
1
]
-=
dy
;
pos
[
2
]
-=
dz
;
pos
-=
diff
;
}
}
}
...
...
Write
Preview
Markdown
is supported
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