Skip to content

Commit ddcd5cc

Browse files
committed
add check to base constructor
1 parent f97309c commit ddcd5cc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/types.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Base type for all n-body interactions. `N` denotes the body order
3939
abstract type NBodyInteraction{N} <: Interaction end
4040

4141
"""
42-
Base type for all specific interactions. `N` denotes number of atoms in the interaction.
42+
Base type for all specific interaction lists. `N` denotes number of atoms in the interaction.
4343
"""
44-
abstract type SpecificInteraction{N} <: Interaction end
44+
abstract type SpecificInteractionList{N} <: Interaction end
4545

4646
"""
4747
Type alias for pairwise interactions
@@ -55,7 +55,7 @@ const PairwiseInteraction = NBodyInteraction{2}
5555
5656
A list of specific interactions that involve one atom such as position restraints.
5757
"""
58-
struct InteractionList1Atoms{I, T} <: SpecificInteraction{1}
58+
struct InteractionList1Atoms{I, T} <: SpecificInteractionList{1}
5959
is::I
6060
inters::T
6161
types::Vector{String}
@@ -68,7 +68,7 @@ end
6868
6969
A list of specific interactions that involve two atoms such as bond potentials.
7070
"""
71-
struct InteractionList2Atoms{I, T} <: SpecificInteraction{2}
71+
struct InteractionList2Atoms{I, T} <: SpecificInteractionList{2}
7272
is::I
7373
js::I
7474
inters::T
@@ -82,7 +82,7 @@ end
8282
8383
A list of specific interactions that involve three atoms such as bond angle potentials.
8484
"""
85-
struct InteractionList3Atoms{I, T} <: SpecificInteraction{3}
85+
struct InteractionList3Atoms{I, T} <: SpecificInteractionList{3}
8686
is::I
8787
js::I
8888
ks::I
@@ -97,7 +97,7 @@ end
9797
9898
A list of specific interactions that involve four atoms such as torsion potentials.
9999
"""
100-
struct InteractionList4Atoms{I, T} <: SpecificInteraction{4}
100+
struct InteractionList4Atoms{I, T} <: SpecificInteractionList{4}
101101
is::I
102102
js::I
103103
ks::I
@@ -623,6 +623,9 @@ function System(;
623623
@warn "eltype of coords or velocities is not isbits, it is recomended to use a vector of SVector's for performance"
624624
end
625625

626+
all(pairwise_inters .<: PairwiseInteraction) || error("pairwise_inters are not all PairwiseInteraction types")
627+
all(specific_inter_lists .<: SpecificInteractionList) || error("specific_inter_lists are not all SpecificInteractionList types")
628+
626629
check_units(atoms, coords, vels, energy_units, force_units, pairwise_inters,
627630
specific_inter_lists, general_inters, boundary)
628631

0 commit comments

Comments
 (0)