kcommon.br 2.5 KB
Newer Older
Mark Friedrichs's avatar
Mark Friedrichs committed
1

2
3
4
5
6
7
8
9
/* -------------------------------------------------------------------------- *
 *                                   OpenMM                                   *
 * -------------------------------------------------------------------------- *
 * This is part of the OpenMM molecular simulation toolkit originating from   *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org.               *
 *                                                                            *
10
11
 * Portions copyright (c) 2009 Stanford University and the Authors.           *
 * Authors: Mark Friedrichs, Mike Houston                                     *
12
13
 * Contributors:                                                              *
 *                                                                            *
14
15
16
17
 * This program is free software: you can redistribute it and/or modify       *
 * it under the terms of the GNU Lesser General Public License as published   *
 * by the Free Software Foundation, either version 3 of the License, or       *
 * (at your option) any later version.                                        *
18
 *                                                                            *
19
20
21
22
 * This program is distributed in the hope that it will be useful,            *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU Lesser General Public License for more details.                        *
23
 *                                                                            *
24
25
 * You should have received a copy of the GNU Lesser General Public License   *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.      *
26
 * -------------------------------------------------------------------------- */
Mark Friedrichs's avatar
Mark Friedrichs committed
27

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
28
kernel void kgetxyz( float4 instr<>, out float3 outstr<> ){
Mark Friedrichs's avatar
Mark Friedrichs committed
29
30
31
32
	outstr = instr.xyz;
}

//Zeroes out a stream
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
33
kernel void kzerof3( out float3 outstr<> ){
Mark Friedrichs's avatar
Mark Friedrichs committed
34
35
36
37
	outstr = float3( 0.0f, 0.0f, 0.0f );
}

//Zeros out a stream
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
38
kernel void kzerof4( out float4 outstr<> ){
Mark Friedrichs's avatar
Mark Friedrichs committed
39
40
41
	outstr = float4( 0.0f, 0.0f, 0.0f, 0.0f );
}

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
42
kernel void ksetf4( float4 val, out float4 outstr<> ){
Mark Friedrichs's avatar
Mark Friedrichs committed
43
44
	outstr = val;
}
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
45

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
46
47
kernel void ksetStr3( float3 instr<>, out float3 outstr<> ){
	outstr  = instr;
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
48
49
}

Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
50
51
kernel void kadd3( float3 in1<>, float3 in2<>, out float3 outstr<> ){ 
   outstr  = in1 + in2;
Mark Friedrichs's avatar
Mods  
Mark Friedrichs committed
52
53
}