3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * GROningen Mixture of Alchemy and Childrens' Stories
54 void rm_pbc(t_idef
*idef
,int ePBC
,int natoms
,matrix box
,rvec x
[],rvec x_s
[])
57 static multi_graph
*mgraph
=NULL
;
58 static bool bFirst
=TRUE
;
64 ePBC
= guess_ePBC(box
);
66 bNeedToCopy
= (x
!= x_s
);
68 if (ePBC
!= epbcNONE
) {
69 if (idef
->ntypes
!=-1) {
71 for(i
=0; i
<ngraph
; i
++)
72 if (mgraph
[i
].natoms
==natoms
)
75 /* make a new graph if there isn't one with this number of atoms */
78 srenew(mgraph
,ngraph
);
79 mgraph
[n
].natoms
=natoms
;
80 mgraph
[n
].gr
=mk_graph(NULL
,idef
,0,natoms
,FALSE
,FALSE
);
82 mk_mshift(stdout
,mgraph
[n
].gr
,ePBC
,box
,x
);
84 shift_x(mgraph
[n
].gr
,box
,x
,x_s
);
88 "\nWarning: if there are broken molecules in the trajectory file,\n"
89 " they can not be made whole without a run input file\n\n");
94 for (i
=0; i
<natoms
; i
++)
95 copy_rvec(x
[i
],x_s
[i
]);
98 void rm_gropbc(t_atoms
*atoms
,rvec x
[],matrix box
)
103 /* check periodic boundary */
104 for(n
=1;(n
<atoms
->nr
);n
++) {
105 for(m
=DIM
-1; m
>=0; m
--) {
106 dist
= x
[n
][m
]-x
[n
-1][m
];
107 if (fabs(dist
) > 0.9*box
[m
][m
]) {
110 x
[n
][d
] -= box
[m
][d
];
113 x
[n
][d
] += box
[m
][d
];