atomes 1.1.16
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
dlp_active.c
Go to the documentation of this file.
1/* This file is part of the 'atomes' software
2
3'atomes' is free software: you can redistribute it and/or modify it under the terms
4of the GNU Affero General Public License as published by the Free Software Foundation,
5either version 3 of the License, or (at your option) any later version.
6
7'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9See the GNU General Public License for more details.
10
11You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12If not, see <https://www.gnu.org/licenses/>
13
14Copyright (C) 2022-2024 by CNRS and University of Strasbourg */
15
22/*
23* This file: 'dlp_active.c'
24*
25* Contains:
26*
27
28 - The functions to retrieve data in the force field structure
29
30*
31* List of functions:
32
33 field_molecule * get_active_field_molecule_from_model_id (project * this_proj, int aid);
34 field_molecule * get_active_field_molecule (int a);
35 field_nth_body * get_active_body (int a, int b);
36 field_external * get_active_external (int a);
37 field_atom* get_active_atom (int a, int b);
38 field_shell * get_active_shell (int a, int b);
39 field_constraint * get_active_constraint (int a, int b);
40 field_pmf * get_active_pmf (int a, int b);
41 field_rigid * get_active_rigid (int a, int b);
42 field_tethered * get_active_tethered (int a, int b);
43 field_prop * get_active_prop (struct field_prop * pr, int a);
44 field_prop * get_active_prop_using_atoms (struct field_prop * pr, int ti, int * ids);
45 field_struct * get_active_struct (int s, int a, int b);
46
47*/
48
49#include "dlp_field.h"
50
60{
61 int i;
62 field_molecule * fmol = this_proj -> force_field[activef] -> first_molecule;
63 field_atom* fat;
64 while (fmol)
65 {
66 fat = fmol -> first_atom;
67 while (fat)
68 {
69 for (i=0; i<fat -> num; i++)
70 {
71 if (fat -> list[i] == aid) return fmol;
72 }
73 fat = fat -> next;
74 }
75 fmol = fmol -> next;
76 }
77 return NULL;
78}
79
88{
89 int i;
90 field_molecule * tfmol = tmp_field -> first_molecule;
91 for (i=0; i<a; i++)
92 {
93 if (tfmol -> next != NULL) tfmol = tfmol -> next;
94 }
95 return tfmol;
96}
97
107{
108 int i;
109 field_nth_body * body;
110 body = tmp_field -> first_body[b];
111 for (i=0; i<a; i++)
112 {
113 if (body -> next != NULL) body = body -> next;
114 }
115 return body;
116}
117
126{
127 int i;
128 field_external * external;
129 external = tmp_field -> first_external;
130 for (i=0; i<a; i++)
131 {
132 if (external -> next != NULL) external = external -> next;
133 }
134 return external;
135}
136
146{
147 int i;
148 field_atom* ato;
149 ato = get_active_field_molecule (a) -> first_atom;
150 for (i=0; i<b; i++)
151 {
152 if (ato -> next != NULL) ato = ato -> next;
153 }
154 return ato;
155}
156
166{
167 int i;
168 field_shell * shl;
169 shl = get_active_field_molecule (a) -> first_shell;
170 for (i=0; i<b; i++)
171 {
172 if (shl -> next != NULL) shl = shl -> next;
173 }
174 return shl;
175}
176
186{
187 int i;
188 field_constraint * cons;
189 cons = get_active_field_molecule (a) -> first_constraint;
190 for (i=0; i<b; i++)
191 {
192 if (cons -> next != NULL) cons = cons -> next;
193 }
194 return cons;
195}
196
206{
207 int i;
208 field_pmf * pmf;
209 pmf = get_active_field_molecule (a) -> first_pmf;
210 for (i=0; i<b; i++)
211 {
212 if (pmf -> next != NULL) pmf = pmf -> next;
213 }
214 return pmf;
215}
216
226{
227 int i;
228 field_rigid * rig;
229 rig = get_active_field_molecule (a) -> first_rigid;
230 for (i=0; i<b; i++)
231 {
232 if (rig -> next != NULL) rig = rig -> next;
233 }
234 return rig;
235}
236
246{
247 int i;
248 field_tethered * tet;
249 tet = get_active_field_molecule (a) -> first_tethered;
250 for (i=0; i<b; i++)
251 {
252 if (tet -> next != NULL) tet = tet -> next;
253 }
254 return tet;
255}
256
266{
267 field_prop * prop;
268 prop = pr;
269 int i;
270 for (i=0; i<a; i++)
271 {
272 if (prop -> next != NULL) prop = prop -> next;
273 }
274 return prop;
275}
276
286field_prop * get_active_prop_using_atoms (struct field_prop * pr, int ti, int * ids)
287{
288 field_prop * prop = NULL;
289 prop = pr;
290 gboolean done;
291 int i;
292 while (prop != NULL)
293 {
294 done = TRUE;
295 for (i=0; i<ti; i++)
296 {
297 if (prop -> aid[i] != ids[i])
298 {
299 done = FALSE;
300 break;
301 }
302 }
303 if (done) break;
304 prop = prop -> next;
305 }
306 return prop;
307}
308
319{
320 int i;
321 field_struct * str;
322 str = get_active_field_molecule (a) -> first_struct[s];
323 for (i=0; i<b; i++)
324 {
325 if (str -> next != NULL) str = str -> next;
326 }
327 return str;
328}
field_constraint * get_active_constraint(int a, int b)
retrieve constraint property
Definition dlp_active.c:185
field_molecule * get_active_field_molecule(int a)
retrieve field molecule
Definition dlp_active.c:87
field_rigid * get_active_rigid(int a, int b)
retrieve rigid property
Definition dlp_active.c:225
field_prop * get_active_prop_using_atoms(struct field_prop *pr, int ti, int *ids)
retrieve field molecule structural property using atoms
Definition dlp_active.c:286
field_struct * get_active_struct(int s, int a, int b)
retrieve field structural property
Definition dlp_active.c:318
field_shell * get_active_shell(int a, int b)
retrieve shell property
Definition dlp_active.c:165
field_molecule * get_active_field_molecule_from_model_id(project *this_proj, int aid)
retrieve field molecule from overall atom id in the model
Definition dlp_active.c:59
field_atom * get_active_atom(int a, int b)
retrieve field atom
Definition dlp_active.c:145
field_external * get_active_external(int a)
retrieve external field property
Definition dlp_active.c:125
field_nth_body * get_active_body(int a, int b)
retrieve field nth body interaction
Definition dlp_active.c:106
field_pmf * get_active_pmf(int a, int b)
retrieve PMF property
Definition dlp_active.c:205
field_prop * get_active_prop(struct field_prop *pr, int a)
the field molecule structural property id to retrieve
Definition dlp_active.c:265
field_tethered * get_active_tethered(int a, int b)
retrieve tethered property
Definition dlp_active.c:245
classical_field * tmp_field
Definition dlp_field.c:951
Variable declarations for the creation of the DL_POLY input file(s)
int activef
Definition global.c:161
int b
Definition tab-1.c:95
int a
Definition tab-1.c:95