root / src / ConvertNumAt.f90
Historique | Voir | Annoter | Télécharger (2,18 ko)
1 | 1 | pfleura2 | FUNCTION ConvertNumAt(ATOM) |
---|---|---|---|
2 | 1 | pfleura2 | |
3 | 12 | pfleura2 | !---------------------------------------------------------------------- |
4 | 12 | pfleura2 | ! Copyright 2003-2014 Ecole Normale Supérieure de Lyon, |
5 | 12 | pfleura2 | ! Centre National de la Recherche Scientifique, |
6 | 12 | pfleura2 | ! Université Claude Bernard Lyon 1. All rights reserved. |
7 | 12 | pfleura2 | ! |
8 | 12 | pfleura2 | ! This work is registered with the Agency for the Protection of Programs |
9 | 12 | pfleura2 | ! as IDDN.FR.001.100009.000.S.P.2014.000.30625 |
10 | 12 | pfleura2 | ! |
11 | 12 | pfleura2 | ! Authors: P. Fleurat-Lessard, P. Dayal |
12 | 12 | pfleura2 | ! Contact: optnpath@gmail.com |
13 | 12 | pfleura2 | ! |
14 | 12 | pfleura2 | ! This file is part of "Opt'n Path". |
15 | 12 | pfleura2 | ! |
16 | 12 | pfleura2 | ! "Opt'n Path" is free software: you can redistribute it and/or modify |
17 | 12 | pfleura2 | ! it under the terms of the GNU Affero General Public License as |
18 | 12 | pfleura2 | ! published by the Free Software Foundation, either version 3 of the License, |
19 | 12 | pfleura2 | ! or (at your option) any later version. |
20 | 12 | pfleura2 | ! |
21 | 12 | pfleura2 | ! "Opt'n Path" is distributed in the hope that it will be useful, |
22 | 12 | pfleura2 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | 12 | pfleura2 | ! |
24 | 12 | pfleura2 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | 12 | pfleura2 | ! GNU Affero General Public License for more details. |
26 | 12 | pfleura2 | ! |
27 | 12 | pfleura2 | ! You should have received a copy of the GNU Affero General Public License |
28 | 12 | pfleura2 | ! along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>. |
29 | 12 | pfleura2 | ! |
30 | 12 | pfleura2 | ! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr, |
31 | 12 | pfleura2 | ! for commercial licensing opportunities. |
32 | 12 | pfleura2 | !---------------------------------------------------------------------- |
33 | 12 | pfleura2 | |
34 | 1 | pfleura2 | use Path_module, only : Nom, max_Z |
35 | 1 | pfleura2 | |
36 | 1 | pfleura2 | IMPLICIT NONE |
37 | 1 | pfleura2 | |
38 | 1 | pfleura2 | INTEGER(4) :: I,Long,ConvertNumAt,IC |
39 | 1 | pfleura2 | character(*) :: ATOM |
40 | 1 | pfleura2 | CHARACTER(3) :: ATOME |
41 | 1 | pfleura2 | CHARACTER(10) :: L_Atom |
42 | 1 | pfleura2 | |
43 | 1 | pfleura2 | ! Verifie qu'il n'y a que des lettres et des espaces dans ATOM |
44 | 1 | pfleura2 | |
45 | 1 | pfleura2 | L_atom=ADJUSTL(Atom) |
46 | 1 | pfleura2 | IF (ATOM(1:1).LT.'A') L_ATOM(1:1)=' ' |
47 | 1 | pfleura2 | IC=Ichar(ATOM(1:1)) |
48 | 1 | pfleura2 | IF ((ic.le.123).AND.(ic.ge.97)) L_ATOM(1:1)=CHAr(IC-32) |
49 | 1 | pfleura2 | IF (ATOM(2:2).LT.'A') L_ATOM(2:2)=' ' |
50 | 1 | pfleura2 | IC=Ichar(ATOM(2:2)) |
51 | 1 | pfleura2 | IF ((ic.le.123).AND.(ic.ge.97)) L_ATOM(2:2)=CHAr(IC-32) |
52 | 1 | pfleura2 | |
53 | 1 | pfleura2 | ! Justifie le nom sur la droite (et non sur la gauche comme souvent...) |
54 | 1 | pfleura2 | Long=INDEX(L_ATOM,' ')-1 |
55 | 1 | pfleura2 | ATOME=' ' // L_ATOM(1:2) |
56 | 1 | pfleura2 | IF (Long.EQ.1) L_ATOM=ATOME(1:2) |
57 | 1 | pfleura2 | I=max_Z |
58 | 1 | pfleura2 | DO WHILE ((nom(I).NE.L_ATOM(1:2)) .AND. (I.GT.0)) |
59 | 1 | pfleura2 | I=I-1 |
60 | 1 | pfleura2 | END DO |
61 | 1 | pfleura2 | |
62 | 1 | pfleura2 | ConvertNumAT=I |
63 | 1 | pfleura2 | |
64 | 1 | pfleura2 | END |