SST Lab Dokuwiki Header
内容へ移動
@surface
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
ab_initio:subsetオブジェクト
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Subsetオブジェクト ====== Using the Subset filter you can make a subset of a listofatoms object. You construct the filter like this: <code python> from ASE.Filters.Subset import Subset m = Subset(atoms,mask=mask) </code> ... or <code python> m = Subset(atoms,indices=indices) </code> mask is a list of length N, N being the number of atoms. A zero value for an element in mask signifies that this atoms is not included in the subset. indices is a list of indices for atoms which should be included in the subset. It can be usefull if you have many atoms, to use the tag attribute on the individual atoms then constructing the listofatoms object (see atoms). By setting a non zero tag (ex 117) on all the static atoms, the mask can be constructed like: <code python> mask = [a.GetTag() != 117 for a in atoms] </code> Example of use (freezing some degrees of freedom): <code python> >>> from ASE import Atom, ListOfAtoms >>> from ASE.Filters.Subset import Subset >>> m = ListOfAtoms([Atom('O', (0, 0, 0), tag=117), ... Atom('H', (0.773, 0.600, 0)), ... Atom('H', (-0.773, 0.600, 0))]) >>> m1 = Subset(m, indices=[1, 2]) >>> m2 = Subset(m, mask=[0, 1, 1]) >>> mask=[a.GetChemicalSymbol() == 'H' for a in m] >>> mask [0, 1, 1] >>> m3 = Subset(m, mask=mask) >>> m4 = Subset(m, mask=[a.GetTag() != 117 for a in m]) >>> >>> m5 = Subset(m, indices=[0]) >>> m6 = Subset(m, mask=[1, 0, 0]) >>> m7 = Subset(m, mask=[a.GetChemicalSymbol() == 'O' for a in m]) >>> m8 = Subset(m, mask=[a.GetTag() == 117 for a in m]) >>> >>> m4.GetCartesianPositions() array([[ 0.773, 0.6 , 0. ], [-0.773, 0.6 , 0. ]]) >>> m8.GetCartesianPositions() array([ [ 0., 0., 0.]]) </code> The first four filters are idential - they all behave like ListOfAtoms objects with only two hydrogen atoms. The last four filters all behave like ListOfAtoms objects with only one oxygen atom.
ab_initio/subsetオブジェクト.txt
· 最終更新: 2022/08/23 13:34 by
127.0.0.1
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ