summaryrefslogtreecommitdiffstats
path: root/kalzium/src/isotope.h
blob: feed345f911ef3b107e5dd7ba49b34ff379e392f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#ifndef ISOTOPE_H
#define ISOTOPE_H
/***************************************************************************
 *   Copyright (C) 2005 by Carsten Niehaus                                 *
 *   [email protected]                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/

#include <qstring.h>

/**
 * @author Carsten Niehaus
 * @author Jörg Buchwald
 *
 * This class represents an Isotope with all its properties
 */
class Isotope
{
	public:
		Isotope( int neutrons, 
				int protones, 
				double percentage, 
				double weight, 
				double halflife, 
				QString format, 
				double alphadecay, 
				double betaplusdecay, 
				double betaminusdecay, 
				double ecdecay, 
				double alphapercentage, 
				double betapluspercentage, 
				double betaminuspercentage, 
				double ecpercentage, 
				QString spin, 
				QString magmoment);

		bool seconds() const{
			if ( m_format == "seconds" )
				return true;
			else
				return false;
		}

		/**
		 * @return the halflife period of the isotope it if has one. The format
		 * is defined by seconds()
		 */
		double halflife() const{
			return m_halflife;
		}
		
		double percentage() const{
			return m_percentage;
		}

		/**
		 * @return the number of neutrons the isotope has
		 */
		int neutrons() const{
			return m_neutrons;
		}

		/**
		 * @return the number of protones the isotope has
		 */
		int protones() const{
			return m_protones;
		}

		/**
		 * @return the number of nucleons of ths isotope
		 */
		int nucleons() const{
			return m_protones+m_neutrons;
		}

		/**
		 * the weight of the isotope
		 */
		double weight() const{
			return m_weight;
		}
		
		/**
		 * @return the energy of isotope's alpha decay 
		 */
		double alphadecay() const{
			return m_alphadecay;
		}
		
		/**
		 * @return the energy of isotope's beta plus decay
		 */
		double betaplusdecay() const{
			return m_betaplusdecay;
		}
		
		/**
		 * @return the energy of isotope's beta-minus decay
		 */
		double betaminusdecay() const{
			return m_betaminusdecay;
		}
		
		/**
		 * @return the energy of isotope's EC- decay
		 */
		double ecdecay() const{
			return m_ecdecay;
		}
	
		QString spin() const{
			return m_spin;
		}
		
		QString magmoment() const{
			return m_magmoment;
		}

		/**
		 * @return the halflife as a QString. The format will be
		 * appended, for example "seconds" or "years" depending 
		 * on the timeframe
		 */
		QString halflifeAsString();

		/**
		 * @return the percentage of the betaminus decay
		 */
		double betaminuspercentage() const{
			return m_betaminuspercentage;
		}
		
		/**
		 * @return the percentage of the betaplus decay
		 */
		double betapluspercentage() const{
			return m_betapluspercentage;
		}
		
		/**
		 * @return the percentage of the alpha decay
		 */
		double alphapercentage() const{
			return m_alphapercentage;
		}
		
		/**
		 * @return the percentage of the EC decay
		 */
		double ecpercentage() const{
			return m_ecpercentage;
		}

	private:
		/**
		 * it is either "years" or "seconds". Usually we use seconds. But some
		 * isotopes have half-lifes of billion of years. This simply
		 * doesn't fit into a unsigned int or double
		 */
		QString m_format;

		/**
		 * the weight of the isotope
		 */
		double m_weight;

		/**
		 * the half-life of an isotope, usually in seconds
		 * @see m_format
		 */
		double m_halflife;
		
		/**
		 * If 95.2% of the isotopes are of this type, this
		 * variable will have the value 95.2
		 */
		double m_percentage;

		/**
		 * the number of neutrons
		 */
		int m_neutrons;

		/**
		 * the number of protones
		 */
		int m_protones;
	
		///Specify if the decay is the energy
		double  m_alphadecay;
		///Specify if the decay is the energy
		double  m_betaplusdecay;
		///Specify if the decay is the energy
		double  m_betaminusdecay;
		///Specify if the decay is the energy
		double  m_ecdecay;
		
		
		/**
		*spin and parity
		*/
		QString m_spin;
		
		/**
		* magnetic moment
		*/
		QString m_magmoment;

		/**
		 * the percentage with which the istope decays as alpha-rays
		 */
		double m_alphapercentage;
		
		/**
		 * the percentage with which the istope decays as beta-plus 
		 */
		double m_betapluspercentage;
		
		/**
		 * the percentage with which the istope decays as beta-minus
		 */
		double m_betaminuspercentage;
		/**
		 * the percentage with which the istope decays as EC
		 */
		double m_ecpercentage;
};

#endif // ISOTOPE_H