<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 20/06/2016 16:29, Pascal Boulet a
écrit :<br>
</div>
<blockquote
cite="mid:0DADA45A-1E93-4D36-B587-55D9D627A9DC@univ-amu.fr"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Bonjour,
<div><br>
</div>
<div>Je travaille avec des atomes (dans une molécule) auxquels je
veux appliquer une matrice de transformation 3x3. Les atomes
sont repérés par des coordonnées x, y et z. En fait j’ai une
liste de ’nat' atomes. Actuellement, pour appliquer la matrice à
chacun des atomes je fais une boucle sur les atomes, tel que:</div>
<div><br>
</div>
<div>
<pre style="font-family: Monospaced; font-size: 12px;"><span style="color:rgb(160,32,240);">for</span> i<span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span>nat
pos<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">=</span>x<span style="color:rgb(74,85,219);">(</span>i,<span style="color:rgb(255,170,0);">:</span><span style="color:rgb(74,85,219);">)</span>
frac<span style="color:rgb(92,92,92);">=</span>M<span style="color:rgb(92,92,92);">*</span>pos<span style="color:rgb(92,92,92);">'</span>
mfprintf<span style="color:rgb(74,85,219);">(</span>fd,<span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">%3s %10.5f %10.5f %10.5f\n</span><span style="color:rgb(188,143,143);">'</span>,lab<span style="color:rgb(74,85,219);">(</span>i<span style="color:rgb(74,85,219);">)</span>,frac<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span>,frac<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span>,frac<span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">3</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(160,32,240);">end</span></pre>
</div>
</blockquote>
.<br>
Pour être concret :<span style="color:rgb(74,85,219);"></span><br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><big><span style="color:rgb(0,0,0);">frac</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">M</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(0,0,0);">x</span><span style="color:rgb(92,92,92);">.'</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">// pour tester la sortie formatée dans la console, sans boucle :</span>
<span style="color:rgb(0,0,0);">frac</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">frac</span><span style="color:rgb(92,92,92);">.'</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(204,0,0);">mprintf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(188,143,143);">%3s %10.5f %10.5f %10.5f\n</span><span style="color:rgb(188,143,143);">'</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">lab</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">frac</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">frac</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">,</span><span style="
color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">frac</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">3</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span></big></pre>
<br>
SG<br>
<br>
</body>
</html>