コード例 #1
0
ファイル: ptm_alloy_types.cpp プロジェクト: lammps/lammps
int32_t find_alloy_type(const refdata_t* ref, int8_t* mapping, int32_t* numbers)
{
        for (int i=0;i<ref->num_nbrs+1;i++)
                if (numbers[i] == -1)
                        return PTM_ALLOY_NONE;

        if (test_pure(ref->num_nbrs, numbers))
                return PTM_ALLOY_PURE;

        if (!test_binary(ref->num_nbrs, numbers))
                return PTM_ALLOY_NONE;

        uint32_t code = canonical_alloy_representation(ref, mapping, numbers);
        for (int i=0;i<NUM_ALLOY_TYPES;i++)
                if ((uint32_t)ref->type == typedata[i][0] && code == typedata[i][2])
                        return typedata[i][1];

        if (ref->type == PTM_MATCH_BCC)
                if (test_shell_structure(ref, mapping, numbers, 8))
                        return PTM_ALLOY_B2;

        if (ref->type == PTM_MATCH_DCUB || ref->type == PTM_MATCH_DHEX)
                if (test_shell_structure(ref, mapping, numbers, 4))
                        return PTM_ALLOY_SIC;


        if (ref->type == PTM_MATCH_GRAPHENE)
                if (test_shell_structure(ref, mapping, numbers, 3))
                        return PTM_ALLOY_BN;

        return PTM_ALLOY_NONE;
}
コード例 #2
0
int main()
{
  test_const();
  test();
  test_pure();
  return 0;
}